Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"All Bibles are man-made." -- Thomas Edison


devel / comp.lang.lisp / anaphoric lambda

SubjectAuthor
* anaphoric lambdaRobert L.
`- Re: anaphoric lambdaRobert L.

1
anaphoric lambda

<t0jlgt$16ls$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!tQVCr3s5BQliuntAiUVMWw.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: anaphoric lambda
Date: Sun, 13 Mar 2022 02:39:29 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t0jlgt$16ls$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="39612"; posting-host="tQVCr3s5BQliuntAiUVMWw.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. - Sun, 13 Mar 2022 02:39 UTC

Thomas F. Burdick wrote:

> Pascal Costanza <pc@p-cos.net> writes:
>
> > (loop for x in '(1 2 3)
> > for y in '(4 5 6)
> > collect (* 2 (+ x y)))
> >
> > vs.
> >
> > (mapcar (lambda (x y)
> > (* 2 (+ x y)))
> > '(1 2 3)
> > '(4 5 6))
>
> Oh, that one's easy:
>
> (mapcar (compose (curry #'* 2) #'+)
> '(1 2 3) '(4 5 6))

(map (& * 2 (+ u v)) '(1 2 3) '(4 5 6))
===>
(10 14 18)

Given:

(define-syntax &-aux
(syntax-rules (u v w quote)
[(_ whole shadow (param ...) () original)
(lambda (param ...) original)]
[(_ (u more ...) (x y ...) () ps original)
(&-aux (more ...) (y ...) (x) ps original)]
[(_ (v more ...) (x y ...) (a) ps original)
(&-aux (more ...) (y ...) (a x) ps original)]
[(_ (w more ...) (x y ...) (a b) ps original)
(&-aux (more ...) (y ...) (a b x) ps original)]
[(_ ((quote ...) more ...) (y z ...) params ps original)
(&-aux (more ...) (z ...) params ps original)]
[(_ ('x more ...) (y z ...) params ps original)
(&-aux (more ...) (z ...) params ps original)]
[(_ ((s ...) more ...) (y z ...) params ps original)
(&-aux (s ... more ...) (s ... z ...) params ps original)]
[(_ (x more ...) (y z ...) params ps original)
(&-aux (more ...) (z ...) params ps original)]
[(_ () shadow params (p ps ...) original)
(&-aux original original params (ps ...) original)]))

;; Lambda with anaphoric parameters u, v, and w.
(define-syntax &
(syntax-rules ()
[(& x ...)
(&-aux (x ...) (x ...) () (1 2 3) (x ...))]))

Re: anaphoric lambda

<t0jpm5$ecc$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!aioe.org!tQVCr3s5BQliuntAiUVMWw.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Re: anaphoric lambda
Date: Sun, 13 Mar 2022 03:50:32 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <t0jpm5$ecc$1@gioia.aioe.org>
References: <t0jlgt$16ls$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="14732"; posting-host="tQVCr3s5BQliuntAiUVMWw.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. - Sun, 13 Mar 2022 03:50 UTC

On 3/12/2022, Robert L. wrote:

> (map (& * 2 (+ u v)) '(1 2 3) '(4 5 6))
> ===>
> (10 14 18)
>
> Given:
>
> (define-syntax &-aux

Better:

(define-syntax &-aux
(syntax-rules (u v w quote)
[(_ () shadow (param ...) original)
(lambda (param ...) original)]
[(_ (u more ...) (x y ...) () original)
(&-aux original original (x) original)]
[(_ (v more ...) (x y ...) (a) original)
(&-aux original original (a x) original)]
[(_ (w more ...) (x y ...) (a b) original)
(&-aux () () (a b x) original)]
[(_ ((quote ...) more ...) (y z ...) params original)
(&-aux (more ...) (z ...) params original)]
[(_ ('x more ...) (y z ...) params original)
(&-aux (more ...) (z ...) params original)]
[(_ ((s ...) more ...) (y z ...) params original)
(&-aux (s ... more ...) (s ... z ...) params original)]
[(_ (x more ...) (y z ...) params original)
(&-aux (more ...) (z ...) params original)]
))
;; Lambda with anaphoric parameters u, v, and w.
(define-syntax &
(syntax-rules ()
[(& x ...)
(&-aux (x ...) (x ...) () (x ...))]))


devel / comp.lang.lisp / anaphoric lambda

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor