From: ·············@gmail.com
Subject: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <c128a238-6a09-4ed9-a425-c2c848faee48@s8g2000prg.googlegroups.com>
Hi,

I am still in a bit of shock that my first loop attempt works, with
one legalistic exception.

This is my simple code to show duplicates in a list:

(defun show-duplicates (list)
  (loop
     initially with ref = (first list)
     for entry in (rest list) do
       (if (equal ref entry)
	   (print entry))
       (setf ref entry)))

Using clisp on windows+cygwin+emacs+slime, I get the following warning
upon compilation:
WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
forbidden by
         ANSI CL.

The code seems to work:

CL-USER> (show-duplicates '(1 3 4 5 5 7 8 12 12 12 15))

5
12
12
NIL

CL-USER> (can-it-be-improved-p)
T

I could not find examples that would show me the problem with my
"initially" form.

To remove the warning, I can use
(loop initially (setf ref (first list)) ...

but that gives me a warning about ref not being defined or bound.

So, what is the right way to do that?

Thanks,

Mirko

From: Joshua Taylor
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <23e7f66c-bfc5-4104-a544-863938f04b6b@f10g2000hsf.googlegroups.com>
On Jan 22, 5:46 am, ·············@gmail.com wrote:
> Hi,
>
> I am still in a bit of shock that my first loop attempt works, with
> one legalistic exception.
>
> This is my simple code to show duplicates in a list:
>
> (defun show-duplicates (list)
>   (loop
>      initially with ref = (first list)
>      for entry in (rest list) do
>        (if (equal ref entry)
>            (print entry))
>        (setf ref entry)))
>
> Using clisp on windows+cygwin+emacs+slime, I get the following warning
> upon compilation:
> WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
> forbidden by
>          ANSI CL.
>
> The code seems to work:
>
> CL-USER> (show-duplicates '(1 3 4 5 5 7 8 12 12 12 15))
>
> 5
> 12
> 12
> NIL
>
> CL-USER> (can-it-be-improved-p)
> T
>
> I could not find examples that would show me the problem with my
> "initially" form.
>
> To remove the warning, I can use
> (loop initially (setf ref (first list)) ...
>
> but that gives me a warning about ref not being defined or bound.
>
> So, what is the right way to do that?
>
> Thanks,
>
> Mirko

No initially:

(defun show-duplicates (list)
  (loop
     with ref = (first list)
     for entry in (rest list) do
       (if (equal ref entry)
           (print entry))
       (setf ref entry)))

The first few lines of loop grammar are:

loop [name-clause] {variable-clause}* {main-clause}* => result*
name-clause::= named name
variable-clause::= with-clause | initial-final | for-as-clause
with-clause::= with var1 [type-spec] [= form1] {and var2 [type-spec]
[= form2]}*

http://www.lisp.org/HyperSpec/Body/mac_loop.html

That is, "with x = y" is a with-clause.
From: Slobodan Blazeski
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <030ac6c0-29b0-47c7-b5fe-6785616facbe@21g2000hsj.googlegroups.com>
On Jan 22, 11:46 am, ·············@gmail.com wrote:
> Hi,
>
> I am still in a bit of shock that my first loop attempt works, with
> one legalistic exception.
>
> This is my simple code to show duplicates in a list:
>
> (defun show-duplicates (list)
>   (loop
>      initially with ref = (first list)
>      for entry in (rest list) do
>        (if (equal ref entry)
>            (print entry))
>        (setf ref entry)))
>
> Using clisp on windows+cygwin+emacs+slime, I get the following warning
> upon compilation:
> WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
> forbidden by
>          ANSI CL.
>
> The code seems to work:
>
> CL-USER> (show-duplicates '(1 3 4 5 5 7 8 12 12 12 15))
>
> 5
> 12
> 12
> NIL
>
> CL-USER> (can-it-be-improved-p)
> T
>
> I could not find examples that would show me the problem with my
> "initially" form.
>
> To remove the warning, I can use
> (loop initially (setf ref (first list)) ...
>
> but that gives me a warning about ref not being defined or bound.
>
> So, what is the right way to do that?
>
> Thanks,
>
> Mirko
1st This doesn't even work on sbcl
xecution of a form compiled with errors.
Form:
  (LOOP INITIALLY WITH REF = (FIRST LIST) FOR ENTRY IN (REST LIST) DO
      (IF (EQUAL REF ENTRY) (PRINT ENTRY)) (SETF REF ENTRY))
Compile-time error:
  (in macroexpansion of (LOOP INITIALLY WITH ...))
(hint: For more precise location, try *BREAK-ON-SIGNALS*.)
A compound form was expected, but WITH found.
current LOOP context: INITIALLY WITH REF.
   [Condition of type SB-INT:COMPILED-PROGRAM-ERROR]
2nd Your only checking for duplicates that are one after another :
(show-duplicates '(1 3 4 5  7 5 8 12 14 12 15))
NIL

Try something like this
UNIFICATION> (defun show-duplicates (list &optional uniques)
	       (loop for e in list do
		    (if (member e uniques)
			(print e)
			(push e uniques))))
STYLE-WARNING: redefining SHOW-DUPLICATES in DEFUN
SHOW-DUPLICATES
UNIFICATION> (show-duplicates '(1 3 4 5  7 5 8 12 14 12 15))

5
12
NIL

cheers
Slobodan
From: Ken Tilton
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <4795e199$0$11620$607ed4bc@cv.net>
·············@gmail.com wrote:
> Hi,
> 
> I am still in a bit of shock that my first loop attempt works, with
> one legalistic exception.
> 
> This is my simple code to show duplicates in a list:
> 
> (defun show-duplicates (list)
>   (loop
>      initially with ref = (first list)

That is a blank initially clause. CLisp is being nice and coping with 
that and pretending you just wrote (loop with ref = (first list)....

>      for entry in (rest list) do
>        (if (equal ref entry)
> 	   (print entry))

Using when when when is suitable makes code more readable.

>        (setf ref entry)))

Loop is pretty powerful so you should have a nervous feeling when you 
find yourself setfing key iteration variables.

It looks as if you are assuming a sorted list and simply printing out 
elements the same as the preceding element:

    (loop for (a b) on list
          when (eql a b)
          do (print b))

You get an extra iteration on the last element and nil so an input list 
of '(nil nil) would print an extra duplicate. If that is a problem you can:

   (loop for a in list
         for b in (cdr list) ; this will run out first and halt the loop
         when (eql a b)
         do (print b))

> 
> Using clisp on windows+cygwin+emacs+slime, I get the following warning
> upon compilation:
> WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
> forbidden by
>          ANSI CL.

Doesn't Lisp give wonderful error messages? One thing refugees from the 
land of genius compilers like C/C++/Java have to learn is to Actually 
Read and Consider Lisp compiler errors/warnings. I actually remember 
telling some newby to some other language "never look at its error 
messages, that is never the problem". I also remember LMAO the one time 
in five years that an error message I had ignored /was/ the problem.

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Pillsy
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <d228c9d8-8f89-449c-a56b-fb63101a0938@i72g2000hsd.googlegroups.com>
On Jan 22, 7:29 am, Ken Tilton <···········@optonline.net> wrote:
[...]
> Using when when when is suitable makes code more readable.

It took me three tries to parse this sentence.

Cheers,
Pillsy
From: Kent M Pitman
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <uve5l7v7r.fsf@nhplace.com>
Pillsy <·········@gmail.com> writes:

> On Jan 22, 7:29�am, Ken Tilton <···········@optonline.net> wrote:
> [...]
> > Using when when when is suitable makes code more readable.
> 
> It took me three tries to parse this sentence.

I'd bet this isn't the only case that's ever happened
with when when when when this is a problem.

(Sorry, must be the delirium brought on by this cold I've got...)

Btw, this kind of reminds me of the old joke that I see has been 
faithfully transcribed by someone on Wikipedia:

 http://en.wikipedia.org/wiki/James_while_John_had_had_had_had_had_had_had_had_had_had_had_a_better_effect_on_the_teacher.
From: Maciej Katafiasz
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <fn5316$47e$3@news.net.uni-c.dk>
Den Tue, 22 Jan 2008 10:09:44 -0500 skrev Kent M Pitman:

> Pillsy <·········@gmail.com> writes:
> 
>> On Jan 22, 7:29 am, Ken Tilton <···········@optonline.net> wrote: [...]
>> > Using when when when is suitable makes code more readable.
>> 
>> It took me three tries to parse this sentence.
> 
> I'd bet this isn't the only case that's ever happened with when when
> when when this is a problem.

I'd add a when, and remove a this:

"I'd bet this isn't the only case that's ever happened with when when 
when when when is a problem."

Cheers,
Maciej
From: Slobodan Blazeski
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <d99745b2-6aa8-4d94-b089-9781bf0e458e@m34g2000hsb.googlegroups.com>
On Jan 22, 4:44 pm, Maciej Katafiasz <········@gmail.com> wrote:
> Den Tue, 22 Jan 2008 10:09:44 -0500 skrev Kent M Pitman:
>
> > Pillsy <·········@gmail.com> writes:
>
> >> On Jan 22, 7:29 am, Ken Tilton <···········@optonline.net> wrote: [...]
> >> > Using when when when is suitable makes code more readable.
>
> >> It took me three tries to parse this sentence.
>
> > I'd bet this isn't the only case that's ever happened with when when
> > when when this is a problem.
>
> I'd add a when, and remove a this:
>
> "I'd bet this isn't the only case that's ever happened with when when
> when when when is a problem."
>
> Cheers,
> Maciej

Stan "Oh my God, they killed Kenny!"
Kyle "You bastards!"
From: John Thingstad
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <op.t5b5s8l5ut4oq5@pandora.alfanett.no>
P� Tue, 22 Jan 2008 14:32:09 +0100, skrev Pillsy <·········@gmail.com>:

> On Jan 22, 7:29�am, Ken Tilton <···········@optonline.net> wrote:
> [...]
>> Using when when when is suitable makes code more readable.
>
> It took me three tries to parse this sentence.
>
> Cheers,
> Pillsy

I guess when is unsuitable :)

--------------
John Thingstad
From: Maciej Katafiasz
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <fn4mhk$47e$1@news.net.uni-c.dk>
Den Tue, 22 Jan 2008 02:46:53 -0800 skrev Mirko.Vukovic:

> I am still in a bit of shock that my first loop attempt works, with one
> legalistic exception.
> 
> This is my simple code to show duplicates in a list:
> 
> (defun show-duplicates (list)
>   (loop
>      initially with ref = (first list)
>      for entry in (rest list) do
>        (if (equal ref entry)
> 	   (print entry))
>        (setf ref entry)))
> 
> Using clisp on windows+cygwin+emacs+slime, I get the following warning
> upon compilation:
> WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
> forbidden by
>          ANSI CL.
> The code seems to work:
[snip]
> I could not find examples that would show me the problem with my
> "initially" form.

Just remove it. WITH already establishes bindings. Besides, have you 
tried ITERATE? Well-documented, extensible and much more lispish in 
syntax.

Cheers,
Maciej
From: ·············@gmail.com
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <b9bd19b5-8714-4692-b41e-f28538e5d088@v17g2000hsa.googlegroups.com>
On Jan 22, 5:46 am, ·············@gmail.com wrote:
> Hi,
>
> I am still in a bit of shock that my first loop attempt works, with
> one legalistic exception.
>
> This is my simple code to show duplicates in a list:
>
> (defun show-duplicates (list)
>   (loop
>      initially with ref = (first list)
>      for entry in (rest list) do
>        (if (equal ref entry)
>            (print entry))
>        (setf ref entry)))
>
> Using clisp on windows+cygwin+emacs+slime, I get the following warning
> upon compilation:
> WARNING: LOOP: missing forms after INITIALLY: permitted by CLtL2,
> forbidden by
>          ANSI CL.
>
> The code seems to work:
>
> CL-USER> (show-duplicates '(1 3 4 5 5 7 8 12 12 12 15))
>
> 5
> 12
> 12
> NIL
>
> CL-USER> (can-it-be-improved-p)
> T
>
> I could not find examples that would show me the problem with my
> "initially" form.
>
> To remove the warning, I can use
> (loop initially (setf ref (first list)) ...
>
> but that gives me a warning about ref not being defined or bound.
>
> So, what is the right way to do that?
>
> Thanks,
>
> Mirko

First, thanks to everyone, especially for sample codes.

Second, I was not clear in my original post, but Ken caught it: I am
parsing an ordered list.

Third, one day (soon?) I may give up on "loop" and switch to "iterate"

Since I really want to collect the duplicates, I went with Ken's
approach:

(defun collect-duplicates (list)
  (loop
     for a in list
     for b in (cdr list)
     when (equal a b)
     collect b))

It eliminates the (setf ...), and I must admit, the setf just did not
look right in the loop.  But I could not think of another way of doing
it.

Mirko
From: Madhu
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <m363xjhdny.fsf@robolove.meer.net>
* (Mirko.Vukovic @ gmail.com) Wrote on Wed, 23 Jan 2008 08:41:15 -0800 (PST):
| Second, I was not clear in my original post, but Ken caught it: I am
| parsing an ordered list.
[...]
| (defun collect-duplicates (list)
|   (loop
|      for a in list
|      for b in (cdr list)
|      when (equal a b)
|      collect b))
|
| It eliminates the (setf ...), and I must admit, the setf just did not
| look right in the loop.  But I could not think of another way of doing
| it.

Note that you can use LOOP destructuring like this:
	  (loop for (a b) on list when (equal a b) collect b)

To fix the duplicate elements in the returned list, you can use
an extra loop variable like this.

(defun collect-duplicates (list)
  "LIST is an ordered list without null elements."
  (loop for prev = NIL then a
        for (a b) on list
        when (equal a b) unless (equal prev a) collect a))

--
Madhu
From: ·············@gmail.com
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <2bfabc2e-82d8-4c34-8a0e-1a43c0a164ee@v46g2000hsv.googlegroups.com>
On Jan 24, 2:43 am, Madhu <·······@meer.net> wrote:
> * (Mirko.Vukovic @ gmail.com) Wrote on Wed, 23 Jan 2008 08:41:15 -0800 (PST):
> | Second, I was not clear in my original post, but Ken caught it: I am
> | parsing an ordered list.
> [...]
> | (defun collect-duplicates (list)
> |   (loop
> |      for a in list
> |      for b in (cdr list)
> |      when (equal a b)
> |      collect b))
> |
> | It eliminates the (setf ...), and I must admit, the setf just did not
> | look right in the loop.  But I could not think of another way of doing
> | it.
>
> Note that you can use LOOP destructuring like this:
>           (loop for (a b) on list when (equal a b) collect b)
>
> To fix the duplicate elements in the returned list, you can use
> an extra loop variable like this.
>
> (defun collect-duplicates (list)
>   "LIST is an ordered list without null elements."
>   (loop for prev = NIL then a
>         for (a b) on list
>         when (equal a b) unless (equal prev a) collect a))
>
> --
> Madhu

Wow!  I like them both (it took me a while to divine your second
formulation).  I was a bit surprised with the "for (a b) on list"
because I thought it would remove pairs of values from the list.

Thanks,

Mirko
From: Madhu
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <m31w87gvhp.fsf@robolove.meer.net>
* Mirko.Vukovic @gmail .com Wrote on Thu, 24 Jan 2008 04:46:18 -0800 (PST):
|>
|> (defun collect-duplicates (list)
|>   "LIST is an ordered list without null elements."
|>   (loop for prev = NIL then a
|>         for (a b) on list
|>         when (equal a b) unless (equal prev a) collect a))
|
| Wow!  I like them both (it took me a while to divine your second
| formulation).  I was a bit surprised with the "for (a b) on list"
| because I thought it would remove pairs of values from the list.

No, what you refer to would be accomplished by using a step function

    (loop for (a b) on list by #'cddr ...)

Which would walk down LIST binding A and B to two non-overlapping
successive values

[I forgot to mention that in my example the given order of loop clauses
is essential, i.e. `for-as-equals-then' clause MUST preceede the
`for-as-in-list' clause if the algorithm is to be implemented by LOOP
correctly.  You cannot switch the order of clauses.]

--
Madhu
From: ·············@gmail.com
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <cba4424c-4395-4385-be88-2550df1fd027@q39g2000hsf.googlegroups.com>
On Jan 24, 9:15 am, Madhu <·······@meer.net> wrote:
> * Mirko.Vukovic @gmail .com Wrote on Thu, 24 Jan 2008 04:46:18 -0800 (PST):
> |>
> |> (defun collect-duplicates (list)
> |>   "LIST is an ordered list without null elements."
> |>   (loop for prev = NIL then a
> |>         for (a b) on list
> |>         when (equal a b) unless (equal prev a) collect a))
> |
> | Wow!  I like them both (it took me a while to divine your second
> | formulation).  I was a bit surprised with the "for (a b) on list"
> | because I thought it would remove pairs of values from the list.
>
> No, what you refer to would be accomplished by using a step function
>
>     (loop for (a b) on list by #'cddr ...)
>
> Which would walk down LIST binding A and B to two non-overlapping
> successive values
>
> [I forgot to mention that in my example the given order of loop clauses
> is essential, i.e. `for-as-equals-then' clause MUST preceede the
> `for-as-in-list' clause if the algorithm is to be implemented by LOOP
> correctly.  You cannot switch the order of clauses.]
>
> --
> Madhu

Thanks for the "by #'cddr" explanation.  And yes, I understood that
the order of for's was essential.

I went to hyperspec to check out the difference between the loop
for ... in and loop for ... on.  It keeps driving home what a huge
language lisp is.

Thanks again,

Mirko
From: Slobodan Blazeski
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <71d52eaa-21e2-4904-9c1a-9e7d0fb43e20@j78g2000hsd.googlegroups.com>
On Jan 24, 8:43 am, Madhu <·······@meer.net> wrote:
> * (Mirko.Vukovic @ gmail.com) Wrote on Wed, 23 Jan 2008 08:41:15 -0800 (PST):
> | Second, I was not clear in my original post, but Ken caught it: I am
> | parsing an ordered list.
> [...]
> | (defun collect-duplicates (list)
> |   (loop
> |      for a in list
> |      for b in (cdr list)
> |      when (equal a b)
> |      collect b))
> |
> | It eliminates the (setf ...), and I must admit, the setf just did not
> | look right in the loop.  But I could not think of another way of doing
> | it.
>
> Note that you can use LOOP destructuring like this:
>           (loop for (a b) on list when (equal a b) collect b)
>
> To fix the duplicate elements in the returned list, you can use
> an extra loop variable like this.
>
> (defun collect-duplicates (list)
>   "LIST is an ordered list without null elements."
>   (loop for prev = NIL then a
>         for (a b) on list
>         when (equal a b) unless (equal prev a) collect a))
>
> --
> Madhu
Nice looping Madhu

Slobodan

The oldest man was once nineteen years old, and full of wisdom. Then
he studied lisp...
From: ·············@gmail.com
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <3d28a2d9-dfbb-4064-bd98-e87d6ca8118b@l1g2000hsa.googlegroups.com>
On Jan 24, 2:43 am, Madhu <·······@meer.net> wrote:
> * (Mirko.Vukovic @ gmail.com) Wrote on Wed, 23 Jan 2008 08:41:15 -0800 (PST):
> | Second, I was not clear in my original post, but Ken caught it: I am
> | parsing an ordered list.
> [...]
> | (defun collect-duplicates (list)
> |   (loop
> |      for a in list
> |      for b in (cdr list)
> |      when (equal a b)
> |      collect b))
> |
> | It eliminates the (setf ...), and I must admit, the setf just did not
> | look right in the loop.  But I could not think of another way of doing
> | it.
>
> Note that you can use LOOP destructuring like this:
>           (loop for (a b) on list when (equal a b) collect b)
>
> To fix the duplicate elements in the returned list, you can use
> an extra loop variable like this.
>
> (defun collect-duplicates (list)
>   "LIST is an ordered list without null elements."
>   (loop for prev = NIL then a
>         for (a b) on list
>         when (equal a b) unless (equal prev a) collect a))
>
> --
> Madhu

Well, I have to temper my enthusiasm for this for Madhu's elegant
solution.  The problem is that on the last iteration of the loop, the
(a b) pair contains (last (list) (nil)) element.  And the problem is
also that I did not say exactly what I really wanted my loop to
accomplish -- so Madhu could not have solved an unstated problem.

While this behavior is not a problem for the plain (equal a b) test,
it may be a problem if I am performing a test on a sub-element of a/
b.  In my case, I am actually testing
(equal (funcall key a) (funcall key b)).

And for some key's, the nil will cause an error.

So, I am back to using Ken's
(loop
  for a in list
  for b in (cdr list)
  ...


Mirko
From: Thomas F. Burdick
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <681355cc-9497-4344-85e6-7e3253717bf5@i12g2000prf.googlegroups.com>
> Well, I have to temper my enthusiasm for this for Madhu's elegant
> solution.  The problem is that on the last iteration of the loop, the
> (a b) pair contains (last (list) (nil)) element.  And the problem is
> also that I did not say exactly what I really wanted my loop to
> accomplish -- so Madhu could not have solved an unstated problem.
>
> While this behavior is not a problem for the plain (equal a b) test,
> it may be a problem if I am performing a test on a sub-element of a/
> b.  In my case, I am actually testing
> (equal (funcall key a) (funcall key b)).
>
> And for some key's, the nil will cause an error.
>
> So, I am back to using Ken's
> (loop
>   for a in list
>   for b in (cdr list)
>   ...

The idiom I use in these situations is

  (loop for (a b . more?) on list while more?
        ...)
From: Edi Weitz
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <u3ashisuc.fsf@agharta.de>
On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:

> The idiom I use in these situations is
>
>   (loop for (a b . more?) on list while more?
>         ...)

With a question mark?  Ick!

Note to newbies: Don't try this at home.

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: ·············@gmail.com
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <67982381-c896-445d-bc8a-ec51fb52d1ce@l1g2000hsa.googlegroups.com>
On Jan 28, 3:43 pm, Edi Weitz <········@agharta.de> wrote:
> On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
>
> > The idiom I use in these situations is
>
> >   (loop for (a b . more?) on list while more?
> >         ...)
>
> With a question mark?  Ick!
>
> Note to newbies: Don't try this at home.

Point taken :-)

>
> --
>
> European Common Lisp Meeting, Amsterdam, April 19/20, 2008
>
>  http://weitz.de/eclm2008/
>
> Real email: (replace (subseq ·········@agharta.de" 5) "edi")
From: Ken Tilton
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <479ea51a$0$6342$607ed4bc@cv.net>
Edi Weitz wrote:
> On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
> 
> 
>>The idiom I use in these situations is
>>
>>  (loop for (a b . more?) on list while more?
>>        ...)
> 
> 
> With a question mark?  Ick!

You may not be aware that Jeff has convinced me Lisp needs change so I 
changed the convention from the confused p/-p thing to a simple ?.

glad to help, kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Thomas F. Burdick
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <156bd513-dc4f-491c-9557-6c539dd28e48@i12g2000prf.googlegroups.com>
> Edi Weitz wrote:
> > On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
>
> >>The idiom I use in these situations is
>
> >>  (loop for (a b . more?) on list while more?
> >>        ...)
>
> > With a question mark?  Ick!

I tend to use ? as a suffix for boolean variables -- in this case I
could have called the variable bork and it'd still be clear what was
going on, but in general I like to be able to tell at a glance if
something was supposed to be a boolean value or a predicate; so in my
code morep would be something to funcall.  I suppose it could cause a
problem if someone wrote a terminating reader macro for #\? and
installed it globally rather than in the files where they use it ...
but it's kind of hard to imagine such a person not having screwed up
their #\? macro.

On Jan 29, 5:01 am, Ken Tilton <···········@optonline.net> wrote:
>
> You may not be aware that Jeff has convinced me Lisp needs change so I
> changed the convention from the confused p/-p thing to a simple ?.
>
> glad to help, kt

Dude, I thought you were already helping with your complicated system
of naming macros things like ^_^, omg!!!$!? and c?8_
From: Ken Tilton
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <479eec94$0$6356$607ed4bc@cv.net>
Thomas F. Burdick wrote:
>>Edi Weitz wrote:
>>
>>>On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
>>
>>>>The idiom I use in these situations is
>>
>>>> (loop for (a b . more?) on list while more?
>>>>       ...)
>>
>>>With a question mark?  Ick!
> 
> 
> I tend to use ? as a suffix for boolean variables -- in this case I
> could have called the variable bork and it'd still be clear what was
> going on, but in general I like to be able to tell at a glance if
> something was supposed to be a boolean value or a predicate; so in my
> code morep would be something to funcall.

I see. You are drawing a line between code and data?

Fence builder!

kt

-- 
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Kent M Pitman
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <uy7a9xje4.fsf@nhplace.com>
Ken Tilton <···········@optonline.net> writes:

> Edi Weitz wrote:
> > On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
> >
> >>The idiom I use in these situations is
> >>
> >>  (loop for (a b . more?) on list while more?
> >>        ...)
> > With a question mark?  Ick!
> 
> You may not be aware that Jeff has convinced me Lisp needs change so I
> changed the convention from the confused p/-p thing to a simple ?.

I often use ? in symbol names.  I'll fix it if I ever run into problems.
I see no reason to give up a perfectly good letter.  In code with a need
to be highly portable, it makes sense to be cautious.  But a lot of code
doesn't have nearly so strong a requirement.
From: Slobodan Blazeski
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <14e6c94c-8dd6-440b-927e-c6e465306e00@f47g2000hsd.googlegroups.com>
On Jan 29, 6:58 am, Kent M Pitman <······@nhplace.com> wrote:
> Ken Tilton <···········@optonline.net> writes:
> > Edi Weitz wrote:
> > > On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
>
> > >>The idiom I use in these situations is
>
> > >>  (loop for (a b . more?) on list while more?
> > >>        ...)
> > > With a question mark?  Ick!
>
> > You may not be aware that Jeff has convinced me Lisp needs change so I
> > changed the convention from the confused p/-p thing to a simple ?.
>
> I often use ? in symbol names.  I'll fix it if I ever run into problems.
> I see no reason to give up a perfectly good letter.  In code with a need
> to be highly portable, it makes sense to be cautious.  But a lot of code
> doesn't have nearly so strong a requirement.

? - looks schemich to me. Ok ok I use it too but it's still look
schemish.

Slobodan
From: Pascal Costanza
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <608i7jF1paedjU1@mid.individual.net>
Slobodan Blazeski wrote:
> On Jan 29, 6:58 am, Kent M Pitman <······@nhplace.com> wrote:
>> Ken Tilton <···········@optonline.net> writes:
>>> Edi Weitz wrote:
>>>> On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
>>>>> The idiom I use in these situations is
>>>>>  (loop for (a b . more?) on list while more?
>>>>>        ...)
>>>> With a question mark?  Ick!
>>> You may not be aware that Jeff has convinced me Lisp needs change so I
>>> changed the convention from the confused p/-p thing to a simple ?.
>> I often use ? in symbol names.  I'll fix it if I ever run into problems.
>> I see no reason to give up a perfectly good letter.  In code with a need
>> to be highly portable, it makes sense to be cautious.  But a lot of code
>> doesn't have nearly so strong a requirement.
> 
> ? - looks schemich to me. Ok ok I use it too but it's still look
> schemish.

Don't give in to the enemy!

Ah, no, wait. Shouldn't we actually fight the Romans?

;)


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Don Geddis
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <87d4rg2c3u.fsf@geddis.org>
Pascal Costanza <··@p-cos.net> wrote on Tue, 29 Jan 2008:
> Slobodan Blazeski wrote:
>> ? - looks schemich to me. Ok ok I use it too but it's still look schemish.
>
> Don't give in to the enemy!
> Ah, no, wait. Shouldn't we actually fight the Romans?

What have they ever done for us?

_______________________________________________________________________________
Don Geddis                  http://don.geddis.org/               ···@geddis.org
From: Andreas Eder
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <86tzkpoq1l.fsf@eder.homelinux.net>
Hi Don,

>>>>> "Don" == Don Geddis <···@geddis.org> writes:

    Don> Pascal Costanza <··@p-cos.net> wrote on Tue, 29 Jan 2008:
    >> Slobodan Blazeski wrote:
    >>> ? - looks schemich to me. Ok ok I use it too but it's still look schemish.
    >> 
    >> Don't give in to the enemy!
    >> Ah, no, wait. Shouldn't we actually fight the Romans?

    Don> What have they ever done for us?

"Romanes Eunt Domus"

'Andreas
-- 
Wherever I lay my .emacs, there's my $HOME.
From: Rob Warnock
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <BpSdnW24ZcM6VzvanZ2dnUVZ_rSrnZ2d@speakeasy.net>
Andreas Eder  <············@gmx.net> wrote:
+---------------
| >>>>> "Don" == Don Geddis <···@geddis.org> writes:
|     >> Slobodan Blazeski wrote:
|     >> Don't give in to the enemy!
|     >> Ah, no, wait. Shouldn't we actually fight the Romans?
| 
|     Don> What have they ever done for us?
+---------------

"Well, the roads..."

+---------------
| "Romanes Eunt Domus"
+---------------

Or, if under threat of having one's throat cut for bad grammar,
"Romani Ite Domum".[1]


-Rob

[1] If I've parsed the LoB transcript correctly, though
    other sources say it should be ""Romani Ite Domi"...

-----
Rob Warnock			<····@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607
From: Marco Antoniotti
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <4d964551-ac22-493e-9b55-838e03e9d869@s12g2000prg.googlegroups.com>
On Feb 4, 9:19 am, ····@rpw3.org (Rob Warnock) wrote:
> Andreas Eder  <············@gmx.net> wrote:
> +---------------
> | >>>>> "Don" == Don Geddis <····@geddis.org> writes:
> |     >> Slobodan Blazeski wrote:
> |     >> Don't give in to the enemy!
> |     >> Ah, no, wait. Shouldn't we actually fight the Romans?
> |
> |     Don> What have they ever done for us?
> +---------------
>
> "Well, the roads..."
>
> +---------------
> | "Romanes Eunt Domus"
> +---------------
>
> Or, if under threat of having one's throat cut for bad grammar,
> "Romani Ite Domum".[1]
>
>

The only threat here is to have you locked up in a cage with a killer
rabbit or to have all the myrrh, gold and frankincense ever given to
you taken away!  :)

Cheers
--
Marco
From: Raymond Wiker
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <m263x4zsqp.fsf@Macintosh-2.local>
Marco Antoniotti <·······@gmail.com> writes:

> On Feb 4, 9:19�am, ····@rpw3.org (Rob Warnock) wrote:
>> Andreas Eder �<············@gmx.net> wrote:
>> +---------------
>> | >>>>> "Don" == Don Geddis <····@geddis.org> writes:
>> | � � >> Slobodan Blazeski wrote:
>> | � � >> Don't give in to the enemy!
>> | � � >> Ah, no, wait. Shouldn't we actually fight the Romans?
>> |
>> | � � Don> What have they ever done for us?
>> +---------------
>>
>> "Well, the roads..."
>>
>> +---------------
>> | "Romanes Eunt Domus"
>> +---------------
>>
>> Or, if under threat of having one's throat cut for bad grammar,
>> "Romani Ite Domum".[1]
>>
>>
>
> The only threat here is to have you locked up in a cage with a killer
> rabbit or to have all the myrrh, gold and frankincense ever given to
> you taken away!  :)

	Whatever happened to 

        "Write that down one hundred times. If it's not done by sunrise,
I'll cut your balls off." 
From: Rainer Joswig
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <joswig-B0E027.09461929012008@news-europe.giganews.com>
In article <························@cv.net>,
 Ken Tilton <···········@optonline.net> wrote:

> Edi Weitz wrote:
> > On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <········@gmail.com> wrote:
> > 
> > 
> >>The idiom I use in these situations is
> >>
> >>  (loop for (a b . more?) on list while more?
> >>        ...)
> > 
> > 
> > With a question mark?  Ick!
> 
> You may not be aware that Jeff has convinced me Lisp needs change so I 
> changed the convention from the confused p/-p thing to a simple ?.

When I see source code like this (sketch, you get the idea)

 (find 'mercedes garage :test #'has-fuel?)

I always think it asks me a question.

 (find 'mercedes garage :test #'has-fuel-p)

Above is more neutral. ;-)


> 
> glad to help, kt
From: Robert Maas, see http://tinyurl.com/uh3t
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <rem-2008feb04-004@yahoo.com>
> From: Ken Tilton <···········@optonline.net>
> You may not be aware that Jeff has convinced me Lisp needs change
> so I changed the convention from the confused p/-p thing to a
> simple ?.

I agree with that proposal, but I worry that some Spanish-language
person will amend your proposal to also include an upside down
question mark at the start of the predicate word.
From: Tobias C. Rittweiler
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <87prvl8uht.fsf@freebits.de>
Edi Weitz <········@agharta.de> writes:

> On Mon, 28 Jan 2008 04:29:31 -0800 (PST), "Thomas F. Burdick" <...> wrote:
>
> > The idiom I use in these situations is
> >
> >   (loop for (a b . more?) on list while more?
> >         ...)
>
> With a question mark?  Ick!

Heh, ever looked at the examples of the CLHS entries for
WITH-HASH-TABLE-ITERATOR or WITH-PACKAGE-ITERATOR? :-)

  -T.
From: Edi Weitz
Subject: Re: (loop initially ... getting non-ANSI CL warning
Date: 
Message-ID: <uir1dfute.fsf@agharta.de>
On Mon, 28 Jan 2008 23:18:06 +0100, "Tobias C. Rittweiler" <···@freebits.de.invalid> wrote:

> Heh, ever looked at the examples of the CLHS entries for
> WITH-HASH-TABLE-ITERATOR or WITH-PACKAGE-ITERATOR? :-)

Those bastards... :)

-- 

European Common Lisp Meeting, Amsterdam, April 19/20, 2008

  http://weitz.de/eclm2008/

Real email: (replace (subseq ·········@agharta.de" 5) "edi")