4 ms·
Thanks. Can you please elaborate some bits on what is meant under "rich syntax for literal data structures"? I'm not a lisp pro, just started studying it.
by qwerty456127 3y ago
Thanks. Can you please elaborate some bits on what is meant under "rich syntax for literal data structures"? I'm not a lisp pro, just started studying it.
- lispm 3y agoThat's nothing special of Lisp. Literal data structures means that one can write down data objects like list, arrays, vectors, numbers (floats, integers, rational, complex, ...), symbols, strings, characters, records/structures, ... Common Lisp for example: (berlin hamburg munich cologne) ; a list of symbols #(berlin hamburg munich cologne) ; a vector of symbols (1.3 1.3d6 13 #c(1 3) 1/3) ; a list of numbers "Hello World!" ; a string #\H ; the character H #S(CITY :NAME BERLIN ; a structure (aka record) of type CITY :COUNTRY GERMANY) #*1010101111 ; a bitvector #2A((BERLIN GERMANY) ; a 2d array (PARIS FRANCE)) Other programming languages have their own syntax for literal data (even data structures like unicode characters, hash tables, unicode strings, decimal numbers, ...) Common Lisp OTOH has an extensible reader, one can add new syntax extensions for data structures, using so-called reader macros. READ is the function to read s-expressions from text streams. It returns data objects.