Re: [PATCH] New function array-mutable?

2021-12-09 Thread Maxime Devos
Hi, lloda schreef op do 25-11-2021 om 20:08 [+0100]: I think literal arrays are always immutable, and one could base the test on that. > Is such a function useful in some other context? If one has an array which is already immutable, it can be referenced freely and copying it seems unnecessary.

Re: [PATCH] New function array-mutable?

2021-11-27 Thread lloda
> On 25 Nov 2021, at 19:56, lloda wrote: > > > >> On 25 Nov 2021, at 19:22, Maxime Devos wrote: >> >> lloda schreef op do 25-11-2021 om 17:40 [+0100]: >>> +Arrays with empty roots are not considered immutable because >>> +@code{array-set!} operations with valid indices won't fail (since >>

Re: [PATCH] New function array-mutable?

2021-11-25 Thread lloda
> On 25 Nov 2021, at 19:19, Maxime Devos wrote: > > lloda schreef op do 25-11-2021 om 17:40 [+0100]: >> [...] > > Suggestion: add a few tests to test-suite/tests/arrays.test: > > (pass-if-equal "new" > #t > (array-mutable? (make-array #f '(1 2) '(3 4 > > (pass-if-equal "empty (two-dime

Re: [PATCH] New function array-mutable?

2021-11-25 Thread lloda
> On 25 Nov 2021, at 19:22, Maxime Devos wrote: > > lloda schreef op do 25-11-2021 om 17:40 [+0100]: >> +Arrays with empty roots are not considered immutable because >> +@code{array-set!} operations with valid indices won't fail (since >> there >> +are no valid indices). >> + >> +@example >> +

Re: [PATCH] New function array-mutable?

2021-11-25 Thread Maxime Devos
lloda schreef op do 25-11-2021 om 17:40 [+0100]: > +Arrays with empty roots are not considered immutable because > +@code{array-set!} operations with valid indices won't fail (since > there > +are no valid indices). > + > +@example > +(array-mutable? #()) @result{} #t > +@end example > +@end deffn

Re: [PATCH] New function array-mutable?

2021-11-25 Thread Maxime Devos
lloda schreef op do 25-11-2021 om 17:40 [+0100]: > [...] Suggestion: add a few tests to test-suite/tests/arrays.test: (pass-if-equal "new" #t (array-mutable? (make-array #f '(1 2) '(3 4 (pass-if-equal "empty (two-dimensional)" #t (array-mutable? (array-copy #1( (pass-if-equal "e

[PATCH] New function array-mutable?

2021-11-25 Thread lloda
Doesn't seem there was any simple way to check this from either Scheme or C. 0001-New-function-array-mutable.patch Description: Binary data

Re: new function

2021-09-23 Thread Damien Mattei
are/guile/docs/master/guile.html/Syntax-Transformer-Helpers.html > > i have tested a lot , even define-once again and i choose to use to > assignment operators and portable code because the non-portable function do > not bring more, finally it was not a bad idea to ask for a new functi

Re: new function

2021-09-23 Thread Damien Mattei
t was not a bad idea to ask for a new function because we can do it with the actual toolbox... Damien On Thu, Sep 23, 2021 at 10:48 PM Taylan Kammer wrote: > Responding to myself: > > On 23.09.2021 22:27, Taylan Kammer wrote: > > > I can't seem to find syntax-local-binding i

Re: new function

2021-09-23 Thread Taylan Kammer
Responding to myself: On 23.09.2021 22:27, Taylan Kammer wrote: > I can't seem to find syntax-local-binding in Guile 2.2 or 3.0. Did you > have to import some special module, or are you using another version? Worked when I imported (system syntax internal). > Either way, I suspect that the fol

Re: new function

2021-09-23 Thread Damien Mattei
yes it can reuse an upper and precedent definition but a nested definition can not be used later at an upper level. anyway it would not be portable , for all those reason i will use to separate operator ,basically <- for set! and <+ for define ,so i can even modify toplevel bindings , i did not wa

Re: new function

2021-09-23 Thread Taylan Kammer
On 23.09.2021 19:27, Damien Mattei wrote: > yes i know parsing the whole code is the only portable solution, but it is > slow,even on a few dozen of lines the slowing is visible ,so i can even think > of that on one thousand lines... > > I finally succeed in Guile with simple piece of code to ma

Re: new function

2021-09-23 Thread Taylan Kammer
On 22.09.2021 23:52, William ML Leslie wrote: > On Thu, 23 Sep 2021, 4:51 am Taylan Kammer, > wrote: > > On 22.09.2021 11:53, Damien Mattei wrote: > > i already do it this way for internal defines ,using a recursive macro > that build a list of variable us

Re: new function

2021-09-23 Thread Maxime Devos
Damien Mattei schreef op do 23-09-2021 om 19:27 [+0200]: > yes i know parsing the whole code is the only portable solution, but it is > slow,even on a few dozen of lines the slowing is visible ,so i can even think > of that on one thousand lines... > > I finally succeed in Guile with simple piec

Re: new function

2021-09-23 Thread Damien Mattei
yes i know parsing the whole code is the only portable solution, but it is slow,even on a few dozen of lines the slowing is visible ,so i can even think of that on one thousand lines... I finally succeed in Guile with simple piece of code to make my example run with a single assignment operator <-

Re: new function

2021-09-23 Thread Damien Mattei
interesting discussion about "scope", note i'm not saying i want Scheme+ act as Python, i'm still thinking the best solution... to be sure about terminology i find this good article about scoping: https://medium.com/altcampus/scope-local-global-and-lexical-e164f53450b3 Damien On Wed, Sep 22, 2021

Re: new function

2021-09-22 Thread William ML Leslie
On Thu, 23 Sep 2021, 4:51 am Taylan Kammer, wrote: > On 22.09.2021 11:53, Damien Mattei wrote: > > i already do it this way for internal defines ,using a recursive macro > that build a list of variable using an accumulator. It can works but macro > expansion seems slow, it was not immediate at co

Re: new function

2021-09-22 Thread Taylan Kammer
On 22.09.2021 11:53, Damien Mattei wrote: > i already do it this way for internal defines ,using a recursive macro that > build a list of variable using an accumulator. It can works but macro > expansion seems slow, it was not immediate at compilation on a little example > (oh nothing more that

Re: new function

2021-09-22 Thread Damien Mattei
i already do it this way for internal defines ,using a recursive macro that build a list of variable using an accumulator. It can works but macro expansion seems slow, it was not immediate at compilation on a little example (oh nothing more that 2 seconds) but i'm not sure it is easily maintainable

Re: new function

2021-09-22 Thread William ML Leslie
You could do it the same way python does it: have `def` be a macro that inspects its body for assignments to symbols, and then let-bind them at the top of the function. On Wed, 22 Sep 2021, 6:45 pm Damien Mattei, wrote: > Hi Taylan, > > i have used Module System Reflection, and it works almost f

Re: new function

2021-09-22 Thread Damien Mattei
Hi Taylan, i have used Module System Reflection, and it works almost for what i wanted to do,the only big problem is that it creates variable binding global, seen from every where and that breaks my example code, by the way i will display for everybody an example of use of such a macro,so everyone

Re: new function

2021-09-21 Thread Damien Mattei
here is the "draft mail" i think it was better to answer separetely,but i send it waiting more... thanks for all the answer, i'm answering in a single answer to all for easyness and because some answers where same First some people don't understand well my goal. It was just to be able to create a

reponse new function

2021-09-21 Thread Damien Mattei
i apologize for my late answer, i wrote a long draft mail with code yesterday for answering but it is too long i think to be send and will confuse everyone, i'm testing a lot of answer,perhaps modifying my goals too!, and try to summarize all that,not easy. for now my goal change a little bit,i

Re: new function

2021-09-19 Thread Taylan Kammer
On 19.09.2021 09:54, Damien Mattei wrote: > hello, > i'm developing an extension to Scheme > and i need a procedure or macro that define a variable only if it is not bind > and if it is just set! it. > > I can not do it in Guile or any Scheme,and i'm desperately searching a way to > do that. I f

Re: new function

2021-09-19 Thread Matt Wette
On 9/19/21 7:41 AM, Matt Wette wrote: On 9/19/21 12:54 AM, Damien Mattei wrote: hello, i'm developing an extension to Scheme and i need a procedure or macro that define a variable only if it is not bind and if it is just set! it. I can not do it in Guile or any Scheme,and i'm desperately s

Re: new function

2021-09-19 Thread Matt Wette
On 9/19/21 12:54 AM, Damien Mattei wrote: hello, i'm developing an extension to Scheme and i need a procedure or macro that define a variable only if it is not bind and if it is just set! it. I can not do it in Guile or any Scheme,and i'm desperately searching a way to do that. I finally conc

new function

2021-09-19 Thread Damien Mattei
hello, i'm developing an extension to Scheme and i need a procedure or macro that define a variable only if it is not bind and if it is just set! it. I can not do it in Guile or any Scheme,and i'm desperately searching a way to do that. I finally conclude that it can be done only by adding it in t