Skip to content

Commit b652b3b

Browse files
committed
version 9.2 enhance and correct for next step allowing break to return a value
1 parent 151754f commit b652b3b

File tree

9 files changed

+72
-38
lines changed

9 files changed

+72
-38
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<p style="text-align: center;"><br>
2020
</p>
2121
<h1 style="text-align: center;"><b><span style="color: #000099;">Scheme+</span></b><b><span
22-
style="color: #999999;"> <font size="+2">version 9.1.1 for Guile Scheme<br>
22+
style="color: #999999;"> <font size="+2">version 9.2 for Guile Scheme<br>
2323
</font></span></b></h1>
2424
<p style="text-align: center;">
2525
Display options for viewing this documentation:<br>

Scheme+.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h2 style=" text-align: center;">Damien Mattei<br>
2323
<p style="text-align: center;"><br>
2424
</p>
2525
<h1 style="text-align: center;"><b><span style="color: #000099;">Scheme+</span></b><b><span
26-
style="color: #999999;"> <font size="+2">version 9.1.1 for Guile Scheme<br>
26+
style="color: #999999;"> <font size="+2">version 9.2 for Guile Scheme<br>
2727
</font></span></b></h1>
2828
<p style="text-align: center;"> </p>
2929
<p style="text-align: center;"><br>

Scheme+.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
;; Scheme+.scm
22

3-
;; version 9.1.1
3+
;; version 9.2
44

55
;; author: Damien MATTEI
66

Scheme+io.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ <h2 style=" text-align: center;">Damien Mattei<br>
8383
no room for doubts must have no room for thoughts either."</i> -<a href="https://www.ics.uci.edu/%7Epattis/" target="_blank">R. Patti</a></p>
8484
<p style="text-align: center;"><br>
8585
</p>
86-
<h1 style="text-align: center;"><b><span style="color: #000099;">Scheme+</span></b><b><span style="color: #999999;"> <font size="+2">version 9.1.1 for Guile Scheme<br>
86+
<h1 style="text-align: center;"><b><span style="color: #000099;">Scheme+</span></b><b><span style="color: #999999;"> <font size="+2">version 9.2 for Guile Scheme<br>
8787
</font></span></b></h1>
8888
<p style="text-align: center;">
8989
Display options for viewing this documentation:<br><br>

TODO

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ clean code
44
add more infix without { } in do while / repeat until / ... ?
55
in $nfx$ see TODO
66
syntax in def.scm and in overload
7+
make it with sub modules of Scheme+ submodule
8+
modify for next step as racket version
9+

bracket-apply.scm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128

129129
(with-syntax ((parsed-args ;;#`(list #,@(parse-square-brackets-arguments-lister-syntax #`(#,@#'args-brackets)))))
130130

131-
(cons #'list
131+
(cons #'list ; list : cause ERROR in start-λογικι-guile+.scm (logic-test) : ice-9/boot-9.scm:1685:16: In procedure raise-exception:
132+
;; In procedure variable-ref: Unbound variable: #<variable 785f3e25c8f0 value: #<undefined>>
132133
(parse-square-brackets-arguments-lister-syntax #'(arg-bracket ...))))) ; #`(#,@#'args-brackets)))))
133134

134135
(display "$bracket-apply$ : #'parsed-args=") (display #'parsed-args) (newline)

for_next_step.scm

Lines changed: 58 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -426,39 +426,68 @@
426426
;; 0
427427
;; 1
428428
;; 2
429-
(define-syntax for
430-
(lambda (stx)
431-
(syntax-case stx ()
432-
((kwd (init test incrmt) body ...)
433-
(with-syntax ((BREAK (datum->syntax (syntax kwd) 'break))
434-
(CONTINUE (datum->syntax (syntax kwd) 'continue)))
429+
;; (define-syntax for
430+
;; (lambda (stx)
431+
;; (syntax-case stx ()
432+
;; ((kwd (init test incrmt) body ...)
433+
;; (with-syntax ((BREAK (datum->syntax (syntax kwd) 'break))
434+
;; (CONTINUE (datum->syntax (syntax kwd) 'continue)))
435435

436-
(syntax
437-
;;(let ()
438-
(call/cc
439-
(lambda (escape)
440-
;;init
441-
(let-syntax ((BREAK (identifier-syntax (escape))))
436+
;; (syntax
437+
;; ;;(let ()
438+
;; (call/cc
439+
;; (lambda (escape)
440+
;; ;;init
441+
;; (let-syntax ((BREAK (identifier-syntax (escape))))
442442

443-
init
444-
(let loop ((res 0)) ;; now we will return a result at the end if no break but if we continue? what happens?
445-
(if test
446-
(begin
447-
(call/cc
448-
(lambda (next)
449-
(set! res (let-syntax ((CONTINUE (identifier-syntax (next))))
450-
(let () ;; allow definitions
451-
body ...)))))
452-
incrmt
453-
(loop res))
454-
res)
455-
))))
456-
;;) ; close (let () ...
443+
;; init
444+
;; (let loop ((res 0)) ;; now we will return a result at the end if no break but if we continue? what happens?
445+
;; (if test
446+
;; (begin
447+
;; (call/cc
448+
;; (lambda (next)
449+
;; (set! res (let-syntax ((CONTINUE (identifier-syntax (next))))
450+
;; (let () ;; allow definitions
451+
;; body ...)))))
452+
;; incrmt
453+
;; (loop res))
454+
;; res)
455+
;; ))))
456+
;; ;;) ; close (let () ...
457457

458-
) ; close syntax
458+
;; ) ; close syntax
459459

460-
) ; close with-syntax
461-
))))
460+
;; ) ; close with-syntax
461+
;; ))))
462+
463+
464+
465+
(define-syntax for
466+
467+
(lambda (stx)
468+
469+
(syntax-case stx ()
470+
471+
((_ (init test incrmt) body ...)
472+
473+
(with-syntax ((BREAK (datum->syntax stx 'break))
474+
(CONTINUE (datum->syntax stx 'continue)))
475+
(syntax
476+
(call/cc
477+
(lambda (escape)
478+
(let ((BREAK escape))
479+
init
480+
(let loop ()
481+
(when test
482+
(call/cc
483+
(lambda (next)
484+
(let ((CONTINUE next))
485+
(let () ;; allow definitions
486+
body ...)))) ; end call/cc
487+
incrmt
488+
(loop))) ; end let loop
489+
))))) ;; close with-syntax
490+
))))
462491

463492

464493
;; (for/bc ({k <+ 0} {k < 3} {k <- {k + 1}})

infix-with-precedence-to-prefix.scm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
;;; evaluates `terms` symbolically or numerically as a basic infix expression
3737
(define (!0-generic terms operator-precedence creator)
3838

39-
;; (display "!0-generic : terms=") (display terms) (newline)
39+
;;(display "!0-generic : terms=") (display terms) (newline)
4040
;; (display "!0-generic : operator-precedence=") (display operator-precedence) (newline)
4141

4242
(define rv

nfx.scm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@
5454
;; TODO : make n-arity for <- and <+ only (because could be false with ** , but not implemented in n-arity for now)
5555

5656

57-
(n-arity ;; this avoid : '{x <- y <- z <- t <- u <- 3 * 4 + 1}
57+
(n-arity ;; this avoids : '{x <- y <- z <- t <- u <- 3 * 4 + 1}
5858
;; SRFI-105.scm : !0 result = (<- (<- (<- (<- (<- x y) z) t) u) (+ (* 3 4) 1)) ;; fail set! ...
5959
;; transform in : '(<- x y z t u (+ (* 3 4) 1))
6060
(!0-generic #'(e1 op1 e2 op2 e3 op ...) ; apply operator precedence rules
6161
infix-operators-lst-for-parser-syntax
6262
(lambda (op a b) (list op a b))))))
63-
(display "$nfx$ : parsed-args=") (display #'parsed-args) (newline)
64-
#'parsed-args)))))
63+
64+
(display "$nfx$ : parsed-args=") (display #'parsed-args) (newline)
65+
#'parsed-args)))))
6566

6667

6768

0 commit comments

Comments
 (0)