Operators
!=
x <a[integer,string,time,decimal,bool,[<l>],object:<{o}>,keyset,guard,module{}]>
y <a[integer,string,time,decimal,bool,[<l>],object:<{o}>,keyset,guard,module{}]>
→ bool
True if X does not equal Y.
pact> (!= "hello" "goodbye")
truepact> (!= "hello" "goodbye")
true&
x integer y integer → integer
Compute bitwise X and Y.
pact> (& 2 3)
2
pact> (& 5 -7)
1pact> (& 2 3)
2
pact> (& 5 -7)
1*
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
Multiply X by Y.
pact> (* 0.5 10.0)
5.0
pact> (* 3 5)
15pact> (* 0.5 10.0)
5.0
pact> (* 3 5)
15+
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
x <a[string,[<l>],object:<{o}>]>
y <a[string,[<l>],object:<{o}>]>
→ <a[string,[<l>],object:<{o}>]>
Add numbers, concatenate strings/lists, or merge objects.
pact> (+ 1 2)
3
pact> (+ 5.0 0.5)
5.5
pact> (+ "every" "body")
"everybody"
pact> (+ [1 2] [3 4])
[1 2 3 4]
pact> (+ { "foo": 100 } { "foo": 1, "bar": 2 })
{"bar": 2,"foo": 100}pact> (+ 1 2)
3
pact> (+ 5.0 0.5)
5.5
pact> (+ "every" "body")
"everybody"
pact> (+ [1 2] [3 4])
[1 2 3 4]
pact> (+ { "foo": 100 } { "foo": 1, "bar": 2 })
{"bar": 2,"foo": 100}-
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
x <a[integer,decimal]> → <a[integer,decimal]>
Negate X, or subtract Y from X.
pact> (- 1.0)
-1.0
pact> (- 3 2)
1pact> (- 1.0)
-1.0
pact> (- 3 2)
1/
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
Divide X by Y.
pact> (/ 10.0 2.0)
5.0
pact> (/ 8 3)
2pact> (/ 10.0 2.0)
5.0
pact> (/ 8 3)
2<
x <a[integer,decimal,string,time]>
y <a[integer,decimal,string,time]> → bool
True if X < Y.
pact> (< 1 3)
true
pact> (< 5.24 2.52)
false
pact> (< "abc" "def")
truepact> (< 1 3)
true
pact> (< 5.24 2.52)
false
pact> (< "abc" "def")
true<=
x <a[integer,decimal,string,time]>
y <a[integer,decimal,string,time]> → bool
True if X <= Y.
pact> (<= 1 3)
true
pact> (<= 5.24 2.52)
false
pact> (<= "abc" "def")
truepact> (<= 1 3)
true
pact> (<= 5.24 2.52)
false
pact> (<= "abc" "def")
true=
x <a[integer,string,time,decimal,bool,[<l>],object:<{o}>,keyset,guard,module{}]>
y <a[integer,string,time,decimal,bool,[<l>],object:<{o}>,keyset,guard,module{}]>
→ bool
Compare alike terms for equality, returning TRUE if X is equal to Y. Equality comparisons will fail immediately on type mismatch, or if types are not value types.
pact> (= [1 2 3] [1 2 3])
true
pact> (= 'foo "foo")
true
pact> (= { 'a: 2 } { 'a: 2})
truepact> (= [1 2 3] [1 2 3])
true
pact> (= 'foo "foo")
true
pact> (= { 'a: 2 } { 'a: 2})
true>
x <a[integer,decimal,string,time]>
y <a[integer,decimal,string,time]> → bool
True if X > Y.
pact> (> 1 3)
false
pact> (> 5.24 2.52)
true
pact> (> "abc" "def")
falsepact> (> 1 3)
false
pact> (> 5.24 2.52)
true
pact> (> "abc" "def")
false>=
x <a[integer,decimal,string,time]>
y <a[integer,decimal,string,time]> → bool
True if X >= Y.
pact> (>= 1 3)
false
pact> (>= 5.24 2.52)
true
pact> (>= "abc" "def")
falsepact> (>= 1 3)
false
pact> (>= 5.24 2.52)
true
pact> (>= "abc" "def")
false^
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
Raise X to Y power.
pact> (^ 2 3)
8pact> (^ 2 3)
8abs
x decimal → decimal
x integer → integer
Absolute value of X.
pact> (abs (- 10 23))
13pact> (abs (- 10 23))
13and
x bool y bool → bool
Boolean logic with short-circuit.
pact> (and true false)
falsepact> (and true false)
falseand?
a x:<r> -> bool b x:<r> -> bool value <r>
→ bool
Apply logical 'and' to the results of applying VALUE to A and B, with short-circuit.
pact> (and? (> 20) (> 10) 15)
falsepact> (and? (> 20) (> 10) 15)
falseceiling
x decimal prec integer → decimal
x decimal → integer
Rounds up value of decimal X as integer, or to PREC precision as decimal.
pact> (ceiling 3.5)
4
pact> (ceiling 100.15234 2)
100.16pact> (ceiling 3.5)
4
pact> (ceiling 100.15234 2)
100.16dec
x integer → decimal
Cast an integer to a decimal value of integer X as decimal.
pact> (dec 3)
3.0pact> (dec 3)
3.0exp
x <a[integer,decimal]> → <a[integer,decimal]>
Exp of X.
pact> (round (exp 3) 6)
20.085537pact> (round (exp 3) 6)
20.085537floor
x decimal prec integer → decimal
x decimal → integer
Rounds down value of decimal X as integer, or to PREC precision as decimal.
pact> (floor 3.5)
3
pact> (floor 100.15234 2)
100.15pact> (floor 3.5)
3
pact> (floor 100.15234 2)
100.15ln
x <a[integer,decimal]> → <a[integer,decimal]>
Natural log of X.
pact> (round (ln 60) 6)
4.094345pact> (round (ln 60) 6)
4.094345log
x <a[integer,decimal]> y <a[integer,decimal]>
→ <a[integer,decimal]>
x <a[integer,decimal]> y <b[integer,decimal]>
→ decimal
Log of Y base X.
pact> (log 2 256)
8pact> (log 2 256)
8mod
x integer y integer → integer
X modulo Y.
pact> (mod 13 8)
5pact> (mod 13 8)
5not
x bool → bool
Boolean not.
pact> (not (> 1 2))
truepact> (not (> 1 2))
truenot?
app x:<r> -> bool value <r> → bool
Apply logical 'not' to the results of applying VALUE to APP.
pact> (not? (> 20) 15)
falsepact> (not? (> 20) 15)
falseor
x bool y bool → bool
Boolean logic with short-circuit.
pact> (or true false)
truepact> (or true false)
trueor?
a x:<r> -> bool b x:<r> -> bool value <r>
→ bool
Apply logical 'or' to the results of applying VALUE to A and B, with short-circuit.
pact> (or? (> 20) (> 10) 15)
truepact> (or? (> 20) (> 10) 15)
trueround
x decimal prec integer → decimal
x decimal → integer
Performs Banker's rounding value of decimal X as integer, or to PREC precision as decimal.
pact> (round 3.5)
4
pact> (round 100.15234 2)
100.15pact> (round 3.5)
4
pact> (round 100.15234 2)
100.15shift
x integer y integer → integer
Shift X Y bits left if Y is positive, or right by -Y bits otherwise. Right shifts perform sign extension on signed number types; i.e. they fill the top bits with 1 if the x is negative and with 0 otherwise.
pact> (shift 255 8)
65280
pact> (shift 255 -1)
127
pact> (shift -255 8)
-65280
pact> (shift -255 -1)
-128pact> (shift 255 8)
65280
pact> (shift 255 -1)
127
pact> (shift -255 8)
-65280
pact> (shift -255 -1)
-128sqrt
x <a[integer,decimal]> → <a[integer,decimal]>
Square root of X.
pact> (sqrt 25)
5.0pact> (sqrt 25)
5.0xor
x integer y integer → integer
Compute bitwise X xor Y.
pact> (xor 127 64)
63
pact> (xor 5 -7)
-4pact> (xor 127 64)
63
pact> (xor 5 -7)
-4|
x integer y integer → integer
Compute bitwise X or Y.
pact> (| 2 3)
3
pact> (| 5 -7)
-3pact> (| 2 3)
3
pact> (| 5 -7)
-3~
x integer → integer
Reverse all bits in X.
pact> (~ 15)
-16pact> (~ 15)
-16