Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 41:22:00 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
24 files (29,813K bytes) |
Messages: | 174,725 |
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))))