sourcedemos/hello-library.xtl
1⍝!/usr/bin/env xetal
2⍝# Hello library: a program using two libraries of its own,
3⍝# userlibs/Hello.xtl and userlibs/Greetings.xtl. Run it from the
4⍝# repository's root with "xetal run demos/hello-library.xtl" (or
5⍝# "./demos/hello-library.xtl"); it prints a greeting and two personal
6⍝# greetings. Read the imports for how u_se< finds a library: "Hello" is
7⍝# Hello.xtl beside this file, then in userlibs/, then on XETAL_PATH,
8⍝# then among the standard libraries; the string on its left is the
9⍝# prefix the library's l: names get here.
10
11⍝## The imports
12
13ʰⁱ⁼u̲se< "Hello"
14ᵍ⁼u̲se< "Greetings"
15
16⍝## Calling the libraries
17
18⍝ h_ello is niladic: it takes Unit (@), the value that stands for
19⍝ nothing, and gives the greeting.
20ʰⁱh̲ello @
21
22⍝ g_reet is monadic: this program supplies the greeting.
23ᵍg̲reet "hi"
24ᵍg̲reet "welcome to"