-
hello
external imul : int -> int -> int = "Math.imul" [@@bs.val]
-
hey
| Date: 2026-02-26T14:32:29Z | |
| moon 0.1.20260224 (2288f02 2026-02-24) | |
| Feature flags enabled: rr_moon_pkg | |
| Darwin HongboZhangs-Mac-mini.local 25.0.0 Darwin Kernel Version 25.0.0: Wed Sep 17 21:42:08 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T8132 arm64 | |
| /Library/Developer/CommandLineTools | |
| Apple clang version 17.0.0 (clang-1700.3.19.1) | |
| Target: arm64-apple-darwin25.0.0 |
| A list of languages which compile to JS (Elm, Purescript, OCaml) | |
| (Inspired by this thread: https://groups.google.com/forum/#!topic/elm-discuss/Um7WIBTq9xU) | |
| They all support curry calling convention by default. | |
| Some interesting results: | |
| 1. `min` is curried function, only OCaml(BuckleScript) managed to optimize this overhead. | |
| 2. All optimize the self tail call | |
| 3. Only BuckleScript and PureScript type-specialized comparison functoin (>=) and inlined |
hello
external imul : int -> int -> int = "Math.imul" [@@bs.val]
hey
| let f x y = x + y |
| external to_str : 'a -> string = "js_anything_to_string" | |
| external to_json_string : 'a -> string = "js_json_stringify" | |
| let debug x = print_endline (to_str x ) | |
| let pprint x = print_endline (to_json_string x) | |
| let rec fib = function | |
| | 1 | 2 -> 1 | |
| | n -> fib (n - 1 ) + fib (n - 2) | |
| (** Imperative style *) | |
| let sum n = | |
| let v = ref 0 in |
| git>npm install -g https://github.com/npm-ml/merlin.git | |
| npm ERR! addLocal Could not install /var/folders/df/dh8jkb254qv48cfc0_rhmkf00000gn/T/npm-48145-1a0fbf19/git-cache-3e4efa99/4116bf8bedbaf927784a9d7e05ccd4430bcd7990 | |
| npm ERR! Darwin 15.5.0 | |
| npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "https://github.com/npm-ml/merlin.git" | |
| npm ERR! node v4.2.1 | |
| npm ERR! npm v3.10.5 | |
| npm ERR! code EISDIR | |
| npm ERR! errno -21 | |
| npm ERR! syscall read |
| reason-demo>npm run build | |
| ^[[?25h | |
| > @ build /Users/hongbozhang/git/bucklescript-addons/examples/reason-demo | |
| > source dependencyEnv && bsc -pp ./node_modules/reason/refmt_impl.native -impl hello.re | |
| /Users/hongbozhang/git/bucklescript-addons/examples/reason-demo/node_modules/dependency-env/.bin/dependencyEnv.js:60 | |
| packageName.replace(new RegExp("\-", "g"), function(s){return "_";}).toUpperCase() + "__"; | |
| ^ | |
| TypeError: Cannot read property 'replace' of undefined |
| // Generated CODE, PLEASE EDIT WITH CARE | |
| 'use strict'; | |
| var invalid_argument = /* tuple */[ | |
| 248, | |
| "Invalid_argument", | |
| -3 | |
| ]; |