[comp.lang.misc] Icon, Discussions of languages

nevin1@ihlpf.ATT.COM (00704A-Liber) (01/13/88)

In article <17327@topaz.rutgers.edu> mccarrol@topaz.rutgers.edu (<MC>) writes:
>NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194		writes:
>]My favorite language is Icon :-) :-); this language is VERY loosely typed.  My
>]problems usually don't come about because of type differences (Note:  since it
>]is an interpretive language it does provide the equivalent of runtime checks).
>]This language helps me find my logic bugs (I don't have to worry about silly
>]little things like stacks and lists; they are built into the language.
>]
>]One of the philosophies of Icon is that every function should either return a
>]useful value or fail (i.e., x < y returns y if true; otherwise fails).  Another
>]thing is that functions can return more than one value (generators; i.e.,
>]find(s1,s2) returns all the positions of s1 in s2, and fails when it can't find
>]any more).  I love these concepts; what do others' think?
>]
>	Since I just started reading some info on Icon this week, and
>you seem to be fairly interested in it, I have a couple of questions
>about Icon. It seems to be a language with a lot of excellent concepts
>(generators in particular strike me as being a great idea..). But it
>doesn't seem to me to be terribly useful in general. It seems like it 
>could do awk type jobs extremely well, but from what I've seen, it
>doesn't seem to be terribly good at much else. What is it intended
>for? Is it basically a text processing language, is it just something
>to try out some new ideas, or have I totally missed something?

Icon is not a superset of SNOBOL4, although I understand that most of the
SNOBOL functions can and have been written in Icon.  It is, however, very good
for string processing.  It is also very good for one-shot programs, since Icon
programs tend to be shorter than in conventional languages and therefore
usually quicker to write.

For the above-stated reasons I (and more which I will mention) I fell that Icon
is very well suited for prototyping.  Since the basic data structures are
already incorporated into the language (such as lists which can be used for
stacks and queues, tables for things like symbol tables, etc.), one can work on
developing better algorithms.  For example, if I want to save an entire stack I
can just push it on to a different stack -- Icon doesn't care.  Since Icon does
all the storage management for me, I can worry about issues like performance
and higher-level storage management (i.e., do I need to keep two separate
copies of the data?).  It is much easier for me to tweak one or two lines of
code in Icon than to tweak the 100 or 200 equivalent lines of code in a
conventional language.

Also, Icon is very portable, since all the current (Version 6) implementations
are derived from the same C source code (available in the PD from the U of
Arizona, BBS: (602) 621-2283).  It is 'compiled' into 'icode' (a
pseudo-assembly language) and then interpreted by the Icon interpreter.  (Note:
this makes Icon run much slower than conventional languages.)

BTW, during my sophomore year of college we had to implement a compiler in
Icon (hi, Prof. Kenevan :-)).  I got it done in 600 lines of code, and that was
w/o really using things like generators to their full extent.  If we had to do
it in Pascal, it probably would have taken 6000+ to do the same thing.
Also, in response to a programming contest, I implemented a program to do
'infinite' (the CS meaning of the word, not the REAL meaning :-)) integer
precision multiplication and the 'power' function.  It took about 100 lines of
code, with typical precedures being uner 5 lines.  Also, it only took about an
hour to develop.  I hate to think how long and complex this would have been in
a language like Modula-2 :-).
-- 
 _ __			NEVIN J. LIBER	..!ihnp4!ihlpf!nevin1	(312) 510-6194
' )  )				"The secret compartment of my ring I fill
 /  / _ , __o  ____		 with an Underdog super-energy pill."
/  (_</_\/ <__/ / <_	These are solely MY opinions, not AT&T's, blah blah blah