Created
August 4, 2014 20:21
-
-
Save humberto-ortiz/b4847059099e58a1273f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; All you need to know about lisp in one screen | |
;;;; Humberto Ortiz-Zuazaga <humberto.ortiz@upr.edu> | |
;;; The identity function takes one argument and returns it | |
(defun id (x) x) | |
;;; You can apply it to anything | |
(id 23.45) ; numbers | |
(id 'foo) ; symbols | |
(id "bar") ; strings | |
(id '(This is a list.)) ; lists | |
;;; Lisp is mostly parens function arguments parens => value | |
(+ 3 5) | |
;;; Nested however you want | |
(* (+ 1 4) (- 7 4)) | |
;; even functions can be values | |
#'id | |
;; functions can be arguments (and be returned) | |
(id #'id) | |
;; and you can call functions returned as values | |
(funcall (id #'id) (* 3 4)) | |
;;; The simple syntax and power of functions lets you do anything. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment