Higher‐order functions
York University CSE 3401 Vida Movahedi
York University‐ CSE 3401‐ V. Movahedi
1
15_HigherFunctions
Higher order functions York University CSE 3401 Vida Movahedi 1 - - PowerPoint PPT Presentation
Higher order functions York University CSE 3401 Vida Movahedi 1 York University CSE 3401 V. Movahedi 15_HigherFunctions Overview Overview Higher order functions Apply and funcall Apply and funcall Eval Mapping
York University‐ CSE 3401‐ V. Movahedi
1
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
2
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
3
15_HigherFunctions
n
=
i
1
York University‐ CSE 3401‐ V. Movahedi
4
15_HigherFunctions
=
n i
1
i 1
York University‐ CSE 3401‐ V. Movahedi
5
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
6
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
7
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
8
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
9
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
10
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
11
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
12
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
13
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
14
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
15
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
16
15_HigherFunctions
Exercise: What if we use let instead of setq in definition of our‐if3?
York University‐ CSE 3401‐ V. Movahedi
17
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
18
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
19
15_HigherFunctions
(setf (get p1 ‘x) 0) (setf (get p1 ‘y) 0) (setf (get p2 ‘x) 1) ...
York University‐ CSE 3401‐ V. Movahedi
20
15_HigherFunctions
Mapcar returns a list
returned by setC ( hi h i th l
(which is the value returned by the last form in setC)
Mapc returns its
York University‐ CSE 3401‐ V. Movahedi
21
p second argument.
15_HigherFunctions
Exercise: Substitute append
pp with cons or list, and see what maplist returns
York University‐ CSE 3401‐ V. Movahedi
22
maplist returns.
15_HigherFunctions
York University‐ CSE 3401‐ V. Movahedi
23
15_HigherFunctions