((META (EMPTY-STRING title "Syntax of Symbolic Expressions") (WORD role "manual") (TAG-SET tags ("#manual" "#reference" "#zettelstore")) (WORD syntax "zmk") (ZID-SET back ("00001012051200" "00001012051400" "00001012053200" "00001012053300" "00001012053400" "00001012054200" "00001012921000" "00001012930000" "00001012931800")) (ZID-SET backward ("00001012051200" "00001012051400" "00001012053200" "00001012053300" "00001012053400" "00001012054200" "00001012921000" "00001012930000" "00001012931800")) (NUMBER box-number "1") (STRING copyright "(c) 2020-present by Detlef Stern ") (TIMESTAMP created "20230403151127") (WORD lang "en") (EMPTY-STRING license "EUPL-1.2-or-later") (TIMESTAMP modified "20240413160345") (TIMESTAMP published "20240413160345") (WORD visibility "public")) (BLOCK (HEADING 1 () "syntax-of-lists" "syntax-of-lists" (TEXT "Syntax of lists")) (PARA (TEXT "A list always starts with the left parenthesis (") (FORMAT-QUOTE () (LITERAL-INPUT () "(")) (TEXT ", U+0028) and ends with a right parenthesis (") (FORMAT-QUOTE () (LITERAL-INPUT () ")")) (TEXT ", U+0029).") (SOFT) (TEXT "A list may contain a possibly empty sequence of elements, i.e. lists and / or atoms.")) (PARA (TEXT "Internally, lists are composed of ") (FORMAT-EMPH () (TEXT "cells")) (TEXT ".") (SOFT) (TEXT "A cell allows to store two values.") (SOFT) (TEXT "The first value references the first element of a list.") (SOFT) (TEXT "The second value references the rest of the list, or is the special value ") (FORMAT-EMPH () (TEXT "nil")) (TEXT " if there is no rest of the list.")) (PARA (TEXT "However, it is possible to store an atom as the second value of the last cell.") (SOFT) (TEXT "In this case, before the last element of a list of at least two elements, a full stop character (") (FORMAT-QUOTE () (LITERAL-INPUT () ".")) (TEXT ", U+002E) signals such a cell as the last two elements.") (SOFT) (TEXT "This allows a more space economic storage of data.")) (PARA (TEXT "A ") (FORMAT-EMPH () (TEXT "proper")) (TEXT " list, which contains ") (FORMAT-EMPH () (TEXT "nil")) (TEXT " as the second value of the last element might be pictured as follows:")) (BLOB () "svg" "VNVNVElem1Elem2ElemN") (PARA (LITERAL-INPUT () "V") (TEXT " is a placeholder for a value, ") (LITERAL-INPUT () "N") (TEXT " is the reference to the next cell (also known as the rest / tail of the list).") (SOFT) (TEXT "Above list will be represented as an symbolic expression as ") (LITERAL-INPUT () "(Elem1 Elem2 ... ElemN)")) (PARA (TEXT "An improper list will have a non-") (FORMAT-EMPH () (TEXT "nil")) (TEXT " reference to an atom as the very last element")) (BLOB () "svg" "VNVNVVElem1Elem2ElemNAtom") (PARA (TEXT "Above improper list will be represented as an symbolic expression as ") (LITERAL-INPUT () "(Elem1 Elem2 ... ElemN . Atom)")) (HEADING 1 () "syntax-of-numbers-atom" "syntax-of-numbers-atom" (TEXT "Syntax of numbers (atom)")) (PARA (TEXT "A number is a non-empty sequence of digits (") (FORMAT-QUOTE () (TEXT "0")) (TEXT " ... ") (FORMAT-QUOTE () (TEXT "9")) (TEXT ").") (SOFT) (TEXT "The smallest number is ") (LITERAL-CODE () "0") (TEXT ", there are no negative numbers.")) (HEADING 1 () "syntax-of-symbols-atom" "syntax-of-symbols-atom" (TEXT "Syntax of symbols (atom)")) (PARA (TEXT "A symbol is a non-empty sequence of printable characters, except left or right parenthesis.") (SOFT) (TEXT "Unicode characters of the following categories contains printable characters in the above sense: letter (L), number (N), punctuation (P), symbol (S).") (SOFT) (TEXT "Symbols are case-sensitive, i.e. ") (FORMAT-QUOTE () (LITERAL-INPUT () "ZETTEL")) (TEXT " and ") (FORMAT-QUOTE () (LITERAL-INPUT () "zettel")) (TEXT " denote different symbols.")) (HEADING 1 () "syntax-of-string-atom" "syntax-of-string-atom" (TEXT "Syntax of string (atom)")) (PARA (TEXT "A string starts with a quotation mark (") (FORMAT-QUOTE () (LITERAL-INPUT () "\"")) (TEXT ", U+0022), contains a possibly empty sequence of Unicode characters, and ends with a quotation mark.") (SOFT) (TEXT "To allow a string to contain a quotations mark, it must be prefixed by one backslash (") (FORMAT-QUOTE () (LITERAL-INPUT () "\\")) (TEXT ", U+005C).") (SOFT) (TEXT "To allow a string to contain a backslash, it also must be prefixed by one backslash.") (SOFT) (TEXT "Unicode characters with a code less than U+FF are encoded by by the sequence ") (FORMAT-QUOTE () (LITERAL-INPUT () "\\xNM")) (TEXT ", where ") (LITERAL-INPUT () "NM") (TEXT " is the hex encoding of the character.") (SOFT) (TEXT "Unicode characters with a code less than U+FFFF are encoded by by the sequence ") (FORMAT-QUOTE () (LITERAL-INPUT () "\\uNMOP")) (TEXT ", where ") (LITERAL-INPUT () "NMOP") (TEXT " is the hex encoding of the character.") (SOFT) (TEXT "Unicode characters with a code less than U+FFFFFF are encoded by by the sequence ") (FORMAT-QUOTE () (LITERAL-INPUT () "\\UNMOPQR")) (TEXT ", where ") (LITERAL-INPUT () "NMOPQR") (TEXT " is the hex encoding of the character.") (SOFT) (TEXT "In addition, the sequence ") (FORMAT-QUOTE () (LITERAL-INPUT () "\\t")) (TEXT " encodes a horizontal tab (U+0009), the sequence ") (FORMAT-QUOTE () (LITERAL-INPUT () "\\n")) (TEXT " encodes a line feed (U+000A).")) (HEADING 1 () "see-also" "see-also" (TEXT "See also")) (UNORDERED (BLOCK (PARA (TEXT "Currently, Zettelstore uses ") (LINK-EXTERNAL () "https://t73f.de/r/sx" (TEXT "Sx")) (TEXT " (") (FORMAT-QUOTE () (TEXT "Symbolic eXpression framework")) (TEXT ") to implement symbolic expressions.") (SOFT) (TEXT "The project page might contain additional information about the full syntax.")) (PARA (TEXT "Zettelstore only uses lists, numbers, string, and symbols to represent zettel."))))))