Fork me on GitHub

List of functions

Basic types

Numeric types

Control structure

Macro

BiwaScheme does not have syntax-ruels or syntax-case, but has define-macro.

(define-macro (test expr)
  `(if ,expr
    #t
    (print (format "test failed: ~a" (quote ,expr)))))

(test (= 1 2)) ;=> test failed: (= 1 2)

Other macro-related functions:

Advanced types

Utilities

Syntax

JavaScript language interface

Browser functions

These functions are only available in browsers (i.e. does not work on Node.js.)

  (element-new '(div "foo"))        => <div>foo</div>
  (element-new '("div#main" "foo")) => <div id='main'>foo</div>
  (element-new '("div.red" "foo"))  => <div class='red'>foo</div>
  (element-new '(div align "right" "foo"))  => <div align='right'>foo</div>
  (element-new '(div (span "foo"))  => <div><span>foo</span></div>

System functions (Node.js only)

You can also use Node.js libraries via js-eval, etc.

(define fs (js-eval "require('fs')"))

(define path ".")
(print (js-invoke fs 'readdirSync path))
; Alternatively you can use `..` macro syntax:
; (print (.. fs `(readdirSync ,path)))

BiwaScheme JavaScript API

See internal/js_api.md for BiwaScheme JavaScript API (eg. writing BiwaScheme library function in JavaScript)