muhaid@gmail.com writes:
Write Lisp functions to do the following.
;; 5.(10) Write a function f that takes a list and returns a list where
;; each element (symbol, number, or list) e of the original list is
;; changed to (e dot). For example, (f '(a (b) c)) return ((a dot)
;; ((b) dot) (c dot)). Note that you only need one statement in f and it
;; has to use mapcar and lambda (for an anonymous function you have to
;; define).
(defun f (l)
(loop for e in l collect (list e 'dot) into res
finally (return (mapcar (lambda (x) x) res))))
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 54 |
| Nodes: | 6 (1 / 5) |
| Uptime: | 21:46:55 |
| Calls: | 742 |
| Files: | 1,218 |
| D/L today: |
6 files (8,794K bytes) |
| Messages: | 186,234 |
| Posted today: | 1 |