1=> 1 (defvar blue "Red") blue=> "Red" (+ 1 7) => 8 (concatenate "My favourite colour is " blue) => "My favourite colour is Red" functions Instructions to the interpreter on what to do. We often say an s-expression 'evaluates to' something else, and many LISP books use the notation => to indicate that. This action is what the LISP interpreter does for every s-expression. evaluate More or less this means 'determine the meaning of '. It's useful to have a term for this since we discuss how lists are navigated and need common ways to talk about it. element We often refer to each 'thing' inside a list as an element. You use two functions for this: defvar for variables and defun for functions. If i made a predicate to check if numbers a and b are both 2, i'd name it both-two? define in the sense of LISP, this means to formally tell the script what you want a given symbol to evaluate to. We often refer to functions which return #t or #f as predicates, and in SWC-LISP, the convention is to name those functions ending with a question mark. It is an s-expression, but more than that it is a value, number, boolean Boolean is a data type that can be either True or False. We use the same kind of notation and terms to discuss lists.Ītom a single 'thing' - the smallest unit thing in LISP. 2 is the second thing, and all the way at the end, the term n representing the last thing in that sequence is the "nth" thing. When referring to any specific 'thing' in that sequence, we talk about its position. n, where the first couple things give you an idea of how the sequence goes (in this case incrementing by 1), the ellipses (.) indicate it continues. Notation for a sequence of things is often 1 2.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |