tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,15 @@
|
|||
# Constructing an environment has to be done by way of evaluation
|
||||
#for historical reasons which will hopefully be entirely eliminated soon.
|
||||
def bindX(value) {
|
||||
def [resolver, env] := e` # bind x and capture its resolver and the
|
||||
def x # resulting environment
|
||||
`.evalToPair(safeScope)
|
||||
resolver.resolve(value) # set the value
|
||||
return env
|
||||
}
|
||||
|
||||
def evalWithX(program, a, b) {
|
||||
def atA := program.eval(bindX(a))
|
||||
def atB := program.eval(bindX(b))
|
||||
return atB - atA
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
? evalWithX(e`(x :float64).exp()`, 0, 1)
|
||||
# value: 1.7182818284590455
|
||||
Loading…
Add table
Add a link
Reference in a new issue