1
2
3
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
|
Icon Programming Language Version 8.6 Help Summaries
Help summaries are available for each of the Icon executable
programs (icont, iconx), and for many aspects of the Icon
language itself.
To see the help summaries, enter one of the following commands:
ihelp icont # Icon translator & linker
ihelp iconx # Icon interpreter
ihelp expressions # summary of expressions & precedence
ihelp functions # summary of functions
ihelp operations # summary of operations
ihelp keywords # list of keywords
ihelp datatypes # list of Icon datatypes
ihelp reserved # list of reserved words
ihelp escapes # list of string escape sequences
ihelp abbreviations # abbreviations used in help files
ihelp <function name> # information on specific function
ihelp about # bibliography and credits for help file
-
abs(N) : N # compute absolute value
Produces the absolute value of N.
-
acos(r1) : r2 # compute arc cosine
Produces the arc cosine of r1 in the range of 0 to pi for r1 in the
range of -1 to 1.
-
any(c,s,i1,i2) : i3 # locate initial character
Succeeds and produces i1 + 1 if s[i1] is in c and i2 > i1, but fails
otherwise.
Defaults:
s &subject
i1 &pos if s defaulted, otherwise 1
i2 0
-
args(p) : i # get number of procedure arguments
Produces the number of arguments for procedure p. For built-in
procedures with a variable number of arguments, the value produced is
-1. For declared procedures with a variable number of arguments, the
value returned is the negative of the number of formal prameters.
-
bal(c1,c2,c3,s,i1,i2) : i3,i4,...,in # locate balanced characters
Generates the sequence of integer positions in s preceding a character
of c1 in s[i1:i2] that is balanced with respect to the characters of c2
and c3, but fails if there is no such position.
Defaults:
c1 &cset
c2 '('
c3 ')'
s &subject
i1 &pos if s defaulted, otherwise 1
i2 0
-
callout(x,x1,x2,...,xn) : xm # call external function
Calls the external function specified by x with arguments x1, x2, ...,
xn. The mechanism for locating the function specified by x is system
dependent.
-
center(s1,i,s2) : s3 # position string at center
Produces a string of size i in which s1 is centered, with s2 used for
padding at left and right as necessary.
Defaults:
i 1
s2 " " (blank)
-
char(i) : s # produce character
Produces a string of length 1 consisting of the character whose
internal representation is i.
-
chdir(s) : n # change directory
Changes the directory to s but fails if there is no such directory
or if the change cannot be made.
-
close(f) : f # close file
Produces f after closing it unless f was opened with the pipe ("p")
option, in which case the integer exit status of the command is
returned.
-
collect(i1,i2) : n # perform garbage collection
Causes a garbage collectionin region i1, requesting i2 bytes of space
in that region. It fails if the requested space is not available. The
regions are identified as follows:
1 Static region
2 String region
3 Block region
If i1 is 0, a collection is done, but no region is identified and i2
has no effect. The value of i2 is ignored for the static region.
Defaults:
i1 0
i2 0
-
copy(x1) : x2 # copy value
Produces a copy of x1 if x1 is a structure; otherwise it produces x1.
-
cos(r1) : r2 # compute cosine
Produces the cosine of r1 in radians.
-
cset(x) # convert to cset
Produces a cset resulting from converting x, but fails if the
conversion is not possible.
-
delay(i) : n # delay execution
Delays execution i milliseconds.
-
delete(X,x) : X # delete element
If X is a set, deletes x from X. If X is a table, deletes the element
for key x from X. Produces X.
-
detab(s1,i1,i2,...,in) : s2 # remove tabs
Produces a string based on s1 in which each tab character is replaced
by one or more blanks. Tab stops are at i1, i2, ..., in, with
additional stops obtained by repeating the last interval.
Default:
i1 9
-
display(i,f) : n # display variables
Writes the image of the current co-expression and the values of the
local variables in the current procedure call. If i > 0, the local
variables in the i preceding procedure calls are displayed as well.
After all local variables are displayed, the values of global variables
are displayed. Output is written to f.
Defaults:
i &level
f &errout
-
dtor(r1) : r2 # convert degrees to radians
Produces the radian equivalent of r1 given in degrees.
-
entab(s1,i1,i2,...,in) : s2 # insert tabs
Produces a string based on s1 in which runs of blanks are replaced by
tabs. Tab stops are at i1, i2, ..., in, with additional stops obtained
by repeating the last interval.
Default:
i1 9
-
errorclear() : n # clear error indication
Clears the indications of the last error.
-
exit(i) # exit program
Terminates the program with exit status i.
Default:
i normal exit (system dependent)
-
exp(r1) : r2 # compute exponential
Produces e raised to the power r1.
-
find(s1,s2,i1,i2) : i3,i4,...,in # find string
Generates the sequence of integer positions in s2 at which s1 occurs as
a substring in s2[i1:i2], but fails if there is no such position.
Defaults:
s2 &subject
i1 &pos if s2 defaulted, otherwise 1
i2 0
-
flush(f) : n # flush I/O buffer
Flushes the input/output buffers for f.
-
function() : s1,s2,...,sn # generate function names
Generates the names of the Icon (built-in) functions.
-
get(L) : x # get value from list
Produces the leftmost element of L and removes it from L, but fails if
L is empty; synonym for pop(L).
-
getenv(s1) : s2 # get value of environment variable
Produces the value of environment variable s1, but fails if the
variable is not set or environment variables are not supported.
-
iand(i1,i2) : i3 # compute bit-wise "and"
Produces the bitwise "and" of i1 and i2.
-
icom(i1) : i2 # compute bit-wise complement
Produces the bitwise complement (1's complement) of i1.
-
image(x) : s # produce string image
Produces a string image of x.
-
insert(X,x1,x2) : X # insert element
If X is a table, inserts the key x1 with value x2 into X. If X is a
set, inserts x1 into X. Produces X.
Default:
x2 &null
-
integer(x) : i # convert to integer
Produces the integer resulting from converting x, but fails if the
conversion is not possible.
-
ior(i1,i2) : i3 # compute bit-wise inclusive "or"
Produces the bitwise inclusive "or" of i1 and i2
-
ishift(i1,i2) : i3 # shift bits
Produces the result of shifting the bits in i1 by i2 positions.
Positive values of i2 shift to the left, negative to the right.
Vacated bit positions are zero-filled.
-
ixor(i1,i2) : i3 # compute bit-wise exclusive "or"
Produces the bitwise exclusive "or" of i1 and i2.
-
key(T) : x1,x2,...,xn # generate keys from table
Generates the keys in table T.
-
left(s1,i,s2) : s3 # position string at left
Produces a string of size i in which s1 is positioned at the left, with
s2 used for padding on the right as necessary.
Defaults:
i 1
s2 " " (blank)
-
list(i,x) : L # create list
Produces a list of size i in which each value is x.
Defaults:
i 0
x &null
-
log(r1,r2) : r3 # compute logarithm
Produces the logarithm of r1 to the base r2.
Default:
r2 e
-
many(c,s,i1,i2) : i3 # locate many characters
Succeeds and produces the position in s after the longest initial sequence
of characters in c in s[i1:i2]. It fails if s[i1] is not in c.
Defaults:
s &subject
i1 &pos if s defaulted, otherwise 1
i2 0
-
map(s1,s2,s3) : s4 # map characters
Produces a string of size *s1 obtained by mapping characters of s1 that
occur in s2 into corresponding characters in s3.
Defaults:
s2 string(&ucase)
s3 string(&lcase)
-
match(s1,s2,i1,i2) : i3 # match initial string
Produces i1 + *s1 if s1 == s2[i1+:*s1], but fails otherwise.
Defaults:
s2 &subject
i1 &pos if s2 defaulted, otherwise 1
i2 0
-
member(X,x) : x # test for membership
If X is a set, succeeds if x is a member of X, but fails otherwise. If
X is a table, succeeds if x is a key of an element in X, but fails
otherwise. Produces x if it succeeds.
-
mmout(x) : n # write text to allocation history
Writes s to the allocation history file. s is given no
interpretation.
-
mmpause(s) : n # write pause to allocation history
Writes s to the allocation history file as a pause point with
identification s.
Default:
s "programmed pause"
-
mmshow(x,s) : n # redraw in allocation history
Specifies redrawing of x in the allocation history file. The color is
defined by s as follows:
"b" black
"g" gray
"w" white
"h" highlight; blinking black and white if possible
"r" normal color
If x is not in an allocated region, has no effect.
Default:
s "r"
-
move(i) : s # move scanning position
Produces &subject[&pos:&pos + i] and assigns i + &pos to &pos, but
fails if i is out of range; reverses assignment to &pos if resumed.
-
name(x) : s # produce name
Produces the name of the variable x. If x is an identifier or a
keyword that is a variable, the name of the identifier or keyword is
produced. If x is a record field reference, the record name and field
name are produced with a separating period. If x is a string, the name
of the string and the subscript range are shown. If x is a subscripted
list or table, the type name followed by the subscripting expression is
produced.
-
numeric(x) : N # convert to numeric
Produces an integer or real number resulting from converting x, but
fails if the conversion is not possible.
-
open(s1,s2) : f # open file
Produces a file resulting from opening s1 according to options in s2,
but fails if the file cannot be opened. The options are:
"r" open for reading
"w" open for writing
"a" open for writing in append mode
"b" open for reading and writing
"c" create
"t" translate line termination sequences to linefeeds
"u" do not translate line termination sequences to linefeeds
"p" pipe to/from a command -- UNIX
The default mode is to translate line termination sequences to
linefeeds on input and conversely on output. The untranslated mode
should be used when reading and writing binary files.
Default:
s2 "rt"
-
ord(s) : i # produce ordinal
Produces an integer (ordinal) between 0 and 255 that is the internal
representation of the single character in s.
-
pop(L) : x # pop from list
Produces the leftmost element of L and removes it from L, but fails if
L is empty; synonym for get(L).
-
pos(i1) : i2 # test scanning position
Produces &pos if &pos = i1, but fails otherwise.
-
proc(x,i) : p # convert to procedure
Produces a procedure corresponding to the value of x, but fails if x
does not correspond to a procedure. If x is the string name of an
operator, i specifies the number of arguments: 1 for unary (prefix), 2
for binary (infix), and 3 for ternary.
Default:
i 1
-
pull(L) : x # pull from list
Produces the rightmost element of L and removes it from L, but fails if
L is empty.
-
push(L,x) : L # push onto list
Adds x to the left end of L and produces L.
-
put(L,x) : L # put onto list
Adds x to the right end of L and produces L.
-
read(f) : s # read line
Produces the next line from f, but fails on end of file.
Default:
f &input
-
reads(f,i) : s # read string
Produces a string consisting of the next i characters from f, or the
remaining characters of f if fewer remain, but fails on an end of
file. In reads(), unlike read(), line termination sequences have no
special significance. reads() should be used for reading binary data.
Defaults:
f &input
i 1
-
real(x) : r # convert to real
Produces a real number resulting from type conversion of x, but fails
if the conversion is not possible.
-
remove(s) : n # remove file
Removes (deletes) the file named s, but fails if s cannot be removed.
-
rename(s1,s2) : n # rename file
Renames the file named s1 to be s2, but fails if the renaming cannot be
done.
-
repl(s1,i) : s2 # replicate string
Produces a string consisting of i concatenations of s1.
-
reverse(s1) : s2 # reverse string
Produces a string consisting of the reversal of s.
-
right(s1,i,s2) : s3 # position string at right
Produces a string of size i in which s1 is positioned at the right, with
s2 used for padding on the left as necessary.
Defaults:
i 1
s2 " " (blank)
-
rtod(r1) : r2 # convert radians to degrees
Produces the degree equivalent of r1 given in radians.
-
runerr(i,x) # terminate with run-time error
Terminates program execution with error i and offending value x.
Default:
x no offending value
-
seek(f,i) : f # seek to position in file
Seeks to position i in f, but fails if the seek cannot be performed.
The first byte in the file is at position 1. seek(f,0) seeks to the
end of file f.
-
seq(i1,i2) : i3,i4,... # generate sequence of integers
Generates an endless sequence of integers starting at i1 with
increments of i2.
Defaults:
i1 1
i2 1
-
set(L) : S # create set
Produces a set whose members are the distinct values in the list L.
Default:
L []
-
sin(r1) : r2 # compute sine
Produces the sine of r1 given in radians.
-
sort(X,i) : L # sort structure
Produces a list containing values from X. If X is a list or a set,
sort(X,i) produces the values of X in sorted order. If X is a table,
sort(X,i)produces a list obtained by sorting the elements of X,
depending on the value of i. For Produces a list according to i:
i = (1 | 2) Produces a list of two-element lists of key/value pairs
from X; ordered by keys for i = 1, by values for i =
2.
i = (3 | 4) Produces a list of size 2 * *X with each consecutive
pair of elements consisting of a key and a value from
X; ordered by keys for i = 3, by values for i = 4.
Default:
i 1
-
sortf(X,i) : L # sort list or set by field
Produces a sorted list of the values in X. Sorting is primarily by
type and in most respects is the same as with sort(X,i). However,
among lists and among records, two structures are ordered by comparing
their ith fields. i can be negative but not zero. Two structures
having the equal ith fields are ordered as they would be in regular
sorting, but structures lacking an ith field appear before structures
having them.
Default:
i 1
-
sqrt(r1) : r2 # compute square root
Produces the square root of r1.
-
stop(x1,x2,...,xn) # stop execution
Terminates program execution with an error status after writing strings
x1,x2,...,xn. If xi is a file, subsequent output is to xi. Initial
output is to standard error output.
Default:
xi "" (empty string)
-
string(x) : s # convert to string
Produces a string resulting from converting x, but fails if the
conversion is not possible.
-
system(s) : i # call system function
Calls the C library function "system" to execute s and produces the
resulting integer exit status.
-
tab(i) : s # set scanning position
Produces &subject[&pos:i] and assigns i to &pos, but fails if i is out
of range. It reverses assignment to &pos if resumed.
-
table(x) : T # create table
Produces a table with a default value x.
Default:
x &null
-
tan(r1) : r2 # compute tangent
Produces the tangent of r1 given in radians.
-
trim(s1,c) : s2 # trim string
Produces a string consisting of the characters of s1 up to the trailing
characters contained in c.
Default:
c ' ' (blank)
-
type(x) : s # produce type name
Produces a string corresponding to the type of x.
-
upto(c,s,i1,i2) : i3,i4,...,in # locate characters
Generates the sequence of integer positions in s preceding a character
of c in s[i1:i2]. It fails if there is no such position.
Defaults:
s &subject
i1 &pos if s defaulted, otherwise 1
i2 0
-
variable(s) : x # produce variable
Produces the variable for the identifier or keyword named s, but fails
if there is no such variable. Local identifiers override global
identifiers.
-
where(f) : i # produce position in file
Produces the current byte position in f. The first byte in the file is
at position 1.
-
write(x1,x2,...,xn) : xn # write line
Writes strings x1,x2,...,xn with a line termination sequence added at
the end. If xi is a file, subsequent output is to xi. Initial output
is to standard output.
Default:
xi "" (empty string)
-
writes(x1,x2,...,xn) # write string
Writes strings x1,x2,...,xn without a line termination sequence added
at the end. If xi is a file, subsequent output is to xi. Initial
output is to standard output.
Default:
xi "" (empty string)
-
icont -- Icon translator and linker
icont [option...] file...
-c # translate only (no link)
-o file # name icode file "file"
-s # suppress progress messages
-t # give &trace initial value of -1
-u # issue warnings for undeclared identifiers
See also:
ihelp iconx
-
iconx -- Icon interpreter
The Icon interpreter is normally invoked automatically when the name of
an Icon program is entered as a command, but it can be invoked
explicitly, too.
iconx icode_file_name [arguments for Icon program.]
Shell environment variables recognized by iconx
===============================================
Name Default Description
-------- ------- -----------------------
TRACE 0 Initial value for &trace.
NOERRBUF undefined If set, &errout is not buffered.
STRSIZE 65000 Initial size (bytes) of string region
(strings).
BLOCKSIZE 65000 Initial size (bytes) of block region
(most objects).
COEXPSIZE 2000 Size (long words) of co-expression blocks.
MSTKSIZE 10000 Size (long words) of main interpreter stack.
STATSIZE 20480 Initial size (bytes) of static region
(co-expression blocks).
STATINCR 1/4 of Increment used to expand static region.
STATSIZE
See also:
ihelp icont
-
Expressions shown in order of decreasing precedence. Items in groups
(as separated by empty lines) have equal precedence.
High Precedence Expressions
(expr) # grouping
{expr1;expr2;...} # compound
x(expr1,expr2,...) # invocation
x{expr1,expr2,...} # "
[expr1,expr2,...] # list
expr.F # field reference
expr1[expr2] # subscript
expr1[expr2:expr3] # section
expr1[expr2+:expr3] # "
expr1[expr2-:expr3] # "
Prefix Expressions
not expr # success/failure reversal
| expr # repeated alternation
! expr # element generation
* expr # size
+ expr # numeric value
- expr # negative
. expr # value (dereference)
/ expr # null
\ expr # non-null
= expr # match and tab
? expr # random value
~ expr # cset complement
@ expr # activation
^ expr # refresh
Infix Expressions
expr1 \ expr2 # limitation
expr1 @ expr2 # transmission
expr1 ! expr2 # invocation
expr1 ^ expr2 # power
expr1 * expr2 # product
expr1 / expr2 # quotient
expr1 % expr2 # remainder
expr1 ** expr2 # intersection
expr1 + expr2 # sum
expr1 - expr2 # numeric difference
expr1 ++ expr2 # union
expr1 -- expr2 # cset or set difference
expr1 || expr2 # string concatenation
expr1 ||| expr2 # list concatenation
expr1 < expr2 # numeric comparison
expr1 <= expr2 # "
expr1 = expr2 # "
expr1 >= expr2 # "
expr1 > expr2 # "
expr1 ~= expr2 # "
expr1 << expr2 # string comparison
expr1 <<= expr2 # "
expr1 == expr2 # "
expr1 >>= expr2 # "
expr1 >> expr2 # "
expr1 ~== expr2 # "
expr1 === expr2 # value comparison
expr1 ~=== expr2 # "
expr1 | expr2 # alternation
expr1 to expr2 by expr3 # integer generation
expr1 := expr2 # assignment
expr1 <- expr2 # reversible assignment
expr1 :=: expr2 # exchange
expr1 <-> expr2 # reversible exchange
expr1 op:= expr2 # (augmented assignments)
expr1 ? expr2 # string scanning
expr1 & expr2 # conjunction
Low Precedence Expressions
break [expr] # break from loop
case expr0 of { # case selection
expr1:expr2
...
[default:exprn]
}
create expr # co-expression creation
every expr1 [do expr2] # iterate over generated values
fail # failure of procedure
if expr1 then exp2 [else exp3] # if-then-else
next # go to top of loop
repeat expr # loop
return expr # return from procedure
suspend expr1 [do expr2] # suspension of procedure
until expr1 [do expr2] # until-loop
while expr1 [do expr2] # while-loop
-
Functions and datatypes of arguments and produced values:
abs(N) : N # compute absolute value
acos(r1) : r2 # compute arc cosine
any(c,s,i1,i2) : i3 # locate initial character
args(p) : i # get number of procedure arguments
bal(c1,c2,c3,s,i1,i2) : i3,i4,...,in # locate balanced characters
callout(x,x1,x2,...,xn) : xm # call external function
center(s1,i,s2) : s3 # position string at center
char(i) : s # produce character
chdir(s) : n # change directory
close(f) : f # close file
collect(i1,i2) : n # perform garbage collection
copy(x1) : x2 # copy value
cos(r1) : r2 # compute cosine
cset(x) # convert to cset
delay(i) : n # delay execution
delete(X,x) : X # delete element
detab(s1,i1,i2,...,in) : s2 # remove tabs
display(i,f) : n # display variables
dtor(r1) : r2 # convert degrees to radians
entab(s1,i1,i2,...,in) : s2 # insert tabs
errorclear() : n # clear error indication
exit(i) # exit program
exp(r1) : r2 # compute exponential
find(s1,s2,i1,i2) : i3,i4,...,in # find string
flush(f) : n # flush I/O buffer
function() : s1,s2,...,sn # generate function names
get(L) : x # get value from list
getenv(s1) : s2 # get value of environment variable
iand(i1,i2) : i3 # compute bit-wise "and"
icom(i1) : i2 # compute bit-wise complement
image(x) : s # produce string image
insert(X,x1,x2) : X # insert element
integer(x) : i # convert to integer
ior(i1,i2) : i3 # compute bit-wise inclusive "or"
ishift(i1,i2) : i3 # shift bits
ixor(i1,i2) : i3 # compute bit-wise exclusive "or"
key(T) : x1,x2,...,xn # generate keys from table
left(s1,i,s2) : s3 # position string at left
list(i,x) : L # create list
log(r1,r2) : r3 # compute logarithm
many(c,s,i1,i2) : i3 # locate many characters
map(s1,s2,s3) : s4 # map characters
match(s1,s2,i1,i2) : i3 # match initial string
member(X,x) : x # test for membership
mmout(x) : n # write text to allocation history
mmpause(s) : n # write pause to allocation history
mmshow(x,s) : n # redraw in allocation history
move(i) : s # move scanning position
name(x) : s # produce name
numeric(x) : N # convert to numeric
open(s1,s2) : f # open file
ord(s) : i # produce ordinal
pop(L) : x # pop from list
pos(i1) : i2 # test scanning position
proc(x,i) : p # convert to procedure
pull(L) : x # pull from list
push(L,x) : L # push onto list
put(L,x) : L # put onto list
read(f) : s # read line
reads(f,i) : s # read string
real(x) : r # convert to real
remove(s) : n # remove file
rename(s1,s2) : n # rename file
repl(s1,i) : s2 # replicate string
reverse(s1) : s2 # reverse string
right(s1,i,s2) : s3 # position string at right
rtod(r1) : r2 # convert radians to degrees
runerr(i,x) # terminate with run-time error
seek(f,i) : f # seek to position in file
seq(i1,i2) : i3,i4,... # generate sequence of integers
set(L) : S # create set
sin(r1) : r2 # compute sine
sort(X,i) : L # sort structure
sortf(X,i) : L # sort list or set by field
sqrt(r1) : r2 # compute square root
stop(x1,x2,...,xn) # stop execution
string(x) : s # convert to string
system(s) : i # call system function
tab(i) : s # set scanning position
table(x) : T # create table
tan(r1) : r2 # compute tangent
trim(s1,c) : s2 # trim string
type(x) : s # produce type name
upto(c,s,i1,i2) : i3,i4,...,in # locate characters
variable(s) : x # produce variable
where(f) : i # produce position in file
write(x1,x2,...,xn) : xn # write line
writes(x1,x2,...,xn) # write string
-
Operations and required datatypes
prefix operations
+N : N # compute positive
-N : N # compute negative
~c1 : c2 # compute cset complement
=s1 : s2 # match string in scanning
@C : x # activate co-expression
^C1 : C2 # create refreshed co-expression
*x : i # compute size
?x1 : x2 # generate random value
!x : x1,x2,...,xn # generate values
/x : x # check for null value
\x : x # check for non-null value
.x : x # dereference variable
infix operations
N1 + N2 : N3 # compute sum
N1 - N2 : N3 # compute difference
N1 * N2 : N3 # compute product
N1 / N2 : N3 # compute quotient
N1 % N2 : N3 # compute remainder
N1 ^ N2 : N3 # compute exponential
x1 ++ x2 : x3 # compute cset or set union
x1 -- x2 : x3 # compute cset or set difference
x1 ** x2 : x3 # compute cset or set intersection
s1 || s2 : s3 # concatenate strings
L1 ||| L2 : L3 # concatenate lists
R.F : x # get field of record
x1 @ C : x2 # transmission value to co-expression
x1 & x2 : x2 # evaluate in conjunction
N1 < N2 : N2 # compare numerically
N1 <= N2 : N2 # "
N1 = N2 : N2 # "
N1 >= N2 : N2 # "
N1 > N2 : N2 # "
N1 ~= N2 : N2 # "
s1 << s2 : s2 # compare lexically
s1 <<= s2 : s2 # "
s1 == s2 : s2 # "
s1 >>= s2 : s2 # "
s1 >> s2 : s2 # "
s1 ~== s2 : s2 # "
x1 === x2 : x2 # compare values
x1 ~=== x2 : x2 # "
x1 := x2 : x1 # assign value
x1 op:= x2 : x1 # augmented assignment
x1 :=: x2 : x1 # exchange values
x1 <- x2 : x1 # assign value reversibly
x1 <-> x2 : x1 # exchange values reversibly
-
Keywords
&allocated : i1,i2,i3,i4 # accumulated bytes allocated
# (total,static,string,block)
&ascii : c # cset of ascii characters
&clock : s # current time of day
&collections : i1,i2,i3,i4 # collection count
# (total,static,string,block)
&cset : c # cset of all characters
¤t : C # current co-expression
&date : s # current date
&dateline : s # current date and time
&digits : c # cset of digits 0-9
&e : r # base of natural logarithms, 2.71828...
&error : i # run-time error conversion control
&errornumber : i # run-time error number
&errortext : s # run-time error message text
&errorvalue : x # run-time error offending value
&errout : f # standard error output file
&fail # fails
&features : s1,s2,...,sn # implementation features
&file : s # current source code file name
&host : s # string identifying host computer
&input : f # standard input file
&lcase : c # cset of lower case letters a-z
&letters : c # cset of all letters A-Za-z
&level : i # level of current procedure call
&line : i # current source code line number
&main : C # main co-expression
&null : n # the null value
&output : f # standard output file
&phi : r # The golden ratio, 1.61803...
&pi : r # The value of pi, 3.14159...
&pos : i # string scanning position
&random : i # random number seed
®ions : i1,i2,i3 # current region size
# (static,string,block)
&source : C # activator of current co-expression
&storage : i1,i2,i3 # current bytes allocated
# (static,string,block)
&subject : s # string scanning subject
&time : i # current run time in milliseconds
&trace : i # procedure tracing control
&ucase : c # cset of upper case letters A-Z
&version : s # version of Icon
-
Datatypes
null(n) string(s) co-expression(C) table(T)
integer(i) cset(c) procedure(p) set(S)
real(r) file(f) list(L) <record types>(R)
(see also "Abbreviations")
-
Reserved words
break do global next repeat to
by else if not return until
case end initial of static while
create every link procedure suspend
default fail local record then
-
Escapes in string and cset constants
\b backspace \v vertical tab
\d delete(rubout) \' single quote
\e escape (altmode) \" double quote
\f formfeed \\ backslash
\l linefeed (newline) \ddd octal code
\n newline (linefeed) \xdd hexadecimal code
\r carriage return \^c control code
\t horizontal tab
-
Abbreviations used in Icon help files (and other Icon literature)
c cset C co-expression
f file L list
i integer N numeric (i or r)
n null R record (any record type)
p procedure S set
r real T table
s string X any structure type (L, R, S, or T)
x any type F field of record
-
About the Icon Programming Language Help File
Information used in this help file was obtained from the following
sources:
Griswold, Ralph E. and Madge T. Griswold. "The Icon Programming
Language, Second Edition", Prentice-Hall, Inc., Englewood Cliffs, New
Jersey. 1990.
Griswold, Ralph E. ICONT(1), manual page for "UNIX Programmer's
Manual", Department of Computer Science, The University of Arizona.
1988.
Griswold, Ralph E., Clinton L. Jeffery, Gregg M. Townsend, and
Kenneth Walker. "Version 8.6 of the Icon Programming Language",
IPD188, Department of Computer Science, The University of Arizona.
1992.
Further information on the Icon Programming Language can be obtained
from:
Icon Project
Department of Computer Science
Gould-Simpson Building
The University of Arizona
Tucson, Arizona 85721
U.S.A.
(602) 621-2018
icon-project@cs.arizona.edu (Internet)
...{uunet,allegra,noao}!arizona!icon-project (uucpnet)
April 2, 1992.
|