mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-15 19:28:47 +00:00
Cosmetics in stdlib
This commit is contained in:
parent
7fd85f27ef
commit
5933f4c3b1
15 changed files with 105 additions and 79 deletions
|
|
@ -1,11 +1,19 @@
|
|||
-- Emulation of first-class references.
|
||||
-- (C) Dmitry Boulytchev, JetBrains Research, St. Petersburg State University, 2020
|
||||
--
|
||||
-- This unit provides an implementation for first-class references emulation.
|
||||
|
||||
-- Creates a new reference cell with contents x
|
||||
public fun ref (x) {
|
||||
[x]
|
||||
}
|
||||
|
||||
-- Returns the contents of the cell x
|
||||
public fun deref (x) {
|
||||
x[0]
|
||||
}
|
||||
|
||||
-- Assigns a new value y into the cell x
|
||||
public infix ::= before := (x, y) {
|
||||
x[0] := y
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue