Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"You shouldn't make my toaster angry." -- Household security explained in "Johnny Quest"


devel / comp.lang.lisp / Multivalue tail recursion?

SubjectAuthor
* Multivalue tail recursion?Robert L.
`- Re: Multivalue tail recursion?Robert L.

1
Multivalue tail recursion?

<su9uan$gif$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!uUJbdg9jyTZ/MaHEmaRA4g.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Multivalue tail recursion?
Date: Sun, 13 Feb 2022 03:35:52 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <su9uan$gif$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="16975"; posting-host="uUJbdg9jyTZ/MaHEmaRA4g.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 Feb 2022 03:35 UTC

> > I would probably do something like this instead:
> >
> > (defun first-n (n list)
> > (loop for i below n for (a . d) on list
> > collect a into x
> > finally (return (values x d))))
>
> Niiiiiiice.

Gauche, Chicken, or Racket

(use srfi-1) ;; split-at for Chicken

(split-at '(a b c d e) 2)
===>
(a b)
(c d e)

Re: Multivalue tail recursion?

<suac30$eld$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!aioe.org!DOAD0NWc5K+Xz+WFzua2sg.user.46.165.242.75.POSTED!not-for-mail
From: No_spamming@noWhere_7073.org (Robert L.)
Newsgroups: comp.lang.lisp
Subject: Re: Multivalue tail recursion?
Date: Sun, 13 Feb 2022 07:30:43 -0000 (UTC)
Organization: Aioe.org NNTP Server
Message-ID: <suac30$eld$1@gioia.aioe.org>
References: <su9uan$gif$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Info: gioia.aioe.org; logging-data="15021"; posting-host="DOAD0NWc5K+Xz+WFzua2sg.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 Feb 2022 07:30 UTC

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

> > > I would probably do something like this instead:
> > >
> > > (defun first-n (n list)
> > > (loop for i below n for (a . d) on list
> > > collect a into x
> > > finally (return (values x d))))
> >
> > Niiiiiiice.
>
> Gauche, Chicken, or Racket
>
> (use srfi-1) ;; split-at for Chicken
>
> (split-at '(a b c d e) 2)
> ===>
> (a b)
> (c d e)
>

Gauche Scheme:

(define (first-n n xs . ys)
(dotimes (n) (push! ys (pop! xs)))
(values (reverse ys) xs))


devel / comp.lang.lisp / Multivalue tail recursion?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor