[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.lisp

Re: performance: reduce+map vs loop.

William James

5/8/2015 9:53:00 AM

Raymond Toy wrote:

> You may want to look at the series package available in the CMU Lisp
> archives and described in CLtL2. Your example could be written as
>
> (defun dot-s (l0 l1)
> (collect-sum (#M+ (scan l0) (scan l1))))

Gauche Scheme:

(define (dot-sum list-1 list-2)
(fold + 0 (map + list-1 list-2)))

Another Way:

(use srfi-42 :only (sum-ec))
(define (dot-sum list-1 list-2)
(sum-ec (:list x list-1 list-2) x))

--
The grooming usually begins with older groups of men befriending girls aged
from 11 to 16 they meet on the street. In a typical scenario, the victim is
initially treated as a girlfriend and showered with presents and attention. But
the relationship quickly becomes more sinister as the abuser plies the child
with drink and drugs before effectively pimping her out to friends and
associates. --- http://www.liveleak.com/view?i=807_...