>> a: [context? 'b]
== [context? 'b]
>> o: object [b: 2]
== make object! [
b: 2
]
>> bind a o
== [context? 'b]
>> do a
== make object! [
b: 2
]
word!
. As Toomas noted, you can use /n
syntax (arr: [a b c] arr/3; c
) or using pick
(pick [a b c] 3). You can even
findit (
first find [a b c] 'a`). As fair I remember, it's like any other way to extract values.
arr: [a b c] arr: bind arr context [a: 1 b: 2 c: 3]
). I don't think it's necessary now.
bind
binds any-word!
:>> arr: [a a: 'a :a]
== [a a: 'a :a]
>> reduce to-word probe first (bind arr context [a: 42])
a
== 42
>> reduce to-word probe second (bind arr context [a: 42])
a:
== 42
>> reduce to-word probe third (bind arr context [a: 42])
'a
== 42
>> reduce to-word probe fourth (bind arr context [a: 42])
:a
== 42
y: [b c d]
probe context? y/1
I expected a result from context? but basically I was wrong. I supposed B has some context
>> equal? system/words context? y/1
== true
Also I expected a result from:
z: make object! [b: 0 c: 1 d: 2]
probe context? z/1
But I get an error
*** Script Error: cannot access 1 in path z/1
*** Where: context?
*** Stack: probe
>>
context?
>> z: make object! [b: 0 c: 1 d: 2]
== make object! [
b: 0
c: 1
d: 2
]
>> w: words-of z
== [b c d]
>> w/1
== b
>> context? w/1
== make object! [
b: 0
c: 1
d: 2
]