Re: cond clause does not allow definitions

2024-05-22 Thread Jeronimo Pellegrini
On 2024-05-22 18:07, Pierpaolo Bernardi wrote: In chez: (cond (else (define x 7) x)) 7 x 7 which looks like a bug to me. You may check if x is defined outside of the cond expression in the other implementations which do not raise an error too? Sure! And the result varies a lot! (cond

Re: cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
hello Maxime, On Thu, May 23, 2024 at 12:12 AM Maxime Devos wrote: > >but it is allowed in else clause: > > >scheme@(guile-user)> (cond (else (define x 7) x)) > > >$4 = 7 > > > > > >not really logic > > > > Probably in the implementation of ‘cond’, (cond (else X)) reduces to ‘X’. > > > > It’s

RE: equality of syntax objects

2024-05-22 Thread Maxime Devos
>asked more simply: >how to know ,for two syntax objects now different but that represents two different procedures created with the same name at two different moment,how to know that the names are still the same? >i see two solutions: -parse the representation string to know for example expt

RE: cond clause does not allow definitions

2024-05-22 Thread Maxime Devos
>but it is allowed in else clause: >scheme@(guile-user)> (cond (else (define x 7) x)) >$4 = 7 > >not really logic Probably in the implementation of ‘cond’, (cond (else X)) reduces to ‘X’. It’s tricky to ensure the same behaviour here as is the case when there is more than only the ‘else’ clause

Re: cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
in the version below it seems that else in cond with definition works alone but not when there is other conditions before: GNU Guile 3.0.8.99-f3ea8 Copyright (C) 1995-2022 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free

Re: cond clause does not allow definitions

2024-05-22 Thread Pierpaolo Bernardi
On Wed, May 22, 2024 at 10:08 PM Jeronimo Pellegrini wrote: > A: (cond (#t (define x 7) x)) > B: (cond (else (define x 7) x)) > > | system | A | B | > |-|---|---| > | Bigloo | 7 | 7 | > | Biwa| 7 | 7 | > | Chez| error | 7

Re: cond clause does not allow definitions

2024-05-22 Thread lloda
Fwiw Guile isn't 100% consistent about this, for example match forms don't allow definitions and maybe some other form that I don't recall atm. > On 22 May 2024, at 22:37, lloda wrote: > > > This is probably >

Re: cond clause does not allow definitions

2024-05-22 Thread lloda
This is probably http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commitdiff;h=764e3614b8c13de604399572a67d071621e9ca21 and the next commit that documents the change. It was after

Re: cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
i wanted to write 'than your' not 'than you' :-/ On Wed, May 22, 2024 at 10:33 PM Damien Mattei wrote: > Bonjour, > > so it is with the version i currently use which is older than you: > (base) mattei@mbp-touch-bar library-FunctProg % guile > GNU Guile 3.0.8.99-f3ea8 > Copyright (C) 1995-2022

Re: cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
Bonjour, so it is with the version i currently use which is older than you: (base) mattei@mbp-touch-bar library-FunctProg % guile GNU Guile 3.0.8.99-f3ea8 Copyright (C) 1995-2022 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is

Re: cond clause does not allow definitions

2024-05-22 Thread Jeronimo Pellegrini
Hello! On 2024-05-22 16:26, Damien Mattei wrote: scheme@(guile-user)> (cond (#t (define x 7) x)) While compiling expression: Syntax error: unknown file:7:10: definition in expression context, where definitions are not allowed, in form (define x 7) I get no error here (Guile 3.0.9.164-e1690,

cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
scheme@(guile-user)> (cond (#t (define x 7) x)) While compiling expression: Syntax error: unknown file:7:10: definition in expression context, where definitions are not allowed, in form (define x 7) but it is allowed in else clause: scheme@(guile-user)> (cond (else (define x 7) x)) $4 = 7 not

Re: using guile like a awk filter in a C program.

2024-05-22 Thread Simon Tournier
Hi Pierre, > I want to call scheme from C. Well, I would start with: https://www.gnu.org/software/guile/manual/html_node/A-Sample-Guile-Main-Program.html Then maybe: https://www.gnu.org/software/guile/manual/html_node/General-Libguile-Concepts.html Personally, I have never done that. The