Re: call/cc does not return a value

2024-09-13 Thread Damien Mattei
, with debugging; memory limit: 8192 MB. SRFI-105 Curly Infix parser for Racket Scheme by Damien MATTEI (based on code from David A. Wheeler and Alan Manuel K. Gloria.) Possibly skipping some header's lines containing space,tabs,new line,etc or comments. Detected R6RS code: #!r6rs SRFI-105.rk

Re: call/cc does not return a value

2024-09-13 Thread Damien Mattei
let ((BREAK escape)) >init >(let loop () > (when test >(call/cc > (lambda (next) > (let ((CONTINUE next)) > (let () ;; allow definitions > body ... ; end call/cc >

call/cc does not return a value

2024-09-12 Thread Damien Mattei
hello, i believed call/cc allowed to return value but i have this macro and i can use continuation, but the value is not passed to the continuation: (define-syntax for (lambda (stx) (syntax-case stx () ((kwd (init test incrmt) body ...) (with-syntax ((BREAK (datum->syntax

syntax and undefined variable

2024-09-10 Thread Damien Mattei
hello, when i try to simplify my code that works it no more works, if change #'list by list it fails with this strange error: ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure variable-ref: Unbound variable: #> the code is: (define-syntax $bracket-apply$ (lambda (stx)

Release of Scheme+ for Guile version 9.1

2024-06-28 Thread Damien Mattei
Hello, i released Scheme+ for Guile version 9.1: https://github.com/damien-mattei/Scheme-PLUS-for-Guile It is a big refactoring of code,now completely implemented with modules and still use syntax transformers. It add very few new features but it is a complete refactoring of the code

Scheme+ v9.0 released

2024-05-26 Thread Damien Mattei
hello, i released the version 9.0 of Scheme+ https://github.com/damien-mattei/Scheme-PLUS-for-Guile New in this release: No more need to parse the file+.scm file ,all parsing is done at pre-compile time in macro. This makes the use of Scheme+ transparent for the user. https://github.com

Re: write simpler a syntax form ?

2024-05-25 Thread Damien Mattei
yes it works. thanks i will use this version,it is simpler On Fri, May 24, 2024 at 3:08 PM Jean Abou Samra wrote: > > > all attempt to simplify this part: #`(#,@#'args-brackets) > > gives errors > > > > Try matching it with ($bracket-apply$ container args-brackets ...) instead > of > ($bracket-a

Re: cond clause does not allow definitions

2024-05-23 Thread Damien Mattei
On Thu, May 23, 2024 at 12:37 AM Jeronimo Pellegrini wrote: > 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. yes ,unless they wanted Chez scheme to behave as Python :-) : if True: x

Re: equality of syntax objects

2024-05-23 Thread Damien Mattei
On Thu, May 23, 2024 at 12:12 AM Maxime Devos wrote: > > So, instead of checking identifiers with free-identifier=?, instead try > ‘syntax->datum’ to extract the name (with lexical information removed) + > ‘eq?’ (to compare two symbols). > :-O yes. i did not think it.it is the first year i use '

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 tr

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 soft

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

Re: cond clause does not allow definitions

2024-05-22 Thread Damien Mattei
efinitions are not allowed, in form (define x 7) thanks On Wed, May 22, 2024 at 10:07 PM Jeronimo Pellegrini wrote: > Hello! > > On 2024-05-22 16:26, Damien Mattei wrote: > > scheme@(guile-user)> (cond (#t (define x 7) x)) > > While compiling expression: > > Sy

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 rea

Re: define-typed: checking values on proc entry and exit

2024-05-21 Thread Damien Mattei
cedence, but all is in respect of scheme syntax rules, i'm uniformising between schemes.Things could be hard if you want to overload [ ] with SRFI 105 but it's work. The last stable version of code is available here : https://github.com/damien-mattei/Scheme-PLUS-for-Guile/blob/main/overlo

Re: equality of syntax objects

2024-05-20 Thread Damien Mattei
quot; or "license()" for more information. x=3 2.0 / 3.0 * 4.0 + 2.0 ** x ** 4.0 - 1.0 2.4178516392292583e+24 same result :-) On Mon, May 20, 2024 at 4:53 PM Damien Mattei wrote: > asked more simply: > > how to know ,for two syntax objects now different but that represents two > differ

Re: equality of syntax objects

2024-05-20 Thread Damien Mattei
is the only solution to manipulate 'and' / 'or'. So i think the best solution is the simple and not pretty that rely on parsing the string representation. On Mon, May 20, 2024 at 1:42 PM Damien Mattei wrote: > hello, > > i want to check the equality of two syntax o

equality of syntax objects

2024-05-20 Thread Damien Mattei
hello, i want to check the equality of two syntax objects. i wrote this macro: (define (check-syntax=? obj1 obj2) (display "check-syntax=? : obj1 =") (display obj1) (newline) (display "check-syntax=? : obj2 =") (display obj2) (newline) (define rv (and (identifier? obj1) ;(syntax? obj1)

Re: write simpler a syntax form ?

2024-05-15 Thread Damien Mattei
note that this simplification works: (cons #'list (optimizer-parse-square-brackets-arguments-lister-syntax #`(#,@#'args-brackets) but all attempt to simplify this part: #`(#,@#'args-brackets) gives errors On Thu, May 16, 2024 at 1:00 AM Damien Mattei wrote: >

Re: Make a game with Hoot for the Lisp Game Jam!

2024-05-15 Thread Damien Mattei
those '70-'80 games looks great! i'm back in childhood... :-) this web assembly/scheme/hoot is impressive. On Wed, May 15, 2024 at 9:57 PM Thompson, David wrote: > Hey Guilers, > > The latest edition of the Lisp Game Jam [0] starts this Friday, May > 17th! The Spritely Institute wants to encou

write simpler a syntax form ?

2024-05-15 Thread Damien Mattei
do you think this can be written simpler? #`(list #,@(optimizer-parse-square-brackets-arguments-lister-syntax #`(#,@#'args-brackets))) i'm quite afraid the look the 'syntax' get it is part of this macro: (define-syntax $bracket-apply$ (lambda (stx) (syntax-case stx () ;; a v

Re: syntax? in scheme/Guile

2024-05-14 Thread Damien Mattei
)) $2 = #f scheme@(guile-user)> #'(2 * 3) $3 = (# # #) scheme@(guile-user)> (syntax? #'*) $4 = #t scheme@(guile-user)> (syntax *) $5 = # scheme@(guile-user)> (syntax? *) $6 = #f regards, damien On Tue, May 14, 2024 at 1:43 AM Thompson, David wrote: > Hi Damien, > >

Re: syntax? in scheme/Guile

2024-05-13 Thread Damien Mattei
t ;; scheme@(guile-user)> (syntax? #'(1 2 3)) ;; $28 = #t ;; scheme@(guile-user)> (syntax? #'*) ;; $23 = #t ;; scheme@(guile-user)> (syntax? 3) ;; $24 = #f ;; scheme@(guile-user)> (syntax? "") ;; $25 = #f On Mon, May 13, 2024 at 10:42 AM Damien Mattei wrote:

syntax? in scheme/Guile

2024-05-13 Thread Damien Mattei
hello, any idea for a predicate for syntax object in Guile/scheme like exist in Racket 'syntax?' ? i'm started writing something but i do not understand this part of R6RS: https://www.r6rs.org/final/html/r6rs-lib/r6rs-lib-Z-H-13.html#node_sec_12.2 what examples can be done for : - -a nonpair,

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-12 Thread Damien Mattei
thank you, i think now i understand better the macro syntax system of R6RS, i will use all that to have in the next version of Scheme+ two systems: -still the command line parser that parse for example infix (and slicing) with operator precedence to prefix -a transparent system for the user that wi

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-11 Thread Damien Mattei
) ) ;; liste à plate des operateurs (define operators-lst (apply append infix-operators-lst-for-parser)) there is too much code i can not put it here... n-arity infix? too long... it. is just to give an idea, i hope problem can be solved in the macro call to optimizer-parse-square-bracket

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-10 Thread Damien Mattei
On Sat, May 11, 2024 at 12:23 AM Jean Abou Samra wrote: > > it is clear that calling <- via ← give a bad result, if instead i use > directly > > <- code works. > > OK, I think I get it now: > > (define-syntax <- > (lambda (sintax) > (syntax-case sintax () > ((<- arg) >(datum->

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-10 Thread Damien Mattei
On Fri, May 10, 2024 at 5:24 PM Jean Abou Samra wrote: > > the built-in let macro creates a kind of "access token" for the variable > lin, and marks the body (display (mac lin)) with that token so that it > has the variable lin in scope. This is so that forms introduced by macros > (like mac here

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-10 Thread Damien Mattei
On Fri, May 10, 2024 at 5:24 PM Jean Abou Samra wrote: > > I'd need a reproducible example to debug this. I have no explanation > other than that there must be a trivial mistake somewhere in your > code or testing procedure (happens to everyone). > > i will try to isolate the problem out of 1

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-10 Thread Damien Mattei
i re-test all, and your are right this working: (define-syntax foo (syntax-rules () ((foo . args) (display 'args (define-syntax bar (syntax-rules () ((bar . args) (foo . args (foo 1 2 3) (1 2 3) (bar 1 2 3) (1 2 3) (foo 1) (1) (bar 1) (1) (define-syntax my-macro (sy

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-10 Thread Damien Mattei
On Fri, May 10, 2024 at 12:35 AM Jean Abou Samra wrote: > > > > Le 9 mai 2024 à 23:57, Damien Mattei a écrit : > > > > it worked now removing the syntax->datum but not in all programs , i do > not > > know why, program it fails was overloading some operator

Re: adding #' syntax and my cloned macro no more works like original....

2024-05-09 Thread Damien Mattei
sorry i can not minimize the code, i even removed all sub-procedures called. in fact it is a general question : "how to clone a macro?" without brutally copying it all in another define-syntax. example cloning a <- macro to call it with the name ← i tried to recopy only the pattern (see other m

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-09 Thread Damien Mattei
it worked now removing the syntax->datum but not in all programs , i do not know why, program it fails was overloading some operator so i think the syntax symbol of operator was not correlated with the good function overloaded. So i keep the code as is. for the cloned macro i did not succeed in oth

adding #' syntax and my cloned macro no more works like original....

2024-05-09 Thread Damien Mattei
hello, i having a little horrific bug in one of my macro. In fact i have 2 macro : <- that do all the job and another alias ← till now the ← acted as a perfect clone of <- wihtout having all the code, being defined as: (define-syntax ← ;; under Linux this symbol can be typed with the ;; combi

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-06 Thread Damien Mattei
not sure to understand, i admit i'm testing new things for me , i try to understand macro syntax and all the stuff... reading https://www.greghendershott.com/fear-of-macros/index.html but half (or less) the way. do you mean just replacing 'list by #'list ? i do it and it is still working at

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-06 Thread Damien Mattei
On Mon, May 6, 2024 at 11:41 AM Jean Abou Samra wrote: > > (with-syntax ((parsed-evaluated-args > >(datum->syntax #f (cons 'list > (optimizer-parse-square-brackets-arguments-lister > > (syntax->datum > #'args-brackets)) > > That sh

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-06 Thread Damien Mattei
If someone have concrete solution to write better code i will be glad to integrate this in my code. On Mon, May 6, 2024 at 12:29 PM Damien Mattei wrote: > at any point in any scheme if the user write such a thing: > (let ((list 3)) (list 4)) > there will be a serious problem > > O

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-06 Thread Damien Mattei
at any point in any scheme if the user write such a thing: (let ((list 3)) (list 4)) there will be a serious problem On Mon, May 6, 2024 at 11:41 AM Jean Abou Samra wrote: > > (with-syntax ((parsed-evaluated-args > >(datum->syntax #f (cons 'list > (optimizer-parse-square-brackets

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-06 Thread Damien Mattei
izer-parse-square-brackets-arguments-lister (syntax->datum #'args-brackets)) (display "$bracket-apply$ : parsed-evaluated-args=") (display #'parsed-evaluated-args) (newline) #'($bracket-apply$next4list-args container parsed-evaluated-args)) On Sun, May

Re: with-syntax return error in Guile, not in Kawa or Racket

2024-05-05 Thread Damien Mattei
i understand Jean, do you have an idea to fix this macro, i'm not far away from the result as the display show it i'm modifying a macro that worked but i want to write it in a more modern way (macro talking), this do the same than in Python in this example: Python 3.11.2 (v3.11.2:878ead1ac1, Feb

with-syntax return error in Guile, not in Kawa or Racket

2024-05-05 Thread Damien Mattei
hi, Guile: (base) mattei@mbp-touch-bar Scheme-PLUS-for-Guile % 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 free software, and you are welcome to redistribute it under ce

Re: Shelling

2024-04-18 Thread Damien Mattei
i did not understood you where searching a shell in scheme... so going further it seems to exist a sort of terminal in scheme too: http://domterm.org/index.html it is for Kawa scheme not guile, but i never test it, i can not provide any feed back Damien On Fri, Apr 19, 2024 at 1:43 AM Tom Whit

Re: Shelling

2024-04-18 Thread Damien Mattei
hello Tom, i use sometimes guile as a shell script, your file should start with: #!/usr/local/bin/guile -s !# and after the scheme code for example : (define stderr (current-error-port)) ; parse the input file from command line (define cmd-ln (command-line)) (define args (cdr cmd-ln)) (when (m

Re: conditional based on binding of a variable

2024-04-15 Thread Damien Mattei
scheme@(guile-user)> (define (foo2) (define x 7) (defined-symbol? x)) scheme@(guile-user)> (foo2) $2 = #t On Tue, Apr 16, 2024 at 8:36 AM Damien Mattei wrote: > this could not works because the defined-symbol? used in the macro > if-defined return false because at the expansion of t

Re: conditional based on binding of a variable

2024-04-15 Thread Damien Mattei
9:24 AM Damien Mattei wrote: > i tried this, that works in some case: > > ;; scheme@(guile-user)> (defined-symbol? d) > ;; ;;; :20:17: warning: possibly unbound variable `d' > ;; $3 = #f > (define-syntax defined-symbol? > (syntax-rules () > ((_ x)

Re: conditional based on binding of a variable

2024-04-14 Thread Damien Mattei
ne) (if where #'iftrue #'iffalse)) but fais with those examples: scheme@(guile-user)> (define (foo) (define x 1) (if-defined x 'def 'not_def)) defined-symbol? : undefined if-defined : where=#f id=# scheme@(guile-user)> (define (bar) (let ((x 1)) (if-defined x 'def

Re: conditional based on binding of a variable

2024-04-12 Thread Damien Mattei
indeed ,seems not a thing feasible ,unless in Racket where it works great: https://stackoverflow.com/questions/3267351/how-do-i-test-whether-a-variable-is-defined-before-referencing-it?noredirect=1&lq=1 On Fri, Apr 12, 2024 at 12:34 AM Damien Mattei wrote: > > hello, > > i

conditional based on binding of a variable

2024-04-11 Thread Damien Mattei
hello, i'm searching the equivalent in scheme , guile or r6rs of this code for Racket: ; Tests ;; (if-defined z (list z) 'not-defined) ; -> not-defined ;; (if-defined t (void) (define t 5)) ;; t ; -> 5 ;; (define x 3) ;; (if-defined x (void) (define x 6)) ;; x ; -> 3 (define-syntax (if-defined

Scheme+ for Guile v8.1

2024-04-10 Thread Damien Mattei
Hello, i released a new minor version of Scheme+ for Guile v8.1: https://github.com/damien-mattei/Scheme-PLUS-for-Guile/releases/tag/v8.1 some new features are: new 'if then else' compatible with scheme 'if': ;; > (if #f else 3) ;; 3 ;; > (if #t else 3) ;; > (if

Re: using a module : rename a single definition

2024-03-27 Thread Damien Mattei
ay not work without renaming > them: > > https://lists.gnu.org/archive/html/guile-user/2023-06/msg00020.html > > Regards, > Zelphir > > On 3/27/24 08:42, Damien Mattei wrote: > > yes it should works. I trying to port all my scheme code in R6RS library > > style for compat

Re: using a module : rename a single definition

2024-03-27 Thread Damien Mattei
yes it should works. I trying to port all my scheme code in R6RS library style for compatibility,it's a bit complex depending the integration of R6RS in a particular scheme but i think there should be a compatibility advantage doing that. Damien On Wed, Mar 20, 2024 at 12:09 AM Maxime Devos wrot

Scheme+ v7.5 for Guile

2024-03-12 Thread Damien Mattei
Hello, i released the version 7.5 of Scheme+ for Guile. https://github.com/damien-mattei/Scheme-PLUS-for-Guile it contains a few examples in this directory: https://github.com/damien-mattei/Scheme-PLUS-for-Guile/tree/main/examples Also released is some versions for Racket and Kawa on my github

Re: using a module : rename a single definition

2024-03-03 Thread Damien Mattei
r Comprehensions ;; #:prefix s42-) (oop goops) (srfi srfi-43)) ; vectors Merçi Damien On Sun, Mar 3, 2024 at 12:50 PM Tomas Volf <~@wolfsden.cz> wrote: > On 2024-03-03 09:46:41 +0100, Damien Mattei wrote: > > hello, > > > > is it possible to import a module ha

using a module : rename a single definition

2024-03-03 Thread Damien Mattei
hello, is it possible to import a module having just one variable renamed (not all) , as in Racket: (require (rename-in srfi/42 (: s42:))) ; Eager Comprehensions it seems in Guile either all is imported and prefixed or only a selection of bindings can be imported: https://www.gnu.o

Re: unusual let binding (of lp) - in function element->xml from sxml simple

2024-02-04 Thread Damien Mattei
Hi Andreas, a good explanation is here: https://stackoverflow.com/questions/31909121/how-does-the-named-let-in-the-form-of-a-loop-work personally i avoid to use it, as i can do the same with internal definitions . regards, Damien On Sat, Feb 3, 2024 at 10:49 PM Andreas Reuleaux wrote: > Hi, > >

Re: can't export conditional variable set with 'cond'

2024-01-23 Thread Damien Mattei
Hello Mortimer, i get in a lot of trouble doing those sort of things with Scheme. i mean trying like in C , expecting to have exported variable , in a object file , and thinking that they are fixed at an address in memory, even this idea is just an assumption of how i expected things to work. But t

features of the latest release of Scheme+ (version 7.3)

2024-01-18 Thread Damien Mattei
rix product impossible, incompatible dimensions")) {v1 <+ (matrix-vect-v M1)} {v2 <+ (matrix-vect-v M2)} (define (res i j) {sum <+ 0} (for ({k <+ 0} {k < p1} {k <- k + 1}) {sum <- sum + v1[i][k] * v2[k][j]}) sum) {v <+ (create-vector-2d re

Scheme+ version 7.3 release

2024-01-08 Thread Damien Mattei
;- (append partial-result (list fst))}) ;; not a slice operator but append it (psba (cdr args))) ;; end def, recurse (psba args-brackets)) ;; initial call A full example is available here: https://github.com/damien-mattei/AI_Deep_Learning

Re: symbol is nested in #{ ...... }#

2024-01-04 Thread Damien Mattei
avior differs on keywords as in this example: #|kawa:1|# (string->keyword "apple") apple: Racket: > (string->keyword "apple") '#:apple Damien On Thu, Jan 4, 2024 at 8:05 PM Thompson, David wrote: > On Thu, Jan 4, 2024 at 6:36 AM Damien Mattei > wrote: >

Re: symbol is nested in #{ ...... }#

2024-01-04 Thread Damien Mattei
lfsden.cz> wrote: > On 2024-01-04 11:15:55 +0100, Damien Mattei wrote: > > Hi, > > why does > > (string->symbol "#:hello") > > $1 = #{#:hello}# > > > > gives #{#:hello}# in guile instead of #:hello ? > > My understanding is that key

symbol is nested in #{ ...... }#

2024-01-04 Thread Damien Mattei
Hi, why does (string->symbol "#:hello") $1 = #{#:hello}# gives #{#:hello}# in guile instead of #:hello ? like in Kawa or Racket i understand it is special to guile as i can write: scheme@(guile-user)> #:hello $1 = #:hello but then how can i generate a #:hello from a string or a list of char? r

example of syntax with Scheme+ and latest version released

2023-11-25 Thread Damien Mattei
available here: https://github.com/damien-mattei/AI_Deep_Learning/blob/10f155100eb49b495a23fe4b909dd2658380743f/exo_retropropagationNhidden_layers_matrix_v2_by_vectors4guile%2B.scm#L78 Damien

Re: access slot of a class

2023-11-21 Thread Damien Mattei
ociated with a single class: In the case of accessor methods, which take > a single argument, they are in a sense associated with a single class.) > > On Tue, Nov 21, 2023 at 9:19 AM Damien Mattei > wrote: > >> that is interesting answer about guile's features i did not k

Re: access slot of a class

2023-11-21 Thread Damien Mattei
just forget to say that in my previous examples, <- is a macro that contain a set! case that is used with single variable.(does not use setter, just set!) On Tue, Nov 21, 2023 at 9:19 AM Damien Mattei wrote: > > that is interesting answer about guile's features i did not know , &

Re: access slot of a class

2023-11-21 Thread Damien Mattei
that is interesting answer about guile's features i did not know , it is related with code i'm writing that instead of fetching the value modify it using the fetch syntax in Scheme+ but my question was just about how to have a class method in a class that can set! the value of a slot. This does nt

access slot of a class

2023-11-20 Thread Damien Mattei
hi, is there a way to access a slot of a class like other variable with set! , Racket,Kawa allow that, but it does not seem to be the case in Guile. regards, damien

Re: export from an imported module

2023-10-30 Thread Damien Mattei
hich you should be able to type x and get 1. > > Best regards, > Mikael > > On Mon, Oct 30, 2023 at 8:37 AM Damien Mattei wrote: >> >> i tried: >> >> ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/Scheme+.scm >> failed: >> ;;; re-ex

Re: export from an imported module

2023-10-30 Thread Damien Mattei
i tried: ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/Scheme+.scm failed: ;;; re-exporting local variable: infix-operators-lst While compiling expression: re-exporting local variable: infix-operators-lst anyway it works with loading each module separately at different levels, code

export from an imported module

2023-10-29 Thread Damien Mattei
i noticed that in Guile if i use a module in a module i can not export the definitions of the used module. It is possible in Racket but in guile it even cause problems.

Re: difference with 'match' at REPL and in code

2023-10-11 Thread Damien Mattei
sorry there was something misformed in my toplevel test example, all is ok even at toplevel: (let ((l '(hello (world (match l ;; <- the input object (('hello (who)) ;; <- the pattern (define x 3) (+ 1 x On Wed, Oct 11, 2023 at 8:51 AM Damien Mattei w

Re: difference with 'match' at REPL and in code

2023-10-10 Thread Damien Mattei
i just forgot to say that in my code <+ is 'define' On Wed, Oct 11, 2023 at 8:50 AM Damien Mattei wrote: > > hi, > > when i test at toplevel: > scheme@(guile-user)> (match 1 (1 (define x3) (+ x 1))) > While compiling expression: > Syntax error: > un

difference with 'match' at REPL and in code

2023-10-10 Thread Damien Mattei
hi, when i test at toplevel: scheme@(guile-user)> (match 1 (1 (define x3) (+ x 1))) While compiling expression: Syntax error: unknown location: definition in expression context, where definitions are not allowed, in form (define x3) but i have this code that works well and have definition in matc

Re: matrix library?

2023-10-06 Thread Damien Mattei
timethod def __mul__(self, m2 : object): # self is at LEFT of multiplication operand : self * m2 = Matrix * m2 = Matrix * Matrix, m2 is at Right of operator if __debug__: print("Matrix.py : __mul__(Matrix,Matrix)") (n1,p1) = self.dim() (n2,p2) = m2.dim() if p1 != n2 : raise MatError('Produit de matrices impossible !') def res(i,j) : # l'élément en ligne i et colonne j du résultat return sum(self.L[i][k] * m2.L[k][j] for k in range(p1)) # le produit aura pour format (n1,p2) return Matrix(res,n1,p2) On Fri, Oct 6, 2023 at 7:49 PM wrote: > > On Fri, Oct 06, 2023 at 07:23:10PM +0200, Damien Mattei wrote: > > and the rest of code for multiplying a matrix and a vector: > > [...] > > I haven't looked at all the details, but... isn't multiplying a > matrix with a vector just a special case of matrix multiplication? > > Cheers > -- > t

Re: matrix library?

2023-10-06 Thread Damien Mattei
-ref matrix-line-set! (matrix? number?)) scheme@(guile-user)> (define M (create-matrix-by-function (lambda (l c) (+ l c)) 2 3)) scheme@(guile-user)> (matrix-v M) $1 = #(#(0 1 2) #(1 2 3)) scheme@(guile-user)> {M[1 2]} $2 = 3 scheme@(guile-user)> {M[1][2]} $3 = 3 scheme@(guile-user)> {

Re: inserting a file in a module?

2023-10-06 Thread Damien Mattei
On Thu, Oct 5, 2023 at 9:35 AM wrote: > I don't know whether it is TRT, but you might try wrapping your > define form in (eval-when (compile) ...) or similar. i tried this: (eval-when (compile) (define scheme-plus-path "/Users/mattei/Dropbox/git/Scheme-PLUS-for-Guile")) (include (string-append s

Re: matrix library?

2023-10-05 Thread Damien Mattei
d slow down calculus on intensive computation, as the infix precedence procedure is evaluated each time ,even if it never change in the computation loop or never in program, i'm working on an optimiser (written in scheme) of code before evaluation , that modify the code (transform the in

Re: inserting a file in a module?

2023-10-05 Thread Damien Mattei
yes , you're right , it is like preprocessor in C , include is like a directive, files are included and later all is evaluated... On Thu, Oct 5, 2023 at 9:35 AM wrote: > > On Thu, Oct 05, 2023 at 08:39:48AM +0200, Damien Mattei wrote: > > hello, > > i have problem i

inserting a file in a module?

2023-10-04 Thread Damien Mattei
hello, i have problem i do not understand when inserting a file in a module, things i never done before: (define-module (matrix) #:use-module (oop goops) #:use-module ((guile) #:select (*) #:prefix orig:) #:export ( matrix matrix-v) ) (define scheme-plu

Re: matrix library?

2023-10-04 Thread Damien Mattei
y-matrix-matrix M Mc))) there should be no difference for computation in Guile ,just that i will use GOOPS instead of struct and that it should be a guile module written in scheme+ syntax see it when finished On Wed, Oct 4, 2023 at 8:28 PM wrote: > > On Wed, Oct 04, 2023 at 05:

Re: matrix library?

2023-10-04 Thread Damien Mattei
gt; On Wed, Oct 04, 2023 at 08:46:02AM +0200, Damien Mattei wrote: >> > hello, >> > does anyone know if it exists a basic matrix library for Guile? >> > just need to multiply a matrix and a vector. >> >> Perhaps this thread from guile-user [1] has something for

matrix library?

2023-10-03 Thread Damien Mattei
hello, does anyone know if it exists a basic matrix library for Guile? just need to multiply a matrix and a vector. Damien

Re: overloading an existing operator in Guile

2023-10-03 Thread Damien Mattei
i agree with you all but there is a misunderstanding of what i'm currently doing. I'm not making + that append vectors a part of Scheme+, it is just for a personal program that i want to overload it. This will never be in Scheme+. (even if python use + for appending list, and list in python are ha

Re: overloading an existing operator in Guile

2023-10-03 Thread Damien Mattei
2 3 4 5) scheme@(guile-user)> {#(1 2 3) + #(4 5)} $5 = #(1 2 3 4 5) On Tue, Oct 3, 2023 at 12:33 PM Damien Mattei wrote: > > thank you > i understand i must overload + the usual way in class > scheme@(guile-user)> > $2 = #< 104a6e380> > > about the described pr

Re: overloading an existing operator in Guile

2023-10-03 Thread Damien Mattei
e 3 oct. 2023 à 11:14, Damien Mattei a écrit : > > is it possible to overload an existing operator in Guile? > > > > Yes, but it's a bit buggy. See > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64508

overloading an existing operator in Guile

2023-10-03 Thread Damien Mattei
hello, is it possible to overload an existing operator in Guile? example overload + to concatenate vectors. for example in Scheme (+ i admit) i can do : ; first stage overloading (define-overload-existing-operator +) ; second stage overloading (overload-existing-operator + vector-append (vector?

Release 7.1 of Scheme+ and Comparison of code between Scheme+ (an enhanced scheme language) and Python

2023-09-21 Thread Damien Mattei
version 7.1 for Guile of Scheme+ language is already released and available: https://github.com/damien-mattei/Scheme-PLUS-for-Guile the doc and features are the same as for Racket: https://damien-mattei.github.io/Scheme-PLUS-for-Racket/Scheme+io.html

Re: error Wrong type to apply: #

2023-08-08 Thread Damien Mattei
i think when defining procedure in a file or even toplevel, the order is of no importance , but seems not to be the case for macro if i remember correctly the examples of the discussion threads last week,and of course, as you mention it, for defining variables dependant of each others, the order is

Re: hidden feature of vector-copy or bug?

2023-08-07 Thread Damien Mattei
end. start defaults to 0 and end defaults to the value of (vector-length vec). If end extends beyond the length of vec, the slots in the new vector that obviously cannot be filled by elements from vec are filled with fill, whose default value is unspecified. On Sun, Aug 6, 2023 at 11:13 AM Damien

hidden feature of vector-copy or bug?

2023-08-06 Thread Damien Mattei
hello, i'm maintaining and developing some code i wrote which is using something is a hidden feature or bug in vector-copy? here is the code but there no need to understand it, the problem is explained after ;; scheme@(guile-user)> (define gva (growable-vector 1 2 3 4 5)) ;; scheme@(guile-user)>

Re: error Wrong type to apply: #

2023-08-04 Thread Damien Mattei
yes :-) i will keep it in mind. It is a bit like a let* i tends to forget it sometimes. On Fri, Aug 4, 2023 at 10:31 AM Jean Abou Samra wrote: > > Le vendredi 04 août 2023 à 10:23 +0200, Damien Mattei a écrit : > > i know what disturb me in this error, it is because the order of &

Re: error Wrong type to apply: #

2023-08-04 Thread Damien Mattei
i know what disturb me in this error, it is because the order of definitions has effect but i always learn (was it right?) that in scheme the order of definitions should have no effect on the resulting evaluations. On Thu, Aug 3, 2023 at 1:01 PM Damien Mattei wrote: > > thank you > it

Re: error Wrong type to apply: #

2023-08-03 Thread Damien Mattei
thank you it is clear now , even if i really never find the macro needed upward i tested too in racket your example and the messages is simple to understand : Welcome to DrRacket, version 8.9 [cs]. Language: reader "../Scheme-PLUS-for-Racket/main/Scheme-PLUS-for-Racket/SRFI/SRFI-105.rkt", with deb

Re: error Wrong type to apply: #

2023-08-03 Thread Damien Mattei
cheme-infix.scm") overload.scm must be before some definitions of scheme-infix.scm even if it is not used here, it is strange, i do not understand all but it compiles now On Thu, Aug 3, 2023 at 11:09 AM Damien Mattei wrote: > > hi, > > i have a main Scheme+ module that exports an overload

error Wrong type to apply: #

2023-08-03 Thread Damien Mattei
hi, i have a main Scheme+ module that exports an overload macro: (define-module (Scheme+) #:use-module (growable-vector) #:use-module (ice-9 local-eval) #:use-module (ice-9 match) #:use-module (srfi srfi-1) ;; any,every #:use-module (srfi srfi-69) ;; Basic hash tables #:use-module (sr

Re: match error

2023-08-01 Thread Damien Mattei
yes i read the section of NEWS: https://git.savannah.gnu.org/cgit/guile.git/tree/NEWS?h=v3.0.9#n8 ** Cross-module inlining "Note however that as with macros, when a definition changes in module A, a separately compiled module B that uses that definition doesn't automatically get recompiled. Thi

Re: match error

2023-08-01 Thread Damien Mattei
it seems the cleaning of old .o files solved the problem On Tue, Aug 1, 2023 at 4:28 PM Damien Mattei wrote: > > i will test that , for now i'm testing under Linux on another system > (previous one was Mac OS) > and the same code works : > > GNU Guile 3.0.1 > Copyrigh

Re: match error

2023-08-01 Thread Damien Mattei
me-implicants[x] which the value of a one dimension vector i will test again on the MacOS laptop , i remembered i had cleaned the cache too ,so it is very strange... if it still fail i will activate your debug info i never used but problem does not seems to come only from my code. On Tue,

Re: match error

2023-08-01 Thread Damien Mattei
yes Zelphir, sorry ,why i forgot the subject? i do not know , i'm using gmail and the feature for editing the subject is hidden :-( now it is fixed Damien On Tue, Aug 1, 2023 at 12:57 PM Zelphir Kaltstahl wrote: > > On 8/1/23 11:53, Damien Mattei wrote: > > hello, > >

Re:

2023-08-01 Thread Damien Mattei
i'm perplex , i'm sure now it is related to 'match' because of that: scheme@(guile-user)> (use-modules (ice-9 match)) scheme@(guile-user)> (match '(1 0) ((2 0) 'nomatch)) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Throw to key `match-error' with args `("match" "no matching pattern" (1

[no subject]

2023-08-01 Thread Damien Mattei
hello, i have this error: ice-9/boot-9.scm:1685:16: In procedure raise-exception: Throw to key `match-error' with args `("match" "no matching pattern" (1 0))'. i thought it was a 'match' related error as i used it in a macro: ;;(display "before match") (newline) (match (list index1-or-ke

  1   2   3   >