mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-16 09:17:35 +02:00
testing
This commit is contained in:
parent
abc37155a9
commit
a1592ca61f
1 changed files with 34 additions and 66 deletions
100
test.scm
100
test.scm
|
@ -1,67 +1,35 @@
|
||||||
1.1
|
|
||||||
;((lambda (x)
|
|
||||||
; ((lambda ()
|
|
||||||
; ((lambda (z)
|
|
||||||
; (+ x z)) 2));))
|
|
||||||
; 1)
|
|
||||||
;((lambda (x y z) (+ x y)) 1 2 3)
|
|
||||||
|
|
||||||
(define x 1)
|
(define (test)
|
||||||
(define y 2)
|
(call/cc
|
||||||
(write (+ x y 3.3))
|
(lambda (k)
|
||||||
((lambda () (+ 1 2)))
|
(write (list 'result
|
||||||
(+ x 2 3 4 1 34 2 5 2 -2 2 -10)
|
(with-exception-handler
|
||||||
|
(lambda (obj)
|
||||||
;;; Temporary testing, delete this once it works
|
(display "Error: ")
|
||||||
; Need to rewrite the code to use this, and preserve the global def
|
(cond
|
||||||
;(define (test)
|
((pair? obj)
|
||||||
; (call/cc
|
(for-each
|
||||||
; (lambda (return)
|
(lambda (o)
|
||||||
; (return #t))))
|
(display o)
|
||||||
;(write (test))
|
(display " "))
|
||||||
;
|
obj))
|
||||||
;; (write
|
(else
|
||||||
;; (with-exception-handler
|
(display obj)))
|
||||||
;; (lambda (con)
|
(display "\n")
|
||||||
;; (cond
|
(k #t))
|
||||||
;; ((string? con)
|
(lambda ()
|
||||||
;; (display con))
|
(repl))))))))
|
||||||
;; (else
|
(define (repl)
|
||||||
;; (display "a warning has been issued")))
|
(display "cyclone> ")
|
||||||
;; 42)
|
(let ((c 'done)) ;(read)))) ;; fine with this line
|
||||||
;; (lambda ()
|
;(let ((c (eval 'done))) ;(read)))) ;; Crashes with this line
|
||||||
;; (+ (raise-continuable "should be a number") 23)
|
;(let ((c (read)))
|
||||||
;; )))
|
(cond
|
||||||
;; ;prints: should be a number
|
((not (eof-object? c))
|
||||||
;; ;=> 65
|
(write c)
|
||||||
;;
|
;(test)
|
||||||
;; (write
|
)
|
||||||
;; (call/cc
|
(else
|
||||||
;; (lambda (k)
|
(exit 0) ;; TODO: crashes on this branch... WTF?
|
||||||
;; (with-exception-handler
|
))))
|
||||||
;; (lambda (x)
|
(test)
|
||||||
;; (display "condition: ")
|
|
||||||
;; (write x)
|
|
||||||
;; ;(newline)
|
|
||||||
;; (k 'exception))
|
|
||||||
;; (lambda ()
|
|
||||||
;; (+ 1 (raise 'an-error)))))))
|
|
||||||
;;
|
|
||||||
;; (with-exception-handler
|
|
||||||
;; (lambda (x)
|
|
||||||
;; (display "something went wrong\n"))
|
|
||||||
;; (lambda ()
|
|
||||||
;; (+ 1 (raise 'an-error))))
|
|
||||||
;;
|
|
||||||
;; ;(define test '(a b))
|
|
||||||
;; ;(set-car! test '(1 2 3))
|
|
||||||
;; ;(write test)
|
|
||||||
;; ;(raise 'done)
|
|
||||||
;; ;(define (loop n)
|
|
||||||
;; ; (cond
|
|
||||||
;; ; ((= n 10000)
|
|
||||||
;; ; (write test)
|
|
||||||
;; ; (loop 0))
|
|
||||||
;; ; (else
|
|
||||||
;; ; (loop (+ n 1)))))
|
|
||||||
;; ;(loop 0)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue