[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

Re: introduction to Lisp...

William James

6/29/2015 8:46:00 PM

> (defun characterify-tree (tree)
> (loop for elt in tree
> collect (if (consp elt) (characterify-tree elt) (character elt))))
>
> Either way, you should get results like this:
>
> (characterify-tree '(a b (c d (e f) g) h))
> => (#\A #\B (#\C #\D (#\E #\F) #\G) #\H)


Gauche Scheme:


(define (characterify-tree tree)
(map
(^x (if (symbol? x) (ref (symbol->string x) 0) (characterify-tree x)))
tree))

(characterify-tree '(a b (c d (e f) g) h))
===>
(#\a #\b (#\c #\d (#\e #\f) #\g) #\h)

--
[V]ersions of the false flag attack have been used ... to direct the force of
the people toward whatever end the ruling class may be seeking.... that end
may be war, or it may be the curtailing of domestic civil liberties and basic
human rights. www.alt-market.com/articles/1808-11-signs-of-a-false-flag