Page 64 - DCAP310_INTRODUCTION_TO_ARTIFICIAL_INTELLIGENCE_AND_EXPERT_SYSTEMS
P. 64
Introduction to Artificial Intelligence & Expert Systems
Notes find-if find an element
Car first element
(dolist (v l) ...) (loop for v in l do for each element do something
...) mapc
Pop get the first element and remove it
Member is an element in the list
Some is the predicate true for an element
Every is the predicate true for every element
(loop for v in l as i upfrom 0 do ...) iterate with index
Remove-if-not delete-if-not keep elements (matching)
Remove-if delete-if keep elements (non matching)
(car (last l)) last element
Nconc list concatenation
Append list concatenation
'(a b c) list constructor
List list constructor
Pairlis list of couples from 2 lists
Length list size
Nth list/array indexing
Aref list/array indexing
Assoc lookup an element in a association list
Delete-duplicates remove duplicates
Remove-duplicates remove duplicates
Reverse Reverse
min/max smallest/biggest element
sort Sort
split-sequence split a list (into sublists delimited by elements
matching a predicate)
Mapcar transform a list (or bag) in another one
Mapcar transform two lists in parallel
Unknown:
list flattening adding an element at index get the last element and remove it partition
a list: elements matching, elements non matching join a list of strings in a string
using a glue string
Various Data Types
(gethash k h) dictionary (access: read/write)
(gethash k h) dictionary (has the key ?)
remhash dictionary (remove by key)
Nil optional value (null value)
V optional value (value)
Normal function call record (selector)
(cons a b) tuple constructor
58 LOVELY PROFESSIONAL UNIVERSITY