epfl-archive/cs420-acc/l3-warmup/tests/prim-block-get-set.l3

16 lines
460 B
Plaintext
Raw Permalink Normal View History

2022-04-07 18:33:05 +02:00
;; In Emacs, open this file in -*- Scheme -*- mode
;; Test the @block-get and @block-set! primitives
(@byte-write 68)
(let ((b (@block-alloc-0 4)))
(@block-set! b 0 'a')
(@block-set! b 1 'b')
(@block-set! b 2 'c')
(@block-set! b 3 'd')
(@byte-write (if (@= (@block-get b 0) 'a') 65 63))
(@byte-write (if (@= (@block-get b 1) 'b') 66 63))
(@byte-write (if (@= (@block-get b 2) 'c') 67 63))
(@byte-write (if (@= (@block-get b 3) 'd') 68 63)))