Re: the "loop" macro

Liste des GroupesRevenir à cl scheme 
Sujet : Re: the "loop" macro
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.scheme
Date : 28. Aug 2025, 20:58:19
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <108qccq$1j42l$1@dont-email.me>
References : 1
User-Agent : XanaNews/1.18.1.6
B. Pym wrote:

Kent M. Pitman wrote:
 
 (loop for x in '(1 2 3 4 5 6 7)
    when (evenp x)
     collect x into evens
    else
     collect x into odds
    finally
     (return (values evens odds)))
 => (2 4 6), (1 3 5 7)
 
It's much shorter if we use a Lispy language
instead of CL.
 
Gauche Scheme
 
"!" is similar to "do".
 
(! (x :in '(1 2 3 4 5 6 7)
      evens cons x
      odds cons x
    :if-else (even? x))
  #f @@ (values evens odds))
 
  ===>
(2 4 6)
(1 3 5 7)
 



 (loop for x in '(a b (c d) e f)
       when (atom x)
        collect x
       else
        append x)
 => (A B C D E F)

It's much shorter if we use a Lispy language instead
of CL.

Gauche Scheme

"!" is similar to "do".

(! (r :meld x
    x :in '(a b (c d) e f))
  @)

  ===>
(a b c d e f)


--
[T]he problem is that lispniks are as cultish as any other devout group and
basically fall down frothing at the mouth if they see [heterodoxy].
  --- Kenny Tilton
The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham

Date Sujet#  Auteur
12 Aug 26 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal