Note that ISETL is case sensitive. In other words MIDPOINT, MidPoint, and midpoint are three different identifiers.
ISETL prompts the user for input by displaying a > (greater than). A >> double-prompt means the last statement or function definition is not complete and ISETL expects more.
User statements must end with a ; (semicolon).
ISETL directives begin with an ! (exclamation point) and do not end with a semicolon. e.g. !setrandom off or !setrandom on
|
> 93.52 * 7; 654.640; > x := 5; > x + 7; 12; > |
Ask ISETL 93.52 times 7 ISETL displays result Assign 5 to x. Ask ISETL x+7 ISETL displays result ISETL prompt |
|
> y := 173 >> ; > |
Assign 173 to y. >> prompt means ISETL expects more, so we supply the missing semicolon. |
|
> $ This line is a comment > |
Everything after a $ is a comment and ignored. |
|
> S := {5, 10..25}; > S; {15, 25, 5, 20, 10}; > S; #S; T; {15, 20, 10, 5, 25}; 5; OM; > |
Define S as a set Display S (note sets have no ordering) ISETL's output displaying S Display S, number of elements of S, T Output displaying x Output displaying number of elements Output for T (OM means undefined) Output (a prompt to the user) |
|
> y := [1..10]; > |
Define y as an ordered tuple. ISETL acknowledges with a new prompt for input. |
|
> x := 12 mod 5; > x; 2; > X; OM; > s := "Mathematics"; > t := 'Mathematics'; > s; "Mathematics"; > t; "Mathematics"; > s = t; true; > |
Assign a value to x Ask ISETL for x ISETL displays result Ask ISETL for X OM means undefined Assign a string to s Assign a string to t Ask ISETL for s ISETL displays result Ask ISETL for t ISETL displays result Ask if equal ISETL displays result ISETL prompt |
|
> 4 in y; true; > |
Test whether 4 is in the set y. Output, yes, it is. Output a prompt for more input. |
|
> S3 := {[a,b,c] : a,b,c in {1..3} : #{a,b,c} = 3}; > |
The set of all ordered 3-tuples such that each member is a 1, 2, or 3, such that the number of different members is 3. i.e. Set of permutations of 3 things. |
|
> S3; {[2, 1, 3], [2, 3, 1], [1, 3, 2], [1, 2, 3], [3, 2, 1], [3, 1, 2]}; > |
Display the elements of S3. Output from ISETL. Output a prompt |
|
> perm := [2, 1, 3] > perm(1); 2; > perm(2); 1; > perm(3); 3; > perm(4); OM; > |
Define perm to be this 3-tuple. Display the 1st member of the 3-tuple. Output Display the 2nd member of the 3-tuple. Output Display the 3rd member of the 3-tuple. Output Display the 4th member of the 3-tuple. Output (OM means undefined) Output a prompt. |
|
> f := func(x); >> return 3*x**2; >> end; > f(0); f(1); f(2); f(-3); 0; 3; 12; 27; > |
Define f as a function of one variable. Note the >> prompts until we complete the function definition. ISETL >> prompts means it's expecting more. We asked ISETL to display four values: f(0), f(1), etc. ISETL displays them one per line, and finally a new prompt. |
|
> {p | p in {2..20} | (forall divisor in {2..p div 2} | p mod divisor /= 0)}; {17, 19, 7, 11, 13, 2, 5, 3}; > !setrandom off > {p | p in {2..20} | (forall divisor in {2..p div 2} | p mod divisor /= 0)}; {2, 3, 5, 7, 11, 13, 17, 19}; > |
By default !setrandom is on so that sets display
in random order. Display all primes between 2 and 20 (in random order). Then use the !setrandom off directive and do it again. |