[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: with-syntax return error in Guile, not in Kawa or Racket
From: |
Damien Mattei |
Subject: |
Re: with-syntax return error in Guile, not in Kawa or Racket |
Date: |
Fri, 10 May 2024 11:40:30 +0200 |
On Fri, May 10, 2024 at 12:35 AM Jean Abou Samra <jean@abou-samra.fr> wrote:
>
>
> > Le 9 mai 2024 à 23:57, Damien Mattei <damien.mattei@gmail.com> 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 so i think the
> > syntax symbol of operator was not correlated with the good function
> > overloaded.
>
> Sorry, I don't understand what you're trying to express here.
>
this was just a 5.00 AM clock assumption, so i'm not sure but : when i
remove syntax->datum (see commented code below) in macro <- :
;; example: {a[4] <- 7}
;; $bracket-apply$ is from SRFI 105 $bracket-apply$ is an argument
of the macro <- here
((_ (brket-applynext container index ...) expr) ; possible to have
NO index :
; minimal form is (_ (brket-applynext container) expr)
;; We will let the second $bracket-apply$ be executed and forbid the
execution of first $bracket-apply$.
(cond ((equal? (quote $bracket-apply$next) (syntax->datum
#'brket-applynext)) ;; already parsed and optimised by parser
#'(assignmentnext container expr index ...)) ; possible to have NO
index
;; integrated curly-infix of guile (no parsing) at REPL
((equal? (quote $bracket-apply$) (syntax->datum #'brket-applynext))
(display "<- : #'(index ...) = ") (display #'(index ...)) (newline)
(display "<- : (syntax->datum #'(index ...)) = ") (display
(syntax->datum #'(index ...))) (newline)
;;(display "<- : (number? (car (syntax->datum #'(index ...)))) = ")
(display (number? (car (syntax->datum #'(index ...))))) (newline)
;; parse arguments at posteriori here:
(with-syntax ((parsed-args (datum->syntax stx ; #f
(cons #'list
(optimizer-parse-square-brackets-arguments-lister
(syntax->datum #'(index ...)))))))
;; (with-syntax ((parsed-args
;; (cons #'list ;; otherwise:Wrong type to apply: 0 ,list will be
interpreted as code !
;; (optimizer-parse-square-brackets-arguments-lister #'(index
...)))))
(display "<- : #'parsed-args=") (display #'parsed-args) (newline)
(display "<- : (syntax->datum #'parsed-args)=") (display (syntax->datum
#'parsed-args)) (newline)
(case (length (cdr (syntax->datum #'parsed-args)))
;;(case (length (cdr #'parsed-args))
;;(case (length #'parsed-args)
if i do this instead:
(with-syntax ((parsed-args
(cons #'list
(optimizer-parse-square-brackets-arguments-lister #'(index ...)))))
my code fails at run-time :
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/Users/mattei/AI_Deep_Learning/exo_retropropagationNhidden_layers_matrix_v2_by_vectors4guile+.scm.go
################## NOT ##################
*init* : nc=#(1 2 1)
z=#(#(0) #(0 0) #(0))
z̃=#(#(0) #(0 0) #(0))
M=#(#<<matrix> 10313c640> #<<matrix> 10313c560>)
ᐁ=#(#(0) #(0 0) #(0))
nbiter=5000
0
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure <: Wrong type argument in position 1: #<procedure +
(#:optional _ _ . _)>
when i look at code , i can use 2 overload mechanism for + , the one of
mine (Scheme+) and the one of GOOPS guile, here this one is in use:
the other is commented:
;scheme@(guile-user)> {#(1 2) + #(3 4 5)}
;$1 = #(1 2 3 4 5)
;scheme@(guile-user)> {#(1 2) + #(3 4 5) + #(6 7)}
;$2 = #(1 2 3 4 5 6 7)
(define-method (+ (x <vector>) (y <vector>)) (vector-append x y))
;; ; first stage overloading
;; (define-overload-existing-operator +)
;; ; second stage overloading
;; (overload-existing-operator + vector-append (vector? vector?))
i do not understand well macro syntax features of R6RS but now all the code
works
> > So i keep the code as is.
> > for the cloned macro i did not succeed in other solution than duplicating
> > the macro and replace <- by ←, stupid but it works now in all codes.
> > In fact it is a general question, how to clone a macro? for a procedure
> it
> > is more simple.
>
> The simple solution
>
> (define-syntax-rule (← . args) (<- . args))
>
sorry, but this can not works because my macro is defined this way:
(define-syntax <-
(lambda (stx)
(syntax-case stx ()
;; silly case
((_ ( ) expr)
#'(void)) ;; void is not portable ;'())
;; one value in values !
;; > {(x) <- (values 7)}
;; > x
;; 7
((_ (var) expr)
#'(set!-values-plus (var) expr))
etc... other case continues
so my arguments are not put in a list as in your definition
ok i see it is not define-syntax but define-syntax-rules, first not in
R6RS, so not portable ,does not exist in Kawa:
#|kawa:1|# define-syntax-rules
/dev/tty:1:1: warning - no declaration seen for define-syntax-rules
/dev/tty:1:1: unbound location: define-syntax-rules
but i test it with my guile code,fails too at run-time:
scheme@(guile-user)> (logic-test)
test 1
(or (and (not a) (not b) (not c) (not d)) (and (not a) (not b) (not c) d)
(and (not a) (not b) c (not d)) (and (not a) b (not c) d) (and (not a) b c
(not d)) (and (not a) b c d) (and a (not b) (not c) (not d)) (and a (not b)
(not c) d) (and a (not b) c (not d)) (and c (not d))) =
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Unbound variable: lin
Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,bt
In /Users/mattei/library-FunctProg/guile/logiki+.scm:
2848:18 5 (_ #<continuation 101c6a500>)
743:23 4 (infix-symb-min-dnf _)
1777:41 3 (minimal-dnf _)
2707:38 2 (_ _)
2526:19 1 (identify-essential-prime-implicants _ _)
In ice-9/boot-9.scm:
1685:16 0 (raise-exception _ #:continuable? _)
the offending code is here:
;; construction of the array
;; set the left column containing prime implicants
(for-basic (lin 0 {lgt-pi - 1})
;;(display "lin=") (display lin) (newline)
;;(display "{vct-prime-implicants[lin]}=") (display
{vct-prime-implicants[lin]}) (newline)
;;(display "{iepi[{lin + 1} 0]}=") (display {iepi[{lin + 1} 0]})
(newline)
{iepi[{lin + 1} 0] ← vct-prime-implicants[lin]})
;;{iepi[{lin + 1} 0] <- vct-prime-implicants[lin]})
;(display "iepi after") (newline)
exactly here, just in the macro:
{iepi[{lin + 1} 0] ← vct-prime-implicants[lin]})
in the macro lin is not more binded, so i suppose there is a problem of
hygiene, the macro wipe out the binding of lin
but it works at REPL,strange ... :
1685:16 0 (raise-exception _ #:continuable? _)
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> {v <+ (vector 1 2 3 4)}
scheme@(guile-user)> {v[1 : 3] <- #(-1 -2 -3 -4 -5 -6 -7)[2 : 4]}
<- : #'(index ...) = (#<syntax:unknown file:6:3 1> #<syntax:unknown
file:6:5 :> #<syntax:unknown file:6:7 3>)
<- : (syntax->datum #'(index ...)) = (1 : 3)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> 1 : 3)>
<- : (syntax->datum #'parsed-args)=(list 1 : 3)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 2 : 4)>
scheme@(guile-user)> v
$1 = #(1 -3 -4 4)
scheme@(guile-user)> {v[1 : 3] ← #(-1 -2 -3 -4 -5 -6 -7)[2 : 4]}
<- : #'(index ...) = (#<syntax:unknown file:8:3 1> #<syntax:unknown
file:8:5 :> #<syntax:unknown file:8:7 3>)
<- : (syntax->datum #'(index ...)) = (1 : 3)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> 1 : 3)>
<- : (syntax->datum #'parsed-args)=(list 1 : 3)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 2 : 4)>
scheme@(guile-user)> v
$2 = #(1 -3 -4 4)
scheme@(guile-user)> (define lin 1)
scheme@(guile-user)> {v[lin : 3] ← #(-1 -2 -3 -4 -5 -6 -7)[2 : 4]}
<- : #'(index ...) = (#<syntax:unknown file:11:3 lin> #<syntax:unknown
file:11:7 :> #<syntax:unknown file:11:9 3>)
<- : (syntax->datum #'(index ...)) = (lin : 3)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> lin : 3)>
<- : (syntax->datum #'parsed-args)=(list lin : 3)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 2 : 4)>
scheme@(guile-user)> v
$3 = #(1 -3 -4 4)
and even with a variable ,i defined lin in the example
> should really work. Maybe you have several files and you forgot to clear
> the bytecode cache? Keep in mind that Guile doesn't do dependency tracking:
> if file B uses a macro defined in file A and file A changes, B won't be
> recompiled automatically, and will use the expansions from the old macros
> until you clear the cache or use --no-auto-compile or similar. This is the
> only explanation I can think of for this part of your problem.
>
i know this caveit, each time i test i remove all the old modules compiled:
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
(base) mattei@mbp-touch-bar ~ % rm -rf .cache/guile/
so the guile compiler find a clean system,output of a compile:
note that the compiler find the problem with unbound variables:
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:2526:19: warning:
possibly unbound variable `lin'
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:2546:18: warning:
possibly unbound variable `col'
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:2554:13: warning:
possibly unbound variable `lin-pos-epi'
if i no more use your macro it works:
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 certain conditions; type `,show c' for details.
Enter `,help' for help.
scheme@(guile-user)> (load "start-λογικι-guile+.scm")
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /Users/mattei/library-FunctProg/start-λογικι-guile+.scm
;;; compiling /usr/local/share/guile/site/3.0/Scheme+.scm
;;; compiling /usr/local/share/guile/site/3.0/for_next_step.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/for_next_step.scm.go
;;; compiling /usr/local/share/guile/site/3.0/growable-vector.scm
;;; growable-vector.scm:149:2: warning: possibly wrong number of arguments
to `vector-copy'
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/growable-vector.scm.go
;;; compiling /usr/local/share/guile/site/3.0/infix-operators.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/infix-operators.scm.go
;;; compiling /usr/local/share/guile/site/3.0/overload.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/overload.scm.go
;;; compiling /usr/local/share/guile/site/3.0/array.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/array.scm.go
;;; compiling /usr/local/share/guile/site/3.0/condx.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/condx.scm.go
<- : #'(index ...) = (#<syntax:assignment.scm:1288:68 i1>
#<syntax:assignment.scm:1288:71 slice> #<syntax:assignment.scm:1288:77 i2>)
<- : (syntax->datum #'(index ...)) = (i1 slice i2)
;;; WARNING: compilation of /usr/local/share/guile/site/3.0/Scheme+.scm
failed:
;;; Unbound variable: optimizer-parse-square-brackets-arguments-lister
<- : #'(index ...) = (#<syntax:assignment.scm:1288:68 i1>
#<syntax:assignment.scm:1288:71 slice> #<syntax:assignment.scm:1288:77 i2>)
<- : (syntax->datum #'(index ...)) = (i1 slice i2)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i1 slice
i2)>
<- : (syntax->datum #'parsed-args)=(list i1 slice i2)
;;; compiling /usr/local/share/guile/site/3.0/operation+.scm
;;; compiling /usr/local/share/guile/site/3.0/set+.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/set+.scm.go
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/operation+.scm.go
;;; compiling /usr/local/share/guile/site/3.0/minterms+.scm
;;; binary-arithmetic.scm:239:2: warning: "~24,'0,':b": wrong port argument
;;; binary-arithmetic.scm:248:3: warning: "~24,' ,':b": wrong port argument
;;; simplify.scm:52:31: warning: possibly unbound variable `zero-symb?'
;;; simplify.scm:115:37: warning: possibly unbound variable `unity-symb?'
;;; binary-arithmetic.scm:257:6: warning: possibly unbound variable
`bitwise-and'
;;; binary-arithmetic.scm:271:16: warning: possibly unbound variable
`arithmetic-shift'
;;; minterms+.scm:419:17: warning: possibly unbound variable `segment-start'
;;; minterms+.scm:420:15: warning: possibly unbound variable `segment-end'
;;; minterms+.scm:422:31: warning: possibly unbound variable
`minterms-vector'
;;; minterms+.scm:425:9: warning: possibly unbound variable
`unified-minterms-vector-1'
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/minterms+.scm.go
;;; compiling /usr/local/share/guile/site/3.0/subscript+.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/subscript+.scm.go
;;; compiling /usr/local/share/guile/site/3.0/regex+.scm
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/usr/local/share/guile/site/3.0/regex+.scm.go
$nfx$ : parsed-args=#<syntax (<- ztest (+ (* 3 5) ztest))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- zorglub (+ zorglub (* 3 5) 2))>
<- : #'(index ...) = (#<syntax:logiki+.scm:2390:34 e>)
<- : (syntax->datum #'(index ...)) = (e)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> e)>
<- : (syntax->datum #'parsed-args)=(list e)
<- : #'(index ...) = (#<syntax:logiki+.scm:2413:17 mt1>)
<- : (syntax->datum #'(index ...)) = (mt1)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt1)>
<- : (syntax->datum #'parsed-args)=(list mt1)
<- : #'(index ...) = (#<syntax:logiki+.scm:2414:17 mt2>)
<- : (syntax->datum #'(index ...)) = (mt2)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt2)>
<- : (syntax->datum #'parsed-args)=(list mt2)
<- : #'(index ...) = (#<syntax:logiki+.scm:2446:18 e>)
<- : (syntax->datum #'(index ...)) = (e)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> e)>
<- : (syntax->datum #'parsed-args)=(list e)
← : #'(index ...) = (#<syntax:logiki+.scm:2511:8 0>)
← : (syntax->datum #'(index ...)) = (0)
← : #'parsed-args=#<syntax (#<syntax:assignment.scm:400:64 list> 0)>
← : (syntax->datum #'parsed-args)=(list 0)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin 0)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin col)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin col)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 0 col)>
← : #'(index ...) = (#<syntax:logiki+.scm:2554:19 lin-pos-epi>
#<syntax:logiki+.scm:2554:31 col>)
← : (syntax->datum #'(index ...)) = (lin-pos-epi col)
← : #'parsed-args=#<syntax (#<syntax:assignment.scm:400:64 list>
lin-pos-epi col)>
← : (syntax->datum #'parsed-args)=(list lin-pos-epi col)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin-pos-epi 0)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin 0)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 0 col)>
← : #'(index ...) = (#<syntax:logiki+.scm:2546:24 lin>
#<syntax:logiki+.scm:2546:28 col>)
← : (syntax->datum #'(index ...)) = (lin col)
← : #'parsed-args=#<syntax (#<syntax:assignment.scm:400:64 list> lin col)>
← : (syntax->datum #'parsed-args)=(list lin col)
← : #'(index ...) = (#<syntax:logiki+.scm:2550:22 lin>
#<syntax:logiki+.scm:2550:26 col>)
← : (syntax->datum #'(index ...)) = (lin col)
← : #'parsed-args=#<syntax (#<syntax:assignment.scm:400:64 list> lin col)>
← : (syntax->datum #'parsed-args)=(list lin col)
← : #'(index ...) = (#<syntax:logiki+.scm:2526:19
(#<syntax:logiki+.scm:2526:24 +> #<syntax:logiki+.scm:2526:20 lin>
#<syntax:logiki+.scm:2526:26 1>)> #<syntax:logiki+.scm:2526:29 0>)
← : (syntax->datum #'(index ...)) = ((+ lin 1) 0)
← : #'parsed-args=#<syntax (#<syntax:assignment.scm:400:64 list> (+ lin 1)
0)>
← : (syntax->datum #'parsed-args)=(list (+ lin 1) 0)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin col)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> lin 0)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> 0 col)>
<- : #'(index ...) = (#<syntax:logiki+.scm:3130:21 mt1>)
<- : (syntax->datum #'(index ...)) = (mt1)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt1)>
<- : (syntax->datum #'parsed-args)=(list mt1)
<- : #'(index ...) = (#<syntax:logiki+.scm:3131:21 mt2>)
<- : (syntax->datum #'(index ...)) = (mt2)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt2)>
<- : (syntax->datum #'parsed-args)=(list mt2)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
<- : #'(index ...) = (#<syntax:logiki+.scm:3140:29 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
<- : #'(index ...) = (#<syntax:logiki+.scm:3150:29 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
<- : #'(index ...) = (#<syntax:logiki+.scm:3240:34 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
<- : #'(index ...) = (#<syntax:logiki+.scm:3611:27 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
<- : #'(index ...) = (#<syntax:logiki+.scm:3613:38 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
<- : #'(index ...) = (#<syntax:logiki+.scm:3666:13 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
<- : #'(index ...) = (#<syntax:logiki+.scm:3646:13 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> i)>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
<- : #'(index ...) = (#<syntax:logiki+.scm:3620:13 i>)
<- : (syntax->datum #'(index ...)) = (i)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> i)>
<- : (syntax->datum #'parsed-args)=(list i)
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$nfx$ : parsed-args=#<syntax (<- i (+ i 1))>
$nfx$ : parsed-args=#<syntax (+ (* 3 n) 1)>
$nfx$ : parsed-args=#<syntax (+ (* x x x) c)>
<- : #'(index ...) = (#<syntax:logiki+.scm:4364:17 mt1>)
<- : (syntax->datum #'(index ...)) = (mt1)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt1)>
<- : (syntax->datum #'parsed-args)=(list mt1)
<- : #'(index ...) = (#<syntax:logiki+.scm:4365:17 mt2>)
<- : (syntax->datum #'(index ...)) = (mt2)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> mt2)>
<- : (syntax->datum #'parsed-args)=(list mt2)
$nfx$ : parsed-args=#<syntax (+ (* 3 (quote (1 2 3))) (quote (4 5 6))
(quote (7 8 9)))>
$bracket-apply$ : parsed-args=#<syntax
(#<syntax:apply-square-brackets.scm:107:57 list> (+ (- (* 2 3) 4) 2))>
$nfx$ : parsed-args=#<syntax (+ (* 3 (quote (1 2 3))) (quote (4 5 6))
(quote (7 8 9)))>
$nfx$ : parsed-args=#<syntax (<- x (+ 1 x (* 4 5)))>
<- : #'(index ...) = (#<syntax:start-λογικι-guile+.scm:225:22 k>)
<- : (syntax->datum #'(index ...)) = (k)
<- : #'parsed-args=#<syntax (#<syntax:assignment.scm:116:64 list> k)>
<- : (syntax->datum #'parsed-args)=(list k)
;;; /Users/mattei/library-FunctProg/start-λογικι-guile+.scm:109:0: warning:
shadows previous definition of `length' at
/Users/mattei/library-FunctProg/start-λογικι-guile+.scm:108:0
;;; /Users/mattei/library-FunctProg/start-λογικι-guile+.scm:151:0: warning:
shadows previous definition of `area' at
/Users/mattei/library-FunctProg/start-λογικι-guile+.scm:142:0
;;; /Users/mattei/library-FunctProg/start-λογικι-guile+.scm:152:0: warning:
shadows previous definition of `area' at
/Users/mattei/library-FunctProg/start-λογικι-guile+.scm:142:0
;;; /Users/mattei/library-FunctProg/start-λογικι-guile+.scm:190:0: warning:
shadows previous definition of `qproc-14b99c8e39d8193a' at
/Users/mattei/library-FunctProg/start-λογικι-guile+.scm:142:0
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:3650:3: warning:
possibly unbound variable `openmp'
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:3650:27: warning:
possibly unbound variable `string->pointer'
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:3670:3: warning:
possibly unbound variable `forfunct'
;;; /Users/mattei/library-FunctProg/guile/logiki+.scm:3974:33: warning:
possibly unbound variable `parallel-vector-map'
;;; compiled
/Users/mattei/.cache/guile/ccache/3.0-LE-8-4.6/Users/mattei/library-FunctProg/start-λογικι-guile+.scm.go
create-overloaded-procedure : pred-list = (#<procedure vector? (_)>)
funct: #<procedure vector-length (_)>
orig-funct: #<procedure length (_)>
old-funct: #<procedure length (_)>
new-funct: #<procedure new-funct args>
create-overloaded-procedure : pred-list = (#<procedure string? (_)>)
funct: #<procedure string-length (_)>
orig-funct: #<procedure new-funct args>
old-funct: #<procedure new-funct args>
new-funct: #<procedure new-funct args>
create-overloaded-procedure : pred-list = (#<procedure number? (_)>)
funct: #<procedure surf-carre-parfait (x)>
orig-funct: #<procedure area args-lst>
old-funct: #<procedure area args-lst>
new-funct: #<procedure new-funct args>
create-overloaded-procedure : pred-list = (#<procedure number? (_)>
#<procedure number? (_)>)
funct: #<procedure surf-carre-long (x y)>
orig-funct: #<procedure new-funct args>
old-funct: #<procedure new-funct args>
new-funct: #<procedure new-funct args>
before add-list-list
before overload-existing-n-arity-operator
create-overloaded-existing-n-arity-operator : pred-list = (#<procedure
list? (_)> #<procedure list? (_)>)
orig-funct = #<procedure + (#:optional _ _ . _)>
funct = #<procedure add-n-lists vn-lst>
funct: #<procedure add-n-lists vn-lst>
orig-funct: #<procedure + (#:optional _ _ . _)>
old-funct: #<procedure + (#:optional _ _ . _)>
new-funct: #<procedure new-funct args>
replace-operator! :
(0 (#<procedure expt (_ _)> #<procedure expt (_ _)>) (#<procedure *
(#:optional _ _ . _)> #<procedure / (#:optional _ _ . _)> #<procedure
modulo (_ _)>) (#<procedure + (#:optional _ _ . _)> #<procedure -
(#:optional _ _ . _)>) (#<procedure << (x n)> #<procedure >> (x n)>)
(#<procedure logand (#:optional _ _ . _)> #<procedure logior (#:optional _
_ . _)>) (#<procedure < (#:optional _ _ . _)> #<procedure > (#:optional _ _
. _)> #<procedure = (#:optional _ _ . _)> #<procedure ≠ (x y)> #<procedure
<= (#:optional _ _ . _)> #<procedure >= (#:optional _ _ . _)>))
(1 (#<procedure expt (_ _)> #<procedure expt (_ _)>) (#<procedure *
(#:optional _ _ . _)> #<procedure / (#:optional _ _ . _)> #<procedure
modulo (_ _)>) (#<procedure new-funct args> #<procedure - (#:optional _ _ .
_)>) (#<procedure << (x n)> #<procedure >> (x n)>) (#<procedure logand
(#:optional _ _ . _)> #<procedure logior (#:optional _ _ . _)>)
(#<procedure < (#:optional _ _ . _)> #<procedure > (#:optional _ _ . _)>
#<procedure = (#:optional _ _ . _)> #<procedure ≠ (x y)> #<procedure <=
(#:optional _ _ . _)> #<procedure >= (#:optional _ _ . _)>))
before mult-num-list
create-overloaded-existing-operator : pred-list = (#<procedure number? (_)>
#<procedure list? (_)>)
funct: #<procedure mult-num-list (k v)>
orig-funct: #<procedure * (#:optional _ _ . _)>
old-funct: #<procedure * (#:optional _ _ . _)>
new-funct: #<procedure new-funct args>
replace-operator! :
(1 (#<procedure expt (_ _)> #<procedure expt (_ _)>) (#<procedure *
(#:optional _ _ . _)> #<procedure / (#:optional _ _ . _)> #<procedure
modulo (_ _)>) (#<procedure new-funct args> #<procedure - (#:optional _ _ .
_)>) (#<procedure << (x n)> #<procedure >> (x n)>) (#<procedure logand
(#:optional _ _ . _)> #<procedure logior (#:optional _ _ . _)>)
(#<procedure < (#:optional _ _ . _)> #<procedure > (#:optional _ _ . _)>
#<procedure = (#:optional _ _ . _)> #<procedure ≠ (x y)> #<procedure <=
(#:optional _ _ . _)> #<procedure >= (#:optional _ _ . _)>))
(2 (#<procedure expt (_ _)> #<procedure expt (_ _)>) (#<procedure new-funct
args> #<procedure / (#:optional _ _ . _)> #<procedure modulo (_ _)>)
(#<procedure new-funct args> #<procedure - (#:optional _ _ . _)>)
(#<procedure << (x n)> #<procedure >> (x n)>) (#<procedure logand
(#:optional _ _ . _)> #<procedure logior (#:optional _ _ . _)>)
(#<procedure < (#:optional _ _ . _)> #<procedure > (#:optional _ _ . _)>
#<procedure = (#:optional _ _ . _)> #<procedure ≠ (x y)> #<procedure <=
(#:optional _ _ . _)> #<procedure >= (#:optional _ _ . _)>))
define-overload-operator : proc =#<procedure *b args-lst>
16
(14 19 24)
5
V=#(-1 -1 -1 -1 -1 -1 #<unspecified> #<unspecified> #<unspecified>
#<unspecified>)
scheme@(guile-user)> (logic-test)
test 1
(or (and (not a) (not b) (not c) (not d)) (and (not a) (not b) (not c) d)
(and (not a) (not b) c (not d)) (and (not a) b (not c) d) (and (not a) b c
(not d)) (and (not a) b c d) (and a (not b) (not c) (not d)) (and a (not b)
(not c) d) (and a (not b) c (not d)) (and c (not d))) = ((¬a ∧ b ∧ d) ∨ (¬b
∧ ¬c) ∨ (c ∧ ¬d))
EXACT
test 2
(or (and (not a) (not b) (not c) (not d)) (and (not a) (not b) (not c) d)
(and (not a) (not b) c (not d)) (and (not a) b (not c) d) (and (not a) b c
(not d)) (and (not a) b c d) (and a (not b) (not c) (not d)) (and a (not b)
(not c) d) (and a (not b) c (not d)) (and c (not d))) = ((¬a ∧ b ∧ d) ∨ (¬b
∧ ¬c) ∨ (c ∧ ¬d))
EXACT
test 3
(or (and (and A B) (not (and C (or (and A (not B)) (and (not A) B))))) (and
(not (and A B)) (and C (or (and A (not B)) (and (not A) B))))) = ((A ∧ B) ∨
(A ∧ C) ∨ (B ∧ C))
EXACT
test 4
(⊕ (· B1 B0) (· C1 (⊕ B1 B0))) = ((B0 ∧ B1) ∨ (B0 ∧ C1) ∨ (B1 ∧ C1))
EXACT
test 5
(or (and B3 (or B2 (and (not B12) B3))) (and B4 (or B2 (and (not B12)
B3)))) = (or (and B2 B3) (and B2 B4) (and B3 (not B12)))
EXACT
test 6
(or (and (not a) (not b) (not c) (not d)) (and (not a) (not b) (not c) d)
(and (not a) (not b) c (not d)) (and (not a) b (not c) d) (and (not a) b c
(not d)) (and (not a) b c d) (and a (not b) (not c) (not d)) (and a (not b)
(not c) d) (and a (not b) c (not d)) (and c (not d))) = ((¬a ∨ ¬b ∨ c) ∧
(¬a ∨ ¬b ∨ ¬d) ∧ (¬a ∨ ¬c ∨ ¬d) ∧ (b ∨ ¬c ∨ ¬d) ∧ (¬b ∨ c ∨ d))
EXACT
test 7
(or (and (and A B) (not (and C (or (and A (not B)) (and (not A) B))))) (and
(not (and A B)) (and C (or (and A (not B)) (and (not A) B))))) = (or (and A
B C) (and A B (not C)) (and A (not B) C) (and (not A) B C))
EXACT
test 8
(or (and B₃ (or B₂ (and (not B₁₂) B₃))) (and B₄ (or B₂ (and (not B₁₂)
B₃)))) = (or (and B₂ B₃) (and B₂ B₄) (and B₃ (not B₁₂)))
EXACT
$1 = #t
but there is sill false warnings in guile in the output:
> ;;; WARNING: compilation of /usr/local/share/guile/site/3.0/Scheme+.scm
> failed:
> ;;; Unbound variable: optimizer-parse-square-brackets-arguments-lister
>
without Scheme+ and optimizer-parse-square-brackets-arguments-lister
the code would fail at startup
as you say perheaps eval-when can help :
https://www.gnu.org/software/guile/manual/html_node/Eval-When.html
but i do not know how,and again this not portable , i have not port this
part of code to Kawa or Racket (problem is different Kawa have no curly
infix mode and Racket ,i use a #lang reader but i have a mode to emulate
SRFI 105 only parser without scheme+ features)
for now all my code : logic computation, deep learning example, and another
private one works with the latest version of Scheme+ , so as it runs again
on more that 10000 lines of code i think it is stable enought to release it
soon after a few more tests. There is no new features, i just migrate a lot
of parser features in the macro system so it should run all code in
curly-mode without no more need to parse code in command line.
best wishes,
Damien
> Jean
>
>
>
- Re: with-syntax return error in Guile, not in Kawa or Racket, (continued)
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/06
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/06
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/06
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/06
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/06
- RE: with-syntax return error in Guile, not in Kawa or Racket, Maxime Devos, 2024/05/06
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/06
- RE: with-syntax return error in Guile, not in Kawa or Racket, Maxime Devos, 2024/05/09
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/09
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/09
- Re: with-syntax return error in Guile, not in Kawa or Racket,
Damien Mattei <=
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/11
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/11
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/12
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Jean Abou Samra, 2024/05/10
- Re: with-syntax return error in Guile, not in Kawa or Racket, Damien Mattei, 2024/05/10