Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,5 @@
|
|||
prog: [x * 2]
|
||||
fn: func [x] [do bind prog 'x]
|
||||
a: fn 2
|
||||
b: fn 4
|
||||
subtract b a
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
Red [
|
||||
Title: "Runtime evaluation/in an environment"
|
||||
Author: "hinjolicious"
|
||||
]
|
||||
|
||||
; a simple but generic lambda function
|
||||
; multi-args lambda
|
||||
; save it or directly evaluate
|
||||
|
||||
lambda: func [a b /eval v /local f][
|
||||
f: func a b
|
||||
either eval [do compose [f (v)]][:f]
|
||||
]
|
||||
|
||||
prog: [x * x + x - 10]
|
||||
a: lambda/eval [x] prog [2]
|
||||
b: lambda/eval [x] prog [4]
|
||||
print b - a
|
||||
|
||||
code: [a * b / (a + b)]
|
||||
c: lambda/eval [a b] code [2 3]
|
||||
d: lambda/eval [a b] code [3 4]
|
||||
print d - c
|
||||
|
||||
my-func: lambda [x y z][x + y + z]
|
||||
print my-func 10 20 30
|
||||
Loading…
Add table
Add a link
Reference in a new issue