Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
⍝ Create a namespace ("hash")
|
||||
X←⎕NS ⍬
|
||||
|
||||
⍝ Assign some names
|
||||
X.this←'that'
|
||||
X.foo←88
|
||||
|
||||
⍝ Access the names
|
||||
X.this
|
||||
that
|
||||
|
||||
⍝ Or do it the array way
|
||||
X.(foo this)
|
||||
88 that
|
||||
|
||||
⍝ Namespaces are first class objects
|
||||
sales ← ⎕NS ⍬
|
||||
sales.(prices quantities) ← (100 98.4 103.4 110.16) (10 12 8 10)
|
||||
sales.(revenue ← prices +.× quantities)
|
||||
sales.revenue
|
||||
4109.6
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
⍝ Assign some names
|
||||
X.this←'that'
|
||||
X.foo←88
|
||||
|
||||
⍝ Access the names
|
||||
X.this
|
||||
that
|
||||
|
||||
⍝ ..or access via 'array index' syntax
|
||||
X['this']
|
||||
that
|
||||
|
||||
⍝ Or do it the array way
|
||||
X.(foo)
|
||||
88
|
||||
|
||||
⍝ GNU APL does not support multiple assoc. array indices however
|
||||
X.(foo this)
|
||||
VALUE ERROR
|
||||
X.(foo this)
|
||||
^
|
||||
|
||||
(sales.prices sales.quantities) ← (100 98.4 103.4 110.16) (10 12 8 10)
|
||||
sales.revenue ← sales.prices +.× sales.quantities
|
||||
sales.revenue
|
||||
4109.6
|
||||
Loading…
Add table
Add a link
Reference in a new issue