Common Lisp Tutorial 8b: Functional Programming (Filter Functions)

preview_player
Показать описание
Happy functional programming Friday everyone, I hope you are all well! Following on from last where where the map function(s) were introduced, this week we look at the filter functions, what they are, how they work and when to use one over another. Enjoy!
Рекомендации по теме
Комментарии
Автор

You're doing great - keep them coming!

MichaelGaribaldi
Автор

You can also use the loop macro to combine maps and filters together, similar to list comprehensions

wladwladsnotmyrealname
Автор

There is a function called `complement` that can be used to get rid of the ...-if-not functions. It works like this
(remove-if (complement #'oddp) '(1 2 3 4)) ;; (1 3)
(remove-if-not #'oddp '(1 2 3 4)) ;; (1 3)

See the book ON LISP from Paul Graham, page 62

Thanks for the videos

chriad