Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 1.27 KB

03-primitive-data-types.md

File metadata and controls

67 lines (50 loc) · 1.27 KB

→ README, → prev: Ident(ifiers) & Quoting, → next: Pairs, Lists & Dicts

Primitive Data Types

i.e. nil, bool, int, float, str, kwd

>>> nil             ; nothing to see here...
nil

>>> #t              ; true
#t
>>> #f              ; false (nil and #f are falsy, everything else is truthy)
#f

>>> 42              ; integer
42
>>> 0x20
32
>>> 0b11
3

>>> 3.14            ; floating point
3.14
>>> "spam & eggs"   ; string
"spam & eggs"
>>> "\u732bs"
"猫s"
>>> "\x20"
" "
>>> :key-word       ; keyword (aka symbol)
:key-word
>>> :"keyword that is not a valid ident"
:"keyword that is not a valid ident"

NB: for more information on keywords/symbols, see [1].

NB: ideally keywords are implemented as interned strings but the language specification does not guarantee that (and the current implementation does not intern them).

References

  1. https://en.wikipedia.org/wiki/Symbol_(programming)