Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Phasers locked on target, Captain.


devel / comp.lang.lisp / When to use apply

SubjectAuthor
o When to use applyRobert L.

1
When to use apply

<su58u0$1g44$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!Ielm+gIDc34O3DFO922iPA.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: When to use apply
Date: Fri, 11 Feb 2022 09:06:10 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su58u0$1g44$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="49284"; posting-host="Ielm+gIDc34O3DFO922iPA.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 09:06 UTC

> Of course, after going through all of that you then see why loop is so
> handy:
>
> CL-USER> (defun nth-elements (n &rest lists)
> (loop for item in lists collect (nth n item)))
>
> NTH-ELEMENTS
> CL-USER> (nth-elements 3 '(10 20 hello x world) '(-1 -2 -3 y) '(z0 z1 z2 z))
>
> (X Y Z)

Instead of CL, let's use a Lisp.

Gauche Scheme:

(define (nth-elements n . seqs)
(map (cut list-ref <> n 'too-short) seqs))

(nth-elements 3
'(foo bar)
'(10 20 hello x world)
'(-1 -2 -3 y)
'(z0 z1 z2 z))

===>
(too-short x y z)


devel / comp.lang.lisp / When to use apply

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor