|
|
|
|
|
by soegaard
55 days ago
|
|
FWIW if you are looking for examples of WebAssembly written in the textual format, take a look at: https://raw.githubusercontent.com/soegaard/webracket/refs/he... As a small example, here is a definition of `$car` which extracts the first value from a pair. (func $car (type $Prim1)
(param $v (ref eq))
(result (ref eq))
(if (result (ref eq))
(ref.test (ref $Pair) (local.get $v))
(then (struct.get $Pair $a (ref.cast (ref $Pair) (local.get $v))))
(else (call $raise-pair-expected (local.get $v))
(unreachable))))
|
|