RosettaCodeData/Task/Associative-array-Creation/APL/associative-array-creation-...

22 lines
455 B
APL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

⍝ Create a namespace ("hash")
X⎕NS
⍝ Assign some names
X.this'that'
X.foo88
⍝ 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