Created
September 12, 2018 09:44
-
-
Save euhmeuh/658b11732664fa5d1a99920cba4bee03 to your computer and use it in GitHub Desktop.
Urlang wrapper
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
#lang s-exp "urlang.rkt" | |
(define (hello name) | |
(console.log (+ "Hello " name "!"))) | |
(hello "Urlang world") |
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
#lang racket/base | |
(provide | |
(except-out (all-from-out racket/base) #%module-begin) | |
(rename-out [module-begin #%module-begin]) | |
load-js) | |
(define-syntax-rule (module-begin expr ...) | |
(#%module-begin | |
(provide javascript) | |
(require urlang) | |
(define javascript (open-output-string)) | |
(parameterize ([current-urlang-run? #f] | |
[current-urlang-echo? #t] | |
[current-output-port javascript]) | |
(urlang | |
(urmodule module expr ...))))) | |
(define (load-js urlang-file) | |
(get-output-string (dynamic-require urlang-file 'javascript))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment