Re: procedure to check equality of list-elements

2022-11-06 Thread Thomas Morley
Am So., 6. Nov. 2022 um 13:39 Uhr schrieb Jean Abou Samra : > > > > Le 06/11/2022 à 13:27, Thomas Morley a écrit : > > Ofcourse not, though you need to know that the chosen proc is suitable > > for the task. > > For me eqv? was always meant to work with exactly two values, like cons. > > But

Re: procedure to check equality of list-elements

2022-11-06 Thread Luca Fascione
Good to know thanks Jean! L >

Re: procedure to check equality of list-elements

2022-11-06 Thread Jean Abou Samra
Le 06/11/2022 à 16:13, Luca Fascione a écrit : Note the detail that + a b c and eq? a b c don't do the exact same thing: + a b c is equivalent to (a + b) + c eq? a b c is equivalent to (a == b) && (b == c) Yes. On the other hand, Scheme (+ a b c d) behaves like Python a+b+c+d, and Scheme

Re: procedure to check equality of list-elements

2022-11-06 Thread Luca Fascione
Note the detail that + a b c and eq? a b c don't do the exact same thing: + a b c is equivalent to (a + b) + c eq? a b c is equivalent to (a == b) && (b == c) The list form has short circuiting if I remember right (eq? bails out on the first false it finds), but I don't remember how evaluation

Re: procedure to check equality of list-elements

2022-11-06 Thread David Kastrup
Thomas Morley writes: > Call me surprised. > The guile manual only gives code-examples comparing _two_ values with > eq? and friends. > I didn't know and didn't imagine it would work for more arguments as > you wrote above. The Guile manual may be somewhat fixated on the C interface which only

Re: procedure to check equality of list-elements

2022-11-06 Thread Thomas Morley
Am So., 6. Nov. 2022 um 13:39 Uhr schrieb Jean Abou Samra : > > > > Le 06/11/2022 à 13:27, Thomas Morley a écrit : > > Ofcourse not, though you need to know that the chosen proc is suitable > > for the task. > > For me eqv? was always meant to work with exactly two values, like cons. > > But

Re: procedure to check equality of list-elements

2022-11-06 Thread Jean Abou Samra
Le 06/11/2022 à 13:27, Thomas Morley a écrit : Call me surprised. The guile manual only gives code-examples comparing _two_ values with eq? and friends. I didn't know and didn't imagine it would work for more arguments as you wrote above. Well, call me surprised too. R5RS section 6.1 defines

Re: procedure to check equality of list-elements

2022-11-06 Thread Jean Abou Samra
Le 06/11/2022 à 13:27, Thomas Morley a écrit : Ofcourse not, though you need to know that the chosen proc is suitable for the task. For me eqv? was always meant to work with exactly two values, like cons. But (apply cons '(1 2 3)) fails ofcourse. In the past I searched the guile-manual and

Re: procedure to check equality of list-elements

2022-11-06 Thread Thomas Morley
Am So., 6. Nov. 2022 um 13:07 Uhr schrieb Jean Abou Samra : > > Le 06/11/2022 à 13:03, Thomas Morley a écrit : > > Hi, > > > > in !1701 `ly:beam::calc-knee' checks whether all list-elements are equal. > > Basically doing (apply eqv? ). > > Tbh, I don't understand why it works... > > > eqv? has no

Re: procedure to check equality of list-elements

2022-11-06 Thread Jean Abou Samra
Le 06/11/2022 à 13:03, Thomas Morley a écrit : Hi, in !1701 `ly:beam::calc-knee' checks whether all list-elements are equal. Basically doing (apply eqv? ). Tbh, I don't understand why it works... eqv? has no problem working on more than two elements. scheme@(guile-user)> (eqv? 1 1) $1 = #t

procedure to check equality of list-elements

2022-11-06 Thread Thomas Morley
Hi, in !1701 `ly:beam::calc-knee' checks whether all list-elements are equal. Basically doing (apply eqv? ). Tbh, I don't understand why it works... Though, the need to check a list for all list-elements are equal happened to me not only once. Thus, would it be acceptable to add something like: