-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from metamorph-scheme/TL/semanalfix
some fixes maybe?
- Loading branch information
Showing
7 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(define cont) | ||
(define x 0) | ||
(define (func) (call/cc (lambda (k) (set! cont k))) (if (= x 100) )) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(define (plus x y) (+ x y)) | ||
(define (myMap f l1 l2) (if (or (null? l1) (null? l2)) '() (cons (f (car l1) (car l2)) ( myMap f (cdr l1) (cdr l2))))) | ||
(define g (myMap plus '(1 2 3 4) '(1 2 3 4))) | ||
(write-string (number->string (car g))) | ||
(newline) | ||
|
||
(define (print-numbers ls) (if (null? ls) #f ((lambda () (write-string (number->string (car ls))) (print-numbers (cdr ls)))))) | ||
|
||
(print-numbers g) | ||
(newline) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(define continuation) | ||
(define counter 0) | ||
|
||
(define (nTimes times func x) | ||
(set! counter (+ counter 1)) | ||
(if (> times 0) | ||
(nTimes (- times 1) func (func x)) | ||
x)) | ||
|
||
(define (pow2AndStore8 x) | ||
(let | ||
( (maybeNum (call/cc (lambda (c) (if (= x 8) (set! continuation c))))) ) | ||
(if (number? maybeNum) maybeNum (* 2 x)))) | ||
|
||
(write-string (number->string (nTimes 5 pow2AndStore8 1))) | ||
(newline) | ||
(if (= counter 6) (write-string (number->string (continuation 5)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
(define outer #t) | ||
(define (od? n) #t) | ||
(let-syntax | ||
((hansi (syntax-rules () | ||
((_ x y z) (and outer (let-syntax ((z (syntax-rules () ((_ a) (odd? a))))) (y (z x)))))))) (hansi 4 not outer)) | ||
((_ x y z) (and outer (let-syntax ((z (syntax-rules () ((_ a) #t))) (y (z x)))))))) (hansi 4 not outer)) |