-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetforms.tem
16 lines (15 loc) · 1.23 KB
/
setforms.tem
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(page "Internals of places and setforms"
(import "docs/gen.html")
(newtable "Operations to support places"
(def setforms "place" "Generates the getter and setter code to access a place." (tests (setforms '(car x))))
(var setter "" (tests))
(mac destructive defset "name parms [body ...]" "Defines a new type of place. Creates a new <code>setforms</code> handler for the function of the specified name." (tests (defset foo (x) nil)))
(def predicate metafn "x" "Helper predicate for setforms. Tests if x is a meta function: that is, it has special syntax, or uses compose or complement." (tests '(metafn '(a:b))))
(def expand-metafn-call "f args" "Helper for setforms. Take a function of the form (compose ...) and expands it into the approprate composed function calls.." (tests "(expand-metafn-call '(compose g h) '(a b))"
))
(def expand= "place val" "Helper for =. Generates code to assign val to place." (tests (expand= 'a 42)))
(def expand=list "terms" "Helper for =. Pairs up the arguments to =, and calls expand= on each pair." (tests (expand=list '(a 42 b 43))))
)
(def or= "place val" "Similar to the or macro, except assigns val to place if place is nil. New in arc3." (tests (let x nil (or= x 4) (or= x 5) x)))
(import "docs/legend.html")
)