:: int -> int -> int -> int -package:beam-core
Returns an undefined functional value that takes an argument of the
type of its first argument and return a value of the type of its
second argument.
ty >- ty = (undefined :: Ty -> Ty)
Examples:
'a' >- 'b' = char >- char = (undefined :: Char -> Char)
int >- bool >- int = undefined :: Int -> Bool -> Int
Truncate a value so it stays within some range.
>>> clamp 5 10 15
10
>>> clamp 5 10 0
5
Given a minimum value and a maximum value, clamp a value to that range
(values less than the minimum map to the minimum and values greater
than the maximum map to the maximum).
>>> clamp 1 10 11
10
>>> clamp 1 10 2
2
>>> clamp 5 10 1
5
Calling
between c l1 l2 puts
c between
l1 and
l2 and appends them.
between c l1 l2 = l1 <> c <> l2
Modify the label of a tree
mid m x y Puts
x and
y around
m.
Note that:
mid m x y = between x y m.
between b c s wraps the string-like s between
b and c.
replaceSeq old new replaces all
old
subsequences with
new.
replaceSeq old new === ointercalate new . splitSeq old
Given
n > 0,
0 <= a < n, and
0 <= b
< n,
modAdd n a b computes
(a + b)
` mod ` n.
Given
n > 0,
0 <= a < n, and
0 <= b
< n,
modSub n a b computes
(a - b)
` mod ` n.
Given
n > 0,
0 <= a < n, and
0 <= b
< n,
modMul n a b computes
(a * b)
` mod ` n.
Create an if-then-else expression.
Concatenate two
Printers with a separator between them.
Choose between two alternatives based on a selector bit.
Safe
div with default value returned on exception.
>>> divOr "d" "a" "b" :: SymInteger
(ite (= b 0) d (div a b))
Safe
mod with default value returned on exception.
>>> modOr "d" "a" "b" :: SymInteger
(ite (= b 0) d (mod a b))