libraryextensions/hello/lib/Hello.xtl
Hello.xtl -- the facade of the hello extension, the smallest X_eTaL native extension: each function proves one thing about the boundary. Import: "hx:" u_se< "Hello" Run with xetal-x (xetal-x --ext DIR puts this directory on XETAL_PATH). Each line below is a native function's signature; the binding macro (lib/Ffi.xtlm, docs/ffi-macro.md) writes the facade function from it.
ˡa̲nswer : Unit -> Int
The answer, 42.
"a_nswer : unit -> int" ᶠᶠⁱb̲ind< "hello/answer"
ˡa̲dd : (Num a, Num b) => a -> b -> Float
Left plus right, added natively.
"a_dd : float float -> float" ᶠᶠⁱb̲ind< "hello/add"
ᶠᶠⁱb̲ind< expands to
ˡa̲dd ← { a b → pa ← (f̲ormat r̲avel f̲loat a) ⎕N̲PUT "ext:hello/add?float=" c̲at f̲ormat s̲hape a pb ← (f̲ormat r̲avel f̲loat b) ⎕N̲PUT "ext:hello/add?float=" c̲at f̲ormat s̲hape b f̲irst n̲umbers ⎕N̲GET "ext:hello/add" }
ˡs̲hout : Char -> Char
The text in upper case (Unicode).
"s_hout : text -> text" ᶠᶠⁱb̲ind< "hello/shout"
ˡs̲um : Num a => a -> Float
The sum of every element of a numeric array.
"s_um : float -> float" ᶠᶠⁱb̲ind< "hello/sum"
ˡe̲cho : Num a => a -> Float
A numeric array sent across and back: the same values and shape.
"e_cho : float -> floats" ᶠᶠⁱb̲ind< "hello/echo"
ˡf̲ail : Unit -> Int
Always fails: a native error is an X_eTaL error.
"f_ail : unit -> int" ᶠᶠⁱb̲ind< "hello/fail"
ˡp̲anic : Unit -> Int
Always panics inside Rust: contained, reported as an X_eTaL error.
"p_anic : unit -> int" ᶠᶠⁱb̲ind< "hello/panic"
ˡpackage : Char
The native package behind these functions (a literal l: name also
makes this file a library to xetal type: ask E7).
ˡpackage ← "hello"