Re: define anywhere

2021-06-11 Thread Damien Mattei
hello Linus, finally i tested your code with my program and it works. define worked in if in ssigma-sol-approx ( in *Preview:* ;; (load "SssRec.scm") ;;(use-modules (syntax define));;(use-modules (guile/define))(use-modules (guile define)) (include "first-and-rest.scm")(include "list.scm")(i

Re: define anywhere

2021-06-11 Thread Damien Mattei
about : https://www.gnu.org/software/guile/manual/html_node/Module-System-Reflection.html i do not want to implement things that are not portable to others schemes using standart macros and SRFI, for now my Scheme+ is a set of macros portable to other scheme and use only SRFI if they are implemente

Re: define anywhere

2021-06-11 Thread Damien Mattei
On Sun, Jun 6, 2021 at 3:36 PM Linus Björnstam wrote: > Oh, my version is an error. I implemented the macro before definitions in > (some) expression contexts were a thing. > do you talk about what? the linked code? > > Andy did a marvellous thing implementinf the new letrec: if it is > possibl

Re: define anywhere

2021-06-11 Thread Damien Mattei
i did not noticed there was an attachment link :-( i read your code, great work... i will read it more later Damien On Sat, Jun 5, 2021 at 5:24 PM Linus Björnstam wrote: > I implemented this hack before guile 3 got defines in function bodies: > https://hg.sr.ht/~bjoli/guile-define > > Even I gui

Re: define anywhere

2021-06-09 Thread Linus Björnstam
Hi Damien! The problem that define only defines a variable in the current lexical environment. Even if a definition in an if block would work from a syntactical standpoint, it would be pointless. As per r6rs, internal (define ...) are akin to letrec, but are only allowed in definition context.

Re: define anywhere

2021-06-09 Thread Damien Mattei
hello, i'm just answering now because my ten years old Mac book pro definitely died sunday evening RIP i was trying to make macro that set! variable if they exist or create it before if the variable is not defined (tested by the Guile procedure 'defined?' which is not R*RS in any version) but it

Re: define anywhere

2021-06-06 Thread Dr. Arne Babenhauserheide
Linus Björnstam writes: > Andy did a marvellous thing … > So TL/DR: guiles way is the correct way. Thank you for the clarification! Best wishes, Arne -- Unpolitisch sein heißt politisch sein ohne es zu merken signature.asc Description: PGP signature

Re: define anywhere

2021-06-06 Thread Linus Björnstam
Oh, my version is an error. I implemented the macro before definitions in (some) expression contexts were a thing. Andy did a marvellous thing implementinf the new letrec: if it is possible, letrec will have no overhead. It also automatically handle dependant clauses: even though it might seem

Re: define anywhere

2021-06-06 Thread Dr. Arne Babenhauserheide
Linus Björnstam writes: > becomes ONE letrec under gulie3, whereas my library turns it into > (letrec ((a 2) (b 3)) > (display "hej") > (letrec ((c 3)) > (+ a b c))) > > That should be an easy fix, again if there is any interest. I’m not sure which approach I prefer. Your approach is mo

Re: define anywhere

2021-06-06 Thread Linus Björnstam
Note however, that I seem to have forgotten when and unless. also: cond has no support for the extended "test guard => lambda" form. Neither do I believe that the any "special" case form is supported. If there is any interest whatsoever, I can implement it when I have time. The code produced is

Re: define anywhere

2021-06-05 Thread Linus Björnstam
I implemented this hack before guile 3 got defines in function bodies: https://hg.sr.ht/~bjoli/guile-define Even I guile 3 it allows a more liberal placement of define, but it won't work for things like bodies of imported macros (like match) -- Linus Björnstam On Sat, 5 Jun 2021, at 00:27, D

Re: define anywhere

2021-06-05 Thread Dr. Arne Babenhauserheide
Taylan Kammer writes: > On 05.06.2021 00:27, Damien Mattei wrote: >> hello, >> i'm was considering that i want to be able to define a variable anywhere in >> code, the way Python do. Few scheme can do that (Bigloo i know) >> ( the list here is not exact: >> https://www.reddit.com/r/scheme/commen

Re: define anywhere

2021-06-04 Thread Taylan Kammer
On 05.06.2021 00:27, Damien Mattei wrote: > hello, > i'm was considering that i want to be able to define a variable anywhere in > code, the way Python do. Few scheme can do that (Bigloo i know) > ( the list here is not exact: > https://www.reddit.com/r/scheme/comments/b73fdz/placement_of_define_in