[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: Add-A-Gram

William James

8/27/2015 4:51:00 PM

Edi Weitz wrote:

> Pascal Bourguignon <spam@mouse-potato.com> wrote:
>
> > The following might be slighly more efficient, or equal, depending
> > on the compiler:
> >
> > (defun subwords (category)
> > "Return list of words from subcategories of CATEGORY."
> > (loop for c in (subcategories category)
> > for h = (gethash c *categories*)
> > when h
> > append h))
>
> LOOP has an idiom for this:
>
> (defun subwords (category)
> "Return list of words from subcategories of CATEGORY."
> (loop for c in (subcategories category)
> when (gethash c *categories*)
> append it))

Gauche Scheme:

(define (subwords category)
(append-map
(lambda (c) (hash-table-get Categories c '()))
(subcategories category)))

--
[H]e was prosecuted ... for "denying" the gas chambers and the six million
figure. In July 1998 a Swiss court sentenced him to 15 months imprisonment,
and to pay a large fine, because of his writings. Rather than serve the
sentence, in August 2000 Graf went into exile. In 2001 he married a Russian
historian in Moscow. www.revisionists.com/revisionists/graf.html