Re: need help w/ `loop'

Liste des GroupesRevenir à cl lisp 
Sujet : Re: need help w/ `loop'
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp comp.lang.scheme
Date : 19. Sep 2024, 09:13:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vcgiun$fueu$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
This baffles me:
 
(loop for i from 0 to 3
  with result = 0
   do
    (incf result i)
   return result)
 
==> 0
 
Why?  doesn't the stuff that occurs in the body of the `loop' make a
difference?  What am I missing?

Why didn't you do it this way?

(let ((result 0))
  (loop for i from 0 to 3
    do (incf result i))
  result)

Why does it make worshippers of CL (COBOL-Like) so happy to do
everything inside of LOOP?

Why didn't you believe Paul Graham when he told you that LOOP
is a disaster?

Gauche Scheme:

(rlet1 result 0
  (dotimes (i 4) (inc! result i)))

 ===>
6

Date Sujet#  Auteur
19 Sep09:13 o Re: need help w/ `loop'1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal