-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathvalue.fs
More file actions
43 lines (40 loc) · 752 Bytes
/
value.fs
File metadata and controls
43 lines (40 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
\ Portable implementation of VALUE, etc
\ The first cell of a VALUE is the XT of the "TO" word.
\ Subsequent cells are the value itself.
\
\ For example, "3 VALUE FOO" makes
\
\ FOO: +---------+
\ | ! |
\ +---------+
\ | 3 |
\ +---------+
\
\ and "100 200 2VALUE BAR" makes
\
\ BAR: +---------+
\ | 2! |
\ +---------+
\ | 200 |
\ +---------+
\ | 100 |
\ +---------+
\
: value
create ['] ! , ,
does> cell+ @
;
: 2value
create ['] 2! , , ,
does> cell+ 2@
;
: to
' >body
dup cell+
state @ if
postpone literal
@ compile,
else
swap @ execute
then
; immediate