* unrecognized pattern operator list @ 2023-10-09 14:48 Damien Mattei 2023-10-09 20:18 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-09 14:48 UTC (permalink / raw) To: kawa mailing list hello, in this code belonging from Guile and Racket version: (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos index3-or-keyword-or-step-eval-pos) ;; {a <+ (make-vector 7 0)} ;; '#(0 0 0 0 0 0 0) ;; > {a[$ $] <- #(1 2 3)} ;; > a ;; '#(1 2 3 0 0 0 0) ((list (== slice) (== slice)) (container-copy! container-eval 0 expr-eval) i have this error: unrecognized pattern operator list near ((list (== slice) i2 (== slice)) slice is defined like that: (define $ '$) (define slice $) what is the equivalent syntax for kawa? damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-09 14:48 unrecognized pattern operator list Damien Mattei @ 2023-10-09 20:18 ` Damien Mattei 2023-10-09 20:26 ` Panicz Maciej Godek 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-09 20:18 UTC (permalink / raw) To: kawa mailing list one of problem is coming from the special syntax of kawa that use [ ] where others scheme don't and incompatible with SRFI 105, this limits some use. like: in type[] or match with patterns looking like ([_ y] ... this would be a good idea to have an option in Kawa that allow replacing those [ ] by normal ( ) or even be compatible with the 2 syntaxes should be possible in my case i dislike 'match form and do not using typing in scheme when available so this not a big problem in my codes but for now i do not know how to modify the SRFI-105 reader for be compatible. It is also possible to parse it with SRFI 105 and after modify again the code to set back the transformed [] in () again in [] in 'match and type[] .... On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > hello, > > in this code belonging from Guile and Racket version: > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > index3-or-keyword-or-step-eval-pos) > > > > > ;; {a <+ (make-vector 7 0)} > ;; '#(0 0 0 0 0 0 0) > ;; > {a[$ $] <- #(1 2 3)} > ;; > a > ;; '#(1 2 3 0 0 0 0) > ((list (== slice) (== slice)) > (container-copy! container-eval > 0 > expr-eval) > > i have this error: > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > slice is defined like that: > > (define $ '$) > (define slice $) > > what is the equivalent syntax for kawa? > > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-09 20:18 ` Damien Mattei @ 2023-10-09 20:26 ` Panicz Maciej Godek 2023-10-09 21:07 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Panicz Maciej Godek @ 2023-10-09 20:26 UTC (permalink / raw) To: Damien Mattei; +Cc: kawa mailing list [-- Attachment #1: Type: text/plain, Size: 2276 bytes --] For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: https://github.com/panicz/grasp/blob/main/src/language/match.scm It is derived from the now withdrawn SRFI-200 document that I submitted at some point: https://srfi.schemers.org/srfi-200/srfi-200.html (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): > one of problem is coming from the special syntax of kawa that use > [ ] where others scheme don't and incompatible with SRFI 105, this > limits some use. > like: in type[] or match with patterns looking like ([_ y] ... > this would be a good idea to have an option in Kawa that allow > replacing those [ ] by normal ( ) or even be compatible with the 2 > syntaxes should be possible > > in my case i dislike 'match form and do not using typing in scheme > when available so this not a big problem in my codes but for now i do > not know how to modify the SRFI-105 reader for be compatible. It is > also possible to parse it with SRFI 105 and after modify again the > code to set back the transformed [] in () again in [] in 'match and > type[] .... > > > On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> > wrote: > > > > hello, > > > > in this code belonging from Guile and Racket version: > > > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > > index3-or-keyword-or-step-eval-pos) > > > > > > > > > > ;; {a <+ (make-vector 7 0)} > > ;; '#(0 0 0 0 0 0 0) > > ;; > {a[$ $] <- #(1 2 3)} > > ;; > a > > ;; '#(1 2 3 0 0 0 0) > > ((list (== slice) (== slice)) > > (container-copy! container-eval > > 0 > > expr-eval) > > > > i have this error: > > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > > slice is defined like that: > > > > (define $ '$) > > (define slice $) > > > > what is the equivalent syntax for kawa? > > > > damien > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-09 20:26 ` Panicz Maciej Godek @ 2023-10-09 21:07 ` Damien Mattei 2023-10-10 5:33 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-09 21:07 UTC (permalink / raw) To: Panicz Maciej Godek; +Cc: kawa mailing list GRASP ,amazing code , would be wonderful for teaching. On Mon, Oct 9, 2023 at 10:26 PM Panicz Maciej Godek <godek.maciek@gmail.com> wrote: > > For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: > > https://github.com/panicz/grasp/blob/main/src/language/match.scm > > It is derived from the now withdrawn SRFI-200 document that I submitted at some point: > > https://srfi.schemers.org/srfi-200/srfi-200.html > > (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) > > Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. > > pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): >> >> one of problem is coming from the special syntax of kawa that use >> [ ] where others scheme don't and incompatible with SRFI 105, this >> limits some use. >> like: in type[] or match with patterns looking like ([_ y] ... >> this would be a good idea to have an option in Kawa that allow >> replacing those [ ] by normal ( ) or even be compatible with the 2 >> syntaxes should be possible >> >> in my case i dislike 'match form and do not using typing in scheme >> when available so this not a big problem in my codes but for now i do >> not know how to modify the SRFI-105 reader for be compatible. It is >> also possible to parse it with SRFI 105 and after modify again the >> code to set back the transformed [] in () again in [] in 'match and >> type[] .... >> >> >> On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: >> > >> > hello, >> > >> > in this code belonging from Guile and Racket version: >> > >> > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos >> > index3-or-keyword-or-step-eval-pos) >> > >> > >> > >> > >> > ;; {a <+ (make-vector 7 0)} >> > ;; '#(0 0 0 0 0 0 0) >> > ;; > {a[$ $] <- #(1 2 3)} >> > ;; > a >> > ;; '#(1 2 3 0 0 0 0) >> > ((list (== slice) (== slice)) >> > (container-copy! container-eval >> > 0 >> > expr-eval) >> > >> > i have this error: >> > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) >> > slice is defined like that: >> > >> > (define $ '$) >> > (define slice $) >> > >> > what is the equivalent syntax for kawa? >> > >> > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-09 21:07 ` Damien Mattei @ 2023-10-10 5:33 ` Damien Mattei 2023-10-10 6:44 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-10 5:33 UTC (permalink / raw) Cc: kawa mailing list i use 'match' for Kawa like this in my code, i haven't test it yet but i suppose it is ok ,having done multiple test in the Kawa REPL : (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) ;; {a <+ (make-vector 7 0)} ;; '#(0 0 0 0 0 0 0) ;; > {a[$ $] <- #(1 2 3)} ;; > a ;; '#(1 2 3 0 0 0 0) ;((list (== slice) (== slice)) ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) (container-copy! container-eval 0 expr-eval) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ;; {s <+ (string-append "abcdefgh")} ;; "abcdefgh" ;; > {s[3 $] <- "zob"} ;; > s ;; "abczobgh" ;; > ([i1 s] #!if (equal? s slice) (container-copy! container-eval i1 expr-eval) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ([s i2] #!if (equal? s slice) (container-copy! container-eval 0 expr-eval 0 i2) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ([i1 i2] (cond ((vector? container-eval) ;; normal case (function-array-n-dim-set! container-eval expr-eval (reverse (list i1 i2)))) ((array? container-eval) ;;(display "assignment.* : 2 args ,array case : container-eval = ") (display container-eval) (newline) (array-set! container-eval index1-or-keyword-eval index2-or-keyword-eval expr-eval)) (else ;; overloaded (define args-lst (list container-eval i1 i2)) (define setter! (find-setter-for-overloaded-square-brackets args-lst)) (setter! container-eval i1 i2 expr-eval))) expr-eval) ;; returning a value allow the chaining : {T[3 2] <- A[4] <- T[2 4]} ) ;; end match i can not find another way than: #!if (and (equal? s1 slice) (equal? s2 slice) to test equality to '($ $) or (list slice slice) , that does not look like a pattern and i could have use 'cond' instead of 'match' as there is little gain in syntax here. On Mon, Oct 9, 2023 at 11:07 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > GRASP ,amazing code , would be wonderful for teaching. > > On Mon, Oct 9, 2023 at 10:26 PM Panicz Maciej Godek > <godek.maciek@gmail.com> wrote: > > > > For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: > > > > https://github.com/panicz/grasp/blob/main/src/language/match.scm > > > > It is derived from the now withdrawn SRFI-200 document that I submitted at some point: > > > > https://srfi.schemers.org/srfi-200/srfi-200.html > > > > (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) > > > > Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. > > > > pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): > >> > >> one of problem is coming from the special syntax of kawa that use > >> [ ] where others scheme don't and incompatible with SRFI 105, this > >> limits some use. > >> like: in type[] or match with patterns looking like ([_ y] ... > >> this would be a good idea to have an option in Kawa that allow > >> replacing those [ ] by normal ( ) or even be compatible with the 2 > >> syntaxes should be possible > >> > >> in my case i dislike 'match form and do not using typing in scheme > >> when available so this not a big problem in my codes but for now i do > >> not know how to modify the SRFI-105 reader for be compatible. It is > >> also possible to parse it with SRFI 105 and after modify again the > >> code to set back the transformed [] in () again in [] in 'match and > >> type[] .... > >> > >> > >> On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: > >> > > >> > hello, > >> > > >> > in this code belonging from Guile and Racket version: > >> > > >> > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > >> > index3-or-keyword-or-step-eval-pos) > >> > > >> > > >> > > >> > > >> > ;; {a <+ (make-vector 7 0)} > >> > ;; '#(0 0 0 0 0 0 0) > >> > ;; > {a[$ $] <- #(1 2 3)} > >> > ;; > a > >> > ;; '#(1 2 3 0 0 0 0) > >> > ((list (== slice) (== slice)) > >> > (container-copy! container-eval > >> > 0 > >> > expr-eval) > >> > > >> > i have this error: > >> > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > >> > slice is defined like that: > >> > > >> > (define $ '$) > >> > (define slice $) > >> > > >> > what is the equivalent syntax for kawa? > >> > > >> > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-10 5:33 ` Damien Mattei @ 2023-10-10 6:44 ` Damien Mattei 2023-10-10 7:03 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-10 6:44 UTC (permalink / raw) Cc: kawa mailing list i talked to fast, the match pattern seems ok but i got a Kawa REPL crash when just loading the code file now, after investigating i localised the problem in this section : (cond ((vector? container-eval) ;; normal case (function-array-n-dim-set! container-eval expr-eval (reverse (list i1 i2)))) ((array? container-eval) ;;(display "assignment.* : 2 args ,array case : container-eval = ") (display container-eval) (newline) (array-set! container-eval index1-or-keyword-eval index2-or-keyword-eval expr-eval)) (else ;; overloaded (define args-lst (list container-eval i1 i2)) (define setter! (find-setter-for-overloaded-square-brackets args-lst)) (setter! container-eval i1 i2 expr-eval))) expr-eval) ;; returning a value allow the chaining : {T[3 2] <- A[4] <- T[2 4]} but as the REPL crashed i have no idea of what is the problem, just got this message: #|kawa:1|# (load "Scheme+.scm") #|kawa:2|# (load "scheme-infix.scm") scheme-infix.scm:55:13: warning - no declaration seen for !* scheme-infix.scm:60:8: warning - no declaration seen for infix-operators-lst scheme-infix.scm:270:17: warning - no declaration seen for infix-operators-lst #|kawa:3|# (load "assignment.scm") assignment.scm:318:13: warning - no declaration seen for parse-square-brackets-arguments assignment.scm:337:11: warning - no declaration seen for assignment-argument-3 assignment.scm:346:11: warning - no declaration seen for assignment-argument-4 assignment.scm:357:11: warning - no declaration seen for assignment-argument-5 assignment.scm:369:7: warning - no declaration seen for assignment-argument-6-and-more assignment.scm:403:43: warning - no declaration seen for bracket-apply assignment.scm:407:43: warning - no declaration seen for bracket-apply assignment.scm:430:8: warning - no declaration seen for hash-table? assignment.scm:450:8: warning - no declaration seen for hash-table? assignment.scm:451:8: warning - no declaration seen for hash-table-set! assignment.scm:466:24: warning - no declaration seen for find-setter-for-overloaded-square-brackets assignment.scm:546:5: warning - no declaration seen for function-array-n-dim-set! assignment.scm:553:21: warning - no declaration seen for find-setter-for-overloaded-square-brackets Exception in thread "main" java.lang.VerifyError: Bad local variable type Exception Details: Location: atInteractiveLevel-115.assignmentArgument$Mn2(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; @622: aload Reason: Type top (current frame, locals[30]) is not assignable to reference type Current Frame: bci: @622 flags: { } locals: { 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/util/List', top, top, top, top, top, top, 'java/util/List', top, top, top, top, top, top, 'java/util/List', top, top, top, top, top, top, top, 'java/util/List', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'gnu/lists/Pair', 'java/lang/Object' } stack: { } Bytecode: 0000000: 2b3a 042c 3a05 b200 0e3a 06b2 000e 3a07 0000010: 2ab8 0014 9900 10b2 0018 3a06 b200 1b3a 0000020: 07a7 000d b200 203a 06b2 0023 3a07 b200 0000030: 2919 04b2 002f b600 35b6 0043 b800 489a 0000040: 0022 1904 b200 4cb8 0052 9900 1704 b200 0000050: 5619 062a b600 4319 04b8 005b 3a04 a700 0000060: 03b2 0029 1905 b200 2fb6 0035 b600 43b8 0000070: 0048 9a00 2219 05b2 004c b800 5299 0017 0000080: 04b2 0056 1906 2ab6 0043 1905 b800 5b3a 0000090: 05a7 0003 1904 1905 b800 613a 0819 0805 00000a0: b800 6759 3a09 c600 6c19 0903 b900 6c02 00000b0: 003a 0b19 0b3a 0a19 0904 b900 6c02 003a 00000c0: 0d19 0d3a 0cb2 0029 190a b200 2fb6 0035 00000d0: b600 43b8 0048 9900 22b2 0029 190c b200 00000e0: 2fb6 0035 b600 43b8 0072 b800 4899 0007 00000f0: 04a7 0008 03a7 0004 0336 0f15 0f99 0015 0000100: b200 5619 072a b200 4c2d b600 7657 2aa7 0000110: 019c 1908 05b8 0067 593a 10c6 0053 1910 0000120: 03b9 006c 0200 3a12 1912 3a11 1910 04b9 0000130: 006c 0200 3a14 1914 3a13 b200 2919 13b2 0000140: 002f b600 35b6 0043 b800 72b8 0048 9900 0000150: 0704 a700 0403 3616 1516 9900 14b2 0056 0000160: 1907 2a19 112d b600 7657 2aa7 0140 1908 0000170: 05b8 0067 593a 17c6 007d 1917 03b9 006c 0000180: 0200 3a19 1919 3a18 1917 04b9 006c 0200 0000190: 3a1b 191b 3a1a b200 2919 18b2 002f b600 00001a0: 35b6 0043 b800 72b8 0048 9900 0704 a700 00001b0: 0403 361d 151d 9900 3eb8 007a 593a 1eb2 00001c0: 0056 1907 3a1f 2a3a 202d 3a21 191a 3a22 00001d0: 191f 1920 b200 4c19 21b6 007e 191e b200 00001e0: 4cb6 0082 191e 1922 b600 8219 1eb6 0086 00001f0: 2aa7 00ba 1908 05b8 0067 593a 1fc6 00a3 0000200: 191f 03b9 006c 0200 3a21 1921 3a20 191f 0000210: 04b9 006c 0200 3a23 1923 3a22 2ab8 0014 0000220: 9900 1fb2 0056 b200 89b6 0035 2a2d 1920 0000230: 1922 b800 61b8 008f b600 7657 a700 602a 0000240: b800 9499 0011 b200 9a2a 2b2c 2db6 0076 0000250: 57a7 004b 2a19 2019 22b8 009e 3a24 b200 0000260: 56b2 00a1 b600 3519 24b6 0043 3a25 191e 0000270: b200 5619 253a 262a 3a27 1920 3a28 1922 0000280: 3a29 2d3a 2a19 2619 2719 2819 29b6 007e 0000290: 191e 192a b600 8219 1eb6 0086 2da7 000e 00002a0: bb00 a359 b200 a7b7 00ab bfb0 5912 3911 00002b0: 01ea 1036 b600 3dbf 5912 3911 01ed 1036 00002c0: b600 3dbf 5912 3911 0203 1021 b600 3dbf 00002d0: 5912 3911 0203 1033 b600 3dbf 5912 3911 00002e0: 0210 101a b600 3dbf 5912 3911 0217 101a 00002f0: b600 3dbf 5912 3911 0222 08b6 003d bf59 0000300: 1239 1102 2910 15b6 003d bf Exception Handler Table: bci [54, 57] => handler: 684 bci [105, 108] => handler: 696 bci [205, 208] => handler: 708 bci [225, 228] => handler: 720 bci [322, 325] => handler: 732 bci [414, 417] => handler: 744 bci [553, 556] => handler: 756 bci [612, 615] => handler: 767 Stackmap Table: full_frame(@23,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{}) same_frame(@36) same_frame(@46) full_frame(@57,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@66) same_frame(@77) same_frame(@97) full_frame(@108,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@117) same_frame(@128) same_frame(@148) full_frame(@208,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@217) full_frame(@228,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@240) same_frame(@244) same_locals_1_stack_item_frame(@245,Integer) same_frame(@248) same_locals_1_stack_item_frame(@249,Integer) full_frame(@274,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{}) full_frame(@325,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@337) same_frame(@341) same_locals_1_stack_item_frame(@342,Integer) full_frame(@366,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) full_frame(@417,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) same_frame(@429) same_frame(@433) same_locals_1_stack_item_frame(@434,Integer) full_frame(@500,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) full_frame(@547,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{}) full_frame(@556,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#250],Object[#10]}) same_frame(@575) same_frame(@582) same_frame(@596) full_frame(@615,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#250],Object[#10]}) chop_frame(@668,1) full_frame(@672,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105]},{}) full_frame(@683,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{Object[#10]}) full_frame(@684,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) same_locals_1_stack_item_frame(@696,Object[#55]) full_frame(@708,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) same_locals_1_stack_item_frame(@720,Object[#55]) full_frame(@732,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) full_frame(@744,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) full_frame(@756,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) full_frame(@767,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#55]}) at java.base/java.lang.Class.getDeclaredFields0(Native Method) at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3473) at java.base/java.lang.Class.getDeclaredField(Class.java:2780) at gnu.expr.ModuleContext.findInstance(ModuleContext.java:71) at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:286) at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) at kawa.Shell.run(Shell.java:289) at kawa.Shell.runFile(Shell.java:551) at kawa.standard.load.apply2(load.java:67) at kawa.standard.load.apply1(load.java:27) at gnu.mapping.Procedure1or2.applyToObject(Procedure1or2.java:64) at gnu.mapping.Procedure.applyToConsumerDefault(Procedure.java:75) at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:343) at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) at kawa.Shell.run(Shell.java:289) at kawa.Shell.run(Shell.java:196) at kawa.Shell.run(Shell.java:183) at kawa.repl.processArgs(repl.java:724) at kawa.repl.main(repl.java:830) (base) mattei@MacBook-Pro-Touch-Bar Scheme-PLUS-for-Kawa % On Tue, Oct 10, 2023 at 7:33 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > i use 'match' for Kawa like this in my code, i haven't test it yet but > i suppose it is ok ,having done multiple test in the Kawa REPL : > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) > > ;; {a <+ (make-vector 7 0)} > ;; '#(0 0 0 0 0 0 0) > ;; > {a[$ $] <- #(1 2 3)} > ;; > a > ;; '#(1 2 3 0 0 0 0) > ;((list (== slice) (== slice)) > ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) > (container-copy! container-eval > 0 > expr-eval) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ;; {s <+ (string-append "abcdefgh")} > ;; "abcdefgh" > ;; > {s[3 $] <- "zob"} > ;; > s > ;; "abczobgh" > ;; > > ([i1 s] #!if (equal? s slice) > (container-copy! container-eval > i1 > expr-eval) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ([s i2] #!if (equal? s slice) > (container-copy! container-eval > 0 > expr-eval > 0 > i2) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ([i1 i2] > (cond ((vector? container-eval) ;; normal case > (function-array-n-dim-set! container-eval expr-eval (reverse > (list i1 i2)))) > ((array? container-eval) > ;;(display "assignment.* : 2 args ,array case : > container-eval = ") (display container-eval) (newline) > (array-set! container-eval index1-or-keyword-eval > index2-or-keyword-eval expr-eval)) > > (else ;; overloaded > (define args-lst (list container-eval i1 i2)) > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > (setter! container-eval i1 i2 expr-eval))) > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > A[4] <- T[2 4]} > > ) ;; end match > > i can not find another way than: > > #!if (and (equal? s1 slice) (equal? s2 slice) > > to test equality to '($ $) or (list slice slice) , that does not look > like a pattern and i could have use 'cond' instead of 'match' as there > is little gain in syntax here. > > On Mon, Oct 9, 2023 at 11:07 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > GRASP ,amazing code , would be wonderful for teaching. > > > > On Mon, Oct 9, 2023 at 10:26 PM Panicz Maciej Godek > > <godek.maciek@gmail.com> wrote: > > > > > > For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: > > > > > > https://github.com/panicz/grasp/blob/main/src/language/match.scm > > > > > > It is derived from the now withdrawn SRFI-200 document that I submitted at some point: > > > > > > https://srfi.schemers.org/srfi-200/srfi-200.html > > > > > > (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) > > > > > > Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. > > > > > > pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): > > >> > > >> one of problem is coming from the special syntax of kawa that use > > >> [ ] where others scheme don't and incompatible with SRFI 105, this > > >> limits some use. > > >> like: in type[] or match with patterns looking like ([_ y] ... > > >> this would be a good idea to have an option in Kawa that allow > > >> replacing those [ ] by normal ( ) or even be compatible with the 2 > > >> syntaxes should be possible > > >> > > >> in my case i dislike 'match form and do not using typing in scheme > > >> when available so this not a big problem in my codes but for now i do > > >> not know how to modify the SRFI-105 reader for be compatible. It is > > >> also possible to parse it with SRFI 105 and after modify again the > > >> code to set back the transformed [] in () again in [] in 'match and > > >> type[] .... > > >> > > >> > > >> On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > >> > > > >> > hello, > > >> > > > >> > in this code belonging from Guile and Racket version: > > >> > > > >> > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > > >> > index3-or-keyword-or-step-eval-pos) > > >> > > > >> > > > >> > > > >> > > > >> > ;; {a <+ (make-vector 7 0)} > > >> > ;; '#(0 0 0 0 0 0 0) > > >> > ;; > {a[$ $] <- #(1 2 3)} > > >> > ;; > a > > >> > ;; '#(1 2 3 0 0 0 0) > > >> > ((list (== slice) (== slice)) > > >> > (container-copy! container-eval > > >> > 0 > > >> > expr-eval) > > >> > > > >> > i have this error: > > >> > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > > >> > slice is defined like that: > > >> > > > >> > (define $ '$) > > >> > (define slice $) > > >> > > > >> > what is the equivalent syntax for kawa? > > >> > > > >> > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-10 6:44 ` Damien Mattei @ 2023-10-10 7:03 ` Damien Mattei 2023-10-11 7:25 ` Damien Mattei 0 siblings, 1 reply; 8+ messages in thread From: Damien Mattei @ 2023-10-10 7:03 UTC (permalink / raw) Cc: kawa mailing list ok this works: (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) ;; {a <+ (make-vector 7 0)} ;; '#(0 0 0 0 0 0 0) ;; > {a[$ $] <- #(1 2 3)} ;; > a ;; '#(1 2 3 0 0 0 0) ;((list (== slice) (== slice)) ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) (container-copy! container-eval 0 expr-eval) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ;; {s <+ (string-append "abcdefgh")} ;; "abcdefgh" ;; > {s[3 $] <- "zob"} ;; > s ;; "abczobgh" ;; > ([i1 s] #!if (equal? s slice) (container-copy! container-eval i1 expr-eval) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ([s i2] #!if (equal? s slice) (container-copy! container-eval 0 expr-eval 0 i2) container-eval ;; returning a value allow the chaining : {T[3 5 6] <- A[4 2 3] <- T[7 2 4]} ) ([i1 i2] (cond ((vector? container-eval) ;; normal case (function-array-n-dim-set! container-eval expr-eval (reverse (list i1 i2)))) ((array? container-eval) ;;(display "assignment.* : 2 args ,array case : container-eval = ") (display container-eval) (newline) '(array-set! container-eval index1-or-keyword-eval index2-or-keyword-eval expr-eval)) (else ;; overloaded (define args-lst (list container-eval i1 i2)) (define setter! (find-setter-for-overloaded-square-brackets args-lst)) '(setter! container-eval i1 i2 expr-eval))) expr-eval) ;; returning a value allow the chaining : {T[3 2] <- A[4] <- T[2 4]} ) ;; end match but if i unquote '(setter! container-eval i1 i2 expr-eval) the REPL crashes, the only way of debug was to quote the portions of code... On Tue, Oct 10, 2023 at 8:44 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > i talked to fast, the match pattern seems ok but i got a Kawa REPL > crash when just loading the code file now, after investigating i > localised the problem in this section : > > (cond ((vector? container-eval) ;; normal case > (function-array-n-dim-set! container-eval expr-eval (reverse > (list i1 i2)))) > ((array? container-eval) > ;;(display "assignment.* : 2 args ,array case : > container-eval = ") (display container-eval) (newline) > (array-set! container-eval index1-or-keyword-eval > index2-or-keyword-eval expr-eval)) > > (else ;; overloaded > (define args-lst (list container-eval i1 i2)) > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > (setter! container-eval i1 i2 expr-eval))) > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > A[4] <- T[2 4]} > > but as the REPL crashed i have no idea of what is the problem, just > got this message: > > #|kawa:1|# (load "Scheme+.scm") > #|kawa:2|# (load "scheme-infix.scm") > scheme-infix.scm:55:13: warning - no declaration seen for !* > scheme-infix.scm:60:8: warning - no declaration seen for infix-operators-lst > scheme-infix.scm:270:17: warning - no declaration seen for infix-operators-lst > #|kawa:3|# (load "assignment.scm") > assignment.scm:318:13: warning - no declaration seen for > parse-square-brackets-arguments > assignment.scm:337:11: warning - no declaration seen for assignment-argument-3 > assignment.scm:346:11: warning - no declaration seen for assignment-argument-4 > assignment.scm:357:11: warning - no declaration seen for assignment-argument-5 > assignment.scm:369:7: warning - no declaration seen for > assignment-argument-6-and-more > assignment.scm:403:43: warning - no declaration seen for bracket-apply > assignment.scm:407:43: warning - no declaration seen for bracket-apply > assignment.scm:430:8: warning - no declaration seen for hash-table? > assignment.scm:450:8: warning - no declaration seen for hash-table? > assignment.scm:451:8: warning - no declaration seen for hash-table-set! > assignment.scm:466:24: warning - no declaration seen for > find-setter-for-overloaded-square-brackets > assignment.scm:546:5: warning - no declaration seen for > function-array-n-dim-set! > assignment.scm:553:21: warning - no declaration seen for > find-setter-for-overloaded-square-brackets > Exception in thread "main" java.lang.VerifyError: Bad local variable type > Exception Details: > Location: > atInteractiveLevel-115.assignmentArgument$Mn2(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; > @622: aload > Reason: > Type top (current frame, locals[30]) is not assignable to reference type > Current Frame: > bci: @622 > flags: { } > locals: { 'java/lang/Object', 'java/lang/Object', > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > 'java/lang/Object', 'java/util/List', top, top, top, top, top, top, > 'java/util/List', top, top, top, top, top, top, 'java/util/List', top, > top, top, top, top, top, top, 'java/util/List', 'java/lang/Object', > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > 'gnu/lists/Pair', 'java/lang/Object' } > stack: { } > Bytecode: > 0000000: 2b3a 042c 3a05 b200 0e3a 06b2 000e 3a07 > 0000010: 2ab8 0014 9900 10b2 0018 3a06 b200 1b3a > 0000020: 07a7 000d b200 203a 06b2 0023 3a07 b200 > 0000030: 2919 04b2 002f b600 35b6 0043 b800 489a > 0000040: 0022 1904 b200 4cb8 0052 9900 1704 b200 > 0000050: 5619 062a b600 4319 04b8 005b 3a04 a700 > 0000060: 03b2 0029 1905 b200 2fb6 0035 b600 43b8 > 0000070: 0048 9a00 2219 05b2 004c b800 5299 0017 > 0000080: 04b2 0056 1906 2ab6 0043 1905 b800 5b3a > 0000090: 05a7 0003 1904 1905 b800 613a 0819 0805 > 00000a0: b800 6759 3a09 c600 6c19 0903 b900 6c02 > 00000b0: 003a 0b19 0b3a 0a19 0904 b900 6c02 003a > 00000c0: 0d19 0d3a 0cb2 0029 190a b200 2fb6 0035 > 00000d0: b600 43b8 0048 9900 22b2 0029 190c b200 > 00000e0: 2fb6 0035 b600 43b8 0072 b800 4899 0007 > 00000f0: 04a7 0008 03a7 0004 0336 0f15 0f99 0015 > 0000100: b200 5619 072a b200 4c2d b600 7657 2aa7 > 0000110: 019c 1908 05b8 0067 593a 10c6 0053 1910 > 0000120: 03b9 006c 0200 3a12 1912 3a11 1910 04b9 > 0000130: 006c 0200 3a14 1914 3a13 b200 2919 13b2 > 0000140: 002f b600 35b6 0043 b800 72b8 0048 9900 > 0000150: 0704 a700 0403 3616 1516 9900 14b2 0056 > 0000160: 1907 2a19 112d b600 7657 2aa7 0140 1908 > 0000170: 05b8 0067 593a 17c6 007d 1917 03b9 006c > 0000180: 0200 3a19 1919 3a18 1917 04b9 006c 0200 > 0000190: 3a1b 191b 3a1a b200 2919 18b2 002f b600 > 00001a0: 35b6 0043 b800 72b8 0048 9900 0704 a700 > 00001b0: 0403 361d 151d 9900 3eb8 007a 593a 1eb2 > 00001c0: 0056 1907 3a1f 2a3a 202d 3a21 191a 3a22 > 00001d0: 191f 1920 b200 4c19 21b6 007e 191e b200 > 00001e0: 4cb6 0082 191e 1922 b600 8219 1eb6 0086 > 00001f0: 2aa7 00ba 1908 05b8 0067 593a 1fc6 00a3 > 0000200: 191f 03b9 006c 0200 3a21 1921 3a20 191f > 0000210: 04b9 006c 0200 3a23 1923 3a22 2ab8 0014 > 0000220: 9900 1fb2 0056 b200 89b6 0035 2a2d 1920 > 0000230: 1922 b800 61b8 008f b600 7657 a700 602a > 0000240: b800 9499 0011 b200 9a2a 2b2c 2db6 0076 > 0000250: 57a7 004b 2a19 2019 22b8 009e 3a24 b200 > 0000260: 56b2 00a1 b600 3519 24b6 0043 3a25 191e > 0000270: b200 5619 253a 262a 3a27 1920 3a28 1922 > 0000280: 3a29 2d3a 2a19 2619 2719 2819 29b6 007e > 0000290: 191e 192a b600 8219 1eb6 0086 2da7 000e > 00002a0: bb00 a359 b200 a7b7 00ab bfb0 5912 3911 > 00002b0: 01ea 1036 b600 3dbf 5912 3911 01ed 1036 > 00002c0: b600 3dbf 5912 3911 0203 1021 b600 3dbf > 00002d0: 5912 3911 0203 1033 b600 3dbf 5912 3911 > 00002e0: 0210 101a b600 3dbf 5912 3911 0217 101a > 00002f0: b600 3dbf 5912 3911 0222 08b6 003d bf59 > 0000300: 1239 1102 2910 15b6 003d bf > Exception Handler Table: > bci [54, 57] => handler: 684 > bci [105, 108] => handler: 696 > bci [205, 208] => handler: 708 > bci [225, 228] => handler: 720 > bci [322, 325] => handler: 732 > bci [414, 417] => handler: 744 > bci [553, 556] => handler: 756 > bci [612, 615] => handler: 767 > Stackmap Table: > full_frame(@23,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{}) > same_frame(@36) > same_frame(@46) > full_frame(@57,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@66) > same_frame(@77) > same_frame(@97) > full_frame(@108,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@117) > same_frame(@128) > same_frame(@148) > full_frame(@208,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@217) > full_frame(@228,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@240) > same_frame(@244) > same_locals_1_stack_item_frame(@245,Integer) > same_frame(@248) > same_locals_1_stack_item_frame(@249,Integer) > full_frame(@274,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{}) > full_frame(@325,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@337) > same_frame(@341) > same_locals_1_stack_item_frame(@342,Integer) > full_frame(@366,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) > full_frame(@417,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > same_frame(@429) > same_frame(@433) > same_locals_1_stack_item_frame(@434,Integer) > full_frame(@500,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) > full_frame(@547,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{}) > full_frame(@556,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#250],Object[#10]}) > same_frame(@575) > same_frame(@582) > same_frame(@596) > full_frame(@615,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#250],Object[#10]}) > chop_frame(@668,1) > full_frame(@672,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105]},{}) > full_frame(@683,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{Object[#10]}) > full_frame(@684,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > same_locals_1_stack_item_frame(@696,Object[#55]) > full_frame(@708,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > same_locals_1_stack_item_frame(@720,Object[#55]) > full_frame(@732,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > full_frame(@744,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > full_frame(@756,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > full_frame(@767,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#55]}) > > at java.base/java.lang.Class.getDeclaredFields0(Native Method) > at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3473) > at java.base/java.lang.Class.getDeclaredField(Class.java:2780) > at gnu.expr.ModuleContext.findInstance(ModuleContext.java:71) > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:286) > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > at kawa.Shell.run(Shell.java:289) > at kawa.Shell.runFile(Shell.java:551) > at kawa.standard.load.apply2(load.java:67) > at kawa.standard.load.apply1(load.java:27) > at gnu.mapping.Procedure1or2.applyToObject(Procedure1or2.java:64) > at gnu.mapping.Procedure.applyToConsumerDefault(Procedure.java:75) > at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:343) > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > at kawa.Shell.run(Shell.java:289) > at kawa.Shell.run(Shell.java:196) > at kawa.Shell.run(Shell.java:183) > at kawa.repl.processArgs(repl.java:724) > at kawa.repl.main(repl.java:830) > (base) mattei@MacBook-Pro-Touch-Bar Scheme-PLUS-for-Kawa % > > On Tue, Oct 10, 2023 at 7:33 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > i use 'match' for Kawa like this in my code, i haven't test it yet but > > i suppose it is ok ,having done multiple test in the Kawa REPL : > > > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) > > > > ;; {a <+ (make-vector 7 0)} > > ;; '#(0 0 0 0 0 0 0) > > ;; > {a[$ $] <- #(1 2 3)} > > ;; > a > > ;; '#(1 2 3 0 0 0 0) > > ;((list (== slice) (== slice)) > > ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) > > (container-copy! container-eval > > 0 > > expr-eval) > > container-eval ;; returning a value allow the chaining : {T[3 5 > > 6] <- A[4 2 3] <- T[7 2 4]} > > ) > > > > ;; {s <+ (string-append "abcdefgh")} > > ;; "abcdefgh" > > ;; > {s[3 $] <- "zob"} > > ;; > s > > ;; "abczobgh" > > ;; > > > ([i1 s] #!if (equal? s slice) > > (container-copy! container-eval > > i1 > > expr-eval) > > container-eval ;; returning a value allow the chaining : {T[3 5 > > 6] <- A[4 2 3] <- T[7 2 4]} > > ) > > > > ([s i2] #!if (equal? s slice) > > (container-copy! container-eval > > 0 > > expr-eval > > 0 > > i2) > > container-eval ;; returning a value allow the chaining : {T[3 5 > > 6] <- A[4 2 3] <- T[7 2 4]} > > ) > > > > ([i1 i2] > > (cond ((vector? container-eval) ;; normal case > > (function-array-n-dim-set! container-eval expr-eval (reverse > > (list i1 i2)))) > > ((array? container-eval) > > ;;(display "assignment.* : 2 args ,array case : > > container-eval = ") (display container-eval) (newline) > > (array-set! container-eval index1-or-keyword-eval > > index2-or-keyword-eval expr-eval)) > > > > (else ;; overloaded > > (define args-lst (list container-eval i1 i2)) > > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > > (setter! container-eval i1 i2 expr-eval))) > > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > > A[4] <- T[2 4]} > > > > ) ;; end match > > > > i can not find another way than: > > > > #!if (and (equal? s1 slice) (equal? s2 slice) > > > > to test equality to '($ $) or (list slice slice) , that does not look > > like a pattern and i could have use 'cond' instead of 'match' as there > > is little gain in syntax here. > > > > On Mon, Oct 9, 2023 at 11:07 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > > > GRASP ,amazing code , would be wonderful for teaching. > > > > > > On Mon, Oct 9, 2023 at 10:26 PM Panicz Maciej Godek > > > <godek.maciek@gmail.com> wrote: > > > > > > > > For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: > > > > > > > > https://github.com/panicz/grasp/blob/main/src/language/match.scm > > > > > > > > It is derived from the now withdrawn SRFI-200 document that I submitted at some point: > > > > > > > > https://srfi.schemers.org/srfi-200/srfi-200.html > > > > > > > > (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) > > > > > > > > Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. > > > > > > > > pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): > > > >> > > > >> one of problem is coming from the special syntax of kawa that use > > > >> [ ] where others scheme don't and incompatible with SRFI 105, this > > > >> limits some use. > > > >> like: in type[] or match with patterns looking like ([_ y] ... > > > >> this would be a good idea to have an option in Kawa that allow > > > >> replacing those [ ] by normal ( ) or even be compatible with the 2 > > > >> syntaxes should be possible > > > >> > > > >> in my case i dislike 'match form and do not using typing in scheme > > > >> when available so this not a big problem in my codes but for now i do > > > >> not know how to modify the SRFI-105 reader for be compatible. It is > > > >> also possible to parse it with SRFI 105 and after modify again the > > > >> code to set back the transformed [] in () again in [] in 'match and > > > >> type[] .... > > > >> > > > >> > > > >> On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > > >> > > > > >> > hello, > > > >> > > > > >> > in this code belonging from Guile and Racket version: > > > >> > > > > >> > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > > > >> > index3-or-keyword-or-step-eval-pos) > > > >> > > > > >> > > > > >> > > > > >> > > > > >> > ;; {a <+ (make-vector 7 0)} > > > >> > ;; '#(0 0 0 0 0 0 0) > > > >> > ;; > {a[$ $] <- #(1 2 3)} > > > >> > ;; > a > > > >> > ;; '#(1 2 3 0 0 0 0) > > > >> > ((list (== slice) (== slice)) > > > >> > (container-copy! container-eval > > > >> > 0 > > > >> > expr-eval) > > > >> > > > > >> > i have this error: > > > >> > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > > > >> > slice is defined like that: > > > >> > > > > >> > (define $ '$) > > > >> > (define slice $) > > > >> > > > > >> > what is the equivalent syntax for kawa? > > > >> > > > > >> > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: unrecognized pattern operator list 2023-10-10 7:03 ` Damien Mattei @ 2023-10-11 7:25 ` Damien Mattei 0 siblings, 0 replies; 8+ messages in thread From: Damien Mattei @ 2023-10-11 7:25 UTC (permalink / raw) Cc: kawa mailing list finally convert all my code from 'match' version to 'cond' version , it does not change a lot. On Tue, Oct 10, 2023 at 9:03 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > ok this works: > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) > > ;; {a <+ (make-vector 7 0)} > ;; '#(0 0 0 0 0 0 0) > ;; > {a[$ $] <- #(1 2 3)} > ;; > a > ;; '#(1 2 3 0 0 0 0) > ;((list (== slice) (== slice)) > ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) > (container-copy! container-eval > 0 > expr-eval) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ;; {s <+ (string-append "abcdefgh")} > ;; "abcdefgh" > ;; > {s[3 $] <- "zob"} > ;; > s > ;; "abczobgh" > ;; > > ([i1 s] #!if (equal? s slice) > (container-copy! container-eval > i1 > expr-eval) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ([s i2] #!if (equal? s slice) > (container-copy! container-eval > 0 > expr-eval > 0 > i2) > container-eval ;; returning a value allow the chaining : {T[3 5 > 6] <- A[4 2 3] <- T[7 2 4]} > ) > > ([i1 i2] > (cond ((vector? container-eval) ;; normal case > (function-array-n-dim-set! container-eval expr-eval (reverse > (list i1 i2)))) > ((array? container-eval) > ;;(display "assignment.* : 2 args ,array case : > container-eval = ") (display container-eval) (newline) > '(array-set! container-eval index1-or-keyword-eval > index2-or-keyword-eval expr-eval)) > > (else ;; overloaded > (define args-lst (list container-eval i1 i2)) > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > '(setter! container-eval i1 i2 expr-eval))) > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > A[4] <- T[2 4]} > > ) ;; end match > > but if i unquote '(setter! container-eval i1 i2 expr-eval) > the REPL crashes, the only way of debug was to quote the portions of code... > > On Tue, Oct 10, 2023 at 8:44 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > i talked to fast, the match pattern seems ok but i got a Kawa REPL > > crash when just loading the code file now, after investigating i > > localised the problem in this section : > > > > (cond ((vector? container-eval) ;; normal case > > (function-array-n-dim-set! container-eval expr-eval (reverse > > (list i1 i2)))) > > ((array? container-eval) > > ;;(display "assignment.* : 2 args ,array case : > > container-eval = ") (display container-eval) (newline) > > (array-set! container-eval index1-or-keyword-eval > > index2-or-keyword-eval expr-eval)) > > > > (else ;; overloaded > > (define args-lst (list container-eval i1 i2)) > > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > > (setter! container-eval i1 i2 expr-eval))) > > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > > A[4] <- T[2 4]} > > > > but as the REPL crashed i have no idea of what is the problem, just > > got this message: > > > > #|kawa:1|# (load "Scheme+.scm") > > #|kawa:2|# (load "scheme-infix.scm") > > scheme-infix.scm:55:13: warning - no declaration seen for !* > > scheme-infix.scm:60:8: warning - no declaration seen for infix-operators-lst > > scheme-infix.scm:270:17: warning - no declaration seen for infix-operators-lst > > #|kawa:3|# (load "assignment.scm") > > assignment.scm:318:13: warning - no declaration seen for > > parse-square-brackets-arguments > > assignment.scm:337:11: warning - no declaration seen for assignment-argument-3 > > assignment.scm:346:11: warning - no declaration seen for assignment-argument-4 > > assignment.scm:357:11: warning - no declaration seen for assignment-argument-5 > > assignment.scm:369:7: warning - no declaration seen for > > assignment-argument-6-and-more > > assignment.scm:403:43: warning - no declaration seen for bracket-apply > > assignment.scm:407:43: warning - no declaration seen for bracket-apply > > assignment.scm:430:8: warning - no declaration seen for hash-table? > > assignment.scm:450:8: warning - no declaration seen for hash-table? > > assignment.scm:451:8: warning - no declaration seen for hash-table-set! > > assignment.scm:466:24: warning - no declaration seen for > > find-setter-for-overloaded-square-brackets > > assignment.scm:546:5: warning - no declaration seen for > > function-array-n-dim-set! > > assignment.scm:553:21: warning - no declaration seen for > > find-setter-for-overloaded-square-brackets > > Exception in thread "main" java.lang.VerifyError: Bad local variable type > > Exception Details: > > Location: > > atInteractiveLevel-115.assignmentArgument$Mn2(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; > > @622: aload > > Reason: > > Type top (current frame, locals[30]) is not assignable to reference type > > Current Frame: > > bci: @622 > > flags: { } > > locals: { 'java/lang/Object', 'java/lang/Object', > > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > > 'java/lang/Object', 'java/util/List', top, top, top, top, top, top, > > 'java/util/List', top, top, top, top, top, top, 'java/util/List', top, > > top, top, top, top, top, top, 'java/util/List', 'java/lang/Object', > > 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', > > 'gnu/lists/Pair', 'java/lang/Object' } > > stack: { } > > Bytecode: > > 0000000: 2b3a 042c 3a05 b200 0e3a 06b2 000e 3a07 > > 0000010: 2ab8 0014 9900 10b2 0018 3a06 b200 1b3a > > 0000020: 07a7 000d b200 203a 06b2 0023 3a07 b200 > > 0000030: 2919 04b2 002f b600 35b6 0043 b800 489a > > 0000040: 0022 1904 b200 4cb8 0052 9900 1704 b200 > > 0000050: 5619 062a b600 4319 04b8 005b 3a04 a700 > > 0000060: 03b2 0029 1905 b200 2fb6 0035 b600 43b8 > > 0000070: 0048 9a00 2219 05b2 004c b800 5299 0017 > > 0000080: 04b2 0056 1906 2ab6 0043 1905 b800 5b3a > > 0000090: 05a7 0003 1904 1905 b800 613a 0819 0805 > > 00000a0: b800 6759 3a09 c600 6c19 0903 b900 6c02 > > 00000b0: 003a 0b19 0b3a 0a19 0904 b900 6c02 003a > > 00000c0: 0d19 0d3a 0cb2 0029 190a b200 2fb6 0035 > > 00000d0: b600 43b8 0048 9900 22b2 0029 190c b200 > > 00000e0: 2fb6 0035 b600 43b8 0072 b800 4899 0007 > > 00000f0: 04a7 0008 03a7 0004 0336 0f15 0f99 0015 > > 0000100: b200 5619 072a b200 4c2d b600 7657 2aa7 > > 0000110: 019c 1908 05b8 0067 593a 10c6 0053 1910 > > 0000120: 03b9 006c 0200 3a12 1912 3a11 1910 04b9 > > 0000130: 006c 0200 3a14 1914 3a13 b200 2919 13b2 > > 0000140: 002f b600 35b6 0043 b800 72b8 0048 9900 > > 0000150: 0704 a700 0403 3616 1516 9900 14b2 0056 > > 0000160: 1907 2a19 112d b600 7657 2aa7 0140 1908 > > 0000170: 05b8 0067 593a 17c6 007d 1917 03b9 006c > > 0000180: 0200 3a19 1919 3a18 1917 04b9 006c 0200 > > 0000190: 3a1b 191b 3a1a b200 2919 18b2 002f b600 > > 00001a0: 35b6 0043 b800 72b8 0048 9900 0704 a700 > > 00001b0: 0403 361d 151d 9900 3eb8 007a 593a 1eb2 > > 00001c0: 0056 1907 3a1f 2a3a 202d 3a21 191a 3a22 > > 00001d0: 191f 1920 b200 4c19 21b6 007e 191e b200 > > 00001e0: 4cb6 0082 191e 1922 b600 8219 1eb6 0086 > > 00001f0: 2aa7 00ba 1908 05b8 0067 593a 1fc6 00a3 > > 0000200: 191f 03b9 006c 0200 3a21 1921 3a20 191f > > 0000210: 04b9 006c 0200 3a23 1923 3a22 2ab8 0014 > > 0000220: 9900 1fb2 0056 b200 89b6 0035 2a2d 1920 > > 0000230: 1922 b800 61b8 008f b600 7657 a700 602a > > 0000240: b800 9499 0011 b200 9a2a 2b2c 2db6 0076 > > 0000250: 57a7 004b 2a19 2019 22b8 009e 3a24 b200 > > 0000260: 56b2 00a1 b600 3519 24b6 0043 3a25 191e > > 0000270: b200 5619 253a 262a 3a27 1920 3a28 1922 > > 0000280: 3a29 2d3a 2a19 2619 2719 2819 29b6 007e > > 0000290: 191e 192a b600 8219 1eb6 0086 2da7 000e > > 00002a0: bb00 a359 b200 a7b7 00ab bfb0 5912 3911 > > 00002b0: 01ea 1036 b600 3dbf 5912 3911 01ed 1036 > > 00002c0: b600 3dbf 5912 3911 0203 1021 b600 3dbf > > 00002d0: 5912 3911 0203 1033 b600 3dbf 5912 3911 > > 00002e0: 0210 101a b600 3dbf 5912 3911 0217 101a > > 00002f0: b600 3dbf 5912 3911 0222 08b6 003d bf59 > > 0000300: 1239 1102 2910 15b6 003d bf > > Exception Handler Table: > > bci [54, 57] => handler: 684 > > bci [105, 108] => handler: 696 > > bci [205, 208] => handler: 708 > > bci [225, 228] => handler: 720 > > bci [322, 325] => handler: 732 > > bci [414, 417] => handler: 744 > > bci [553, 556] => handler: 756 > > bci [612, 615] => handler: 767 > > Stackmap Table: > > full_frame(@23,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{}) > > same_frame(@36) > > same_frame(@46) > > full_frame(@57,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@66) > > same_frame(@77) > > same_frame(@97) > > full_frame(@108,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@117) > > same_frame(@128) > > same_frame(@148) > > full_frame(@208,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@217) > > full_frame(@228,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@240) > > same_frame(@244) > > same_locals_1_stack_item_frame(@245,Integer) > > same_frame(@248) > > same_locals_1_stack_item_frame(@249,Integer) > > full_frame(@274,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{}) > > full_frame(@325,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@337) > > same_frame(@341) > > same_locals_1_stack_item_frame(@342,Integer) > > full_frame(@366,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) > > full_frame(@417,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#248],Object[#10],Object[#10]}) > > same_frame(@429) > > same_frame(@433) > > same_locals_1_stack_item_frame(@434,Integer) > > full_frame(@500,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105]},{}) > > full_frame(@547,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{}) > > full_frame(@556,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#250],Object[#10]}) > > same_frame(@575) > > same_frame(@582) > > same_frame(@596) > > full_frame(@615,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#250],Object[#10]}) > > chop_frame(@668,1) > > full_frame(@672,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105]},{}) > > full_frame(@683,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105]},{Object[#10]}) > > full_frame(@684,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > > same_locals_1_stack_item_frame(@696,Object[#55]) > > full_frame(@708,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > > same_locals_1_stack_item_frame(@720,Object[#55]) > > full_frame(@732,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > > full_frame(@744,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > > full_frame(@756,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10]},{Object[#55]}) > > full_frame(@767,{Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#10],Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Object[#105],Top,Top,Top,Top,Top,Top,Top,Object[#105],Object[#10],Object[#10],Object[#10],Object[#10],Object[#252]},{Object[#55]}) > > > > at java.base/java.lang.Class.getDeclaredFields0(Native Method) > > at java.base/java.lang.Class.privateGetDeclaredFields(Class.java:3473) > > at java.base/java.lang.Class.getDeclaredField(Class.java:2780) > > at gnu.expr.ModuleContext.findInstance(ModuleContext.java:71) > > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:286) > > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > > at kawa.Shell.run(Shell.java:289) > > at kawa.Shell.runFile(Shell.java:551) > > at kawa.standard.load.apply2(load.java:67) > > at kawa.standard.load.apply1(load.java:27) > > at gnu.mapping.Procedure1or2.applyToObject(Procedure1or2.java:64) > > at gnu.mapping.Procedure.applyToConsumerDefault(Procedure.java:75) > > at gnu.mapping.CallContext.runUntilDone(CallContext.java:586) > > at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:343) > > at gnu.expr.ModuleExp.evalModule(ModuleExp.java:211) > > at kawa.Shell.run(Shell.java:289) > > at kawa.Shell.run(Shell.java:196) > > at kawa.Shell.run(Shell.java:183) > > at kawa.repl.processArgs(repl.java:724) > > at kawa.repl.main(repl.java:830) > > (base) mattei@MacBook-Pro-Touch-Bar Scheme-PLUS-for-Kawa % > > > > On Tue, Oct 10, 2023 at 7:33 AM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > > > i use 'match' for Kawa like this in my code, i haven't test it yet but > > > i suppose it is ok ,having done multiple test in the Kawa REPL : > > > > > > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos) > > > > > > ;; {a <+ (make-vector 7 0)} > > > ;; '#(0 0 0 0 0 0 0) > > > ;; > {a[$ $] <- #(1 2 3)} > > > ;; > a > > > ;; '#(1 2 3 0 0 0 0) > > > ;((list (== slice) (== slice)) > > > ([s1 s2] #!if (and (equal? s1 slice) (equal? s2 slice)) > > > (container-copy! container-eval > > > 0 > > > expr-eval) > > > container-eval ;; returning a value allow the chaining : {T[3 5 > > > 6] <- A[4 2 3] <- T[7 2 4]} > > > ) > > > > > > ;; {s <+ (string-append "abcdefgh")} > > > ;; "abcdefgh" > > > ;; > {s[3 $] <- "zob"} > > > ;; > s > > > ;; "abczobgh" > > > ;; > > > > ([i1 s] #!if (equal? s slice) > > > (container-copy! container-eval > > > i1 > > > expr-eval) > > > container-eval ;; returning a value allow the chaining : {T[3 5 > > > 6] <- A[4 2 3] <- T[7 2 4]} > > > ) > > > > > > ([s i2] #!if (equal? s slice) > > > (container-copy! container-eval > > > 0 > > > expr-eval > > > 0 > > > i2) > > > container-eval ;; returning a value allow the chaining : {T[3 5 > > > 6] <- A[4 2 3] <- T[7 2 4]} > > > ) > > > > > > ([i1 i2] > > > (cond ((vector? container-eval) ;; normal case > > > (function-array-n-dim-set! container-eval expr-eval (reverse > > > (list i1 i2)))) > > > ((array? container-eval) > > > ;;(display "assignment.* : 2 args ,array case : > > > container-eval = ") (display container-eval) (newline) > > > (array-set! container-eval index1-or-keyword-eval > > > index2-or-keyword-eval expr-eval)) > > > > > > (else ;; overloaded > > > (define args-lst (list container-eval i1 i2)) > > > (define setter! (find-setter-for-overloaded-square-brackets args-lst)) > > > (setter! container-eval i1 i2 expr-eval))) > > > expr-eval) ;; returning a value allow the chaining : {T[3 2] <- > > > A[4] <- T[2 4]} > > > > > > ) ;; end match > > > > > > i can not find another way than: > > > > > > #!if (and (equal? s1 slice) (equal? s2 slice) > > > > > > to test equality to '($ $) or (list slice slice) , that does not look > > > like a pattern and i could have use 'cond' instead of 'match' as there > > > is little gain in syntax here. > > > > > > On Mon, Oct 9, 2023 at 11:07 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > > > > > GRASP ,amazing code , would be wonderful for teaching. > > > > > > > > On Mon, Oct 9, 2023 at 10:26 PM Panicz Maciej Godek > > > > <godek.maciek@gmail.com> wrote: > > > > > > > > > > For what it's worth, I wrote my own implementation of match for Kawa and use it in GRASP: > > > > > > > > > > https://github.com/panicz/grasp/blob/main/src/language/match.scm > > > > > > > > > > It is derived from the now withdrawn SRFI-200 document that I submitted at some point: > > > > > > > > > > https://srfi.schemers.org/srfi-200/srfi-200.html > > > > > > > > > > (it contains a fairly detailed description of the implementation of the match macro, both in syntax-case and syntax-rules) > > > > > > > > > > Anyway, it doesn't seem to be causing any conflicts with Kawa's built-in match, so you cloud try adapting it to your taste. > > > > > > > > > > pon., 9 paź 2023 o 22:18 Damien Mattei via Kawa <kawa@sourceware.org> napisał(a): > > > > >> > > > > >> one of problem is coming from the special syntax of kawa that use > > > > >> [ ] where others scheme don't and incompatible with SRFI 105, this > > > > >> limits some use. > > > > >> like: in type[] or match with patterns looking like ([_ y] ... > > > > >> this would be a good idea to have an option in Kawa that allow > > > > >> replacing those [ ] by normal ( ) or even be compatible with the 2 > > > > >> syntaxes should be possible > > > > >> > > > > >> in my case i dislike 'match form and do not using typing in scheme > > > > >> when available so this not a big problem in my codes but for now i do > > > > >> not know how to modify the SRFI-105 reader for be compatible. It is > > > > >> also possible to parse it with SRFI 105 and after modify again the > > > > >> code to set back the transformed [] in () again in [] in 'match and > > > > >> type[] .... > > > > >> > > > > >> > > > > >> On Mon, Oct 9, 2023 at 4:48 PM Damien Mattei <damien.mattei@gmail.com> wrote: > > > > >> > > > > > >> > hello, > > > > >> > > > > > >> > in this code belonging from Guile and Racket version: > > > > >> > > > > > >> > (match (list index1-or-keyword-eval-pos index2-or-keyword-eval-pos > > > > >> > index3-or-keyword-or-step-eval-pos) > > > > >> > > > > > >> > > > > > >> > > > > > >> > > > > > >> > ;; {a <+ (make-vector 7 0)} > > > > >> > ;; '#(0 0 0 0 0 0 0) > > > > >> > ;; > {a[$ $] <- #(1 2 3)} > > > > >> > ;; > a > > > > >> > ;; '#(1 2 3 0 0 0 0) > > > > >> > ((list (== slice) (== slice)) > > > > >> > (container-copy! container-eval > > > > >> > 0 > > > > >> > expr-eval) > > > > >> > > > > > >> > i have this error: > > > > >> > unrecognized pattern operator list near ((list (== slice) i2 (== slice)) > > > > >> > slice is defined like that: > > > > >> > > > > > >> > (define $ '$) > > > > >> > (define slice $) > > > > >> > > > > > >> > what is the equivalent syntax for kawa? > > > > >> > > > > > >> > damien ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-10-11 7:26 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-10-09 14:48 unrecognized pattern operator list Damien Mattei 2023-10-09 20:18 ` Damien Mattei 2023-10-09 20:26 ` Panicz Maciej Godek 2023-10-09 21:07 ` Damien Mattei 2023-10-10 5:33 ` Damien Mattei 2023-10-10 6:44 ` Damien Mattei 2023-10-10 7:03 ` Damien Mattei 2023-10-11 7:25 ` Damien Mattei
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).