Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
1
Task/Topic-variable/Forth/topic-variable-1.fth
Normal file
1
Task/Topic-variable/Forth/topic-variable-1.fth
Normal file
|
|
@ -0,0 +1 @@
|
|||
: myloop 11 1 do i . loop cr ; myloop
|
||||
5
Task/Topic-variable/Forth/topic-variable-2.fth
Normal file
5
Task/Topic-variable/Forth/topic-variable-2.fth
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
: ^2 dup * ;
|
||||
: sqrt 0 tuck ?do 1+ dup 2* 1+ +loop ;
|
||||
: topic >r r@ ^2 . r@ sqrt . r> drop ;
|
||||
|
||||
23 topic
|
||||
9
Task/Topic-variable/PicoLisp/topic-variable-1.l
Normal file
9
Task/Topic-variable/PicoLisp/topic-variable-1.l
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
PicoLisp sets the value of the variable (symbol) '@' to the result of
|
||||
conditional and controlling expressions in flow- and logic-functions (cond, if,
|
||||
and, when, while, etc.).
|
||||
|
||||
Within a function or method '@' behaves like a local variable, i.e. its value is
|
||||
automatically saved upon function entry and restored at exit.
|
||||
|
||||
For example, to read the current input channel until EOF, and print the square
|
||||
of every item which is a number:
|
||||
9
Task/Topic-variable/PicoLisp/topic-variable-2.l
Normal file
9
Task/Topic-variable/PicoLisp/topic-variable-2.l
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
(while (read)
|
||||
(when (num? @)
|
||||
(println (* @ @)) ) )
|
||||
abc # Not a number
|
||||
7 # Number
|
||||
49 # -> print square
|
||||
xyz # Not a number
|
||||
3 # Number
|
||||
9 # -> print square
|
||||
Loading…
Add table
Add a link
Reference in a new issue