-
Notifications
You must be signed in to change notification settings - Fork 86
maps
Chris Petersen edited this page Oct 16, 2014
·
1 revision
maps behaves like map, except for stripping empty lists from the returned list.
Parameter | Description |
---|---|
fcn | Function to be applied to each element |
lst | The list to operate on |
Example 1: Show the difference between map and maps.
> (define lst (list (list 1 (list)) (list 2 (list 3 8 34))))
> (map cadr lst)
(() (3 8 34))
> (maps cadr lst)
((3 8 34))
Example 2: Example from a communication page, where we want to keep only recent chat messages.
> (define allchats (list
(list (- ##now 1000) "A" "Once upon a time there was a blue dinosaur." 1)
(list (- ##now 2200) "B" "Hope this will be interesting ..." 0)
(list (- ##now 2300) "B" "Okay." 0)
(list (- ##now 2500) "A" "Shell I tell you a story" 1)
(list (- ##now 2500) "B" "I am really bored right now" 0)
(list (- ##now 3000) "B" "The red fox jumps over the lazy dog." 0)))
> (define age 2400)
> (maps (lambda(l) (if (< (- ##now (car l)) age) l '())) allchats)
((-1000. "A" "Once upon a time there was a blue dinosaur." 1)
(-2200. "B" "Hope this will be interesting ..." 0)
(-2300. "B" "Okay." 0))
-
- accelerometer
- alist
- audio
- audioaux
- base64
- btle-scan
- camera
- cdb
- cgi
- config
- csv
- curl
- digest
- dmtx
- download
- eventloop
- fcgi
- fft
- generalized-arrays
- gps
- graph
- gyro
- hidapi
- hpdf
- html
- httpsclient
- hybridapp
- json
- lmdb
- ln_core
- ln_glcore
- ln_glgui
- ln_store
- localization
- localization_gui
- localnotification
- magnetometer
- mdns
- mqtt
- mqtt-store
- multitouch
- oauth
- orientation
- p256ecdsa
- png
- portaudio
- pregexp
- pressure
- prime
- pushnotification
- redcap
- rsa
- rtaudio
- rupi
- rotation
- sanestring
- scheduler
- serial
- sets
- settings
- simplexnoise
- sqlite
- ssax
- syntax-case
- timestamp
- ttf
- uiform
- url
- uuid
- vibrate
- videoplayer
- watchdog
- website
- xml
- zip