Global Script is a family of statically-typed pure-functional programming notations,
built around a common calculus,
useful for all kinds of programming,
but focusing on business application programming and data processing to start with.
Global Script's syntax aspires to provide the value of Lisp, at 10% of the cost of in parentheses.
Examples
'fibs = iterate2 (+) 0 1;
'primes = w 2 (repeat true), where:
'w !'n (false@'bs) :- w (n+1) bs;
'w !'p (true@'bs) :- p @ w (p + 1) (set (every-nth-element p) false bs);
;
'fizz-buzz = map (— #2 ∘ fizz ∘ buzz ∘ print) naturals, where:
'fizz !('t ∧《 'n, 'fd, 's, 》) = if 3*_ ∝ n. say log{Fizz} t, else: t;
'buzz !('t ∧《 'n, 'fd, 's, 》) = if 5*_ ∝ n. say log{Buzz} t, else: t;
'say 's₀ 《 'n, true, 's1, 》 :- 《 n, true, s₀ <> s₁, 》;
'say 's₀ 《 'n, false, _, 》 :- 《 n, true, s₀, 》;
'print 'n = 《 n, false, fmt-decimal n, 》;
I/O Examples
λ _. send: fmt.line: qq{hello world}
λ 'as. send: fmt.line: fmt.words as
λ 'as. for 'a ∈ as. analyzeM file.open o/r/ fn<§a>.
case left 'err. to-err: send qq{§a: §fmt{%s}(err)\n},
case right 'fh. cat << fh, where:
'cat = for 's ← receive: many symbol. send s;
GUI Examples
λ _. text log{Hello, world!}
λ _. 〈{
_ ← display: λ 's. text log{Hello, §(get (name #contents) s)!};
labelled log{Name}: textbox 'name str{};
; }〉
λ _. 〈{
_ ← display: λ 's. text log{Hello, §(get name s)!};
labelled log{Name} (textbox 'inpname str{}) <> button 'go (text log{Go});
state 'name str{};
_ ← on (go #click): for 'nm ← gets (inpname #contents). sets name nm;
}〉