;;; missimetry of cons and bracketed list (cons 16 (list 1 2 3)) (cons (list 1 2 3) 5) ;; so adding to front is easy, ;; adding to back is hard, since last element connected to nil (last `(1 2 3 4)) ; => (4) ;; for sets: ;; member, union, intersection, set-difference, subsetp ;; stopped at exercise 6.26 (i remember reading that in the court hallway) ;;; tables / alists (setf words '((one un) (two deu) (three trois) (four quatre) (five cing))) (assoc 'three words) (cdr '(one un)) (rassoc '(un) words) ; why not found? (setf sounds '((cow . moo) (pig . oink) (cat . meow) (dog . woof) (bird . tweet))) (rassoc 'moo sounds) ;;; keyword arguments... (setf text `(b a n a n a - p a n d a)) text (remove `a text) (remove `a text :count 3) (remove `a text :count 2 :from-end t) ;; keyword is symbol with : at the start of the name (keywordp ':hello) (keywordp :hello) ; no need to quote? (keywordp 'hello) ;; trees, subst & sublis ? ;; performing substitutions from alist into tree (?) ;;; subst - substitute X for Y in Z (subst 'the 'a '(a list even nested (a hare) will get a substitution)) ;;; sublis - takes make substitutions at same time ;; and it takes which? alisp plist? urgh ;; in emacs - plist is one level list ;; alist - list of cons cells ;; here also 2 level list is alist, and what's expected (sublis '((rose . red) (violet . blue) (sunflower . yellow)) '(here is the rose strucure (another rose and violet thingy) multilevel)) ;; I suppse could be used on "code as data"