Alles aangepast.

This commit is contained in:
2026-06-08 12:55:08 +02:00
parent a9610e6e0c
commit 823130e3ac
24 changed files with 418 additions and 2621 deletions
+8 -29
View File
@@ -1,32 +1,11 @@
#lang racket/base
(require "../main.rkt")
(define examples
(list
(cons 'expression
(js/expression
(let loop ([i 0] [acc 0])
(if (< i 5)
(loop (+ i 1) (+ acc i))
acc))))
(cons 'program-t1
(js
(set! window.myfunc
(λ (x)
(let* ((el (send document getElementById 'hi))
(y (* x x)))
(send el setAttribute "x" (+ y "")))
(send console log "dit set attribute x on element hi")))))
(cons 'program-t2
(js
(define (f x)
(if (and (> x 10) (< x 15))
(begin (console.log x)
(return x))
(return (* x x))))))
(cons 'regexp
(js/expression
(regexp-match #px"([a-z]+)-([0-9]+)" "abc-123")))))
(require (prefix-in use: "js-usecases.rkt")
(prefix-in dom: "dom-exercises.rkt"))
(for ([e (in-list examples)])
(printf "===== ~a =====\n~a\n\n" (car e) (cdr e)))
(module+ main
(displayln ";; js-usecases")
(display use:generated-js)
(newline)
(displayln ";; dom-exercises")
(display dom:generated-js))