Skip to content

indexing

Pannous edited this page Dec 10, 2022 · 11 revisions

indexing

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

Direct access

Bracket indexing is as a general rule close to metal: "abc"[1]='B' manipultates the byte sequence blindly, whereas "abc"#2="β" sets the character unicode safely.

The bracket version allows complex expressions, 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 indexing and expressions needs grouping

{a:1 b:2}[a] is related to pattern matching and evaluation {a:1 b:2}(a)

Home

Philosophy

data & code blocks

features

inventions

evaluation

keywords

iteration

tasks

examples

todo : bad ideas and open questions

⚠️ specification and progress are out of sync

Clone this wiki locally