Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"The Street finds its own uses for technology." -- William Gibson


devel / comp.lang.lisp / merits of Lisp vs Python

SubjectAuthor
o merits of Lisp vs PythonRobert L.

1
merits of Lisp vs Python

<su69ul$1s5d$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=16832&group=comp.lang.lisp#16832

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!NDfxRBuCiRvCDaRamFkRZA.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: merits of Lisp vs Python
Date: Fri, 11 Feb 2022 18:29:42 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su69ul$1s5d$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="61613"; posting-host="NDfxRBuCiRvCDaRamFkRZA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: XanaNews/1.18.1.6
X-Notice: Filtered by postfilter v. 0.9.2
 by: Robert L. - Fri, 11 Feb 2022 18:29 UTC

> (loop for e in list
> maximizing e into max
> minimizing e into min
> finally (return (values min max)))

In one pass, find the largest number and
the smallest number.

Even better: in one pass, find the smallest number,
the largest number, the sum, and the product.

(multi-reduce min max + * '(3 2 9 8 4 5 6 7))
===>
2 9
44
362880

Given:

(define (multi-fold* funcs knils the-list)
(let loop ((the-list the-list)
(accums knils))
(if (null? the-list)
(apply values accums)
(loop (cdr the-list)
(map (lambda (fn acc) (fn (car the-list) acc))
funcs
accums)))))

(define (multi-fold . args)
(let ((rev (reverse args)))
(multi-fold* (reverse (cddr rev)) (cadr rev) (car rev))))

(define (multi-reduce* funcs the-list)
(multi-fold* funcs (map (lambda _ (car the-list)) funcs) (cdr the-list)))

(define (multi-reduce . args)
(let ((rev (reverse args)))
(multi-reduce* (reverse (cdr rev)) (car rev))))


devel / comp.lang.lisp / merits of Lisp vs Python

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor