Skip to content

Keyword: dict

Pebaz edited this page May 29, 2019 · 1 revision

Description

Creates a Dict value from the supplied arguments. Must be given an even number of keys/values in order to construct a Dict. Any object can be used as the value but only these values can be used as keys:

  • String
  • Boolean
  • Integer
  • Float
  • Identifier

Usage

(set 'info (dict "first name" "David" "last name" "Wallace" 'age 41))
(print info)
(print (get info "first name"))
(print (get info "age"))
(print (get info 'age))

(set 'ms (dict 'first-name "Michael" 'last-name "Scott"))
(print (get info "first name"))
(print (get ms 'first-name))
(set 'foo1 (dict True "True Value"))    (print (get foo1 True))
(set 'foo2 (dict 11 "Int Value"))       (print (get foo2 11))
(set 'foo3 (dict 3.14 "Float Value"))   (print (get foo3 3.14))

Clone this wiki locally