-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkloop.scm
More file actions
32 lines (25 loc) · 825 Bytes
/
kloop.scm
File metadata and controls
32 lines (25 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(module-export loop
;; re-exported from runtime but shouldn't be needed
gvref glength
)
(import (rnrs lists))
(import (rnrs hashtables))
(import (kloop-runtime))
(define (syntax-violation who message form #!optional subform)
(let* ((in (if who
(format "~a" who)
(syntax-case form ()
((x . _) (syntax->datum #'x))
(x (syntax->datum #'x)))))
(fsrc (syntax->datum form))
(src (if subform
(format "~s in ~s" (syntax->datum subform) fsrc)
fsrc)))
(error (format "Invalid syntax in ~a: ~a ~a" in message src))))
(define (r6rs-error who msg . irritants)
(apply error who msg irritants))
(define-syntax assert
(syntax-rules ()
((_ exp) (unless exp (error "assertion failed" 'exp)))))
(include-relative "kloop-expand.scm")
(define-syntax loop loop-expand)