- Joy Types / Aggregates
- Joy Types / Char, Truth, File
- Joy Types / Numerics
- Stack Manipulation
- Aggregates / at, of, drop, pair, rest, size, take, unpair, ....
- Aggregates / Tests
- Aggregates / average, flatten, frontlist, insert, delete, variance, ....
- Aggregates / cons and concat
- Aggregates / first, second,...
- Aggregates / merge, qsort, reverse, transpose, zip
- Aggregates / trees
- Characters
- Logic
- Numerics / Binary
- Numerics / Unary
- Numerics / algorithm: fact, fib, ...
- Numerics / float
- Numerics / random, Maxint
- combinators / Recursive
- combinators / dips
- combinators / apply: i, i2, b, x, infra, cleave,...
- combinators / apply: app, nullary, unary, binary,...
- combinators / branches and loops
- combinators / functionals on aggregates
- files and Streams
- format
- joy / Help and Debug
- joy / Library Loading
- joy / Program: quit, abort, name, body, ...
- std-input and -output
- system
- time and date
Abbreviations A Aggregate: Set, String or List B Boolean: true or false C Character F Float I Integer L List N Number P Program Seq Sequence: String or List Set Set Str String T Tree U User defined symbol X Y Z Anything -> Type specifier => Evaluates to ... Resulting type depends on parameter stack.
Note:
The following descriptions do include a type specification, the definition and/or a describing text and sometimes examples. A type specification like 'I1 I2 -> I3' does not mean there are three different types of integer. The incoming and outgoing values are just enumerated in order to make them addressable by the following text.
[Joy Home Page]
For questions and discussion about JOY please contact the JOY mailing list at concatenative@yahoogroups.com
.
Generated at Monday 11-FEB-02 21:52:12 by Rabbit
.
- list type
-> L
interp.c
The type of lists of values of any type (including lists) or the type of quoted programs which may contain operators or combinators. Literals of this type are written inside square brackets.
[] => []
[ 3 512 -7] => [ 3 512 -7]
[ john mary] => [ john mary]
[ 'A 'C[ 'B]] => [ 'A 'C[ 'B]]
[ dup *] => [ dup *]
- set type
-> Set
interp.c
The type of sets of small non-negative integers. The maximum is platform dependent, typically the range is 0..31. Literals are written inside curly braces.
{} => {}
{ 0} => { 0}
{ 1 3 5} => { 1 3 5}
{ 17 18 19} => { 17 18 19}
- string type
-> Str
interp.c
The type of strings of characters. Literals are written inside double quotes.
Unix style escapes are accepted: \n - newline, \t - tabulator and so on.
"" => ""
"A" => "A"
"hello world" => "hello world"
"123" => "123"
- character type
-> C
interp.c
The type of characters. Literals are written with a single quote. Examples:'A '7 ';
and so on. Unix style escapes are allowed.
'a => 'a
'0 => '0
'# => '#
- file type
-> STREAM
interp.c
The type of references to open I/O streams, typically but not necessarily files. The only literals of this type are stdin stdout and stderr.
stdin => file type
- truth value type
-> B
interp.c
The logical type or the type of truth values. It has just two literals: true and false.
true => true
false => false
- float type
-> F
interp.c
The type of floating-point numbers. Literals of this type are written with embedded decimal points (like 1.2) and optional exponent specifiers (like 1.5E2).
1.20 => 1.20
- integer type
-> I
interp.c
The type of negative zero or positive integers. Literals are written in decimal notation.
-123 => -123
0 => 0
42 => 42
- dup
X -> X X
interp.c
Pushes an extra copy of X onto stack.
42 dup => 42 42
- dup2
X Y -> X Y X Y
inilib
== dupd dup swapd;
- dupd
Y Z -> Y Y Z
interp.c
As if defined by: dupd == [dup] dip;
- id
->
interp.c
Identity function, does nothing. Any program of the form P id Q is equivalent to just P Q.
- newstack
... ->
inilib
== [] unstack;
Remove the stack and continue with the empty stack.
- pop
X ->
interp.c
Removes X from top of the stack.
1 2 pop => 1
- pop2
Y Z ->
inilib
== pop pop;
- popd
Y Z -> Z
interp.c
As if defined by: popd == [pop] dip;
- rolldown
X Y Z -> Y Z X
interp.c
Moves Y and Z down and moves X up.
- rolldownd
X Y Z W -> Y Z X W
interp.c
As if defined by: rolldownd == [rolldown] dip;
- rollup
X Y Z -> Z X Y
interp.c
Moves X and Y up and moves Z down.
- rollupd
X Y Z W -> Z X Y W
interp.c
As if defined by: rollupd == [rollup] dip;
- rotate
X Y Z -> Z Y X
interp.c
Interchanges X and Z.
- rotated
X Y Z W -> Z Y X W
interp.c
As if defined by: rotated == [rotate] dip;
- stack
.. X Y Z -> .. X Y Z [Z Y X ..]
interp.c
Pushes the stack as a list.
1 2 3 stack => 1 2 3[ 3 2 1]
- swap
X Y -> Y X
interp.c
Interchanges X and Y.
1 2 swap => 2 1
- swapd
X Y Z -> Y X Z
interp.c
As if defined by: swapd == [swap] dip;
- unstack
[X Y ..] -> ..Y X
interp.c
The list [X Y ..] becomes the new stack.
1 2 3[ 'a 'b] unstack => 'b 'a
- at
A I -> X
interp.c
X is the member of A at position I. The first item is at position 0.
[ 1 2 3] 1 at => 2
1[ 1 2 3] of => 2
- drop
A N -> A
interp.c
Result is A with its first N elements deleted.
[ 1 2 3] 2 drop => [ 3]
{ 1 2 3} 2 drop => { 3}
"abc" 2 drop => "c"
- elements
L -> Set
agglib
== {}swap [swons]step;
Returns all members of L, doubles removed. The elements of L must fit the sets range.
[ 1 2 3 1 2 3] elements => { 1 2 3}
- of
I A -> X
interp.c
X is the member of A at position I. The first item is at position 0.
[ 1 2 3] 1 at => 2
1[ 1 2 3] of => 2
- pair
X Y -> L
was: stdlib
== [] cons cons;
"Frank" 17 pair => ["Frank" 17]
- pairlist
X X -> L
agglib
== [] cons cons;
- pairset
I I -> Set
agglib
== {} cons cons;
- pairstring
C C -> Str
agglib
== "" cons cons;
- rest
A -> A
interp.c
Result is the non-empty aggregate A with its first member removed.
- restd
agglib
== [rest] dip;
- set2string
agglib
== ""[[ chr] dip cons] foldr;
- setsize
-> setsize
interp.c
Pushes the maximum number of elements in a set (platform dependent). Typically it is 32 and set members are in the range 0..31.
setsize => 32
- shunt
A A -> A
agglib
== [swons] step;
[][ 1 2 3] shunt => [ 3 2 1]
- size
A -> I
interp.c
Integer I is the size of aggregate A.
- string2set
agglib
== {} swap shunt;
- take
A I -> A
interp.c
Retain just the first I elements of A.
[ 1 2 3] 2 take => [ 1 2]
{ 1 2 3} 2 take => { 1 2}
- unitlist
X -> L
agglib
== [] cons;
1 unitlist => [ 1]
- unitset
I -> Set
agglib
== {} cons;
- unitstring
C -> Str
agglib
== "" const] dip;;
- unpair
A -> X Y
agglib
== uncons uncons pop;
[ 1 2 3 4] unpair => 1 2
- all
A [P:test] -> X
interp.c
Applies test P to members of aggregate A, returns true if all pass.
[ 1 2 3 4][ 5 >] all => false
[ 1 2 3 4][ 5 <] all => true
- compare
A A -> I
interp.c
I (=-1 0 +1) is the comparison of aggregates A1 and A2. The values correspond to the predicates <= = >=.
{ 1 2 3}{ 1 2 3} compare => 0
{ 1 2 3}{ 1 2 4} compare => 4
{ 1 2 3}{ 1 31} compare => -3
"1 2 3"" 1 2 3" compare => 17
1 1 compare => 0
1 10 compare => -9
true false compare => 1
false true compare => -1
- equal
T T -> B
interp.c
(Recursively) tests whether two trees are identical.
[ 1[ 'a[ 5] 2]][ 1[ 'a[ 5] 2]] equal => true
[ 1[ 'a[ 5] 2]][ 1[ 'a[ 6] 2]] equal => false
- has
A X -> B
interp.c
Tests whether aggregate A has X as a member.
[ 1 2 3] 3 has => true
3[ 1 2 3] in => true
- in
X A -> B
interp.c
Tests whether X is a member of aggregate A.
[ 1 2 3] 3 has => true
3[ 1 2 3] in => true
- leaf
X -> B
interp.c
Tests whether X is not a list.
- list
X -> B
interp.c
Tests whether X is a list.
- null
X -> B
interp.c
Tests for empty aggregate X or zero numeric.
0 null => true
[] null => true
{} null => true
"" null => true
- null2
X Y -> B
agglib
== nulld null or;
Tests whether X or Y is null.
- nulld
X Y -> B Y
agglib
== [null] dip;
- set
X -> B
interp.c
Tests whether X is a set.
- small
X -> B
interp.c
X has to be an aggregate or an integer.
Tests whether aggregate X has 0 or 1 members or integer X is 0 or 1.
-1 small => true
0 small => true
1 small => true
2 small => false
[] small => true
[ 1] small => true
[ 1 2] small => false
- some
A [P:test] -> B
interp.c
Applies test to members of aggregate A and returns true if some ( that is one or more ) pass, false if not.
[ 1 2 3][ odd] some => true
[ 2 4 6][ odd] some => false
- string
X -> B
interp.c
Tests whether X is a string.
- average
L -> N
Set -> I
agglib
== [sum] [size] cleave /;
- cartproduct
L L -> L
seqlib
[ 1 2][ 'a 'b] cartproduct => [[ 2 'b][ 2 'a][ 1 'b][ 1 'a]]
- delete
A X -> A
seqlib
Delete first occurance of X out of A.
"delete" 'e delete => "dlete"
- flatten
L -> L
seqlib
== [ null] [] [ uncons] [ concat] linrec;
[[ 1 2 3][ 4 5 6][ 7[ 'a 'b] 9]] flatten => [ 1 2 3 4 5 6 7[ 'a 'b] 9]
- from-to
I I A -> A
C C A -> A
agglib
Create an aggregate containing values from I1 to I2 for sets and lists, from C1 to C2 for strings.
- from-to-list
I I -> L
agglib
== [] from-to;
5 10 from-to-list => [ 5 6 7 8 9 10]
- from-to-set
I I -> Set
agglib
== {} from-to;
5 10 from-to-set => { 5 6 7 8 9 10}
- from-to-string
C C -> Str
agglib
== "" from-to";
'a 'f from-to-string => "abcdef"
- frontlist
A -> A
seqlib
[ 1 2 3] frontlist => [[][ 1][ 1 2][ 1 2 3]]
- frontlist1
A -> A
seqlib
== [ null] [[] cons] [ uncons] [[ cons] map popd[] swons] linrec;
Thompson p 247
[ 1 2 3] frontlist1 => [[][ 1][ 1 2][ 1 2 3]]
- insert
A X -> A
seqlib
Insert X in A at sorted position.
[ 1 2 3 4 1] 3.50 insert => [ 1 2 3 3.50 4 1]
- insert-old
seqlib
Alternative implementation of insert.
- insertlist
L X -> L
seqlib
[ 1 2 3]"X" insertlist => [["X" 1 2 3][ 1"X" 2 3][ 1 2"X" 3][ 1 2 3"X"]]
- orlist
[P] -> [P]
seqlib
== [list] swap disjoin;
Creates a quoted program that evaluates to true, if [P] returns true or X is a list.
[ set] orlist => [[ list][ true][ set] ifte]
{ 1 2 3}[ set] orlist[ sum][] ifte => 6
- orlistfilter
[P] -> [P]
seqlib
== orlist[filter]cons;
[ set] orlistfilter => [[[ list][ true][ set] ifte] filter]
[ 1{ 1 2}[ 99 88]"string"][ set] orlistfilter i => [{ 1 2}[ 99 88]]
- permlist
L -> L
seqlib
Create a list of all permutations of L.
[ 1 2 3] permlist => [[ 1 2 3][ 2 1 3][ 2 3 1][ 1 3 2][ 3 1 2][ 3 2 1]]
- powerlist1
L ->L
seqlib
[ 1 2 3] powerlist1 => [[][ 3][ 2][ 2 3][ 1][ 1 3][ 1 2][ 1 2 3]]
- powerlist2
seqlib
[ 1 2 3] powerlist2 => [[ 1 2 3][ 1 2][ 1 3][ 1][ 2 3][ 2][ 3][]]
- product
L|Set -> N
seqlib
== 1[ *] fold;
Calculate the product of all list or set items.
[ 1 2 3 4 5] product => 120
- restlist
L -> L
seqlib
== [ null] [[] cons] [ dup rest] [ cons] linrec;
[ 1 2 3 4] restlist => [[ 1 2 3 4][ 2 3 4][ 3 4][ 4][]]
- scalarproduct
L L -> N
seqlib
== [ 0] dip2[ null2] [ pop2] [ uncons2[ * +] dip2] tailrec;
Scalarproduct.
[ 2 3 1][ 6 4 12] scalarproduct => 36
- subseqlist
L -> L
seqlib
[ 1 2 3] subseqlist => [[ 1][ 1 2][ 1 2 3][ 2][ 2 3][ 3][]]
- sum
L|Seq -> N
agglib
== 0[+]fold;
Calculate the sum of all list or set items.
[ 1 2 3 4 5] sum => 15
- variance
L -> N
agglib
Calculate variance of lists items.
- concat
A A -> A
interp.c
Evaluates to the concatenation of two aggregates.
[ 1 2 3 4][ 3 4 5 6] concat => [ 1 2 3 4 3 4 5 6]
"abcd""efgh" concat => "abcdefgh"
{ 1 2 3 4}{ 3 4 5 6} concat => { 1 2 3 4 5 6}
- cons
X A -> A
interp.c
Result is A with a new member X (first member for sequences).
9[ 1 2 3] cons => [ 9 1 2 3]
'z"abc" cons => "zabc"
9{ 1 2 3} cons => { 1 2 3 9}
- cons2
X Y A A -> A A
agglib
== swapd cons consd;
Cons 2 values to 2 aggregates.
1 2[][] cons2 => [ 1][ 2]
- consd
agglib
== [cons] dip;
- enconcat
X A1 A2 -> A
interp.c
The concatenation of two aggregates A1 and A2 with X inserted between them.
As if defined byenconcat == swapd cons concat;
0[ 1 2 3 4][ 3 4 5 6] enconcat => [ 1 2 3 4 0 3 4 5 6]
'0"abcd""efgh" enconcat => "abcd0efgh"
0{ 1 2 3 4}{ 3 4 5 6} enconcat => { 0 1 2 3 4 5 6}
- swoncat
A A -> A
inilib
== swap concat;
[ 1 2 3 4][ 3 4 5 6] swoncat => [ 3 4 5 6 1 2 3 4]
"abcd""efgh" swoncat => "efghabcd"
{ 1 2 3 4}{ 3 4 5 6} swoncat => { 1 2 3 4 5 6}
- swons
A X -> A
interp.c
Result is A with a new member X (first member for sequences).
[ 1 2 3] 9 swons => [ 9 1 2 3]
"abc" 'z swons => "zabc"
{ 1 2 3} 9 swons => { 1 2 3 9}
- swons2
A A X Y -> A A
agglib
== swapd swons swonsd;
Swons 2 items to 2 aggregates.
"ext"[ 1 2 3] 't 999 swons2 => "text"[ 999 1 2 3]
- swonsd
agglib
== [swons] dip;
- uncons
A -> X A
interp.c
Returns the first and the rest of non-empty aggregate A.
[ 1 2 3] uncons => 1[ 2 3]
- uncons2
A A -> X Y A A
agglib
== unconsd uncons swapd;
Uncons 2 values from 2 aggregates.
[ 999 1 2 3]"text" uncons2 => 999 't[ 1 2 3]"ext"
- unconsd
agglib
== [uncons] dip;
- unswons
A -> A X
interp.c
Returns the rest and the first of non-empty aggregate A.
[ 1 2 3] unswons => [ 2 3] 1
- unswons2
A A -> A A X Y
agglib
== [ unswons] dip unswons swapd;
Unswons 2 items from 2 aggregates.
[ 1 2 3]"text" unswons2 => [ 2 3]"ext" 1 't
- unswonsd
agglib
== [unswons] dip;
- fifth
A -> A
agglib
== 4 drop first;
- first
A -> X
interp.c
X is the first member of the non-empty aggregate A.
- firstd
agglib
== [first] dip;
- fourth
L -> L
agglib
== 3 drop first;
- second
agglib
== rest first;
- secondd
agglib
== [ secondd] dip;
- third
agglib
== rest rest first;
- thirdd
agglib
== [third] dip;
- merge
Seq Seq -> Seq
seqlib
Concat 2 sorted sequences with sorted result.
[ 1 2 3 4][ 2 3 4 5] merge => [ 1 2 2 3 3 4 4 5]
"aabc""abde" merge => "aaabbcde"
- merge1
Seq Seq -> Seq
seqlib
Concat 2 sorted sequences of sequences with sorted result.
- mk_qsort
L [P] -> L
seqlib
Sort a sequence. The new order is obtained after applying P on every list item.
[[ 1 2 3][ 5][ 700 -699]][ sum] mk_qsort => [[ 700 -699][ 5][ 1 2 3]]
- qsort
A -> A
seqlib
== [small] [] [uncons [>] split] [swapd cons concat] binrec;
Sort a sequence.
"string." qsort => ".ginrst"
[ 1 3 2] qsort => [ 1 2 3]
- qsort1
L -> L
seqlib
== [small] [] [uncons [[first] unary2 >] split] [swapd cons concat] binrec;
Sort a sequence of sequences.
- qsort1-1
L -> L
seqlib
Sort a sequence of sequences. Like qsort1, but different implementation.
- reverse
S -> S
seqlib
== [[]] [""] iflist swap shunts;
Reverse a list or string.
[ 1 2 3] reverse => [ 3 2 1]
- reverselist
L -> L
seqlib
== [] swap shunt ;
Reverse a list.
- reversestring
Str -> Str
seqlib
== "" swap shunt ;
Reverse a string.
- transpose
L -> L
seqlib
Transpose a list of lists.
[[ 1 2 3 4][ 'a 'b 'c]] transpose => [[ 1 'a][ 2 'b][ 3 'c]]
- zip
A A -> A
agglib
== [null2] [pop2 []] [uncons2] [[pairlist] dip cons] linrec;
Zip 2 aggregates into a list of pairs.
[ 1 2 3][ 10 20 30] zip => [[ 1 10][ 2 20][ 3 30]]
- zipwith
A A [P] -> A
was: stdlib
== [[null2] [pop2 []] [uncons2]]dip [dip cons]cons linrec;
Zip 2 aggregates, combining by P.
[ 1 2 3][ 10 20 30][ +] zipwith => [ 11 22 33]
- treeflatten
seqlib
- treereverse
seqlib
- treesample
seqlib
== [[ 1 2[ 3 4] 5[[[ 6] ] ] 7] 8] ;
- treeshunt
seqlib
- treestrip
seqlib
- char
X -> B
interp.c
Tests whether X is a character.
- chr
I -> C
interp.c
C is the character whose Ascii value is integer I (or logical or character).
- ord
C -> I
interp.c
Integer I is the Ascii value of character C (or logical or integer).
- to-lower
C -> C
inilib
== ['a ] [32 +] [] ifte;
- to-upper
C -> C
inilib
== ['a >=] [32 -] [] ifte;
- !=
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X not equal to Y. Also supports float.
- >
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X greater than Y. Also supports float.
Qsort is using > in order to obtain the arrangement.
["dup""dup2""dup3" dup dup2"1""Xx"] qsort => ["1""Xx""dup" dup"dup2" dup2"dup3"]
- >=
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X greater than or equal to Y. Also supports float.
- <
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X less than Y. Also supports float.
- <=
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X less than or equal to Y. Also supports float.
- =
X Y -> B
interp.c
Either both X and Y are numeric or both are strings or symbols. Tests whether X equal to Y. Also supports float.
- and
X Y -> Z
interp.c
Result is the intersection of two sets or the logical conjunction of two truth values.
{ 1 2 3}{ 2 3 4} and => { 2 3}
true false and => false
- boolean
X -> B
inilib
True if X is a logical or a set.
- choice
B X Y -> Z
interp.c
Result is X if B is true and Y if B is false.
- conjoin
[P][P] -> [P]
inilib
== [[false] ifte] cons cons;
[ P1][ P2] conjoin => [[ P1][ P2][ false] ifte]
- disjoin
[P][P] -> [P]
inilib
== [ifte] cons [true] swons cons;
[ P1][ P2] disjoin => [[ P1][ true][ P2] ifte]
- false
-> B
interp.c
Pushes the value false.
false => false
- falsity
-> B
inilib
== false;
- logical
X -> B
interp.c
Tests whether X is a logical.
- negate
X -> [P]
inilib
== [[false] [true] ifte] cons;
[ small] negate => [[ small][ false][ true] ifte]
- not
X -> Y
interp.c
Y is the complement of a set, the logical negation of a truth value.
{ 1 2 3} not => { 0 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31}
true not => false
- or
X Y -> Z
interp.c
Z is the union of two sets, the logical disjunction of two truth values.
{ 1 2 3}{ 2 3 4} or => { 1 2 3 4}
true false or => true
- sequand
X [P:condition][P:if-true] -> ...
inilib
== [pop false] ifte;
- sequor
X [P:condition][P:if-false] -> ...
inilib
== [pop true] swap ifte;
- true
-> B
interp.c
Pushes the value true.
true => true
- truth
-> B
inilib
== true;
- xor
X Y -> Z
interp.c
Z is the symmetric difference of two sets, the logical exclusive disjunction of two truth values.
{ 1 2 3}{ 2 3 4} xor => { 1 4}
true false xor => true
- *
N N -> N
interp.c
Result is the product of two numbers. Also supports float.
- +
N N -> N
interp.c
Result is the adding of two numbers. Also supports float.
- -
N N -> N
interp.c
Numeric N is the result of subtracting two numbers. Also supports float.
- /
N N -> N
interp.c
Result is the (rounded) ratio of two integers or the quotient of two numbers. Also supports float.
10 3 / => 3
10.00 3 / => 3.33
10 3.00 / => 3.33
- abs
N -> N
interp.c
Result is the absolute value (0 1 2..) of number N. Also supports float.
- div
I I -> I I
interp.c
Result are the quotient and remainder of dividing two integers.
7 3 div => 2 1
- ipow
N I -> N
was: stdlib
== 1 rotate [*] cons times;
I times N * N, that is N raised to I-th power.
2 3 ipow => 8
- max
N N -> N
interp.c
Result is the maximum of two numbers. Also supports float.
- min
N N -> N
interp.c
Result is the minimum of two numbers. Also supports float.
- null2
X Y -> B
agglib
== nulld null or;
Tests whether X or Y is null.
- rem
I I -> I
interp.c
Result is the remainder of dividing two integers. Also supports float.
7 3 rem => 1
- even
N -> B
numlib
== 2 rem null;
Tests whether number N is even.
2 even => true
3 even => false
- integer
X -> B
interp.c
Tests whether X is an integer.
- neg
N -> N
interp.c
Result is the negative of a number. Also supports float.
- negative
N -> B
numlib
== 0 <;
- null
X -> B
interp.c
Tests for empty aggregate X or zero numeric.
- nulld
agglib
== [null] dip;
- numerical
X -> B
inilib
True if X is an integer or a float.
- odd
N -> B
numlib
== even not;
Tests whether a number is not even.
2 odd => false
3 odd => true
- positive
N -> B
numlib
== 0 >;
- pred
N -> N
interp.c
Result is the predecessor of numeric N.
2 pred => 1
- sign
I -> I
interp.c
Result is the sign (-1 or 0 or +1) of a number. Also supports float.
-7 sign => -1
0 sign => 0
7.20 sign => 1.00
- small
X -> B
interp.c
X has to be an aggregate or an integer.
Tests whether aggregate X has 0 or 1 members or numeric 0 or 1.
-1 small => true
0 small => true
1 small => true
2 small => false
[] small => true
[ 1] small => true
[ 1 2] small => false
- succ
M -> N
interp.c
Numeric N is the successor of numeric M.
- cube-root
numlib
- deriv
numlib
- fact
numlib
- fib
numlib
- gcd
numlib
- newton
numlib
- prime
numlib
- qroots
F:a F:b F:c ->
numlib
find roots of the quadratic equation with coefficients a b c :
a * X^2 + b * X + c = 0
- use-newton
numlib
- acos
F -> F
interp.c
Result is the arc cosine of F.
- asin
F -> F
interp.c
Result is the arc sine of F.
- atan
F -> F
interp.c
Result is the arc tangent of F.
- atan2
F F -> F
interp.c
Result is the arc tangent of the quotient of two floats.
- ceil
F -> F
interp.c
Result is the float ceiling of F.
1.25 ceil => 2.00
1.52 ceil => 2.00
- celsius
F -> F
numlib
== 32 - 5 * 9 /;
Convert Fahrenheit to Celsius.
- cos
F -> F
interp.c
Result is the cosine of F.
- cosdeg
F -> F
numlib
== radians cos;
Cosine calculated from degree-value.
- cosh
F -> F
interp.c
Result is the hyperbolic cosine of F.
- e
-> F
numlib
== 1.0 exp;
- exp
F -> F
interp.c
Result is e (2.718281828...) raised to the Fth power.
- fahrenheit
F -> F
numlib
== 9 * 5 / 32 +;
Convert Celsius to Fahrenheit.
- float
X -> B
interp.c
Tests whether X is a float.
- floor
F -> F
interp.c
Result is the floor of F.
1.25 floor => 1.00
1.52 floor => 1.00
- frexp
F -> F I
interp.c
Result is the mantissa and the exponent of F. Unless F = 0 0.5 <= abs(F2) < 1.0.
- ldexp
F I -> F
interp.c
Result is F times 2 to the Ith power.
- log
F -> F
interp.c
Result is the natural logarithm of F.
- log10
F -> F
interp.c
F is the common logarithm of F.
- modf
F -> F F
interp.c
Results are the fractional part and the integer part (but expressed as a float) of F.
12.25 modf => 0.25 12.00
- pi
-> F
numlib
== 3.14159265;
- pow
F1 F2 -> F
interp.c
Result is F1 raised to the F2th power.
- radians
N -> F
numlib
== pi * 180 /;
Convert degree to radians.
- sin
F -> F
interp.c
Result is the sine of F.
- sindeg
F -> F
numlib
== radians sin;
Sine calculated from degree-value.
- sinh
F -> F
interp.c
Result is the hyperbolic sine of F.
- sqrt
F -> F
interp.c
Result is the square root of F.
- tan
F -> F
interp.c
Result is the tangent of F.
- tandeg
F -> F
numlib
== radians tan;
Tangent calculated from degree-value.
- tanh
F -> F
interp.c
Result is the hyperbolic tangent of F.
- trunc
F -> I
interp.c
Result is an integer equal to the float F truncated toward zero.
1.25 trunc => 1
1.52 trunc => 1
- maxint
-> maxint
interp.c
Pushes largest integer (platform dependent). Typically it is 32 bits.
2147483647 => 2147483647
- rand
-> I
interp.c
I is a random integer.
- srand
I ->
interp.c
Sets the random integer seed to integer I.
- binrec
[P:condition] [P:if-true] [P:R1] [P:R2] -> ...
interp.c
Executes P:condition. If that yields true executes P:if-true.
Else uses P:R1 to produce two intermediates, recurses on both and then executes P:R2 to combines their results.
[ 1 3 5 2 4][ small][][ uncons[ >] split][ enconcat] binrec => [ 1 2 3 4 5]
- condlinrec
[ [C1] [C2] .. [P:default] ] -> ...
interp.c
Each[Ci]
is of the forms[[P:condition] [P:if-true]]
or[[P:condition] [P:R1] [P:R2]]
.
Tries each P:condition. If that yields true and there is just a P:if-true executes that and exits.
If there are P:R1 and P:R2 executes P:R1, recurses and executes P:R2.
Subsequent case are ignored.
If no P:condition yields true then [P:default] is used. It is of the forms [[T]] or [[R1] [R2]].
For the former executes T.
For the latter executes R1, recurses and executes R2.
- genrec
[P:condition] [P:if-true] [P:R1] [P:R2] -> ...
interp.c
Executes P:condition. If that yields true executes P:if-true.
Else executes P:R1 and then
[[P:condition] [P:if-true] [P:R1] [P:R2] genrec] P:R2
.
- linrec
[P:condition] [P:if-true] [P:R1] [P:R2] -> ...
interp.c
Executes P:condition. If that yields true executes P:if-true. Else executes P:R1, recurses and executes P:R2.
1[ 1 2 3 4 5][ null][ pop][ uncons][ *] linrec => 120
- primrec
X [P:initial] [P:combine] -> X
interp.c
Executes P:initial to obtain an initial value.
If X is an integer uses increasing positive integers from 1 up to X and combines by P:combine for new X.
For aggregate X uses successive members and combines by P:combine for new X.
5[ 1][ *] primrec => 120
[ 1 2 3 4 5][ 1][ *] primrec => 120
- tailrec
[P:condition] [P:if-true] [P:R1] -> ...
interp.c
Executes P:condition. If that yields true executes P:if-true.
Else executes P:R1 and recurses.
1[ 1 2 3 4 5][ null][ pop][ uncons[ *] dip] tailrec => 120
- treegenrec
T [P:O1] [P:O2] [P:C] -> ...
interp.c
T is a tree. If T is a leaf executes P:O1.
Else executes P:O2 and then
[[P:O1] [P:O2] [P:C] treegenrec] P:C
.
- treerec
T [P:O] [P:C] -> ...
interp.c
T is a tree. If T is a leaf executes P:O.
Else executes[[O] [C] treerec] C
.
- dip
X [P] -> ... X
interp.c
Saves X, executes P and pushes X back.
1 2 3["diver"] dip => 1 2"diver" 3
- dip2
X Y [P] -> ... X Y
inilib
== [dip] cons dip;
Saves X and Y, executes P and restores X and Y.
Equivalent to dipd.
1 2 3["diver"] dip2 => 1"diver" 2 3
- dip3
X Y Z [P] -> ... X Y Z
inilib
== [dip2]cons dip;
Saves X Y Z, executes P and restores X Y Z.
1 2 3["diver"] dip3 => "diver" 1 2 3
- dipd
X Y [P] -> ... X Y
inilib
== [dip] cons dip;
Saves X and Y, executes P and restores X and Y.
Equivalent to dip2.
1 2 3["diver"] dipd => 1"diver" 2 3
- all
A [P:test] -> X
interp.c
Applies test P to members of aggregate A, returns true if all pass.
[ 1 2 3 4][ 5 >] all => false
[ 1 2 3 4][ 5 <] all => true
- b
[P] [P] -> ...
was: stdlib
== [i]dip i;
Executes both quoted programs.
16 2 4[ *][ /] b => 2
- call
Symbol -> ...
inilib
== [] cons i;
Execute the symbol.
1 2"+" intern call => 3
- cleave
X [P] [P] -> Y Z
interp.c
Executes both quotations, each with X on top of the stack and each producing one result.
3[ 2 *][ 3 *] cleave => 6 9
- construct
[P:init] [[P1] [P2] ..] -> X1 X2 ..
interp.c
Saves state of stack and then executes [P:init]. Then executes each [Pi] to give Xi pushed onto saved stack.
4 5[ pop][[ 10 +][ 20 +][ 30]] construct => 4 5 14 24 30
- i
[P] -> ...
interp.c
Executes P. So [P] i == P.
[ 1 2 3 *] i => 1 6
- i2
... X [P1][P2] -> ...
inilib
== [dip]dip i;
4 5 6[ *][ +] i2 => 26
- infra
L [P] -> L
interp.c
Using list L as stack, executes P and returns a new list. The first element of L is used as the top of stack, and after execution of P the top of stack becomes the first element of new L.
[ 2 3 4 5][ *] infra => [ 6 4 5]
- some
A [P:test] -> B
interp.c
Applies test to members of aggregate A and returns true if some ( that is one or more ) pass, false if not.
[ 1 2 3][ odd] some => true
[ 2 4 6][ odd] some => false
- x
[P] -> ...
interp.c
Executes P without popping [P]. So [P] x == [P] P.
1 2[ cons] x => 1[ 2 cons]
- app1
X [P] -> X
interp.c
Executes P, pushes result new X on stack without old X.
- app11
X X [P] -> X
interp.c
Executes P pushes result on stack.
- app12
X Y Z [P] -> X X
interp.c
Executes P twice with Y and Z returns 2 values.
- app2
X X [P] -> X X
interp.c
== unary2;
Obsolescent.
- app3
X X X [P] -> X X X
interp.c
== unary3;
Obsolescent.
- app4
X X X X [P] -> X X X X
interp.c
== unary4;
Obsolescent.
- binary
X Y [P] -> Z
interp.c
Executes P which leaves Z on top of the stack. No matter how many parameters this consumes, exactly two are removed from the stack.
1 2 3[ 9] binary => 1 9
1 2 3[ + +] binary => 1 6
1 2 3[] binary => 1 3
1 2 3[ 99 999] binary => 1 999
- nullary
[P] -> X
interp.c
Executes P which leaves X on top of the stack. No matter how many parameters this consumes none are removed from the stack.
1 2 3[ +] nullary => 1 2 3 5
1 2 3[] nullary => 1 2 3 3
1 2 3[ 7 8 9] nullary => 1 2 3 9
- nullary2
X1 X2 [P] -> X1 X2 X:P(rest-of-stack..X1) X:P(rest-of-stack..X2)
inilib
== [nullary]cons dup i2 swapd;
2 3[ 10 +] nullary2 => 2 3 12 13
- ternary
X Y Z [P] -> X
interp.c
Executes P which leaves new X on top of the stack. No matter how many parameters this consumes, exactly three are removed from the stack.
1 2 3[ 9] ternary => 9
1 2 3[ + +] ternary => 6
1 2 3[] ternary => 3
1 2 3[ 99 999] ternary => 999
- unary
X [P] -> Y
interp.c
Executes P which leaves Y on top of the stack. No matter how many parameters this consumes exactly one is removed from the stack.
100 5 1[ * +] unary => 100 5 105
1 2 3[] unary => 1 2 3
1 2 3[ 7 8 9] unary => 1 2 9
- unary2
X Y [P] -> X Y
interp.c
Executes P twice, with X and Y on top of the stack returning new X and new Y.
No matter how many parameters both executions consume, exactly two are removed from the stack.
100 5 1 2[ * +] unary2 => 100 5 105 110
- unary3
X Y Z [P] -> X Y Z
interp.c
Executes P three times, with X Y and Z on top of the stack returning new X, new Y and new Z.
No matter how many parameters the executions consume, exactly tree are removed from the stack.
100 5 1 2 3[ * +] unary3 => 100 5 105 110 115
- unary4
X X X X [P] -> X X X X
interp.c
Executes P four times, with X:1-4 on top of the stack returning four new X.
No matter how many parameters the executions consume, exactly four are removed from the stack.
100 5 1 2 3 4[ * +] unary4 => 100 5 105 110 115 120
- branch
B [P1] [P2] -> ...
interp.c
If B is true then executes P1 else executes P2.
true["true"]["false"] branch => "true"
- case
X [..[Xi Pi].. [P:default]] -> ...
interp.c
Indexing on the value of X, execute the matching Pi or P:default.
1[[ 1"one"][ 2"two"]["default"]] case => "one"
2[[ 1"one"][ 2"two"]["default"]] case => "two"
'D[[ 1"one"][ 2"two"]["default"]] case => 'D"default"
9[[ 1["one"]][ 2"two"][ 9"default"]] case => 9 9"default"
1[[ 1 4 5 *][ 2"two"]["default"]] case => 20
1[[ 1["one"]][ 2"two"]["default"]] case => ["one"]
- cond
[ ...[[Pi:condition] Pi:if-true]... [P:Default]] -> ...
interp.c
Tries each condition. If a condition yields true executes the corresponding if-true and exits.
If no condition yields true executes default.
1[[[ 1 =] pop"One"][[ 2 =] pop"Two"][ pop"Default"]] cond => "One"
2[[[ 1 =] pop"One"][[ 2 =] pop"Two"][ pop"Default"]] cond => "Two"
'D[[[ 1 =] pop"One"][[ 2 =] pop"Two"][ pop"Default"]] cond => "Default"
1[[[ 1 =] pop 4 5 *][[ 2 =] pop"Two"][ pop"Default"]] cond => 20
1[[[ 1 =] pop["One"]][[ 2 =] pop"Two"][ pop"Default"]] cond => ["One"]
- conts
-> [[P] [Q] ..]
interp.c
Pushes current continuations. Buggy, do not use.
- forever
[P] -> ...
inilib
== 2147483647 swap times;
- ifchar
X [P1] [P2] -> ...
interp.c
If X is a character executes P1 else executes P2.
- iffile
X [P1] [P2] -> ...
interp.c
If X is a file executes P1 else executes P2.
- iffloat
X [P1] [P2] -> ...
interp.c
If X is a float executes P1 else executes P2.
- ifinteger
X [P1] [P2] -> ...
interp.c
If X is an integer executes P1 else executes P2.
- iflist
X [P1] [P2] -> ...
interp.c
If X is a list executes P1 else executes P2.
- iflogical
X [P1] [P2] -> ...
interp.c
If X is a logical or truth value executes P1 else executes P2.
- ifset
X [P1] [P2] -> ...
interp.c
If X is a set executes P1 else executes P2.
- ifstring
X [P:if-true] [P:if-false] -> ...
interp.c
If X is a string executes P:if-true else executes P:if-false.
"text"["true"]["false"] ifstring => "text""true"
- ifte
[P:condition] [P:if-true] [P:if-false] -> ...
interp.c
Executes P:condition. If that yields true then executes P:if-true else executes P:if-false.
1234[ 1234 =]["true"]["false"] ifte => 1234"true"
1234[ 1234 =][ pop"true"][ pop"false"] ifte => "true"
1234[ odd][][ 1 +] ifte => 1235
- opcase
X [..[X Xs]..] -> [Xs]
interp.c
Indexing on type of X returns the list [Xs].
1[[ 1"integer"][ 'c"char"][[]"list"]["default"]] opcase => 1["integer"]
2[[ 1"integer"][ 'c"char"][[]"list"]["default"]] opcase => 2["integer"]
'a[[ 1"integer"][ 'c"char"][[]"list"]["default"]] opcase => 'a["char"]
[ 1][[ 1"integer"][ 'c"char"][[]"list"]["default"]] opcase => [ 1]["list"]
{}[[ 1"integer"][ 'c"char"][[]"list"]["default"]] opcase => {}["default"]
- repeat
[P:body][P:condition] -> ...
inilib
== dupd swap[ i] dip2 while;
1[ 1 +][ 10 =] repeat => 2
- times
N [P] -> ...
interp.c
Executes N times P.
- while
[P1] [P2] -> ...
interp.c
While executing P1 yields true executes P2.
1[ 10 =][ 1 +] while => 1
- filter
A [P] -> A
interp.c
Uses test P to filter an aggregate and produces a sametype aggregate.
[ 1 2 3 4][ odd] filter => [ 1 3]
- fold
A X [P] -> X
interp.c
Starting with X sequentially pushes members of aggregate A and combines with binary operator P to produce new X.
[ 1 2 3 4] 0[ +] fold => 10
- fold2
A A X [P] -> A
agglib
== rollupd stepr2;
Starting with X sequentially pushes members of both aggregates and combines with ternary operator P to produce new X.
[ 1 2 3][ 6 7 8][][ pair swons] fold2 => [[ 3 8][ 2 7][ 1 6]]
- foldr
A X [P] -> X
agglib
== [ [[null]]dip (*P1*) []cons [pop]swoncat (*P2*) [uncons] ]dip (*P3*) linrec;
["some ""strings ""to ""concat "]""[ concat] foldr => "some strings to concat "
["some ""strings ""to ""concat "]""[ concat] fold => "some strings to concat "
- foldr2
agglib
== [ [[null2]]dip(* P1 ) []cons[pop2]swoncat(* P2 *) [uncons2](* P3 *) ]dip linrec;
- interleave2
agglib
== [cons cons] foldr2;
- interleave2list
agglib
== [] interleave2;
- map
A [P] -> A
interp.c
Executes P on each member of aggregate A and collects results in a sametype aggregate.
[ 1 2 3 4][ odd] map => [ true false true false]
- mapr
A [P] -> A
agglib
[ 1 2 3 4][ odd] mapr => [ true false true false]
- mapr2
agglib
== [ [null2] [pop2[]] [uncons2] ]dip(* P1 P2 P3 *) [dip cons]cons(* P4 *) linrec;
- pairstep
agglib
== [dupd] swoncat [step pop] cons cons step;
- split
A [P] -> A A
interp.c
Uses test P to split aggregate A into two aggregates of the same type.
[ 1 2 3 4][ odd] split => [ 1 3][ 2 4]
- step
A [P] -> ...
interp.c
Sequentially putting members of aggregate A onto stack, executes P for each member of A.
[ 1 2 3 4][ odd] step => true false true false
- step2
A A [P] -> ...
was: stdlib
== [[dup] dip] swoncat [step pop] cons cons step;
[][ 1 2 3][ 4 5 6 0][ pair swap[ swons] dip] step2 => [[ 3 0][ 3 6][ 3 5][ 3 4][ 2 0][ 2 6][ 2 5][ 2 4][ 1 0][ 1 6][ 1 5][ 1 4]]
- stepr2
A A [P] -> ...
agglib
== [ [null2] [pop pop] ]dip(* P1 P2 *) [dip]cons [dip]cons [uncons2]swoncat(* P3 *) tailrec;
[ 1 2 3][ 4 5 6 0][ pair] stepr2 => [ 1 4][ 2 5][ 3 6]
- treefilter
seqlib
- treemap
seqlib
- treestep
T [P] -> ...
interp.c
Recursively traverses leaves of tree T executes P for each leaf.
- fclose
STREAM ->
interp.c
The stream is closed and removed from the stack.
- feof
STREAM -> STREAM B
interp.c
B is the end-of-file status of stream.
- ferror
STREAM -> STREAM B
interp.c
B is the error status of stream.
- fflush
STREAM -> STREAM
interp.c
Flush stream forcing all buffered output to be written.
- fgetch
STREAM -> STREAM C
interp.c
C is the next available character from stream.
- fgets
STREAM -> STREAM Str
interp.c
Str is the next available line from stream.
- file
Str -> B
interp.c
Tests whether string Str is a file.
- fopen
Str C -> STREAM
interp.c
The file system object with pathname Str is opened with mode C (r w a etc.) and stream object STREAM is pushed.
If the open fails file:NULL is pushed.
- fput
STREAM X -> STREAM
interp.c
Writes X to stream.
- fputch
STREAM C -> STREAM
interp.c
The character C is written to the current position of stream.
- fputchars
STREAM Str -> STREAM
interp.c
The string Str is written without quotes to the current position of stream.
- fputstring
STREAM Str -> STREAM
interp.c
== fputchars;
Temporary alternative to fputchars.
- fread
STREAM I -> STREAM L
interp.c
I bytes are read from the current position of stream and returned as a list of integers.
- fremove
Str -> B
interp.c
The file system object with pathname Str is removed from the file system. B is a boolean indicating success or failure.
- frename
Str1 Str2 -> B
interp.c
The file system object with pathname Str1 is renamed to Str2. B is a boolean indicating success or failure.
- fseek
STREAM I1 I2 -> STREAM
interp.c
Stream is repositioned to position I1 relative to whence-point I2 where I2 = 0 1 2 for beginning current position end respectively?
- ftell
STREAM -> STREAM I
interp.c
I is the current position of stream.
- fwrite
STREAM L -> STREAM
interp.c
A list of integers is written as bytes to the current position of stream.
- format
I C I1 I2 -> Str
interp.c
Result is the formatted version of integer I in mode C with maximum width I1 and minimum width I2.
Possible modes of C:
'd or 'i: decimal
'o: octal
'x or X: hex
12 'd 1 1 format => "12"
12 'd 8 2 format => " 12"
12 'd 8 3 format => " 012"
- formatf
F C I1 I2 -> Str
interp.c
Result is the formatted version of Float F in mode C with maximum width I1 and precision I2.
Possible modes of C:
'e or E: exponential
'f: fractional
'g or G: general
12.89 'e 10 4 formatf => "1.2890e+01"
12.89 'f 10 4 formatf => " 12.8900"
12.89 'g 10 4 formatf => " 12.89"
- strtod
Str -> F
interp.c
String Str is converted to float F.
- strtol
Str I -> I
interp.c
String Str is converted to an integer using base I. If I = 0 assumes base 10 but leading "0" means base 8 and leading "0x" means base 16.
"12" 3 strtol => 5
- __dump
->
interp.c
debugging only: pushes the dump as a list.
- __latex_manual
->
interp.c
Writes manual of all Joy primitives in Latex to output file.
- __memoryindex
->
interp.c
Pushes current value of memory.
- __memorymax
->
interp.c
Pushes value of total size of memory.
- __settracegc
I ->
interp.c
Sets value of flag for tracing garbage collection to I (= 0..5).
- __symtabindex
->
interp.c
Pushes current size of the symbol table.
- __symtabmax
->
interp.c
Pushes value of maximum size of the symbol table.
- _help
->
interp.c
Lists all hidden symbols in library and then all hidden inbuilt symbols.
- autoput
-> I
interp.c
Pushes current value of flag for automatic output.
- echo
-> I
interp.c
Pushes value of echo flag.
- help
->
interp.c
Lists all defined symbols including those from library files. Then lists all primitives of raw Joy.
- helpdetail
L ->
interp.c
Gives brief help on each item of L.
- manual
->
interp.c
Writes manual of all Joy primitives to output file.
- setautoput
I ->
interp.c
Sets value of flag for automatic put to I. The automatic output is executed as soon as Joy is returning to its main execution loop.
0: none
1: execute one put
2: print the stack
- setecho
I ->
interp.c
Sets the value of echo flag for listing of source code lines at stdout while including new files. This results in a mix of code lines with the results these lines produce.
0: no echo
1: echo
2: echo with tab
3: echo with tab and linenumber.
- setundeferror
I ->
interp.c
Sets flag that controls behavior of undefined functions.
0: no error
1: error
- undeferror
-> I
interp.c
Pushes current value of undefined-is-error flag.
- AGGLIB
-> Str
agglib
== "agglib.joy - aggregate library ";
- INILIB
-> Str
inilib
== "inilib.joy - the initial library, assumed everywhere ";
- NUMLIB
-> Str
numlib
== "numlib.joy - numerical library ";
- SEQLIB
-> Str
seqlib
== "seqlib.joy - sequence library, assumes agglib.joy ";
- _agglib
-> B
agglib
== true;
- _inilib
-> B
inilib
- _numlib
-> B
numlib
== true;
- _seqlib
-> B
seqlib
- all-libload
->
inilib
== basic-libload special-libload;
- basic-libload
->
inilib
== "agglib" libload "seqlib" libload "numlib" libload;
- include
Str ->
interp.c
Transfers input to file whose name is specified by Str. On end-of-file returns to previous input file.The specified filename has to provide a filename extension.
- libload
Str ->
inilib
Str specifies a filename without filename extension. If there is no symbol '_filename' defined, the specified file is included.
- special-libload
->
inilib
== "mtrlib" libload "tutlib" libload "lazlib" libload;
- verbose
-> B
inilib
== false;
If verbose is defined as false, there comes no notice if a library has already been loaded.
- abort
->
interp.c
Aborts the execution of current Joy program and returns to Joy main cycle.
- body
U -> [P]
interp.c
Quotation [P] is the body of user-defined symbol U.
[ qsort] first body => [[ small][][ uncons[ >] split][ swapd cons concat] binrec]
- gc
->
interp.c
Initiates garbage collection.
- intern
Str -> U
interp.c
Pushes the item whose name is string Str.
"qsort" intern => qsort
"+" intern => +
1 2"+" intern[] cons i => 3
- name
U -> Str
interp.c
Result is the type of U for literals, the name of U for atoms and definitions.
[ qsort] first name => "qsort"
[ +] first name => "+"
17 name => " integer type"
- quit
->
interp.c
Exit from Joy.
- user
X -> B
interp.c
Tests whether X is a user-defined symbol.
- ask
Str -> X
inilib
== "Please " putchars putchars newline getbr /> ;
- bell
->
inilib
== '\007 putch;
- get
-> X
interp.c
Reads a factor from input and pushes it onto stack.
Note: While including files ("filename.joy" include
) the input into the Joy system is turned to the specified file. In that case get takes its input from the same file.
- newline
->
inilib
== '\n putch;
- put
X ->
interp.c
Writes X to output, pops X off stack.
- putch
C|I ->
interp.c
Writes character C or whose ASCII is I to stdout.
- putchars
Str ->
interp.c
Write Str without quotes to stdout.
- putlist
L ->
seqlib
Print a list user-readable to stdout.
[ [1 2 3] [4 5 6] [7 8 [1 2 3] 9] ] putlist
is printed as
[ [1 2 3] [4 5 6] [7 8 [1 2 3] 9] ]
- putln
X ->
inilib
== put newline;
- putstrings
L ->
inilib
== [putchars] step;
- space
->
inilib
== '\032 putch;
- stderr
-> STREAM
interp.c
Pushes the standard error stream.
- stdin
-> STREAM
interp.c
Pushes the standard input stream.
- stdout
-> STREAM
interp.c
Pushes the standard output stream.
- getenv
Str -> Str
interp.c
Retrieves the value of the environment variable specified by Str.
- system
Str ->
interp.c
Escapes to shell and executes Str. The string may cause execution of another program. When that has finished the process returns to Joy.
- clock
-> I
interp.c
Pushes the integer value of current CPU usage in hundreds of a second.
- gmtime
I -> L
interp.c
Converts a time I into a list L representing universal time:
[year month day hour minute second isdst yearday weekday].
Month is 1 = January ... 12 = December.
isdst is true or false: (daylight savings/summer time).
weekday is 0 = Monday ... 7 = Sunday.
- localtime
I -> L
interp.c
Converts a time I into a list L representing local time:
[year month day hour minute second isdst yearday weekday].
Month is 1 = January ... 12 = December.
isdst is true or false (daylight savings/summer time).
weekday is 0 = Monday ... 7 = Sunday.
- localtime-strings
-> L
inilib
Push a list with current time as follows:
[year month day hour minute second isdst yearday weekday].
localtime-strings => ["2002""FEB""11""21""52""12""false""00041""Monday"]
- mktime
L -> I
interp.c
Converts a list L representing local time into a time I. L has to be in the format generated by localtime.
- months
-> L
inilib
== [ "JAN" "FEB" "MAR" "APR" "MAY" "JUN" "JUL" "AUG" "SEP" "OCT" "NOV" "DEC"] ;
x
- now
-> S
inilib
Push a string containing current time.
now => "21:52:12"
- show-todaynow
->
inilib
== today putchars space now putchars newline;
Print current time and date to std-output.
- strftime
L Str -> Str
interp.c
Formats a list L in the format of localtime or gmtime using a string and pushes the result as string.
- time
-> I
interp.c
Pushes the current time (in seconds since the Epoch).
time => 1013460732
- today
-> Str
inilib
Push a string containing todays date.
today => "Monday 11-FEB-02"
- weekdays
-> L
inilib
== [ "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"]li> ;