-
-
Notifications
You must be signed in to change notification settings - Fork 4
indexing
Pannous edited this page Sep 18, 2021
·
11 revisions
Angle offers
-
zero based indexing (a b c)[1] == b
-
one based indexing {a b c}#2 == b
-
map field object accessors:
-
{a:1 b:2}[a] == 1
-
{a:1 b:2}.a == 1
-
a in {a:1 b:2} == 1
-
a of {a:1 b:2} == 1
The bracket version allows complex expression, whereas '#' 'in' and 'of'
bind tightly, so
1 + 1 in {1:2} == 1 + {1:2}['1'] == 1+2
TODO: REALLY ?
1 + 1 in {1:3} == (1+1) in {1:3} == false
Solution: compiler error: mixing evalutations needs grouping
{a:1 b:2}[a]
is related to pattern matching and evaluation
{a:1 b:2}(a)