From icon-group-sender Thu Jan 2 11:02:16 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 06:35:40 MST To: icon-group@cs.arizona.edu Date: Thu, 02 Jan 1997 11:02:16 -0800 From: Stuart Robinson Message-Id: <32CC0638.692B@ohsu.edu> Organization: Oregon Health Sciences University Sender: icon-group-request@cs.arizona.edu Reply-To: robinstu@ohsu.edu Subject: Help for an Icon Neophyte Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2468 Hello, there. In my last posting, I put out an APB on Corre's book, Icon Programming for Humanists, and received many helpful responses. Thanks. I finally managed to lay my hands on the book. Now that I have started teaching myself Icon, I sometimes find that I reach dead-ends, and there is no one around to steer me in the right direction. So, I thought that I would post problem programs to this newsgroup and hope that some kind soul with more knowledge of Icon would step in and lend a hand. I hope this is appropriate. I am trying to write a program to test Zipf's Law. Zipf was a linguist who observed that when you take the frequency of the words in a text and rank them from most to least frequent that you can then create a log-log plot of frequency against rank and obtain roughly a straight line. The program that I have created thus far is taken almost directly from The Icon Programming Language. Here it is: procedure main() num := 0 wlist := sort(countwords(), 4) while num +:= 1 do { write(left(num||" "||get(wlist), 12), right(get(wlist), 4)) } end procedure countwords() wordcount := table(0) while line := read() do line ? { while tab(upto(&letters)) do wordcount[tab(many(&letters))] +:= 1 } return wordcount end I would like to the program to take a text, convert all of the letters to lowercase (so that "Which" and "which" are not counted as separate words), create a table of all of the words along with their associated frequencies, and to print out the results in ranked fashion. For example, given the following text Which is the dog which can outrace the cars? I would like output more or less as follows (please ignore formatting--I will eventually use entab() for ease of exportation into a program such as Excel): 1 the 2 2 which 2 3 can 1 4 cars 1 5 dog 1 6 is 1 7 outrace 1 I have run into the following problems. First, I was unsuccessful at mapping lowercase letters on to uppercase letters. I assume that I want to use something like map(line, &ucase, &lcase), but where should I insert it? And should the csets &ucase and &lcase be bracketted by single quotations marks? Second, the program seems to hang up at the end. I have no idea why that's happening. Eventually I would like to have the program do the log-log plot, but for now I can use the resulting output for exportation. Thanks in advance for any help you can provide. Stuart Robinson srobinso@reed.edu, robinstu@ohsu.edu From icon-group-sender Fri Jan 3 06:46:00 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:10 MST From: eka@corp.cirrus.com (Eka Laiman) Message-Id: <9701031442.AA08170@ss492.corp.cirrus.com> Subject: Re: Help for an Icon Neophyte To: robinstu@ohsu.edu Date: Fri, 3 Jan 1997 06:46:00 -0800 (PST) Cc: icon-group@cs.arizona.edu In-Reply-To: from "Stuart Robinson" at Jan 2, 97 11:02:16 am X-Mailer: ELM [version 2.4 PL24alpha3] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1651 > I have run into the following problems. First, I was unsuccessful at > mapping lowercase letters on to uppercase letters. I assume that I want > to use something like map(line, &ucase, &lcase), but where should I > insert it? And should the csets &ucase and &lcase be bracketted by > single quotations marks? Second, the program seems to hang up at the > end. I have no idea why that's happening. > > Eventually I would like to have the program do the log-log plot, but for > now I can use the resulting output for exportation. > > Thanks in advance for any help you can provide. May I suggest how I would approach the problem? 1. I would use a table to store the different words. (I do not have my ICON book with me at present - I am out of town), it is done with something like: wordtbl := table(0) 2. Read the text line by line. while (inline := read()) do { // process the line here } // process the result here 3. For each line do the following: 3.1. Map all non alphanumeric characters into "blank" (white space). This can be done by defining the set of non-alphanumeric characters at the outset of the program. Again something like: non_alnum := &cset --- &alnum (I don't remember the exact keywords). 3.2. Map the upper case to the lower case. The mapping process would read like: inline := map(inline, source, dest) 4. Now break "inline" into words and store the count of each word in the "wordtbl". 5. When out of the "while read" loop, do something (again like this): every word := key(wordtbl) do { write(word || "\t" || wordtbl[word]) } -eka- From icon-group-sender Fri Jan 3 09:21:34 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:19 MST Message-Id: <1.5.4.32.19970103152134.0071bfe4@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 03 Jan 1997 09:21:34 -0600 To: icon-group@cs.arizona.edu From: Chris Tenaglia Subject: RE: Help for Icon Neophyte Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1724 I think this does basically the same thing. It solves the case problem. map() coverts to lower case by default. Your code looked more like classical icon. Mine uses 3gl style. This looks more boring, but if I want to diddle the code, then I want the steps separated a little so more can be added later easier. Also think about your procedures. You can chunk things a dozen different ways. Some are far more maintainable. For example, my parse() procedure is general enough that I've re-used it in a 1000 other icon programs. I think each procedure should do one thing. If a procedure does several things it becomes less re-usable and more likely to have side effects if changed. I've read both books. Dr. Corre's book is best read after The Icon Programming Language. Dr. Corre's book helped me understand string scanning. Until then I used string scanning, borrowed from other programs, but didn't know enough to write my own. I still don't get coexpressions and I've been programming icon since 1987. procedure main() count := table(0) while line := map(read()) do { words := parse(line,' ,.;:!?') every count[!words] +:= 1 } result := sort(count) every pair := !result do write(pair[1]," : ",pair[2]) end # # parse a string into a list with respect to a delimiter # procedure parse(line,delims) static chars chars := &cset -- delims tokens := [] line ? while tab(upto(chars)) do put(tokens,tab(many(chars))) return tokens end Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Fri Jan 3 09:28:05 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:33 MST Date: Fri, 3 Jan 1997 09:28:05 -0600 Message-Id: <97010309280532@cowboy.biomed.com> From: graham@cowboy.biomed.com (Steve Graham, extension 5224) To: icon-group@cs.arizona.edu Subject: Re: Help for an Icon Neophyte X-Vms-To: SMTP%"icon-group@cs.arizona.edu" X-Vms-Cc: GRAHAM Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3430 Stuart Robinson wrote: >> Hello, there. >> >> In my last posting, I put out an APB on Corre's book, Icon Programming >> for Humanists, and received many helpful responses. Thanks. I finally >> managed to lay my hands on the book. >> >> Now that I have started teaching myself Icon, I sometimes find that I >> reach dead-ends, and there is no one around to steer me in the right >> direction. So, I thought that I would post problem programs to this >> newsgroup and hope that some kind soul with more knowledge of Icon would >> step in and lend a hand. I hope this is appropriate. >> >> I am trying to write a program to test Zipf's Law. Zipf was a linguist >> who observed that when you take the frequency of the words in a text and >> rank them from most to least frequent that you can then create a log-log >> plot of frequency against rank and obtain roughly a straight line. >> >> The program that I have created thus far is taken almost directly from >> The Icon Programming Language. Here it is: >> >> procedure main() >> >> num := 0 >> >> wlist := sort(countwords(), 4) >> while num +:= 1 do { >> write(left(num||" "||get(wlist), 12), right(get(wlist), 4)) >> } >> end >> >> procedure countwords() >> >> wordcount := table(0) >> >> while line := read() do >> line ? { >> while tab(upto(&letters)) do >> wordcount[tab(many(&letters))] +:= 1 >> } >> >> return wordcount >> >> end >> >> I would like to the program to take a text, convert all of the letters >> to lowercase (so that "Which" and "which" are not counted as separate >> words), create a table of all of the words along with their associated >> frequencies, and to print out the results in ranked fashion. For >> example, given the following text >> >> Which is the dog which can outrace the cars? >> >> I would like output more or less as follows (please ignore formatting--I >> will eventually use entab() for ease of exportation into a program such >> as Excel): >> >> 1 the 2 >> 2 which 2 >> 3 can 1 >> 4 cars 1 >> 5 dog 1 >> 6 is 1 >> 7 outrace 1 >> >> I have run into the following problems. First, I was unsuccessful at >> mapping lowercase letters on to uppercase letters. I assume that I want >> to use something like map(line, &ucase, &lcase), but where should I >> insert it? And should the csets &ucase and &lcase be bracketted by >> single quotations marks? Second, the program seems to hang up at the >> end. I have no idea why that's happening. >> >> Eventually I would like to have the program do the log-log plot, but for >> now I can use the resulting output for exportation. >> >> Thanks in advance for any help you can provide. >> >> Stuart Robinson >> srobinso@reed.edu, robinstu@ohsu.edu >> To fix your problem with lowercase, change the following: while line := read() do line ? { while tab(upto(&letters)) do wordcount[tab(many(&letters))] +:= 1 } to: while (line := read()) do { line ? { while tab(upto(&letters)) do { word := map(tab(many(&letters)),&ucase,&lcase) wordcount[word] +:= 1 } } } I believe that this will also fix the hang up problem. Steve Graham graham@cowboy.biomed.com From icon-group-sender Fri Jan 3 11:52:09 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:42 MST Date: Fri, 3 Jan 1997 11:52:09 -0600 Message-Id: <199701031752.LAA32416@ns1.computek.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Help for an Icon Neophyte To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 761 >procedure countwords() wordcount := table(0) while line := read() do line ? { while tab(upto(&letters)) do wordcount[tab(many(&letters))] +:= 1 } return wordcount end >I have run into the following problems. First, I was unsuccessful at mapping lowercase letters on to uppercase letters. I assume that I want to use something like map(line, &ucase, &lcase), but where should I insert it? And should the csets &ucase and &lcase be bracketted by single quotations marks? You can simply change the appropriate line from the countwords routine as follows: while line := map(read(),&ucase,&lcase) do I expect that you'll receive lots of other replies for the other issues you mentioned. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Fri Jan 3 12:55:35 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:23:53 MST Message-Id: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 3 Jan 1997 12:55:35 -0800 To: icon-group@cs.arizona.edu From: Michael Shafto Subject: Icon --> MIDI Cc: mshafto@mail.arc.nasa.gov Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 571 Does anyone have experience using Icon for music generation, specifically direct generation of MIDI code? (Not interested in layout/typography for musical notation.) Although ... I would be interested in applications of Icon to the *analysis* of MIDI code, come to think of it. Thanks, Mike ----- ----- ----- ----- ----- ----- ----- Mike Shafto (mshafto@mail.arc.nasa.gov) http://olias.arc.nasa.gov/personnel/people/mike_shafto.html Cognition Research Group, Human & Systems Technology Branch NASA-Ames Research Center, AFH: MS 262-2 Moffett Field, CA 94035-1000 From icon-group-sender Sat Jan 4 00:03:06 1997 Received: by cheltenham.cs.arizona.edu; Fri, 3 Jan 1997 17:24:06 MST Date: Sat, 04 Jan 1997 00:03:06 GMT From: ia@stryx.demon.co.uk (Iain Alexander) Reply-To: ia@stryx.demon.co.uk Message-Id: <17370@stryx.demon.co.uk> To: icon-group@cs.arizona.edu Subject: Re: Help for an Icon Neophyte X-Mailer: PCElm 1.10 Lines: 39 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1201 In message <32CC0638.692B@ohsu.edu> Stuart Robinson writes: Well, I'm no expert, but I think I can answer most of your questions. > I assume that I want to use something like map(line, &ucase, &lcase), > but where should I insert it? I suggest either while line := read() do map(line, &ucase, &lcase) ? { ... } or while line := map(read(), &ucase, &lcase) do line ? { ... } > And should the csets &ucase and &lcase be bracketted by > single quotations marks? No, they're (special) variable names. You would use quotation marks if you were defining the sets explicitly e.g. 'abcdefghijklmnopqrstuvwxyz' > Second, the program seems to hang up at the > end. I have no idea why that's happening. The loop > while num +:= 1 do { > write(left(num||" "||get(wlist), 12), right(get(wlist), 4)) > } has no way of terminating. It doesn't care whether the write(...) succeeds or fails. You want it to stop when the get() fails because it's run out of words. I think you can say num := 1 while write(left(num||" "||get(wlist), 12), right(get(wlist), 4)) do { num +:= 1 } -- Iain Alexander ia@stryx.demon.co.uk I.Alexander@bra0125.wins.icl.co.uk From icon-group-sender Fri Jan 3 17:35:32 1997 Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 06:19:53 MST To: icon-group@cs.arizona.edu Date: Fri, 03 Jan 1997 17:35:32 -0800 From: Stuart Robinson Message-Id: <32CDB3E4.3358@ohsu.edu> Organization: Oregon Health Sciences University Sender: icon-group-request@cs.arizona.edu Reply-To: robinstu@ohsu.edu Subject: Another Question from the Neophyte Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1171 Hello. My last posting was promptly responded to. Thanks. I think I've nearly solved all of the problems with the program. Once it is finished, I will post it to the newsgroup for anyone interested. But I've run into a new problem. I have found numerous options for scanning forward in a string, but I haven't found a good way to move backwards, besides first reversing a string and then scanning forward (which is functionally scanning backwards). For example, I created the following little program to extract the names of some functions nestled at the end of some lines of HTML (see input below): ======================= procedure main() while line := reverse(read()) do line ? { write(reverse(tab(upto(" ")))) } end ======================= Example input:
  • convert to cset cset()
  • convert to string string()
  • find string find() etc. Example output: cset() string() find() etc. I did manage to find a solution, but isn't there less cumbersome way of scanning backwards than using reverse()? Thanks in advance. Stuart Robinson srobinso@reed.edu, robinstu@ohsu.edu From icon-group-sender Sat Jan 4 14:27:03 1997 Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 06:20:04 MST To: icon-group@cs.arizona.edu Date: 4 Jan 1997 14:27:03 GMT From: espie@aviso.ens.fr (Marc Espie) Message-Id: <5alpbn$3kd@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu References: <32CDB3E4.3358@ohsu.edu> Subject: Re: Another Question from the Neophyte Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1869 In article <32CDB3E4.3358@ohsu.edu>, Stuart Robinson wrote: >But I've run into a new problem. I have found numerous options for >scanning forward in a string, but I haven't found a good way to move >backwards, besides first reversing a string and then scanning forward >(which is functionally scanning backwards). >For example, I created the following little program to extract the names >of some functions nestled at the end of some lines of HTML (see input >below): > >======================= >procedure main() > >while line := reverse(read()) do >line ? > >{ >write(reverse(tab(upto(" ")))) ^^^ bad code... upto() takes a cset as an argument. You're suffering an hidden conversion string->cset here. Use tab(upto(' ')) instead. >cset() >string() >find() >etc. > >I did manage to find a solution, but isn't there less cumbersome way of >scanning backwards than using reverse()? > You can write reverse functions to upto and friends. This is rather easy using &subject and &pos. The most difficult part is to get the generator part okay. I remember seeing some of Icon's matching functions written in Icon in the Icon book. Some function along these lines should work (untested code...caution): procedure downto(c, s, i1, i2) /i1 = if /s then &pos else *s /s = &subject /i2 = 1 every i := i1 to i2 by -1 do if member(c, s[i]) then suspend i end This might give some performance hit, though. In case this is not acceptable, locating the rtl code for upto and writing a reverse function should be a breeze... even though this is most certainly not suitable for the Icon main distribution. -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Mon Jan 6 09:46:12 1997 Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 13:48:53 MST Date: Mon, 6 Jan 1997 09:46:12 -0500 (EST) From: "Phillip L. Thomas" To: icon-group Cc: snobol4@mercury.dsu.edu Subject: New Library of Congress Catalog Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 702 We are working on a new library catalog retrieval system which you may enjoy using for its own sake (it includes an e-mail facility that sends you your search results-- great for doing research and building bibliographies). Behind the scenes are a number of features which make use of SNOBOL4 and Icon programs: The catalog update system is a SNOBOL4 program which adds, changes, and deletes records in the master files. The "Author Browse" feature searches a file built with an icon parser. The search algorithm itself, while written in C, is based on a search algorithm in the Icon Programming Library. The address for the catalog is: http://lcweb2.loc.gov/catalog -- Phillip Lee Thomas From icon-group-sender Mon Jan 6 11:57:48 1997 Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 13:49:07 MST Date: Mon, 6 Jan 1997 11:57:48 -0600 Message-Id: <199701061757.LAA05351@ns1.computek.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Another Question from the Neophyte To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 715 >... I haven't found a good way to move backwards, besides first reversing a string and then scanning forward (which is functionally scanning backwards). >...I did manage to find a solution, but isn't there less cumbersome way of scanning backwards than using reverse()? There are a variety of kluges which can be used, but honestly I think that often the most effective way simply is to use reverse()... since then everything works in its most natural way. There has been talk of implementing a "&direction" item which could be set either to +1 or -1 to set the scanning direction, but nobody seems to be very excited about that as a general feature. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Mon Jan 6 11:23:17 1997 Received: by cheltenham.cs.arizona.edu; Mon, 6 Jan 1997 13:49:15 MST Date: Mon, 6 Jan 1997 11:23:17 -0800 Message-Id: <199701061923.LAA16481@dfw-ix3.ix.netcom.com> X-Sender: bobalex@popd.ix.netcom.com X-Mailer: Windows Eudora Pro Version 2.1.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: robinstu@ohsu.edu, Icon Group From: Bob Alexander Subject: Re: Another Question from the Neophyte Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1016 >But I've run into a new problem. I have found numerous options for >scanning forward in a string, but I haven't found a good way to move >backwards, besides first reversing a string and then scanning forward >(which is functionally scanning backwards). Here's a way to solve your problem without reverse scanning: procedure main() while line := read() do line ? { every i := 0 | upto(' ') write(line[i + 1:0]) } end Scanning in Icon is most definitely biased toward left-to-right scanning, however the cursor (&pos) can be moved "backward" for certain problems. E.g. the argument to move() can be negative, and tab() can take you toward the left, too. You can also write your own scanning functions to move the cursor backward. This might invoke the wrath of some scanning purists, but it works for some things. However, as shown above, sometimes there is a completely different way of approaching a problem that appears to involve backward scanning. -- Bob Alexander bobalex@ix.netcom.com From icon-group-sender Tue Jan 7 10:18:42 1997 Received: by cheltenham.cs.arizona.edu; Tue, 7 Jan 1997 14:36:02 MST Message-Id: X-Mailer: Novell GroupWise 4.1 Date: Tue, 07 Jan 1997 10:18:42 -0600 From: Charlie Hethcoat To: gep2@computek.net, icon-group@cs.arizona.edu Subject: Another Question from the Neophyte -Reply Mime-Version: 1.0 Content-Type: text/plain Content-Disposition: inline Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1733 The question was how best to scan for the last nonblank token, as I recall. Using reverse() seems the most natural way to do it, if no preceding tokens are needed. Otherwise, a normal left-to-right scan to put tokens on a list (tokenlist) would be best. Then the last token is found in tokenlist[-1]. An Icon library routine written by Ralph Griswold does this neatly. But I do wonder about the implementation of reverse(). If it is a very efficient operation, I'm sure it's the best general solution. I am unfamiliar with the Icon source, so I do not know if it moves a lot of data around, or just resets some pointers and flags to give the appearance of reversing a string. This would be equivalent to the &direction flag that Gordon mentioned, but implicit rather than explicit. So if s := "A line of text" then is reverse(s) literally "txet fo enil A", or more like {HEY, ICONX! SCAN THE FOLLOWING DATA BACKWARDS! pointerto(s)}? Charlie Hethcoat >>> 1997 Jan 06, 11:57am >>> >... I haven't found a good way to move backwards, besides first reversing a string and then scanning forward (which is functionally scanning backwards). >...I did manage to find a solution, but isn't there less cumbersome way of scanning backwards than using reverse()? There are a variety of kluges which can be used, but honestly I think that often the most effective way simply is to use reverse()... since then everything works in its most natural way. There has been talk of implementing a "&direction" item which could be set either to +1 or -1 to set the scanning direction, but nobody seems to be very excited about that as a general feature. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Tue Jan 7 14:01:06 1997 Received: by cheltenham.cs.arizona.edu; Tue, 7 Jan 1997 14:36:15 MST Date: Tue, 7 Jan 1997 14:01:06 -0600 Message-Id: <199701072001.OAA06901@ns1.computek.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Another Question from the Neophyte -Reply To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1522 >The question was how best to scan for the last nonblank token, as I recall. Well, I don't recall the problem being described in QUITE that way... if so, one probably needs to consider things like nesting and embedded (e.g. in quoted strings) commas or spaces... forcing characters and all the other minutae. >Using reverse() seems the most natural way to do it, if no preceding tokens are needed. It actually works quite well, even IF preceding tokens are needed. You just get them AFTER the "last" one, rather than before it. >Otherwise, a normal left-to-right scan to put tokens on a list (tokenlist) would be best. I tend to avoid that kind of thing since I think it's rather contrary to the spirit of ICON... rather more the way you'd do things in C (which isn't necessarily BAD per se, but it means you're thinking about things in the old-fashioned knit-one-perl-two paradigms). > But I do wonder about the implementation of reverse(). If it is a very efficient operation, I'm sure it's the best general solution. I am unfamiliar with the Icon source, so I do not know if it moves a lot of data around, or just resets some pointers and flags to give the appearance of reversing a string. It's a pretty safe guess that it actually creates an inverted copy of the string. This ought to be done efficiently enough (especially when compared to the OTHER functions your Icon code calls up!) that one needn't worry a great deal about it. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Thu Jan 9 22:56:27 1997 Received: by cheltenham.cs.arizona.edu; Fri, 10 Jan 1997 10:16:49 MST Message-Id: <199701100408.XAA21753@server01.ilap.com> From: "Steve Pritchard" To: "Icon Group" Subject: ICON pgmrs needed in Toronto Area Date: Thu, 9 Jan 1997 22:56:27 -0500 X-Msmail-Priority: Normal X-Priority: 3 X-Mailer: Microsoft Internet Mail 4.70.1155 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 577 We have immediate contract or employment positions available to persons with the right qualifications. These include: (1) Good working knowledge of ICON. (2) Mastery of at least one other major programming language. (3) Computer science or equivalent background. (4) Work experience. Initially we would prefer people in the Toronto area. Later, other positions may open up. Please send to the above email address a resume (attached if you wish, WORD format preferred, RTF or text as a second choice). State your availability. Steve Pritchard Concorde Software Inc. From icon-group-sender Tue Jan 14 02:12:47 1997 Received: by cheltenham.cs.arizona.edu; Tue, 14 Jan 1997 08:19:43 MST Date: Tue, 14 Jan 1997 02:12:47 -0800 (PST) From: Kevin Trung Tran Reply-To: Kevin Trung Tran To: icon-group@cs.arizona.edu Subject: text editor pack Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 754 Hi, I'm a first time icon user and am having problem figuring out the sample downloaded packet. I've downloaded the gipl.tar and untarred it etc. I enter into the directory gpacks/ged/ which is supposed to be a sample text editor program. When I try to use the make file provided, I received a "cannot resolve reference to file 'io.u1' " which I've noticed that this file was not created at all. Please explain to me the problem here. Also, since this program is graphic-based (I think), I'm not too familiar with setting up my unix and dos to run in graphic mode. What do I have to set up to execute this sample text editing program and commands such as WOpen()? Any assistance would be greatly appreciated. Thank you. Kevin ttran@cs.ucr.edu From icon-group-sender Fri Jan 17 04:23:10 1997 Received: by cheltenham.cs.arizona.edu; Tue, 21 Jan 1997 10:29:28 MST To: icon-group@cs.arizona.edu Date: Fri, 17 Jan 1997 04:23:10 -0800 From: Brian Tiffin Message-Id: <32DF6F2E.68D4@trytel.com> Organization: B.W. Tiffin Enterprises Inc. Sender: icon-group-request@cs.arizona.edu Subject: y2k Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 687 Hi, Anyone working with Icon dealing with the Year 2000 problem (yet)? I have a feeling that Icon could be a key tool in tracking down your weirder date references and getting a handle on data flow tracing. Has anyone ever drawn up industrial strength recognizers for COBOL say? Or your various assemblers that will no doubt be getting a good dusting off? Etc... Just curious. And always appreciative of the great guys and gals of the Icon project. Just itchin' to put this beauty tool to work on a job that will get Icon some of the recognition it deserves. I think it may save a few butts. Umm, Icon IS y2k safe, right? Thanks, Brian Tiffin From icon-group-sender Tue Jan 21 10:50:03 1997 Received: by cheltenham.cs.arizona.edu; Tue, 21 Jan 1997 10:30:07 MST Sender: vinsone@infi.net Message-Id: <32E4E5AB.50AD8616@atlas.vcu.edu> Date: Tue, 21 Jan 1997 10:50:03 -0500 From: Eric Vinson X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.18 i486) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Subject: Marching Window Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 763 Hello, Ive got a pesky little problem....I have a window with a progress indicator that I raise whenever a new file is being processed then lower and set it to be hidden when not in use. So far so good, but upon successive use the y position increases and the window appears lower and lower on the screen. The only time posx and posy attributes are set is when the window is created...these values are not manipulated anywhere else. The only actions performed on the window are : raise, change canvas to normal, lower, change canvas to hidden. Any ideas?? Thanks, Eric --------------------------------- I ain't gonna pay no dollar for no corn muffin that's half dough. --------------------------------- PS - I love your palindromes & Faberisms! From icon-group-sender Tue Jan 21 14:12:56 1997 Received: by cheltenham.cs.arizona.edu; Tue, 21 Jan 1997 12:21:57 MST Date: Tue, 21 Jan 1997 14:12:56 -0400 (AST) From: DA To: icon-group@cs.arizona.edu Subject: Re: y2k In-Reply-To: <32DF6F2E.68D4@trytel.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 286 On Fri, 17 Jan 1997, Brian Tiffin wrote: > > Umm, Icon IS y2k safe, right? > I don't use Icon, but I've been always interested in it but never got enough time. But I wonder what does the y2k problem has to do with Icon? IMHO all prog. languages are y2k safe. Regards, Q. From icon-group-sender Tue Jan 21 09:26:56 1997 Received: by cheltenham.cs.arizona.edu; Wed, 22 Jan 1997 08:48:48 MST Date: Tue, 21 Jan 1997 09:26:56 -0600 Message-Id: <199701211526.JAA31871@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: y2k To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 907 >> Umm, Icon IS y2k safe, right? >I don't use Icon, but I've been always interested in it but never got enough time. That's probably precisely why you NEED to take time to learn it. :-) It ought to SAVE you more time by using it than it TAKES you to learn it. >But I wonder what does the y2k problem has to do with Icon? IMHO all prog. languages are y2k safe. Not necessarily... there are a number of y2k issues, not just at the programming language level. 1) I suspect that some PC BIOSes aren't even y2k safe. 2) I suspect that some versions of MS-DOS aren't y2k safe (and many of the MS-DOS command utilities probably aren't, either). 3) Many languages have runtimes with functions which return the "year" as a two-digit number and/or don't generate the high-order two ASCII digits correctly for the year after 1999 (etc.) Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Wed Jan 22 21:17:41 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 09:24:29 MST X-Authentication-Warning: hill.ucr.edu: joan owned process doing -bs Date: Wed, 22 Jan 1997 21:17:41 -0800 (PST) From: Junrong Yuan X-Sender: joan@hill.ucr.edu Reply-To: Junrong Yuan To: icon-group@cs.arizona.edu Subject: Icon Compiling Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1775 Dear Sirs I got an interesting problem when trying to compile the following short Icon program: ** procedure main() L := [ 1, 2, 3 ]; # Set L to a list of 3 small integers Change_All ( L ); # This procedure does not affect L every write ( ! L ); # Display the values of L Change_One ( L ); # This procedure changes the first element of L every write ( ! L ); # Display the values of L end procedure Change_All ( foo ) # This does not affect the caller's foo... foo := 86; # ...because we are not changing... end # ...a PART of an aggregate procedure Change_One ( foo ) # This procedure affects the caller's foo... foo[1] := 99; # ...because we are changing... end # ...a PART of an aggregate ** When I use icnt -x, the program runs correctly and ouput right results, as the following: -- 1052 > icont test -x Translating: test.icn: main Change_All Change_One No errors Linking: Executing: 1 2 3 99 2 3 hill: /home/csgrads/joan/Class/CS181/ICON/learning while if I try the other way around, first compile it and then execute, it won't give out any output at all! See the following: -- 1053 > test hill: /home/csgrads/joan/Class/CS181/ICON/learning -- I am not sure the reason about this. Am I missing something? I am looking forward to hearing from you. THank you very much! Joan -- Joan Yuan |VOICE : (909)787-2953 Dept. Of Computer Science |FAX : (909)787-4643 University Of California |WWW : http://www.cs.ucr.edu/~joan/ Riverside, CA 92521-0304 |EMAIL : joan@cs.ucr.edu From icon-group-sender Thu Jan 23 09:43:46 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 18:15:51 MST Date: Thu, 23 Jan 1997 09:43:46 -0700 From: Gregg Townsend Message-Id: <9701231643.AA16196@hawk.CS.Arizona.EDU> To: icon-group@cs.arizona.edu, joan@cs.ucr.edu Subject: Re: Icon Compiling Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 521 From: Junrong Yuan When I use icnt -x, the program runs correctly and ouput right results... while if I try the other way around, first compile it and then execute, it won't give out any output at all! See the following: -- 1053 > test "test" is a built-in command in some Unix shells. Try "./test". Gregg Townsend / gmt@CS.Arizona.EDU / +1 520 621 4325 / 32 13 45N 110 57 16W Computer Science / Univ of Arizona / 1040 E 4th St / Tucson AZ 85721-0077 From icon-group-sender Thu Jan 23 08:41:52 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 18:16:14 MST Date: Thu, 23 Jan 1997 08:41:52 -0800 From: kwalker@orville.premenos.com (Ken Walker) Message-Id: <199701231641.IAA01277@varda.premenos.com> Subject: Re: Icon Compiling To: icon-group@cs.arizona.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Md5: q4sabbqlmWbPNpAujr/c2g== Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 630 > Date: Wed, 22 Jan 1997 21:17:41 -0800 (PST) >From: Junrong Yuan ... > When I use icnt -x, the program runs correctly and ouput right > results, as the following: ... > while if I try the other way around, first compile it and then > execute, it won't give out any output at all! See the following: ... Try calling it something other than "test". Are you using Unix? In some shells "test" is a build-in command. Even if it isn't built in, "test" might be found in your path before ".". Alternatively, you can try executing "./test". Ken Walker, kwalker@premenos.com Premenos Coporation, Concord, Ca. 94520 From icon-group-sender Thu Jan 23 09:14:13 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 18:16:32 MST Sender: cary@hpclpax.cup.hp.com Message-Id: <32E79C65.77E5@cup.hp.com> Date: Thu, 23 Jan 1997 09:14:13 -0800 From: Cary Coutant Organization: Hewlett-Packard Co. X-Mailer: Mozilla 3.0Gold (X11; I; HP-UX A.09.05 9000/720) Mime-Version: 1.0 To: Junrong Yuan Cc: icon-group@cs.arizona.edu Subject: Re: Icon Compiling References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 202 The problem is the name of your program -- "test". This is a shell built-in, so you're actually executing the built-in, which does nothing but return an exit status. Try typing "./test". Cary Coutant From icon-group-sender Thu Jan 23 11:29:16 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 18:16:43 MST Message-Id: <1.5.4.32.19970123172916.0073d510@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Thu, 23 Jan 1997 11:29:16 -0600 To: Junrong Yuan , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: Icon Compiling Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2495 This is because 'test' is a unix command that tests for the existence of a file. There's also a unix command : 'which' which you can use to see which program you're running. Try 'which test' or 'which newprogram' to make sure you aren't selecting the name of an already active program. I suppose you could also run your test with ./test Chris. At 09:17 PM 1/22/97 -0800, Junrong Yuan wrote: >Dear Sirs > > I got an interesting problem when trying to compile the following >short Icon program: > >** > procedure main() > L := [ 1, 2, 3 ]; # Set L to a list of 3 small integers > Change_All ( L ); # This procedure does not affect L > every write ( ! L ); # Display the values of L > Change_One ( L ); # This procedure changes the first element of >L > every write ( ! L ); # Display the values of L > end > procedure Change_All ( foo ) # This does not affect the caller's >foo... > foo := 86; # ...because we are not changing... > end # ...a PART of an aggregate > procedure Change_One ( foo ) # This procedure affects the caller's >foo... > foo[1] := 99; # ...because we are changing... > end # ...a PART of an aggregate > >** > > When I use icnt -x, the program runs correctly and ouput right >results, as the following: >-- >1052 > icont test -x >Translating: >test.icn: > main > Change_All > Change_One >No errors >Linking: >Executing: >1 >2 >3 >99 >2 >3 >hill: /home/csgrads/joan/Class/CS181/ICON/learning > > while if I try the other way around, first compile it and then >execute, it won't give out any output at all! See the following: >-- >1053 > test >hill: /home/csgrads/joan/Class/CS181/ICON/learning > >-- > > I am not sure the reason about this. Am I missing something? I am >looking forward to hearing from you. > > THank you very much! > > Joan > >-- > >Joan Yuan |VOICE : (909)787-2953 >Dept. Of Computer Science |FAX : (909)787-4643 >University Of California |WWW : http://www.cs.ucr.edu/~joan/ >Riverside, CA 92521-0304 |EMAIL : joan@cs.ucr.edu > > > > > > > > > Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Thu Jan 23 10:18:54 1997 Received: by cheltenham.cs.arizona.edu; Thu, 23 Jan 1997 18:17:09 MST X-Authentication-Warning: hill.ucr.edu: joan owned process doing -bs Date: Thu, 23 Jan 1997 10:18:54 -0800 (PST) From: Junrong Yuan X-Sender: joan@hill.ucr.edu To: icon-group@cs.arizona.edu Subject: Thank you very much! Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 551 Dear Sirs Thank you all for your kind reply! The reason was indeed the name conflict with UNIX built-in command 'test'. It now works perfectly after I change the file name. Thank you very much! You have really been a great help! Regards! Joan -- Joan Yuan |VOICE : (909)787-2953 Dept. Of Computer Science |FAX : (909)787-4643 University Of California |WWW : http://www.cs.ucr.edu/~joan/ Riverside, CA 92521-0304 |EMAIL : joan@cs.ucr.edu From icon-group-sender Wed Jan 29 14:50:43 1997 Received: by cheltenham.cs.arizona.edu; Wed, 29 Jan 1997 18:29:34 MST Date: Wed, 29 Jan 1997 14:50:43 -0700 (MST) From: Dan Nicolaescu X-Sender: done@florence To: icon-group@cs.arizona.edu Subject: icon emacs & font-lock Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Length: 268 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Hi all! Has anybody written some font-lock regular expresions to be used for syntax highlighing icon buffers in emacs? I so please send me a pointer to them. All I could find was a hacked version of hilit.el, but I would realy like to use font-lock. Thanks, Dan From icon-group-sender Thu Jan 30 23:17:19 1997 Received: by cheltenham.cs.arizona.edu; Fri, 31 Jan 1997 10:14:31 MST Message-Id: <32F12BFF.1D86@charlie.cns.iit.edu> Date: Thu, 30 Jan 1997 23:17:19 +0000 From: "Thomas W. Christopher" Reply-To: tc@charlie.cns.iit.edu Organization: Illinois Institute of Technology X-Mailer: Mozilla 3.01Gold (WinNT; I) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Cc: tc@charlie.cns.iit.edu Subject: An LL(1) parser generator is available in and for Icon Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2318 Announcing an LL(1) parser generator available in Icon. Here are the specifications in the format of comp.compilers listing of free compilers: language: BNF (Extended) package: TCLL1 version: 1 parts: parser generator (LL(1)), parser, manual, example implementations of EULER and FP author: Thomas W. Christopher location: http://www.iit.edu/~tc/toolsfor.htm description: TCLL1 takes an extended CFG with action symbols,alternation, repetition, and conditional groupings and translates into a file of tables to be read in by the parser. The parser will call the semantics routines named by the action symbols at the appropriate times. The parsers performs panic mode error repair. A 60 page manual is available for TCLL1. Example implementations of EULER and FP using TCLL1 are available. The EULER implementation is accompanied by a 60 page manual including exercises for use in a compiler writing course. conformance: N/A reference: TCLL1 Parser Generator--manual features: The parser generator and parsers are written in the Icon programming language. bugs: none restriction: requires writing in the Icon programming language. requires: -the Icon programming language; -more than 8MB of main memory. ports: UNIX, Windows NT, MS-DOS portability: very high: as portable as Icon. status: under active development. An LL(k) parser generator is in alpha testing. Retargeting the tables to other languages is in progress. discussion: N/A help: author (as time permits) support: author (as time permits) contributions: Tax deductable by check to Department of Computer Science and Applied Mathematics Illinois Institute of Technology IIT Center Chicago IL 60616 USA (Contributions will be matched one-for-one.) announcements: http://www.iit.edu/~tc/toolsfor.htm contact: author updated: 20 Jan. 1997 From icon-group-sender Fri Jan 31 13:16:28 1997 Received: by cheltenham.cs.arizona.edu; Fri, 31 Jan 1997 10:15:07 MST To: icon-group@cs.arizona.edu Date: Fri, 31 Jan 1997 13:16:28 GMT From: feustel@netcom.com (Dave Feustel) Message-Id: Organization: DAFCO Sender: icon-group-request@cs.arizona.edu Subject: Is There An Icon Mailing List? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 214 The complete lack of traffic in this group makes me wonder where all the Icon topics get discussed. Is there an Icon mailing list? -- Dave Feustel http://feustel.mixi.net 219-483-1857 mailto:feustel@netcom.com From icon-group-sender Sat Feb 1 00:35:03 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 08:42:50 MST To: icon-group@cs.arizona.edu Date: 1 Feb 1997 00:35:03 GMT From: Samuel Chan Message-Id: <5cu33n$lll@skylark.ucr.edu> Organization: Dept. Computer Science, UCR Sender: icon-group-request@cs.arizona.edu Subject: HELP!! problem w/ Icon structs Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1229 well, it seems that either people don't know about this newsgroup or Icon just isn't popular. let me try to get something going. i'm new at Icon. right now i can't seem to declare Icon structures (lists, tables, sets, etc.) without errors(Invalid declarations). the text i'm using says to make use of some procedures by linking the appropriate libararies, which i did: link sets link lists . . . mylist:=[a,b,c,d] myset:=set() but the errors persists. i even set my $IPATH to every directory under $ICON_HOME/ipl, but no success. i can't seem to locate any solutions in the texts. i know it's something so small that i'm just overlooking. i'd appreciate any help. thanks!! -- Samuel Chan schan@cs.ucr.edu http://www.cs.ucr.edu/~schan st that has a given value in a certain record field. What shall I do ? I am looking forward to hearing from you! Thank you very much! Sincerely yours Joan Yuan -- Joan Yuan |VOICE : (909)787-2953 Dept. Of Computer Science |FAX : (909)787-4643 University Of California |WWW : http://www.cs.ucr.edu/~joan/ Riverside, CA 92521-0304 |EMAIL : joan@cs.ucr.edu From icon-group-sender Mon Feb 3 08:06:33 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 08:43:11 MST To: icon-group@cs.arizona.edu Date: Mon, 03 Feb 1997 08:06:33 -0700 From: Steve Wampler Message-Id: <32F5FEF9.58E6@gemini.edu> Organization: Gemini 8m Telescopes Project Sender: icon-group-request@cs.arizona.edu References: <5cu33n$lll@skylark.ucr.edu> Subject: Re: HELP!! problem w/ Icon structs Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1819 Samuel Chan wrote: > > well, > > it seems that either people don't know about this newsgroup or Icon > just isn't popular. let me try to get something going. > > i'm new at Icon. right now i can't seem to declare Icon structures > (lists, tables, sets, etc.) without errors(Invalid declarations). the > text i'm using says to make use of some procedures by linking the > appropriate libararies, which i did: > > link sets > link lists > . > . > . > mylist:=[a,b,c,d] > myset:=set() > > but the errors persists. i even set my $IPATH to every directory under > $ICON_HOME/ipl, but no success. i can't seem to locate any solutions in > the texts. i know it's something so small that i'm just overlooking. > i'd appreciate any help. thanks!! The two assignments you give don't need access to any external procedures, so the link commands aren't needed. If you *do* need access to the procedures defined in sets.icn and lists.icn, make sure you have translated the sources into ucode files by running the script Ucode in the mail ipl directory. [Or, just cd ipl/procs and run: icont -c sets lists which will create the ucode files in that directory.] I would (personally) copy the resulting files sets.u1,sets.u2,lists.u1, and lists.u2 into some other directory (the 'lib' directory for Icon springs to mind) and set IPATH to point to that directory. If you done that (the files sets.u? and lists.u? exist in the directory that IPATH points to, then you might check the location of the link directives in your source code - they must be outside any procedure definitions. -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] The Gods that smiled upon your birth are laughing now. -- fortune cookie From icon-group-sender Mon Feb 3 13:40:13 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 13:13:52 MST Message-Id: <32F5EABD.7548@charlie.cns.iit.edu> Date: Mon, 03 Feb 1997 13:40:13 +0000 From: "Thomas W. Christopher" Reply-To: tc@charlie.cns.iit.edu Organization: Illinois Institute of Technology X-Mailer: Mozilla 3.01Gold (WinNT; I) Mime-Version: 1.0 To: joan@cs.ucr.edu Cc: icon-group@cs.arizona.edu Subject: Icon for symbol tables Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 355 Joan, 1) You can put ANY type value in an Icon table. Records are no problem. 2) You'd have to program your own list search, e.g. to look for a record r in list L with a value v in its x field: if r:=!L & r.x===y then #found it else # not found -- -Thomas W. Christopher http://www.iit.edu/~tc tc@charlie.cns.iit.edu From icon-group-sender Mon Feb 3 09:15:14 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 13:13:23 MST Date: Mon, 3 Feb 1997 09:15:14 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: Icon Tables To: joan@cs.ucr.edu Cc: icon-group@cs.arizona.edu Message-Id: In-Reply-To: Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2227 Junrong Yuan wrote: > Dear Sirs > > I have a question about Icon data structure of 'table'. As I > understand it, a table is a 2D array that has a 'key', and a 'value', I > wonder what kind of types that the 'value' field support. To be more > specific, does it support 'record' or 'list'? The Icon book > said it can be used to implement symbol tables, etc. In the case of symbol > table, a key may correspond to several attributes, I am thinking of > putting all the attributes in a record, but I couldn't find a way to store > a record as 'value' filed in a table. In Icon, any variable can hold a value of any type. This includes the entry and value fields of tables, sets, records, lists, whatever. To put a record into a table, just assign an instance of the record to a table entry. E.g: record point(x,y,z) . . . t := table() t["pos1"] := point(1.0,1.0,5.0) Note that the record definition ("record point(x,y,z)") has to appear outside of any procedure definition. > Another question: does list support search functions? If I have > a list of records, and I want to find a given item in the list that has a > given value in a certain record field. What shall I do ? If you are using Icon 9.3 and newer, there is a function sortf() that will sort a list (or table) on the basis of field values of records in the list or table. However, this does sort the entire list instead of searching it, so you would still have to search the list. It's easy to write code to generate all records in a list list of records that have some value in a specific field, e.g.: every (r := !a).z = 5.0 do { # process record r from list a, since it has a z field value of 5.0... ... } or, if you actually need the list index value for some reason: every i := 1 to *a do { if a[i].z = 5.0 then { # process record a[i]... } } If you are always searching the same field each time, you might consider putting the records into a table instead of a list, but this would take a bit more setup. -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] The Gods that smiled upon your birth are laughing now. -- fortune cookie From icon-group-sender Mon Feb 3 10:56:44 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 13:13:43 MST Date: Mon, 3 Feb 1997 10:56:44 -0800 Message-Id: <199702031856.KAA21895@dfw-ix3.ix.netcom.com> X-Sender: bobalex@popd.ix.netcom.com X-Mailer: Windows Eudora Pro Version 2.1.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Junrong Yuan , Icon Group From: Bob Alexander Subject: Re: Icon Tables Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2588 At 03:06 PM 2/2/97 -0800, Junrong Yuan wrote: > I have a question about Icon data structure of 'table'. As I >understand it, a table is a 2D array that has a 'key', and a 'value' That's one way of looking at tables. However, I prefer to think of them as one-dimensional "arrays", with elements indexed by *any* datatype rather than by an integer. The table syntax in Icon supports that mental image by using a "subscripting" notation (myTable["abc"]). >I wonder what kind of types that the 'value' field support. To be more >specific, does it support 'record' or 'list'? The values in tables can be of any Icon datatype, including records, lists, tables, files, what-have-you. For that matter, keys can be of any datatype, too. Strings are probably the most commonly-used, but keys can also be integers, files, etc. Read carefully the rules about the "===" comparison operator to see exactly how keys are determined to be "equal" for various datatypes (for example, lists are "===" only if they are the *same* list, not just a similar list). >The Icon book >said it can be used to implement symbol tables, etc. In the case of symbol >table, a key may correspond to several attributes, I am thinking of >putting all the attributes in a record, but I couldn't find a way to store >a record as 'value' filed in a table. Here's how to do that: - Declare the record. This must be outside of any procedure. record SymTableEntry(field1,field2) # declare the record - Create the table. This must be in a procedure, and should be executed only once. Note that you might want your symbol table to be global, so it should be declared as such. global SymTable # this declaration must be outside of any procedure ... SymTable := table() # this must be in a procedure - Here is the code to create an entry record and add it to the table symbol := "abc" SymTable[symbol] := SymTableEntry(123,456) > Another question: does list support search functions? If I have >a list of records, and I want to find a given item in the list that has a >given value in a certain record field. What shall I do ? There is no list search function in Icon. However, such things can be coded so succinctly in Icon that they really aren't as useful as in some other languages. Here is one compact way to do it: if (foundEntry := !myList).aField == "xyz" then else Hope this helps. -- Bob Alexander bobalex@ix.netcom.com From icon-group-sender Mon Feb 3 16:15:48 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Feb 1997 16:38:28 MST Message-Id: <1.5.4.32.19970203221548.0073d484@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 03 Feb 1997 16:15:48 -0600 To: icon-group@cs.arizona.edu From: Chris Tenaglia Subject: table dimensions Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1031 I've made 2-d tables. The index of a table can be thought of as a database key. n-dimensions can be supported by cleverly constructing the index. Let's say I have x, and y to index a table. If x, and y are integers here are some reference samples. db := table("n/a") ....lotsa code.... db[x || "," || y] := newstuff work := db[x || "," || y] ....more code.... x := hashx(dbkey) y := hashy(dbkey) update(db[x || "," || y]) Obviously, this is just pseudocode, but I've used the methodology to write some small databases. I also used it in graphics to write some 3-d graphics. Then use array[x || "," || y || "," || z] to reference the points in 3-d. Thus you can convert one dimension into N dimensions. Chris. Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Tue Feb 4 08:53:19 1997 Received: by cheltenham.cs.arizona.edu; Thu, 6 Feb 1997 16:31:45 MST To: icon-group@cs.arizona.edu Date: 4 Feb 1997 08:53:19 -0700 From: icon-project@cs.arizona.edu Message-Id: <5d7m1f$i7@cheltenham.CS.Arizona.EDU> Organization: University of Arizona CS Department, Tucson AZ Sender: icon-group-request@cs.arizona.edu Reply-To: icon-project@cs.arizona.edu Subject: Icon Programming Language FAQ Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 14760 Archive-name: comp-lang-icon-faq Posting-Frequency: monthly Frequently Asked Questions About The Icon Programming Language Last updated: December 11, 1996 This FAQ answers various questions about the Icon programming language, ranging from what it is to how you can get it. The master copy of this FAQ is the Web page http://www.cs.arizona.edu/icon/faq.html. Other on-line documentation is available via the main Icon page at http://www.cs.arizona.edu/icon/. This FAQ is written by Ralph Griswold and Gregg Townsend, with help from Cliff Hathaway, Clint Jeffery, and Bob Alexander. * 1. What is Icon? * 2. What is Icon good for? * 3. Where did Icon come from? * 4. What does "Icon" stand for? * 5. On what computers does Icon run? * 6. Who did all these implementations? * 7. Are there other implementations in the works? * 8. What about different versions of Icon? * 9. Which implementations of Icon have graphics/window capabilities? * 10. Where can I get Icon? * 11. Where can I get documentation about Icon? * 12. How do I get started with Icon? * 13. What is the Icon Project? * 14. Where can I find examples of Icon programs? * 15. What is Idol? * 16. How often is material in Icon's FTP area updated? * 17. How do I stay up to date with what's going on with Icon? * 18. Is there a users' group for Icon? * 19. How do I get technical support? * 20. What do I need to run Icon? * 21. Can I build my own implementation of Icon for a new platform? ---------------------------------------------------------------------------- 1. What is Icon? Icon is a very high level general-purpose programming language with extensive features for processing strings (text) and data structures. Icon is an imperative, procedural language with a syntax that is reminiscent of C and Pascal, but its semantics are at a much higher level than those languages. Icon has a novel expression-evaluation mechanism that integrates goal-directed evaluation and backtracking with conventional control structures. It has a string scanning facility for pattern matching that avoids the tedious details usually associated with analyzing strings. Icon's built-in data structures include sets and tables with associative lookup, lists that can be used as vectors or stacks and queues, and records. Icon is a strongly, though not statically, typed language. It provides transparent automatic type conversion. For example, if an integer is used in an operation that requires a string, the integer is automatically converted to a string. Several implementations of Icon have high-level graphics facilities with an easily programmed window interface. Icon manages storage automatically. Objects are created as needed during program execution and space is reclaimed by garbage collection as needed. The sizes of strings and data structures are limited only by the amount of available memory. 2. What is Icon good for? As a general-purpose programming language with a large computational repertoire, Icon can be used for most programming tasks. It's at its best when used build software tools, for processing text, and when ease of programming is needed for experimental and research applications. Paradoxically, Icon is used most often for short, one-shot tasks and for very complex applications. Icon is designed to make programming easy; it emphasizes the value of programmer's time and the importance of getting programs to work quickly. This explains its usefulness for prototyping as well as the apparent paradox of applicability to simple and complex applications. 3. Where did Icon come from? Icon is the latest in a series of high-level programming languages designed to facilitate programming tasks involving strings and structures. The original language, SNOBOL, was developed at Bell Telephone Laboratories in the early 60s. SNOBOL evolved into SNOBOL4, which is still in use. Subsequent languages were developed at The University of Arizona with support from the National Science Foundation. Incidentally, Icon bears little physical resemblance to SNOBOL4, although it has similar objectives and many similar capabilities. 4. What does "Icon" stand for? The name Icon (which is not spelled ICON) is not an acronym nor does it stand for anything in particular, although the word "iconoclastic" was mentioned at the time the name was chosen. The name predates the now common use of "icon" to refer to small images used in graphical user interfaces. This latter usage sometimes causes persons to think mistakenly that Icon is designed to create or manipulate icons. There's not much that can be done about this. 5. On what computers does Icon run? The implementation of Icon is highly portable. Version 9 runs on UNIX, MS-DOS, Windows, NT, Macintosh/MPW, VAX/VMS, the Amiga, and the Acorn Archimedes. There are older versions for the Atari ST, IBM CMS and MVS, the Macintosh, and OS/2. Icon programs also are highly portable. Most Icon programs can run on any platform that supports Icon. 6. Who did all these implementations? The original implementation of Icon for UNIX was done at The University of Arizona. Most of the other implementations originally were done by volunteers scattered around the world. It's worth noting that all implementations of Icon are based on the same source code, which is written in C. This contributes to the portability of Icon itself, as well as to the portability of programs written in Icon. 7. Are there other implementations in the works? Work is constantly underway on implementations of Icon for new platforms. Microsoft Windows and Windows NT implementations are in beta testing. 8. What about different versions of Icon? Icon has evolved through a series of versions with improved and extended capabilities. The latest major version number is 9. This version includes recent changes and additions, notably in the graphics area, and runs on UNIX, MS-DOS, Macintosh/MPW, VAX/VMS, the Amiga, and Acorn Archimedes. Other implementations presently are at Version 8. Almost all programs that run under Version 8 and that do not use graphics will run under Version 9. 9. Which implementations of Icon have graphics/window capabilities? Icon's graphics facilities presently are supported on UNIX and VAX/VMS. Windows NT and Microsoft Windows implementations that support Icon's graphics facilities are in beta testing. 10. Where can I get Icon? Icon is available via anonymous FTP and on the Web. For FTP, use ftp.cs.arizona.edu and cd /icon. For the Web, use http://www.cs.arizona.edu/icon/ and check out the links there. For FTP, the directory /icon/binaries contains executable versions of Icon for several systems, including several popular UNIX platforms. The directory /icon/packages contains source code, test programs, related material, and, most cases, executable binaries as well. All directories have README files with additional information. 11. Where can I get documentation about Icon? The definitive work on Icon is the book The Icon Programming Language, Griswold and Griswold, third edition, Peer-to-Peer Communications, Inc, 1996, 386 pages, ISBN 1-57398-001-3. This book is a complete description and reference manual for Version 9 of Icon. A technical report describes changes since that version. There also is a book on the implementation of Icon: The Implementation of the Icon Programming Language, Griswold and Griswold, Princeton University Press, 1986, 336 pages, ISBN 0-691-08431-9. This book describes the implementation as of Version 6 of Icon. Although the implementation has changed considerably since then, the basic structure is the same. Technical reports describing recent implementation changes are included with copies of the book purchased from the Icon Project. These books are available from the Icon Project. Additional documentation is available via FTP in /icon/doc. Notable documents are: * IPD266: An Overview of Icon (text, PostScript, PDF) * IPD281: Graphics/window facilities (PostScript, PDF) * IPD278: Version 9.3 of Icon (text, PostScript, PDF) There are manual pages for UNIX systems, and more documentation under the Icon web page, but there is no complete on-line documentation. The Icon Newsletter, which includes topical material about Icon and a list of material available from the Icon Project, is published three times a year and is available on the Web. There is a subscription fee for an on-going subscription by postal mail. The Icon Analyst, a technically-oriented newsletter that features articles about programming, is published six times a year. There is a subscription fee for the Analyst. A sample copy is available on the Web. All back issues of both newsletters are available for purchase. 12. How do I get started with Icon? If you're running under UNIX, check first in the /icon/binaries/unix FTP directory to see if there is a "starter kit" for your platform. Starter kits include executables, documentation, and other material. Otherwise, go to the /icon/packages directory and get the appropriate package. Packages include documentation and other material; see the README file in that directory for more details. There is a UNIX package for platforms that lack starter kits. If the non-UNIX package you pick up does not contain executable files, check /icon/binaries. You also may want to get the overview of Icon: /icon/doc/ipd266.txt or ipd266.ps.Z. You'll find pointers to other documents of interest in the package you pick up. 13. What is the Icon Project? The Icon Project is a name used by the group that develops, implements, distributes, and supports the Icon programming language. The Icon Project is not commercial organization. It derives support from The University of Arizona, revenue from the sale of program material and documentation, and user contributions. 14. Where can I find examples of Icon programs? There is a large program library for Icon. It is an excellent resource for both new and experienced programmers. The library contains numerous examples of how to do things with Icon. The library also provides many useful applications, as well as hundreds of procedures that supplement Icon's built-in repertoire. The library, like other Icon material, is available via FTP in /icon/library. 15. What is Idol? Idol is an object-oriented extension to Icon that provides concepts such as classes and multiple inheritance. Idol is written in Idol and is distributed as part of the Icon program library. Idol runs on almost all of the platforms that support Icon. Additional Idol information is available from Clint Jeffery, jeffery@ringer.cs.utsa.edu. 16. How often is material in Icon's FTP area updated? New material is added when it's available. Established implementations usually are updated only when there's a new version. This typically is every year or two. The Icon program library is updated on a similar schedule. 17. How do I stay up to date with what's going on with Icon? The best way to find out about developments related to Icon is to read the Icon Newsletter. You can stay up to date on the source code, which is changed much more frequently than the version on FTP is updated, by subscribing to the source update service, which provides a new version about twice a year. There also is a subscription service for updates to the Icon program library, which provides new material about twice a year. There is on-line information about subscribing to these services. 18. Is there a users' group for Icon? There is no official Icon users' group. The Icon Project maintains an electronic mailing list, icon-group@cs.arizona.edu. Mail sent to this address is forwarded to subscribers. To subscribe (or unsubscribe), send a message to icon-group-request@cs.arizona.edu. There is a gateway between icon-group and comp.lang.icon, an unmoderated newsgroup for discussing issues related to Icon. The gateway, which exchanges messages between the two systems, is imperfect and not under the control of the Icon Project. The newsgroup generally provides faster response than the mailing list, is less intrusive, but sometimes suffers from inappropriate postings. The Icon Project usually sends messages of interest to the Icon community to icon-group. 19. How do I get technical support? The Icon Project is not a commercial organization, and its capacity for providing technical support is limited. Please use the appropriate resource when you need assistance: Ordering Icon Material mail: Icon Project Department of Computer Science The University of Arizona P.O. Box 210077 Tucson, Arizona 85721-0077 U.S.A. fax: (520) 621-4246 voice: (520) 621-6613 e-mail: icon-orders@cs.arizona.edu Getting On-Line Information and Material web: http://www.cs.arizona.edu/icon/ ftp: ftp.cs.arizona.edu (cd /icon) e-mail: ftpmail@cs.arizona.edu Send a message consisting of the word help. Assistance with Installing Icon e-mail: icon-project@cs.arizona.edu Bug Reports e-mail: icon-project@cs.arizona.edu fax: (520) 621-4246 Assistance with Programming Problems e-mail: icon-group@cs.arizona.edu news: comp.lang.icon Uploading Files ftp: ftp.cs.arizona.edu (cd /incoming) After uploading, send e-mail to icon-project@cs.arizona.edu. 20. What do I need to run Icon? Icon will run on most computers. Under MS-DOS, the Icon interpreter needs at least 500 KB of application RAM to work well. 21. Can I build my own implementation of Icon for a new platform? As mentioned above, Icon is written in C and the source code is available. The existing implementations are testament to its portability. (A small amount of assembly-language code is required for a context switch, but this is only needed for an optional feature -- co-expressions -- that can be disabled without affecting other features of Icon.) New ports involve platform-specific configuration parameters and, in some cases, platform-specific code. The feasibility of a new port and the amount of work it may take depends on the platform -- its architecture, its C compiler, and its environment. Ports to new UNIX platforms generally are easy, although novel architectures may present problems. Ports to new operating systems generally are more difficult, especially if Icon's graphics facilities are implemented. The Icon Project provides what help it can with new ports. In return, it asks that code related to the port to be returned to the Icon Project for inclusion in future versions of the source code for Icon. This makes the new port available to others as well as to the porter when Icon is updated. From icon-group-sender Fri Feb 7 12:44:01 1997 Received: by cheltenham.cs.arizona.edu; Fri, 7 Feb 1997 16:55:17 MST From: Samuel Chan Message-Id: <199702072044.MAA01313@ott.ucr.edu> Subject: linked list, structs To: icon-group@cs.arizona.edu Date: Fri, 7 Feb 1997 12:44:01 -0800 (PST) Content-Type: text Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 633 Hi, Can someone help me with going about creating a linked list in Icon? I want to make a list of records using either 'sets', lists', or some other structure type in Icon. Instances of my records are local and my list is global. Of course I will need to be able to access each record in the list from anywhere in the program. The list should also be dynamically changed during the program(i.e. records are added/deleted and the list shrinks/grows accordingly). What would be the best way to go about doing this in Icon? Any help would be appreciated. Thanks!! -- Samuel Chan schan@cs.ucr.edu http://www.cs.ucr.edu/~schan From icon-group-sender Fri Feb 7 16:59:02 1997 Received: by cheltenham.cs.arizona.edu; Fri, 7 Feb 1997 17:00:28 MST Date: Fri, 7 Feb 1997 16:59:02 MST From: "Cliff Hathaway" Message-Id: <199702072359.AA16241@cheltenham.cs.arizona.edu> To: icon-group Subject: Re: linked list, structs Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 306 Forgive me if I'm jumping to erroneous conclusions, but this sounds a lot like a programming assignment. Some time spent with the book (The Icon Programming Language) would answer most, if not all, of your questions -- and prove much more instructional in the long run. Speaking only for myself. cliff From icon-group-sender Mon Feb 17 14:16:45 1997 Received: by cheltenham.cs.arizona.edu; Mon, 17 Feb 1997 12:44:34 MST Message-Id: <3308AE9D.62B0@mail.bcpl.lib.md.us> Date: Mon, 17 Feb 1997 14:16:45 -0500 From: Paul Medlock X-Sender: Paul Medlock X-Mailer: Mozilla 4.0b1 (Win95; I) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Subject: Icon extensability and embeddedness X-Priority: Normal Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 661 I have been looking at Python and Tcl to possibly embed in a hypertext engine that I am revamping. I have been using a Modula 2 like language that I developed back in 1987. But, it is a bit too low-level, and I would like to use a more advanced language this time around.  I had read articles about Icon years ago, but had forgotten about it until someone mentioned it recently. I like the language, but I don't see any notes on extending it to use my APIs nor any information about embedding it within my application. Also, I don't see any license statement as to whether I could use it. Do you have any information that could help me? Thank you. From icon-group-sender Wed Feb 19 01:24:05 1997 Received: by cheltenham.cs.arizona.edu; Thu, 20 Feb 1997 07:52:48 MST To: icon-group@cs.arizona.edu Date: 19 Feb 1997 01:24:05 GMT From: espie@bireme.ens.fr (Marc Espie) Message-Id: <5edknl$791@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu Subject: X-Tiles, a puzzle in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2909 Fed up with all these postings having nothing to do with our beloved newsgroup ? Beginning to believe you are the sole user of Icon left alive ? This is to announce the first public release of X-Tiles, a graphics game (puzzle) written in Icon. The game is rather simple: you are treated to a rectangular playfield filled with rectangular tiles of various colors. You have to remove all tiles, knowing you can only remove connected sets of tiles of the same color. The scoring system heavily favors the removal of big sets of tiles (for a set s, you score (*s-2) * (*s -2) ) When you remove such a set, all tiles above fall down. Then, if there are empty columns, other columns slide leftward to fill the gaps This is a complete game with nice graphics. You can even set up your own background picture. THIS IS THE FIRST PUBLIC RELEASE !!! THERE ARE UNDOUBTEDLY *BUGS* LURKING AROUND... You've been warned !!! Please check You might wish to get as well for an inkling of what the game looks like. It should work under any recent Icon system that supports graphics... as such, I have only tested it under Unix in both color and black and white. Feel free to redistribute, put it into the icon `contrib' area, etc. Outside of being a rather funny little game, the program itself might be of interest, as it uses quite a few of Icon specific features. (On the other side, I tend to obfuscate by using all of Icon niceties at once) I believe it is a good example of `rapid prototyping': using the original crude version of the program, it was easy to add various improvements. Also, it is rather small compared to everything it does: wc X-Tiles.icn -> 828 2710 18419 (stripping comments and blank lines gives: 569 1791 12775) It also shows why the Icon compiler still is useful sometimes... For sizes over 25x25, there is a definite difference in feeling between the compiled and the interpreted version. Although the original game algorithm was already not quite trivial to get right, the current program also tries very hard to compute a minimal set of changes to display... Considering that connected sets of tiles are displayed as one big block with only the border highlighted, this can get rather messy. There are lots of areas (following up on the mouse pointer, bitmap images, intricate color handling) where this code clarified lots of things for me. Anyway, feel free to read the code and discuss anything you deem interesting... There are probably quite a few areas where this program could be more elegant. -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Fri Feb 21 09:07:37 1997 Received: by cheltenham.cs.arizona.edu; Fri, 21 Feb 1997 12:52:00 MST To: icon-group@cs.arizona.edu Date: Fri, 21 Feb 1997 09:07:37 -0500 From: Jan Galkowski Message-Id: <330DAC29.41C67EA6@solstice.digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu Subject: What's the biggest Icon program you've written? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 605 This is an informal and very unscientific survey. What's the biggest Icon program you've written? What did it do? Do you have any "lessons learned" you'd like to share? Did you have any efficiency issues to overcome? Did you use coexpressions? Have you ever needed to "sell" Icon to management? Are they distracted by inferior yet more popular and less powerful languages? I'm curious about these questions, but I'd also like to see the discussion group be more active. -- Jan Theodore Galkowski, Developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 From icon-group-sender Fri Feb 21 14:33:47 1997 Received: by cheltenham.cs.arizona.edu; Fri, 21 Feb 1997 16:55:39 MST Date: Fri, 21 Feb 1997 14:33:47 -0600 Message-Id: <199702212033.OAA00872@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: What's the biggest Icon program you've written? To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2151 >What's the biggest Icon program you've written? What did it do? Probably my biggest Icon program was a program which attempted to find out which of a number of outstanding invoices for a given customer were intended to be covered by a check sent by the customer. I don't recall offhand how big it was, (this was several years ago) but probably not much more than a few hundred lines in any case. The biggest programs I've written in SNOBOL4 have been bigger (several thousand lines), probably either (1) the pattern-matching intelligent mini-disassembler for Intel machine instructions, or (2) a cross-compiler which aids in cross-compiling Motorola-flavor assembler language programs to Intel-flavor assembler language. The script compiler I wrote for the French Social Security administration was impressively short, given its functionality. >Do you have any "lessons learned" you'd like to share? Be prepared to use the features of the languages creatively!! >Did you have any efficiency issues to overcome? Yes... one question (on the invoice/payment matcher especially) is trying to decide which possible optimizations would take longer than the time they might be able to save!!! >Did you use coexpressions? I don't recall up to now ever using coexpressions, although I think they could be very useful in other circumstances. >Have you ever needed to "sell" Icon to management? I've never had great difficulty with this. As a consultant, I'm usually hired BECAUSE of my expertise in how to best attack the customer's problem... they're not likely to condemn my advice on technical grounds. (And of course, they're paying me by the hour/day... so the most effective development tools both saves them money, and gets their problem solved faster). >Are they distracted by inferior yet more popular and less powerful languages? They will sometimes ask about them, but I've never yet had a customer force me to write a program for them in a tool other than the one I recommended to them. If they INSISTED, I'd adhere to their choice: it's their money! Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Fri Feb 21 14:44:44 1997 Received: by cheltenham.cs.arizona.edu; Fri, 21 Feb 1997 16:56:05 MST Message-Id: <1.5.4.32.19970221204444.006c750c@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 21 Feb 1997 14:44:44 -0600 To: Jan Galkowski , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: What's the biggest Icon program you've written? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2436 At 09:07 AM 2/21/97 -0500, Jan Galkowski wrote: >This is an informal and very unscientific survey. > >What's the biggest Icon program you've written? What did it do? >Do you have any "lessons learned" you'd like to share? 1546 lines. A personal database system I called Attercop. I wrote it in assembler in 1983 (approx 2200 lines). I ported it to unix and icon in 1988. I'm still using it. Why? It works. I don't have to deal with a DBA. I can have multiple, database keys and I can change them on the fly. NOW, I write big systems, but they're usually separate icon modules that interact. I find them easy to manage under 200 lines. > >Did you have any efficiency issues to overcome? Did you use >coexpressions? Speed was an issue for the VMS implementation. I was able to speed up Attercop by switching from using lists to tables. Performance improved maybe 100 fold on larger datasets. Coexpressions. Never quite understood them. Used once to write a better diff program. > >Have you ever needed to "sell" Icon to management? Are they >distracted by inferior yet more popular and less powerful >languages? At first NO. Management wanted the job done, and I had something called "system manager prerogative". Much success. Then the operation grew and consultants came in. Suddenly industry standards like perl became the buzz word. The hackers concept "reverse intent" came into force and now standards are excuses for not doing things. Icon is in there because I wrote 100's of small icon modules and built a pyramid of dependency. It works well. I've offered to train anyone interested. No takers. Strange. I have yet to see the truck loads of cheap perl coders brought in, but someone left a perl manual on my desk as a hint. Trouble is, there's no-one else who knows much about programming languages. The cobol trained management thinks perl, C, icon, and shell script all look funny. > >I'm curious about these questions, but I'd also like to see >the discussion group be more active. > >-- Jan Theodore Galkowski, > Developer, tool & numerical methods elf > Digicomp Research Corporation, > Ithaca, NY 14850-5720 I hope I provided some food for the flames..... Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Fri Feb 21 20:11:23 1997 Received: by cheltenham.cs.arizona.edu; Mon, 24 Feb 1997 08:29:56 MST To: icon-group@cs.arizona.edu Date: 21 Feb 1997 20:11:23 GMT From: espie@allege.ens.fr (Marc Espie) Message-Id: <5ekvhb$7md@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu References: <330DAC29.41C67EA6@solstice.digicomp.com> Subject: Re: What's the biggest Icon program you've written? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 4683 In article <330DAC29.41C67EA6@solstice.digicomp.com>, Jan Galkowski wrote: >This is an informal and very unscientific survey. > >What's the biggest Icon program you've written? What did it do? >Do you have any "lessons learned" you'd like to share? A set of functions to manipulate some combinatorial graphs, and display the result graphically. Roughly 4000 lines (wc says 3936 11172 82247) for the total. I've got into the main pitfall of Icon: forgetting about failure. writing stuff such as i <- value & function(i) forgetting that function(i) was not returning anything, or using suspended generators, and having them resumed and backtracking and... well, ending up with the assignment to i being cancelled where it was not intended. The biggest problems I've run into are some limitations of Icon. There are no modules, no import/export mechanism for big projects. I would also like a better version of itweak... the current one doesn't deal with undeclared local variables. You end up being somewhat forced to declare local variables... which I hate :-( I would MUCH prefer to have to declare global symbols I want to use in a procedure, together with a mechanism to `trap' affectation to known procedure names, and warn the user. I'm also missing features such as manifest constants. The preprocessor is not such a great solution when you end up with a trace that mentions `2' and you wrote HIGHLIGHT_COLOR in your source. Idol does have some potential as well. Pity it is a line-oriented preprocessor... Last time I tried it, I ended up with some impossible to debug mis-mash of code... maybe I should try harder ? >Did you have any efficiency issues to overcome? Did you use >coexpressions? I very seldom need co-expressions. Knowing how they are implemented makes them somewhat unsafe for `production' code: your process might crash if it goes into intricate computations, and they don't exist on every platform. There is a strange ambiguity there: on one hand, small programs usually don't need co-expressions (the rare case such as the label generator can be implemented using classical techniques without obfuscating the code that much), and bigger programs where they would be needed won't be reliable. I'm sincerely hoping they will get better one day. I have a feeling that Icon could deal with multi-threaded applications very nicely with just a tweak of the coexpression mechanism. Also, I still like the Icon compiler. In my particular case, I was using that graph manipulator to do some research on some graphs. Having the program run twice as fast just meant I could explore bigger graphs. It would be great if the Icon compiler went some steps further. For instance, Icon gobbles lots of memories to tag numerous, small structures. The compiler could find that these structures are statically typed and optimize almost all the way down to C. >Have you ever needed to "sell" Icon to management? Are they >distracted by inferior yet more popular and less powerful >languages? I've somewhat stopped trying to `sell' Icon to anybody... about the time I stopped selling the Amiga to anybody, for mostly the same reasons. There are some arresting problems. The fact that Icon is supported by a rather small development team (for instance, compiler work is stopped) is a problem. Not being well-spread is another problem. Also, Icon can't deal with some things: deeper access to the system is feasible, but you have to delve into the code to add the things you need. This does deter from some of the qualities of Icon: rapid development. Also, the Icon book is rather hard to come by, for instance. You won't find it in specialized libraries, and will have to special-order it. All this means that Icon has almost a non-image. I do tend to do all my development in Icon/perl/C/C++/PostScript... I use Icon as much as I can, switch to perl when this will be faster to code, C/C++ for anything that craves speed, and PostScript for printing applications. There is such a wealth of perl programmers/perl development these days that is very difficult to match with Icon. For instance, the text editor nvi does procure an interface to perl... >I'm curious about these questions, but I'd also like to see >the discussion group be more active. Nice understatement ! Did you see my previous posting ? I'm quite willing to discuss anything about my coding habits, as shown in X-Tiles. -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Mon Feb 24 10:19:49 1997 Received: by cheltenham.cs.arizona.edu; Mon, 24 Feb 1997 12:23:44 MST To: icon-group@cs.arizona.edu Date: Mon, 24 Feb 1997 10:19:49 -0500 From: Jan Galkowski Message-Id: <3311B195.794BDF32@solstice.digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu References: <330DAC29.41C67EA6@solstice.digicomp.com>, <5ekvhb$7md@nef.ens.fr> Subject: Re: What's the biggest Icon program you've written? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 6702 Marc Espie wrote: > > In article <330DAC29.41C67EA6@solstice.digicomp.com>, > Jan Galkowski wrote: [snip] > A set of functions to manipulate some combinatorial graphs, and display > the result graphically. > Roughly 4000 lines (wc says 3936 11172 82247) for the total. Marc, Thanks to you and to the others that have responded, for your replies. I am responding to yours because of your solicitation, and because I wanted to ask some questions. I intended to summarize what I've found after the question has "been on the books" for a while. All responses have been interesting. > > I've got into the main pitfall of Icon: forgetting about failure. > writing stuff such as i <- value & function(i) > forgetting that function(i) was not returning anything, or using > suspended generators, and having them resumed and backtracking and... well, > ending up with the assignment to i being cancelled where it was not > intended. This is interesting. I would have thought notions of success and failure, a la logic programming, was a big reason for using Icon. It is bound to have serious impacts upon one's design and programming styles if one plans to use it. > > The biggest problems I've run into are some limitations of Icon. There are > no modules, no import/export mechanism for big projects. IMO, I'm not sure these are as much limitations of Icon as taking where it hasn't received much use or wasn't intended to be used. I can't really answer that, of course. I feel it is someplace where it would be useful to have some support. But I don't know whether Idol-like solutions are right. In fact, I tend to doubt they are. And I feel I don't want to clutter up the presently pretty language with other than more built-ins. That is, I wouldn't want to change the syntax in any way that would require, for instance, some declarative sugar on every procedure. And also, it's not clear that ways of controlling and organizing many small pieces of text, each with a local scope, belong in a programming language. I am in favor of something being there which facilitates this, but that is hardly a universal or a compelling view. [snip] > I'm also missing features such as manifest constants. The preprocessor is > not such a great solution when you end up with a trace that mentions `2' > and you wrote HIGHLIGHT_COLOR in your source. This is a problem with a preprocessor, I imagine. One would almost need to have a backtrace log of substitutions for an error system to be able to figure out what the original references were. Is it worth it? [snip] > I very seldom need co-expressions. Knowing how they are implemented > makes them somewhat unsafe for `production' code... [snip] Can you be more explicit here? As far as I know, co-expressions and the whole generator thing is supported for the Unix world, and for the DOS world, and at the ProIcon level for the Macintosh world. That's a chunk of space. What in particular do you find "unsafe"? > > I'm sincerely hoping they will get better one day. I have a feeling that > Icon could deal with multi-threaded applications very nicely with just > a tweak of the coexpression mechanism. I disagree. IMO, I think these are two similar things with vastly different reasons for existence and destinies. The co-expression mechanism is a highly distilled and easy to control form of search in the manner of the AI and logic languages, all the way back to PLANNER and unification, with the programmer calling most of the shots. [snip] > > I've somewhat stopped trying to `sell' Icon to anybody... about the time > I stopped selling the Amiga to anybody, for mostly the same reasons. I didn't meaning "selling" in the evangelical sense but, rather, in a business case to immediate management. And, if I may read into your post, do you mean you feel Icon is as dead as the Amiga is? > > There are some arresting problems. > The fact that Icon is supported by a rather small development team (for > instance, compiler work is stopped) is a problem. I respectfully disagree. If anything characterizes Icon's implementations, IMO, it is that elusive attribute called "coherence". Its opposite is the MS treatment of a software megolith like Visual Basic. [snip] > Also, the Icon book is rather hard to come by, for instance. > You won't find it in specialized libraries, and will have to special-order it. > All this means that Icon has almost a non-image. IMO, I think publicization is up to us, the users. I find the Icon Project an easy and ready source of documentation. I feel they are like small businesspeople-- they can't expand without justifying their costs on their existing cash flow. > [snip] > There is such a wealth of perl programmers/perl development these days that > is very difficult to match with Icon. For instance, the text editor nvi > does procure an interface to perl... > The "effort threshold" to acceptance of Icon is its innovative concepts. Without these, such as its ideas on elevating success and failure, it would not be Icon. But these new ideas are its raison d'etre, not an obstacle. No, I think the problem, rather, is in the way programming is done and promulgated. People seem to want to get as much as possible for as little as possible invested. While that may be a good model for capital accumulation, it's not how much of the world works. One isn't going to make major headway towards solving difficult software issues and problems without a correspondingly major change in the way programming is practiced. It is an exaggeration, but I would argue that other than means of classifying and tagging small pieces of text, much of programming practice hasn't advanced much beyond FORTRAN, despite increases in hardware capability of a hundred thousandfold. I feel the obstacles one sees to Icon are no different than some of those to APL or to logic programming in, say, Prolog: It's just too different a mindset. But, also, I think a paraphrase of the biologists' Law of the Unspecialized applies here: The next major technology does not generally come as a refinement of the mainstream of a previous one but, rather, as a dramatic development from what appears to be a curious and isolated backwater which may, to some, even seem a cul de sac. [snip] I cannot, in any way, speak for the Icon Project, of course, just as a very interested user of Icon who has knocked around in strange programming environments for several years. -- Jan Theodore Galkowski, Developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 From icon-group-sender Mon Feb 24 11:02:17 1997 Received: by cheltenham.cs.arizona.edu; Mon, 24 Feb 1997 12:24:03 MST Date: Mon, 24 Feb 1997 11:02:17 -0600 Message-Id: <199702241702.LAA12898@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: What's the biggest Icon program you've written? To: icon-group@cs.arizona.edu In-Reply-To: <5ekvhb$7md@nef.ens.fr> X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1104 >I do tend to do all my development in Icon/perl/C/C++/PostScript... I use Icon as much as I can, switch to perl when this will be faster to code, I'm fairly astounded that ANYONE knowing Icon wouldn't prefer SNOBOL4/SPITBOL to Perl... the fact that ANYONE would use Perl for ANYTHING, given the availability of SNOBOL4/SPITBOL instead, verges on insanity... I guess we have to forgive[/pity] those who don't know any better (for them, Perl probably looks great) but for those of us who ARE more aware... >C/C++ for anything that craves speed, and PostScript for printing applications. For TRUE speed, obviously nothing much beats assembler language (despite, yes, it being something of a dying art...), and for business or communications applications I like FoxPro and SALT, respectively. I agree that PostScript wouldn't be a bad language for print generating applications, but then again I don't seem to need that kind of thing very often. I use C mostly just when I need to interface with existing C-centric libraries etc etc. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Mon Feb 24 14:30:06 1997 Received: by cheltenham.cs.arizona.edu; Tue, 25 Feb 1997 08:35:45 MST Message-Id: <1.5.4.32.19970224203006.00706c1c@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 24 Feb 1997 14:30:06 -0600 To: Jan Galkowski , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: What's the biggest Icon program you've written? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 4952 At 10:19 AM 2/24/97 -0500, Jan Galkowski wrote: >Marc Espie wrote: >> >> In article <330DAC29.41C67EA6@solstice.digicomp.com>, >> Jan Galkowski wrote: > >[snip] >> I've got into the main pitfall of Icon: forgetting about failure. >> writing stuff such as i <- value & function(i) >> forgetting that function(i) was not returning anything, or using >> suspended generators, and having them resumed and backtracking and... well, >> ending up with the assignment to i being cancelled where it was not >> intended. > > This is interesting. I would have thought notions of success and failure, >a la logic programming, was a big reason for using Icon. It is bound to have >serious impacts upon one's design and programming styles if one plans to use it. > Failure is part of the language design. It DOES impact design. But I think that it's a positive thing. I think it's elegant, actually, that one could make use of "nothing". It's part of everything in this language fitting together so well. >> >> The biggest problems I've run into are some limitations of Icon. There are >> no modules, no import/export mechanism for big projects. > > IMO, I'm not sure these are as much limitations of Icon as taking where it >hasn't received much use or wasn't intended to be used. I can't really answer >that, of course. I feel it is someplace where it would be useful to have some >support. But I don't know whether Idol-like solutions are right. In fact, I >tend to doubt they are. And I feel I don't want to clutter up the presently >pretty language with other than more built-ins. That is, I wouldn't want to >change the syntax in any way that would require, for instance, some declarative >sugar on every procedure. > > And also, it's not clear that ways of controlling and organizing many small >pieces of text, each with a local scope, belong in a programming language. I >am in favor of something being there which facilitates this, but that is hardly >a universal or a compelling view. This hasn't affected my developments. I've tried to keep the modules small and well documented. My biggest headache came from the VMS implementation. Up till V8.6 it was rock solid. Then V8.7 came out with X-windows stuff and things began to fall apart. Then it couldn't handle char(255) (aka \xff). Now I couldn't get it to recompile successfully on the Alpha AXP. I gave up on the VMS side. >[snip] > >> >> I've somewhat stopped trying to `sell' Icon to anybody... about the time >> I stopped selling the Amiga to anybody, for mostly the same reasons. > > I didn't meaning "selling" in the evangelical sense but, rather, in a business >case to immediate management. And, if I may read into your post, do you >mean you feel Icon is as dead as the Amiga is? I don't ask anymore either. I just do it, do it well, document it, and I'm glad it holds up. I'm also open to training any coworker who wants in. > >> >> There are some arresting problems. >> The fact that Icon is supported by a rather small development team (for >> instance, compiler work is stopped) is a problem. > > I respectfully disagree. If anything characterizes Icon's implementations, >IMO, it is that elusive attribute called "coherence". Its opposite is the MS >treatment of a software megolith like Visual Basic. That hasn't affected me. After the first year, and having the book I became pretty self sufficient. It hasn't needed oodles of patches and if somthing works well enough, a lot less support is needed. >[snip] > >> There is such a wealth of perl programmers/perl development these days that >> is very difficult to match with Icon. For instance, the text editor nvi >> does procure an interface to perl... >> > The "effort threshold" to acceptance of Icon is its innovative concepts. >Without these, such as its ideas on elevating success and failure, it would not >be Icon. But these new ideas are its raison d'etre, not an obstacle. I agree. Another side note: I've heard the common complaint that Icon doesn't have enough system interfaces (like perl does). At least in my applications, I'm not really interesting in the guts of the OS, but rather files, which I think is Icon's forte. I kind of view deep system access as a liability, that makes it that much easier to mess things up (even by accident) and crash the system. Icon insulates us (and our apprentices) from those dangers. I have never yet found myself needing or wanting that deep of access for icon. (although I did alot with assembler many years ago). >-- > Jan Theodore Galkowski, > Developer, tool & numerical methods elf > Digicomp Research Corporation, > Ithaca, NY 14850-5720 > > Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Tue Feb 25 16:34:57 1997 Received: by cheltenham.cs.arizona.edu; Tue, 25 Feb 1997 17:29:33 MST Message-Id: <1.5.4.32.19970225223457.006d13a4@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 25 Feb 1997 16:34:57 -0600 To: icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Icon Programming Style Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3591 Not that it matters, but maybe it does, once upon a time I wrote an Icon Programming Style Guide, to make it like an officially certified tool. I'm put it on a Web page for anyone interested in downloading and looking it over. Basically, all the Icon software I've written here conforms to this guide. It's a Microsoft Word document and you should be able to read or print it from Word or Wordpad under Windows95. It's location is: http://www.execpc.com/~cdt/style.html Enjoy! Chris. Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! rom icon-group-sender Tue Feb 25 14:30:26 1997 Received: by cheltenham.cs.arizona.edu; Tue, 25 Feb 1997 17:29:24 MST Date: Tue, 25 Feb 1997 14:30:26 -0600 Message-Id: <199702252030.OAA01358@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: What's the biggest Icon program you've written? To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu ["selling" Icon (or SNOBOL/SPITBOL)] >I don't ask anymore either. I just do it, do it well, document it, and I'm glad it holds up. I'm also open to training any coworker who wants in. I think this is a reasonable approach. Alternatively, one can take the opportunity to educate the client about the more powerful tools we use, which allows us to solve their problems in a better and more robust way at a fraction of the time and cost it would take using primitive languages like C or Pascal. This seems to usually be welcome... of course, people HIRE consultants precisely because they realize they themselves don't know the best way to do the things they need and want to do. >>>...The fact that Icon is supported by a rather small development team (for >> instance, compiler work is stopped) is a problem. >> I respectfully disagree. If anything characterizes Icon's implementations, >IMO, it is that elusive attribute called "coherence". Its opposite is the MS >treatment of a software megolith like Visual Basic. >That hasn't affected me. After the first year, and having the book I became pretty self sufficient. It hasn't needed oodles of patches and if somthing works well enough, a lot less support is needed. Agreed. And it's nice to use tools that are mature enough and bug-free enough that they don't have to be subject to operational upheavals and expensive new software versions every year or two. (I'd been happily using Macro Spitbol, vintage 1986, along with a 1988-vintage SNOBOL4+ until I finally bought SPITBOL-386 last year... mostly because I finally ended up with a program for one of my clients where I really needed the extra memory capacity supported by SPITBOL-386). >...I've heard the common complaint that Icon doesn't have enough system interfaces (like perl does). At least in my applications, I'm not really interesting in the guts of the OS, but rather files, which I think is Icon's forte. I kind of view deep system access as a liability, that makes it that much easier to mess things up (even by accident) and crash the system. The bigger issue, I think, is that such low-level access also generally makes the programs FAR less operating-system dependent. Not that that's a HUGE issue of course, but it's nice when they can be kept more portable. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Wed Feb 26 02:52:12 1997 Received: by cheltenham.cs.arizona.edu; Wed, 26 Feb 1997 08:23:56 MST Date: Wed, 26 Feb 1997 02:52:12 -0600 Message-Id: <199702260852.CAA00416@segfault.cs.utsa.edu> From: Clinton Jeffery To: icon-group@cs.arizona.edu Subject: Icon 9.3 for Microsoft Windows status Reply-To: jeffery@cs.utsa.edu Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1541 Icon folks running Microsoft Windows may be interested in trying out the latest set of binaries, available by ftp to ringer.cs.utsa.edu, directory pub/icon/nt/graphics. Changes were made in response to various user requests. There are also non-graphics NT (runs under Win95 too) console binaries in pub/icon/nt/console. These files will also be available from the Arizona site after they are copied over. The source codes will get updated a little later. Here are the highlights from the READ.ME file; Native Windows facilities: Icon programs can now access Windows menus, buttons, scrollbars, and common dialogs. These facilities are under construction, but far enough along to be useful. See IPD 271 for documentation. Comments would be appreciated. Wi.icn, an Icon programming environment that replaces, simplifies, and fixes bugs reported in Wicon.exe. Wi.icn also serves as a demonstration of Icon's native Windows interface facilities. It is ~550 lines of Icon. cicont.exe, a Windows NT (and Windows 95) command-line version of icont, functionally equivalent to wicont.exe. Note that Windows NT console binaries for Icon version 9.3 are also available. The help files now have keywords for Windows Help searches. A bugfix in field access, seen as spurious runtime errors in certain graphics applications. As always, I appreciate your comments and suggestions! Clint Jeffery jeffery@cs.utsa.edu Division of Computer Science, The University of Texas at San Antonio Research http://www.cs.utsa.edu/research/plss.html From icon-group-sender Wed Feb 26 17:15:42 1997 Received: by cheltenham.cs.arizona.edu; Thu, 27 Feb 1997 09:03:41 MST To: icon-group@cs.arizona.edu Date: 26 Feb 1997 17:15:42 GMT From: espie@fregate.ens.fr (Marc Espie) Message-Id: <5f1r3u$b7l@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu References: <331437DE.41C67EA6@solstice.digicomp.com> Subject: Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2405 In article <331437DE.41C67EA6@solstice.digicomp.com>, Jan Galkowski wrote: [SMALLER reply though] >[LONG post warning!] >Now, I don't in any way want to depreciate or criticize the use or >power of Icon in traditional programming. Indeed, seeing how >traditional problems can be addressed by new methods and >expressive styles is crucial to developing programming itself. >While the conceptual algorithm for expression may be about the >same, the means used to realize it with the "generate and test" mindset >available in Icon can be dramatically different than in, say, Ada. >Moreover, there are some algorithms which, because of the >availability of Icon's tables, may now be usable and practical >because the effort to use these elements is negligible compared to, >again say, Ada since their one might need to implement the >elements. It is important to continuously reconsider putting >new wines in "old bottles" if the depth of our collective craft >is to be maintained. Icon tables and sets are indeed a very powerful mechanism. However, they sometimes suffer from their generality. The current implementation uses hash functions that assume a rather smooth average distribution of the data. I've been using Icon a lot for combinatorial computations involving words, lattices and graphs, where Icon excells thanks to its generators, and high-level operations on sets. However, I've also ran into some spectacular failures. You see, the sets of words I study are NOT average. Indeed, I am trying to find some non obvious correlations between those... and the hashing functions... well, I've got cases where everything ended up in one or two buckets, or rather larger sets where the hashing process failed due to the sheer size of the data. I would rather like to be able to specify MORE things about my sets (average size, distribution of data, other hashing functions) than is possible with the current implementation. Right now, I have to reinvent the wheel, and reimplement somehow my own sets without all the clarity Icon procures to us. (I'll admit that Icon sets and tables works in more than 95% of the cases I've thrown at it) -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Wed Feb 26 08:17:18 1997 Received: by cheltenham.cs.arizona.edu; Thu, 27 Feb 1997 09:03:58 MST To: icon-group@cs.arizona.edu Date: Wed, 26 Feb 1997 08:17:18 -0500 From: Jan Galkowski Message-Id: <331437DE.41C67EA6@solstice.digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu Subject: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 9732 [LONG post warning!] One of the things that strikes me from the partial set of responses I've gotten regarding my queries "What's the largest Icon program you've written?" and related, is the extent to which these reported uses of Icon are examples of "new wines in old bottles". That is to say, the applications remain pretty traditional, although Icon brings its own means and methods to these problems. Now, I don't in any way want to depreciate or criticize the use or power of Icon in traditional programming. Indeed, seeing how traditional problems can be addressed by new methods and expressive styles is crucial to developing programming itself. While the conceptual algorithm for expression may be about the same, the means used to realize it with the "generate and test" mindset available in Icon can be dramatically different than in, say, Ada. Moreover, there are some algorithms which, because of the availability of Icon's tables, may now be usable and practical because the effort to use these elements is negligible compared to, again say, Ada since their one might need to implement the elements. It is important to continuously reconsider putting new wines in "old bottles" if the depth of our collective craft is to be maintained. Still, I wonder if use of Icon would be invigorated if we, collectively, tried to push it into new areas, ones where it may well have an edge on traditional software solutions. For example, the current (March 1997) issue of _Scientific_ _American_ reports in part (see pages 54-55) that finding and decoding graphical pictures is a big part of the technical frontier for Web crawlers. Putting aside the extremely thorny problem of dealing with natural images (the kind off of a camera or TV screen), consider the set of images which are generated by graphics facilities of applications or programming languages such as the graphics facilities of Icon. (Professor Griswold and company are working a book just addressing these facilities.) Then, perhaps, finesse how to get these images into some symbolic form and consider the problem of matching patterns within these images using some two-dimensional analog to Icon's matching facilities. What can be developed there? I think there's a practical motivation, but I suspect in this initial search it's counterproductive to limit oneself to just the practical. Let this be a kind of brain teaser, and let's leave it as motivated purely for fun. Well, let's consider some of the literature on this. People have considered various kinds of two dimensional automata. These could form the mechanical metaphor for a two-dimensional scanner. Basically, the analog to a Turing machine of sorts is a scanner which can move at one step in any of four orthogonal directions, north, south, west, or east. It can tell the state of a cell it is over, basically what it contains, and it can write into that cell. It's also possible to "mark" cells with annotations that don't overwrite their contents. I recall a good conceptual description of such a machine in the second or third edition of the neat little book _Perceptrons_ by Marvin Minsky and Seymour Paper, quoting work by Blum, although their interest is getting at the computational basics of understanding natural images. One could imagine a set of facilities analogous to Icon's _move_, _tab_, _find_, _match_, "?", and some 2D equivalent to csets working in two dimensions, at least plausibly. Although they don't seem sufficiently powerful to deal with natural imagery, people have explored various kinds of 2D grammars. These are often studied and presented in the context of production of patterns and textures, but we might consider them for recognition and parsing. There are, for example, _shape_ _grammars_ proposed by G.Stiny and J.Gips (_Algorithmic_ _Aesthetics_: _Computer_ _Models_ _for_ _Criticism_ _and_ _Design_ _in_ _the_ _Arts_, University of California Press, Berkeley, 1972, as reported in D.Ballard, C.Brown, _Computer_ _Vision_, 1982, pp. 173-175) which are used to generate textures. There are tree grammars (see S.Y.Lu, K.S.Fu, "A syntactic approach to texture analysis," _Computer_ _Graphics_ _and_ _Image_ _Processing_, vol. 7, no. 3, June 1978, pp. 303-330, also summarized in Ballard and Brown, pp. 175-178) which apply pyramids to the description of tesselations. Milgram and Rosenfeld ("Array automata and array grammars", Proceedings, IFIP Congress 71, Booklet TA-2, Amsterdam: North-Holland, 1971, 166-173, also described on pp. 178-181 of Ballard and Brown) which use two-dimensional "atoms" to generate patterns from symbols. (The term "atom" is used in the sense it is in LISP, as a basic elementary symbol which cannot be deconstructed, at least "using ordinary chemical means".) Finally, in modeling regions and pictures, Rosenfeld and Kak give a moderately lengthy and technical presentation on grammars in their volume 2 of _Digital_ _Picture_ _Processing_ (Academic Press, 1982, pp. 317-327). A little description of shape grammars will illustrate how this tends to go: Suppose one is given, First, a finite set of shapes, Vt. Members of Vt are "terminal elements" or basic symbols. Second, a finite set of symbols, Vm. Members of Vm are "nonterminal shape elements" or markets. Vm and Vt are disjoint. Third, a set Vt+ consisting of elements formed by the "finite arrangement of one or more elements of Vt in which any elements and/or their mirror images may be used a multiple number of times in any location, orientation, or scale" (Ballard, Brown, page 173). This is complicated. We could just as well enhance Vt to consist of a basic symbol and basic symbols generated from that one by rotation, reflection, and scaling. I like that way of doing this better. Fourth, a set Vt* which consists of Vt+ and the empty shape. Fifth, a set Vm+ defined from Vm in the manner Vt+ is defined from Vt. Sixth, a set Vm* which consists of Vm+ and the empty shape. Seventh, a finite set R of ordered triples (u,v,w) such that u is a shape consistning of elements of Vm+, v is an element of Vt*, and w is an element of Vm*. Each of these triples is called a "shape rule" where u is the left side of the rule, and v an w together form the right side of the rule. A texture is generated from a shape grammar by beginning with some initial shape and repeatedly apply the shape rules wherever they can be applied. The elementary step of applying a particular shape rule (u,v,w) to some shape S is S with the right side (v and w concatenated) substituted for an occurence in the former S of an instance of u. The iteration which does this can be sketched: 1. Find part of the shape in question which is geometrically similar to the left side of a rule in therms of both terminal elements and nonterminal elements. There must be a 1-1 correspondence between the terminals and markers on the LHS of the rule and the terminals and markers in the part of the shape in question to which the rule is to be applied. Deal with multiple matching rules in some way (a conflict resolution strategy), perhaps by letting _all_ rules produce daughter shapes concurrently and in different contexts. 2. Find the geometric transformations such as scaling, local translation, rotation, reflection which make the LHS of the rule identical to the corresponding part in the shape in question. 3. Apply these same transformations to the RHS of the matching rule. 4. Substitute the transformed RHS of the rule for the part of the shape that corresponds to the LHS of the rule. The generation process terminates when no rule in the grammar can be applied. Ballard and Brown given an example of how the shape grammar can generate the hexagonal tesselation of the plane: Vt consists of a single hexagon of a fixed size (for brevity, call this symbol "H") Vm consists of a single nonterminal, "o", say called a "dot". R consists of the rules o H o ---> H H H o ---> H o H H o ---> H H o o H o ---> H H H o ---> H H o H o ---> H H o where basically one template instance of "H" with a dot adjacent produces all configurations of the dot about the hexagonal element, that is, one placement on each of its six sides. Recognition of a texture involves deconstruction of the pattern using the rules in the reverse direction. If there is but a single nonterminal left in the procedure, the shape is said to be recognized, and its identity is given by the identity of the nonterminal. OK. So what could be done with Icon? I'm not at all proposing extensions or changes to the language at all. Let's just consider it a programming exercise and challenge. If we wanted to write Icon programs to parse two dimensional symbol structures, how would we go about it? Well, we need to place indices in some canonical way, and we need to have a means of stepping from one (i,j) configuration to another. How do we describe two dimensional shape patterns? Suppose, for the moment, the array we want to do matching in can have on ASCII characters as elements. Clearly, later we could expand the definition of csets to contain various graphical elements such as oriented lines, etc. - Jan Theodore Galkowski, Developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 jan@digicomp.com From icon-group-sender Thu Feb 27 19:43:43 1997 Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 08:56:53 MST To: icon-group@cs.arizona.edu Date: Thu, 27 Feb 1997 19:43:43 -0800 From: Stuart Robinson Message-Id: Organization: Reed College, Portland, Oregon Sender: icon-group-request@cs.arizona.edu Subject: Help with Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1053 Hello. I am trying to do some text analysis with Icon. Because I am new to the language (and to programming in general), I am not sure how to proceed. Let me describe the problem and perhaps some generous soul will lend a hand. I have a number of texts each line of which has been coded for three types of information. Each line of the text will be assigned a number and a code for two categories. The numbers are just whole numbers (raning from 1 to 20 or so) and each category has four members (say, ABCD and WXYZ). Here is an example text: 1 A X 1 A Y 1 B Y 2 B Y Note that some successive lines share an index number (as in lines 1 and 2 and 2 and 3). When that is the case, I would like the program to output the members of each category for the matched lines, as below: 1-2 AA XY 2-3 AB YY That is it. There are some additional complications, but I think that I can solve those at a later date. At the moment, this sort of rough-and-ready analysis is all I need. Any suggestions? Thanks in advance. --Stuart From icon-group-sender Thu Feb 27 09:59:21 1997 Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 08:56:42 MST To: icon-group@cs.arizona.edu Date: Thu, 27 Feb 1997 09:59:21 -0500 From: Jan Galkowski Message-Id: <3315A149.41C67EA6@solstice.digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu References: <331437DE.41C67EA6@solstice.digicomp.com>, <5f1r3u$b7l@nef.ens.fr> Subject: Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2336 Marc Espie wrote: > > In article <331437DE.41C67EA6@solstice.digicomp.com>, > Jan Galkowski wrote: > [SMALLER reply though] > >[LONG post warning!] [snip] > > Icon tables and sets are indeed a very powerful mechanism. However, > they sometimes suffer from their generality. The current implementation > uses hash functions that assume a rather smooth average distribution > of the data. [snip] > However, I've also ran into some spectacular failures. You see, the > sets of words I study are NOT average. Indeed, I am trying to find > some non obvious correlations between those... and the hashing functions... > well, I've got cases where everything ended up in one or two buckets, > or rather larger sets where the hashing process failed due to the > sheer size of the data. > > I would rather like to be able to specify MORE things about my sets > (average size, distribution of data, other hashing functions) than > is possible with the current implementation. Well, hash functions do have the drawback of making assumptions about the distribution of data. This doesn't matter if the implementation is Icon, Perl, or APL. (APL doesn't have a key-table lookup mechanism like Icon and Perl do, but it does use a hash function to retrieve variable identifiers and sometimes APL programmers use a plethora of global variables to achieve the same effect.) That's part of their nature. > > Right now, I have to reinvent the wheel, and reimplement somehow my > own sets without all the clarity Icon procures to us. Apart from the address space limitation -- which I'd think you'd overcome by defining a bigger table than you need -- I'd think the answer to the poor distribution problem would be to "prehash" the keys instead of investing in a lot of effort to build lookup routines, adding routines, removal routines, etc. If one can tell lots of distinct keys map into the same two buckets, use their distinctions to remap them into a wider scatter. Why couldn't you use the Icon "map" to systematically jumble things up a bit? > [snip] I'm curious: What does your post have to do with two-dimensional matching, or did it just comment on my lead paragraphs? -- Jan Theodore Galkowski, Developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 From icon-group-sender Fri Feb 28 11:15:31 1997 Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 12:48:10 MST Date: Fri, 28 Feb 1997 11:15:31 -0600 Message-Id: <199702281715.LAA15028@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Help with Program To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1738 >Hello. I am trying to do some text analysis with Icon. Because I am new to the language (and to programming in general), I am not sure how to proceed. >I have a number of texts each line of which has been coded for three types of information. Each line of the text will be assigned a number and a code for two categories. The numbers are just whole numbers (raning from 1 to 20 or so) and each category has four members (say, ABCD and WXYZ). Here is an example text: >1 A X 1 A Y 1 B Y 2 B Y >Note that some successive lines share an index number (as in lines 1 and 2 and 2 and 3). When that is the case, I would like the program to output the members of each category for the matched lines, as below: >1-2 AA XY 2-3 AB YY >Any suggestions? Thanks in advance. Took me a while to understand what you wanted, but here at least would be a SNOBOL4+/SPITBOL version of a complete program that does what you want: SWS = SPAN(" " CHAR(9)) ;* 'span whitespace' pattern TAB = CHAR(9) ;* define a tab character LET = ANY(&LCASE &UCASE) ;* parse an alpha character RECPAT = SPAN("0123456789") . N SWS LET . M1 SWS LET . M2 RLOOP (?(N1 = N) ?(M1A = M1) ?(M2A = M2) ?(LN1 = LN)) ;* remember prior line LINE = INPUT ?(LN = LN + 1) :F(END) ;* read and count line OUTPUT = ~(LINE ? RECPAT) "Line number " LN " is invalid." :S(RLOOP) OUTPUT = EQ(N1,N) LN1 "-" LN TAB M1A M1 TAB M2A M2 :(RLOOP) END The short length and speed of doing stuff like this in SNOBOL4+/SPITBOL is part of what still incites me to do this kind of thing in S-BOL rather than Icon... I'll be interested to see what kinds of Icon versions people post! Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Fri Feb 28 12:23:11 1997 Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 12:48:34 MST Message-Id: <199702281720.AA15519@optima.cs.arizona.edu> X-Sender: lindsay@mail.rmc.ca X-Mailer: Windows Eudora Light Version 1.5.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 28 Feb 1997 12:23:11 -0500 To: icon-group@cs.arizona.edu From: "John H. Lindsay" Subject: Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3767 At 08:17 1997 02 26 -0500, you wrote: >[LONG post warning!] > >One of the things that strikes me from the partial set of responses >I've gotten regarding my queries "What's the largest Icon program >you've written?" and related, is the extent to which these reported >uses of Icon are examples of "new wines in old bottles". That is to >say, the applications remain pretty traditional, although Icon brings >its own means and methods to these problems. ... big snip ... You (and at least one other poster) rightly point out the nicities and problems related to 2-dimensional extensions. In the same vein, I'll drop back to 1-dimensional ideas. It has bothered me for a long time that the idea of _string_ has only been applied to single characters in icon and many other languages. The problems of macro call recognition, local syntax processing and partial pre-compilation are related to handling strings of strings or strings of tokens (where a token is, roughly, a structure consisting of a string with some extra information). HMP (High-Level Multipurpose Language or High- Level Macro Language - I.B.M.'s never-openly distributed macro extension to PL/I) and ML/I (Brown's Macro Language/ I) allow for recognition of essentially BNF-like patterns of such strings, but not of string handling with similar operations to what we now use freely with character strings, only restricted references to the individual character string RESULTS (from tokens) of recognizing such token strings. No language seems to support directly or even to support via a standard library or module, the character-string-like or tree-like operations on strings of anything else. (I haven't yet gotten around to looking at TXL - Tree Transformation Language - done just a few years ago at Queen's University though, so I shouldn't say that quite yet.) In the string operations, I'm thinking not only of concatenation and extracting a copy of a substring, but of Icon and SNOBOL4-like pattern matching with excursions into other code in the process a la unevaluated expressions in SNOBOL4 pattern matching and extracting a copy of or even a reference to (as a pseudovariable) of a matched portion. The worst part is that, currently, Icon lacks anything like SNOBOL4's OPSYN that can be used to give unused unary prefix or binary infix operators a meaning or a new meaning. Fortunately, with SNOBOL's polymorphic data, the ability to overload operators is implicit and it would be implicit in Icon too if Icon had an OPSYN-like facility. I would like to play with such ideas, and on more than just pencil and paper. The dodge of using functions works, but is not as systactically simple or as expressive as using operators; hence, it's harder to see underlying structure and problems. For this type of end, I'd love to see the ability in Icon to create new operators, and to extend and to redefine existing operators. Even though Icon has very many pre-defined operators, Individual problems need more operators, and it seems to me that the lexical rule for 'what's an operator' is simple. I'd hope that the facility would generalize the idea of prefix vs postfix for unary operators with the idea of 2-operator and n-operator binary and n-ary expressions; such things seem to occur easily in natural language expressions. The scope of such extensions could be open to discussion, but with record type definitons being global to a program, global scope might be appropriate. I wouldn't mind having to code parentheses to resolve ambiguities for this sort of thing. All the best ! John H. Lindsay, DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE ROYAL MILITARY COLLEGE OF CANADA PO BOX 17000 STN FORCES KINGSTON ON K7K7B4 From icon-group-sender Fri Feb 28 14:17:52 1997 Received: by cheltenham.cs.arizona.edu; Fri, 28 Feb 1997 16:24:05 MST Message-Id: <1.5.4.32.19970228201752.006dcf90@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 28 Feb 1997 14:17:52 -0600 To: "John H. Lindsay" , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2375 snip...snip... > >The worst part is that, currently, Icon lacks anything like SNOBOL4's >OPSYN that can be used to give unused unary prefix or binary infix >operators a meaning or a new meaning. Fortunately, with >SNOBOL's polymorphic data, the ability to overload operators >is implicit and it would be implicit in Icon too if Icon had an >OPSYN-like facility. Since icon variables are not typed, the operators are. So if you were to define a operator, it seems like you'd need some way to define a new "data" type that the operator would cast the variable into. .snip.. >For this type of end, I'd love to see the ability in Icon to create new >operators, and to extend and to redefine existing operators. Even >though Icon has very many pre-defined operators, Individual >problems need more operators, and it seems to me that the lexical >rule for 'what's an operator' is simple. I'd hope that the facility would >generalize the idea of prefix vs postfix for unary operators with the >idea of 2-operator and n-operator binary and n-ary expressions; >such things seem to occur easily in natural language expressions. >The scope of such extensions could be open to discussion, but >with record type definitons being global to a program, global scope >might be appropriate. I wouldn't mind having to code parentheses >to resolve ambiguities for this sort of thing. I suggested this once too. I envisioned using the $ as a dynamic programmer defined operator. You'd need to define unary and binary properties and have to be careful about data conversions. But I guess someone was assigning $ to be some other part of the language at the time, and the idea never caught on. examples.... _____________________________________________________ operator unary(myfunc) operator binary(otherfunc) procedure myfunc(a) return a * sin(1.00/a) end procedure otherfunc(a,b) return a*a + b*b end ______________________________________________________ >John H. Lindsay, >DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE >ROYAL MILITARY COLLEGE OF CANADA >PO BOX 17000 STN FORCES >KINGSTON ON K7K7B4 > > Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Fri Feb 28 20:57:37 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 08:32:40 MST Date: Fri, 28 Feb 1997 20:57:37 -0600 (CST) Message-Id: <199703010257.UAA23596@dfw-ix9.ix.netcom.com> X-Sender: bobalex@popd.ix.netcom.com X-Mailer: Windows Eudora Pro Version 2.1.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Stuart Robinson , Icon Group From: Bob Alexander Subject: Re: Help with Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1723 Here's a little Icon program that does what you asked, I think. I'll leave it as an exercise to add little improvements like a "local" declaration (not all that helpful in such a small program, but a good idea as complexity increases), and maybe comments (it's not a necessary part of the Icon culture to write cryptic programs). If any questions, feel free to ask. --- Bob procedure main() lineNbr := 0 while line := read() do line ? { lineNbr +:= 1 (nbr := tab(many(&digits)) & tab(many(' \t')) & letter1 := move(1) & tab(many(' \t')) & letter2 := move(1) & pos(0)) | write("*** Line ",lineNbr," is invalid") if nbr === lastNbr then write(lineNbr - 1,"-",lineNbr," ", lastLetter1,letter1," ",lastLetter2,letter2) lastNbr := nbr; lastLetter1 := letter1; lastLetter2 := letter2 } end >I have a number of texts each line of which has been coded for three types >of information. Each line of the text will be assigned a number and a >code for two categories. The numbers are just whole numbers (raning from 1 >to 20 or so) and each category has four members (say, ABCD and WXYZ). >Here is an example text: > >1 A X >1 A Y >1 B Y >2 B Y > >Note that some successive lines share an index number (as in lines 1 and >2 and 2 and 3). When that is the case, I would like the program to >output the members of each category for the matched lines, as below: > >1-2 AA XY >2-3 AB YY > >That is it. There are some additional complications, but I think that I >can solve those at a later date. At the moment, this sort of >rough-and-ready analysis is all I need. > >Any suggestions? Thanks in advance. > >--Stuart > > > > From icon-group-sender Sat Mar 1 17:58:34 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 08:32:57 MST Date: Sat, 1 Mar 1997 17:58:34 +0200 (WET) From: Ehud Lamm To: Jan Galkowski Cc: icon-group@cs.arizona.edu Subject: Re: Icon and two-dimensional matching In-Reply-To: <331437DE.41C67EA6@solstice.digicomp.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 905 The problem of two dimensional matching is a problem I tend to come back to every couple of years. What usually stopos me from starting to hack some code, is that I don't seem to be able to formulate a model which will be both simple enough and sufficient to use in interesting contexts. I usually end up desinging something specific for the problem at hand. Examples are: Checking MineSweeper board configurations; finding sections in HTML pages (e.g, section title from of articles); Multi-line grep etc. If you can point me to something general along these lines - which I can use, I'd be happy. If you showed me a good grammer for this kind of thing - I'd be surprised not to find it already coded and shipped. I suggest you point your question to comp.theory as well. Any way - I'd be happy to hear any thought on matters such as these. Ehud Lamm mslamm@pluto.mscc.huji.ac.il From icon-group-sender Mon Mar 3 12:31:17 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 13:01:51 MST Date: Mon, 3 Mar 1997 12:31:17 -0600 Message-Id: <199703031831.MAA09252@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: Help with Program To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1836 >> I thought about making something where you concatenate two consecutive lines (in an overlapping pairs fashion) and then parse the two lines with a single pattern match... eliminating the need to separately test the two category numbers for equality, and eliminating all those "remember" assignments... but finally decided that the way I did it was clearer and probably faster as well. >That would have been an interesting solution to see! It's really pretty simple, too (although my original was probably more efficient): &TRIM = 1 SWS = SPAN(" " CHAR(9)) ;* 'span whitespace' pattern TAB = CHAR(9) ;* define a tab character LET = ANY(&LCASE &UCASE) ;* parse an alpha character RECPAT = SPAN("0123456789") $ N SWS LET . M1A SWS LET . M2A SWS + *N SWS LET . M1 SWS LET . M2 RPOS(0) RLOOP (?(L1 = L) ?(LN1 = LN)) ;* remember prior line L = INPUT ?(LN = LN + 1) :F(END) ;* read and count line (L1 " " L) ? RECPAT :F(RLOOP) ;* parse line pair OUTPUT = LN1 "-" LN TAB M1A M1 TAB M2A M2 :(RLOOP) END This version unfortunately requires that the number appear in EXACTLY the same form, although that could be fixed by changing *N to: SPAN("0123456789") $ N2 *EQ(N,N2) The bigger problem is that (since now you have two reasons for the pattern to fail... either the line doesn't parse, or else the lines don't match) and that you basically both lose the diagnostic message for malformed lines, and you change the way the two surrounding (presuming they're good) lines are handled. One could make it less possible to "fool" the pattern match by appending something trickier than a space between the records (a CR/LF pair might work, for example) and changing the pattern appropriately. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Mon Mar 3 12:56:34 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 13:02:08 MST Message-Id: <199703031852.AA05027@optima.cs.arizona.edu> X-Sender: lindsay@mail.rmc.ca X-Mailer: Windows Eudora Light Version 1.5.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 03 Mar 1997 12:56:34 -0500 To: jan@solstice.digicomp.com (Jan Galkowski), icon-group@cs.arizona.edu, jtgalkowski@worldnet.att.net From: "John H. Lindsay" Subject: Re: "Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 7649 At 11:51 1997 02 28 -0500, you wrote: > >On Fri, 28 Feb 1997 09:45:54 -0500 John H. Lindsay" > wrote >>... big snip ... > >>You (and at least one other poster) rightly point out the nicities and >>problems related to 2-dimensional extensions. In the same vein, >>I'll drop back to 1-dimensional ideas. > >I hope you have posted this response out to comp.lang.icon. I didn't >see it there. Actually, I didn't even see this other post that addressed >2-dimensional extensions. Newsgroups are funny things. If you could, >might you send me a copy of this other post? Thanks. Sounds >interesting. I've just about finished reorganizing my machine, partly due to hardware problems, and partly due to a major reorganization of the college's net access; I have e-mail back, but not a news reader just yet. I received your message via e-mail since I'm on the Icon mailing list. I've copied my original e-mail for you to the news group, and added the news group address to this message. The other message was the one by Mark Espie; let me know if you didn't see it. I think posts to the news group are turned around quite automatically to the mailing list, but appearance on the news group may take quite a bit longer. >>It has bothered me for a long time that the idea of _string_ has >>only been applied to single characters in icon and many other >>languages. ... snip ... > Could you explain this part a little better? It seemed to run on. There are only a couple of character string operators that are generally implemented, concatenation and extraction of a copy of a substring. SNOBOL4, and to a lesser extent, Icon, add pattern matching with picking out values of simple or complex parts of the string as matched by patterns. I find it a matter of assymetry that (1) many other languages don't have strings of anything other than characters, (2) while Icon has lists, they are different from strings (a list of characters is different from a character string), lists have a different concatenation operator, but the same element and substring selectors, and they don't have pattern matching, and (3) where languages have ways of treating variables, values and expressions, these are usually not propagated to strings of any sort. Of note is the ability of some languages to treat a portion of an agregate or of an apparently indivisible thing like a file variable as if it were a variable - a pseudovariable. In some cases this creates access to otherwise inaccessible things, the status of a file, the ability to terminate a task by setting the completion status of a task variable, or the current dimensions of a conformant array parameter in ISO Extended Pascal. In other cases, this both creates a problem in that there is more than one way to address an area of storage (with problems for some (all?) programmers ensuing), and also creates a necessary way to do some necessary things like treat a diagonal or column of a vector of a matrix as a vector in its own right. Slices or cross-sections of arrays in Algol 68 are a case in point; these may be written easily and assigned to IN SITU as if they were variables so that the host array has its values changed. Cross-sections may be passed to routines as arrays. There may be some restrictions on what one can do with a pseudovarible - one might resize an array, but would not attempt to resize a cross-section since this would do violence to the host array, or be a meaningless operation. Icon and SNOBOL emphasize handling values rather than references although there are 'name' operators, and don't handle sub-arrays, substrings or sublists as pseudovariables. For my work, I'd really like to be able to define methods of handling sub(structures | strings | arrays) as structures, strings, or arrays. A few of these things are available in Icon, and the rest aren't. I need to be able to do things like do pattern matching on the output of a generator, where the generator might yield a stream of characters or a stream of other sorts of things -- tokens. This means defining new operators or extending the meaning of existing operators to new types of data or to new semantic situations. I'm interested in generalized macro processing, where the macro processing becomes a method - a dynamic method - of program language development, and that plays just as much a part in program development as algorithm design, module design and data structure design. One specifies the TRANSLATION of algorithms, data specifications, ... into code. Previous passes over the text or previous work in the same pass where rescanning is allowed, besides perhaps transforming the text, may decorate it with tokens (roughtly, a structure containing a source string and other information), or with trees or with other structures and with other information. Then one has to recognize patterns among the tag-along information and source text, and to process it both by generating new information and transforming the structures and data that exist. > If I understand correctly, what you're going after is something like >being able to bind arbitrary portions of what we call "strings" with >procedural packages. I'm thinking of something like currying functions >in the lambda calculus with pieces of "unevaluated" strings and being >able to splice these critters in freely amongst the characters. Am I >off? Generally, I try to avoid deeper aspects of formal logic, so I'm guessing here; you've got most of it, I think. >>The worst part is that, currently, Icon lacks anything like SNOBOL4's >>OPSYN that can be used to give unused unary prefix or binary infix >>operators a meaning or a new meaning. ... snip ... > I knew SNOBOL4 some time ago, but I forget what OPSYN does. >In your post to the comp.lang.icon, could you describe these and other >features of Icon? Not everyone who comes to and uses Icon came >there from SNOBOL4. OPSYN is a function that assigns an existing function name or operator as the meaning of a name or operator. One can overload an operator by saving the meaning of an operator, and then assigning the operator to a routine containing a test of the data type of the arguments to determine whether to apply the old operator meaning, or use the new meaning. ... snip ... > Well, I suppose it depends upon what one means by functions. To >me, an operator or functional is simply a curried version of a multiple >parameter function, assuming functions have full rights as they should, >and as they do in Icon, and Edison, for example. Right. I don't know Edison; do you have a reference ? >>For this type of end, I'd love to see the ability in Icon to create new >>operators, and to extend and to redefine existing operators. ... snip ... > Hmmm. Why couldn't one define a series of unbounded-number-of- >arguments procedures which picked up their "actual" parameters by >pattern matching in the immediate context of their being called? That is, >why wouldn't the same be achieved by building pattern matching into >the parameter passing mechanism, something which could be >implemented on a procedure by procedure case? One wouldn't >want the overhead of pattern matching in each and every instance, >true? ????? I'll think about this one. > >Have a great weekend, > > Jan Galkowski. Thanks, it was; I hope yours was great as well. All the best ! John H. Lindsay, Assistant Professor, DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE ROYAL MILITARY COLLEGE OF CANADA PO BOX 17000 STN FORCES KINGSTON ON K7K7B4 From icon-group-sender Mon Mar 3 17:54:07 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 16:36:27 MST To: icon-group@cs.arizona.edu Date: 3 Mar 1997 17:54:07 GMT From: kot@buteo.math.utk.edu (Mark Kot) Message-Id: <5ff37v$r3n$1@gaia.ns.utk.edu> Organization: University of Tennessee Sender: icon-group-request@cs.arizona.edu Subject: reading reals Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 263 What is the Icon analog to the C programming instruction scanf("%f%f", &x, &y); ? That is, what is the simplest (or most standard) way to read two real numbers (with intervening and/or preceding white space) from a line of input in Icon ? Many thanks ! From icon-group-sender Mon Mar 3 15:49:08 1997 Received: by cheltenham.cs.arizona.edu; Mon, 3 Mar 1997 16:36:39 MST Date: Mon, 3 Mar 1997 15:49:08 -0600 Message-Id: <199703032149.PAA13757@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: "Re: Icon and two-dimensional matching To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1858 Interesting article, however: >Icon and SNOBOL emphasize handling values rather than references although there are 'name' operators, and don't handle sub-arrays, substrings or sublists as pseudovariables. SNOBOL4 absolutely DOES support substrings as a pseudovariable, as long as the substring in question it the portion of the subject string that you're matching. This, in fact, is the basis for ALL pattern matching in SNOBOL4! >I'm interested in generalized macro processing, where the macro processing becomes a method - a dynamic method - of program language development, and that plays just as much a part in program development as algorithm design, module design and data structure design. One specifies the TRANSLATION of algorithms, data specifications, ... into code. Previous passes over the text or previous work in the same pass where rescanning is allowed, besides perhaps transforming the text, may decorate it with tokens (roughtly, a structure containing a source string and other information), or with trees or with other structures and with other information. Then one has to recognize patterns among the tag-along information and source text, and to process it both by generating new information and transforming the structures and data that exist. One of the shortcomings of Icon (compared with S-BOL), IMO, is that Icon supports neither EVAL() nor CODE(). Admittedly these are features that one doesn't use often in most S-BOL programs, but when you -do- need them, they are absolutely indispensable! In the case in question, you could use the full features of S-BOL to modify the program itself at source level, and to replace almost any desired part of it with an "enhanced" version during program execution... even in the middle of a statement! Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Mon Mar 3 18:46:44 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 08:22:45 MST Date: Mon, 3 Mar 1997 18:46:44 -0600 Message-Id: <199703040046.SAA14304@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: reading reals To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 957 >...What is the Icon analog to the C programming instruction > scanf("%f%f", &x, &y); ? >That is, what is the simplest (or most standard) way to read two real numbers (with intervening and/or preceding white space) from a line of input in Icon ? If I were doing it in SNOBOL/SPITBOL (S-BOL) I'd probably just use something like: RD = "0123456789-." ;* define real digits characters RECORD FENCE BREAK(RD) SPAN(RD) . X BREAK(RD) SPAN(RD) . Y One could, of course, easily enough define more demanding patterns which required more specific formatting and which wouldn't match things like "4.0.7-.-86", but for straightforward applications the way I proposed it would probably work fine. Similar approaches would probably yield similar results in Icon using string scanning. If you then need to have X and Y be specifically numeric type, that's easy enough by: X = +X Y = +Y Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Mon Mar 3 20:29:10 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 08:22:55 MST Date: Mon, 3 Mar 1997 20:29:10 -0600 (CST) From: "Chris D. Tenaglia" To: Mark Kot Cc: icon-group@cs.arizona.edu Subject: Re: reading reals In-Reply-To: <5ff37v$r3n$1@gaia.ns.utk.edu> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1251 # # not much error checking done # I include the other procedures as examples too # procedure main() line := input("Enter A & B>") a := real(parse(line,' \t')[1]) b := real(parse(line,' \t')[2]) write(real(a + b)) end # # prompt for an input string # procedure input(prompt) writes(prompt) return read() end # # parse a string into a list with respec to a delimiter # procedure parse(line,delims) static chars chars := &cset -- delims tokens := [] line ? while tab(upto(chars)) do put(tokens,tab(many(chars))) return tokens end Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | ce que vous obtenez ! On 3 Mar 1997, Mark Kot wrote: > Date: 3 Mar 1997 17:54:07 GMT > From: Mark Kot > To: icon-group@cs.arizona.edu > Subject: reading reals > > > What is the Icon analog to the C > programming instruction > > scanf("%f%f", &x, &y); ? > > That is, what is the simplest (or most standard) > way to read two real numbers (with intervening > and/or preceding white space) from a line of > input in Icon ? > > Many thanks ! > From icon-group-sender Mon Mar 3 15:03:06 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 08:23:18 MST To: icon-group@cs.arizona.edu Date: Mon, 03 Mar 1997 15:03:06 -0700 From: Steve Wampler Message-Id: <331B4A9A.4C37@gemini.edu> Organization: Gemini 8m Telescopes Project Sender: icon-group-request@cs.arizona.edu References: <5ff37v$r3n$1@gaia.ns.utk.edu> Subject: Re: reading reals Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1015 Mark Kot wrote: > > What is the Icon analog to the C > programming instruction > > scanf("%f%f", &x, &y); ? > > That is, what is the simplest (or most standard) > way to read two real numbers (with intervening > and/or preceding white space) from a line of > input in Icon ? Hmmm, 'simplest' is interesting. I assume you really mean %f, and not %g, and that you're happy with pretty simple error checking. Here's one approach: procedure main() every line := !&input do { line ? { x := get_real() | write(&errout, "Bad real: ",&subject) y := get_real() | write(&errout, "Bad real: ",&subject) } write("x = ", x) write("y = ", y) } end procedure get_real() static digitseq initial digitseq := '+-.' ++ &digits suspend real( (tab(upto(digitseq)), tab(many(digitseq))) ) end -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] The Gods that smiled upon your birth are laughing now. -- fortune cookie From icon-group-sender Tue Mar 4 01:41:06 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 08:23:28 MST Date: Tue, 4 Mar 1997 01:41:06 -0600 Message-Id: <199703040741.BAA05683@segfault.cs.utsa.edu> From: Clinton Jeffery To: espie@fregate.ens.fr Cc: icon-group@cs.arizona.edu In-Reply-To: <5f1r3u$b7l@nef.ens.fr> (espie@fregate.ens.fr) Subject: Re: Icon and two-dimensional matching Reply-To: jeffery@cs.utsa.edu Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 694 [Marc Espie wrote:] > I've got cases where everything ended up in one or two buckets, > or rather larger sets where the hashing process failed due to the > sheer size of the data. Interesting. I will agree that it might be useful to be able to specify your own hashing function. It is true that tables with millions of elements use a LOT of memory. But given a computer with enough memory the tables scale up very well to large size, thanks to work by Bill Griswold and Gregg Townsend. The number of buckets increases dynamically. Clint Jeffery jeffery@cs.utsa.edu Division of Computer Science, The University of Texas at San Antonio Research http://www.cs.utsa.edu/research/plss.html From icon-group-sender Tue Mar 4 08:20:39 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 14:44:17 MST To: icon-group@cs.arizona.edu Date: 4 Mar 1997 08:20:39 -0700 From: icon-project@cs.arizona.edu Message-Id: <5fhek7$1p5@cheltenham.CS.Arizona.EDU> Organization: University of Arizona CS Department, Tucson AZ Sender: icon-group-request@cs.arizona.edu Reply-To: icon-project@cs.arizona.edu Subject: Icon Programming Language FAQ Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 14760 Archive-name: comp-lang-icon-faq Posting-Frequency: monthly Frequently Asked Questions About The Icon Programming Language Last updated: December 11, 1996 This FAQ answers various questions about the Icon programming language, ranging from what it is to how you can get it. The master copy of this FAQ is the Web page http://www.cs.arizona.edu/icon/faq.html. Other on-line documentation is available via the main Icon page at http://www.cs.arizona.edu/icon/. This FAQ is written by Ralph Griswold and Gregg Townsend, with help from Cliff Hathaway, Clint Jeffery, and Bob Alexander. * 1. What is Icon? * 2. What is Icon good for? * 3. Where did Icon come from? * 4. What does "Icon" stand for? * 5. On what computers does Icon run? * 6. Who did all these implementations? * 7. Are there other implementations in the works? * 8. What about different versions of Icon? * 9. Which implementations of Icon have graphics/window capabilities? * 10. Where can I get Icon? * 11. Where can I get documentation about Icon? * 12. How do I get started with Icon? * 13. What is the Icon Project? * 14. Where can I find examples of Icon programs? * 15. What is Idol? * 16. How often is material in Icon's FTP area updated? * 17. How do I stay up to date with what's going on with Icon? * 18. Is there a users' group for Icon? * 19. How do I get technical support? * 20. What do I need to run Icon? * 21. Can I build my own implementation of Icon for a new platform? ---------------------------------------------------------------------------- 1. What is Icon? Icon is a very high level general-purpose programming language with extensive features for processing strings (text) and data structures. Icon is an imperative, procedural language with a syntax that is reminiscent of C and Pascal, but its semantics are at a much higher level than those languages. Icon has a novel expression-evaluation mechanism that integrates goal-directed evaluation and backtracking with conventional control structures. It has a string scanning facility for pattern matching that avoids the tedious details usually associated with analyzing strings. Icon's built-in data structures include sets and tables with associative lookup, lists that can be used as vectors or stacks and queues, and records. Icon is a strongly, though not statically, typed language. It provides transparent automatic type conversion. For example, if an integer is used in an operation that requires a string, the integer is automatically converted to a string. Several implementations of Icon have high-level graphics facilities with an easily programmed window interface. Icon manages storage automatically. Objects are created as needed during program execution and space is reclaimed by garbage collection as needed. The sizes of strings and data structures are limited only by the amount of available memory. 2. What is Icon good for? As a general-purpose programming language with a large computational repertoire, Icon can be used for most programming tasks. It's at its best when used build software tools, for processing text, and when ease of programming is needed for experimental and research applications. Paradoxically, Icon is used most often for short, one-shot tasks and for very complex applications. Icon is designed to make programming easy; it emphasizes the value of programmer's time and the importance of getting programs to work quickly. This explains its usefulness for prototyping as well as the apparent paradox of applicability to simple and complex applications. 3. Where did Icon come from? Icon is the latest in a series of high-level programming languages designed to facilitate programming tasks involving strings and structures. The original language, SNOBOL, was developed at Bell Telephone Laboratories in the early 60s. SNOBOL evolved into SNOBOL4, which is still in use. Subsequent languages were developed at The University of Arizona with support from the National Science Foundation. Incidentally, Icon bears little physical resemblance to SNOBOL4, although it has similar objectives and many similar capabilities. 4. What does "Icon" stand for? The name Icon (which is not spelled ICON) is not an acronym nor does it stand for anything in particular, although the word "iconoclastic" was mentioned at the time the name was chosen. The name predates the now common use of "icon" to refer to small images used in graphical user interfaces. This latter usage sometimes causes persons to think mistakenly that Icon is designed to create or manipulate icons. There's not much that can be done about this. 5. On what computers does Icon run? The implementation of Icon is highly portable. Version 9 runs on UNIX, MS-DOS, Windows, NT, Macintosh/MPW, VAX/VMS, the Amiga, and the Acorn Archimedes. There are older versions for the Atari ST, IBM CMS and MVS, the Macintosh, and OS/2. Icon programs also are highly portable. Most Icon programs can run on any platform that supports Icon. 6. Who did all these implementations? The original implementation of Icon for UNIX was done at The University of Arizona. Most of the other implementations originally were done by volunteers scattered around the world. It's worth noting that all implementations of Icon are based on the same source code, which is written in C. This contributes to the portability of Icon itself, as well as to the portability of programs written in Icon. 7. Are there other implementations in the works? Work is constantly underway on implementations of Icon for new platforms. Microsoft Windows and Windows NT implementations are in beta testing. 8. What about different versions of Icon? Icon has evolved through a series of versions with improved and extended capabilities. The latest major version number is 9. This version includes recent changes and additions, notably in the graphics area, and runs on UNIX, MS-DOS, Macintosh/MPW, VAX/VMS, the Amiga, and Acorn Archimedes. Other implementations presently are at Version 8. Almost all programs that run under Version 8 and that do not use graphics will run under Version 9. 9. Which implementations of Icon have graphics/window capabilities? Icon's graphics facilities presently are supported on UNIX and VAX/VMS. Windows NT and Microsoft Windows implementations that support Icon's graphics facilities are in beta testing. 10. Where can I get Icon? Icon is available via anonymous FTP and on the Web. For FTP, use ftp.cs.arizona.edu and cd /icon. For the Web, use http://www.cs.arizona.edu/icon/ and check out the links there. For FTP, the directory /icon/binaries contains executable versions of Icon for several systems, including several popular UNIX platforms. The directory /icon/packages contains source code, test programs, related material, and, most cases, executable binaries as well. All directories have README files with additional information. 11. Where can I get documentation about Icon? The definitive work on Icon is the book The Icon Programming Language, Griswold and Griswold, third edition, Peer-to-Peer Communications, Inc, 1996, 386 pages, ISBN 1-57398-001-3. This book is a complete description and reference manual for Version 9 of Icon. A technical report describes changes since that version. There also is a book on the implementation of Icon: The Implementation of the Icon Programming Language, Griswold and Griswold, Princeton University Press, 1986, 336 pages, ISBN 0-691-08431-9. This book describes the implementation as of Version 6 of Icon. Although the implementation has changed considerably since then, the basic structure is the same. Technical reports describing recent implementation changes are included with copies of the book purchased from the Icon Project. These books are available from the Icon Project. Additional documentation is available via FTP in /icon/doc. Notable documents are: * IPD266: An Overview of Icon (text, PostScript, PDF) * IPD281: Graphics/window facilities (PostScript, PDF) * IPD278: Version 9.3 of Icon (text, PostScript, PDF) There are manual pages for UNIX systems, and more documentation under the Icon web page, but there is no complete on-line documentation. The Icon Newsletter, which includes topical material about Icon and a list of material available from the Icon Project, is published three times a year and is available on the Web. There is a subscription fee for an on-going subscription by postal mail. The Icon Analyst, a technically-oriented newsletter that features articles about programming, is published six times a year. There is a subscription fee for the Analyst. A sample copy is available on the Web. All back issues of both newsletters are available for purchase. 12. How do I get started with Icon? If you're running under UNIX, check first in the /icon/binaries/unix FTP directory to see if there is a "starter kit" for your platform. Starter kits include executables, documentation, and other material. Otherwise, go to the /icon/packages directory and get the appropriate package. Packages include documentation and other material; see the README file in that directory for more details. There is a UNIX package for platforms that lack starter kits. If the non-UNIX package you pick up does not contain executable files, check /icon/binaries. You also may want to get the overview of Icon: /icon/doc/ipd266.txt or ipd266.ps.Z. You'll find pointers to other documents of interest in the package you pick up. 13. What is the Icon Project? The Icon Project is a name used by the group that develops, implements, distributes, and supports the Icon programming language. The Icon Project is not commercial organization. It derives support from The University of Arizona, revenue from the sale of program material and documentation, and user contributions. 14. Where can I find examples of Icon programs? There is a large program library for Icon. It is an excellent resource for both new and experienced programmers. The library contains numerous examples of how to do things with Icon. The library also provides many useful applications, as well as hundreds of procedures that supplement Icon's built-in repertoire. The library, like other Icon material, is available via FTP in /icon/library. 15. What is Idol? Idol is an object-oriented extension to Icon that provides concepts such as classes and multiple inheritance. Idol is written in Idol and is distributed as part of the Icon program library. Idol runs on almost all of the platforms that support Icon. Additional Idol information is available from Clint Jeffery, jeffery@ringer.cs.utsa.edu. 16. How often is material in Icon's FTP area updated? New material is added when it's available. Established implementations usually are updated only when there's a new version. This typically is every year or two. The Icon program library is updated on a similar schedule. 17. How do I stay up to date with what's going on with Icon? The best way to find out about developments related to Icon is to read the Icon Newsletter. You can stay up to date on the source code, which is changed much more frequently than the version on FTP is updated, by subscribing to the source update service, which provides a new version about twice a year. There also is a subscription service for updates to the Icon program library, which provides new material about twice a year. There is on-line information about subscribing to these services. 18. Is there a users' group for Icon? There is no official Icon users' group. The Icon Project maintains an electronic mailing list, icon-group@cs.arizona.edu. Mail sent to this address is forwarded to subscribers. To subscribe (or unsubscribe), send a message to icon-group-request@cs.arizona.edu. There is a gateway between icon-group and comp.lang.icon, an unmoderated newsgroup for discussing issues related to Icon. The gateway, which exchanges messages between the two systems, is imperfect and not under the control of the Icon Project. The newsgroup generally provides faster response than the mailing list, is less intrusive, but sometimes suffers from inappropriate postings. The Icon Project usually sends messages of interest to the Icon community to icon-group. 19. How do I get technical support? The Icon Project is not a commercial organization, and its capacity for providing technical support is limited. Please use the appropriate resource when you need assistance: Ordering Icon Material mail: Icon Project Department of Computer Science The University of Arizona P.O. Box 210077 Tucson, Arizona 85721-0077 U.S.A. fax: (520) 621-4246 voice: (520) 621-6613 e-mail: icon-orders@cs.arizona.edu Getting On-Line Information and Material web: http://www.cs.arizona.edu/icon/ ftp: ftp.cs.arizona.edu (cd /icon) e-mail: ftpmail@cs.arizona.edu Send a message consisting of the word help. Assistance with Installing Icon e-mail: icon-project@cs.arizona.edu Bug Reports e-mail: icon-project@cs.arizona.edu fax: (520) 621-4246 Assistance with Programming Problems e-mail: icon-group@cs.arizona.edu news: comp.lang.icon Uploading Files ftp: ftp.cs.arizona.edu (cd /incoming) After uploading, send e-mail to icon-project@cs.arizona.edu. 20. What do I need to run Icon? Icon will run on most computers. Under MS-DOS, the Icon interpreter needs at least 500 KB of application RAM to work well. 21. Can I build my own implementation of Icon for a new platform? As mentioned above, Icon is written in C and the source code is available. The existing implementations are testament to its portability. (A small amount of assembly-language code is required for a context switch, but this is only needed for an optional feature -- co-expressions -- that can be disabled without affecting other features of Icon.) New ports involve platform-specific configuration parameters and, in some cases, platform-specific code. The feasibility of a new port and the amount of work it may take depends on the platform -- its architecture, its C compiler, and its environment. Ports to new UNIX platforms generally are easy, although novel architectures may present problems. Ports to new operating systems generally are more difficult, especially if Icon's graphics facilities are implemented. The Icon Project provides what help it can with new ports. In return, it asks that code related to the port to be returned to the Icon Project for inclusion in future versions of the source code for Icon. This makes the new port available to others as well as to the porter when Icon is updated. From icon-group-sender Tue Mar 4 11:37:26 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 14:44:03 MST Message-Id: <199703041635.AA27705@optima.cs.arizona.edu> X-Sender: lindsay@mail.rmc.ca X-Mailer: Windows Eudora Light Version 1.5.2 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Tue, 04 Mar 1997 11:37:26 -0500 To: gep2@computek.net, icon-group@cs.arizona.edu From: "John H. Lindsay" Subject: Re: Icon and two-dimensional matching Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3630 At 15:49 1997 03 03 -0600, you wrote: >Interesting article, however: > >>Icon and SNOBOL emphasize handling values rather than references >although there are 'name' operators, and don't handle sub-arrays, >substrings or sublists as pseudovariables. > >SNOBOL4 absolutely DOES support substrings as a pseudovariable, as long as the >substring in question it the portion of the subject string that you're matching. > This, in fact, is the basis for ALL pattern matching in SNOBOL4! No, at least not in the sense that I'm speaking about. Yes, it's possible to replace a substring (assign to it) in the middle of a string, thus making a string replacement statement a form of assignment. But that alone does not make a substring, either identified through pattern matching or using SUBSTR into a pseudovariable; one can't form the NAME of any sort of expression including a substring -- that's reserved to variables -- to pass it as an argument IN SITU to a called function for example. Passing cross-sections of arrays to a routine is a bit more interesting in Algol 68 than in PL/I; in the latter, with the * as a sort of subscript meaning 'all the subscript values in this dimension' or with the once-proposed subrange notation, the range of the subscripts for the cross-section argument and corresponding parameter are inherited from those of the host array, but in Algol 68, the range of subscripts of the slice defaults to from 1 to the number of elements in that dimension of the slice or may be specified as starting at any integer value as an optional part of the 'trimscript' that selects the slice from the host array. In these cases, it can be recognized that the slice (pseudovariable), while sharing storage with the host, is an array in its own right. >>I'm interested in generalized macro processing, where the macro >processing becomes a method - a dynamic method - of program >language development, and that plays just as much a part in program >development as algorithm design, module design and data structure >design. One specifies the TRANSLATION of algorithms, data >specifications, ... into code. Previous passes over the text or previous >work in the same pass where rescanning is allowed, besides perhaps >transforming the text, may decorate it with tokens (roughtly, a structure >containing a source string and other information), or with trees or with >other structures and with other information. Then one has to recognize >patterns among the tag-along information and source text, and to >process it both by generating new information and transforming the >structures and data that exist. > >One of the shortcomings of Icon (compared with S-BOL), IMO, is that Icon >supports neither EVAL() nor CODE(). Admittedly these are features that one >doesn't use often in most S-BOL programs, but when you -do- need them, they are >absolutely indispensable! Right ! >In the case in question, you could use the full features of S-BOL to modify the >program itself at source level, and to replace almost any desired part of it >with an "enhanced" version during program execution... even in the middle of a >statement! Right, but I'm considering general macro processing, and trying to avoid fixing it to any one language or compiler, even though for what I'm doing, there has to be a base language for the macro stuff. >Gordon Peterson >http://www.computek.net/public/gep2/ All the best ! John H. Lindsay, Assistant Professor, DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE ROYAL MILITARY COLLEGE OF CANADA PO BOX 17000 STN FORCES KINGSTON ON K7K7B4 From icon-group-sender Tue Mar 4 14:33:17 1997 Received: by cheltenham.cs.arizona.edu; Tue, 4 Mar 1997 14:44:43 MST Date: Tue, 4 Mar 1997 14:33:17 -0600 Message-Id: <199703042033.OAA32615@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: Icon and two-dimensional matching To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 4250 >>SNOBOL4 absolutely DOES support substrings as a pseudovariable, as long as the substring in question is the portion of the subject string that you're matching. This, in fact, is the basis for ALL pattern matching in SNOBOL4! >No, at least not in the sense that I'm speaking about. Yes, it's possible to replace a substring (assign to it) in the middle of a string, thus making a string replacement statement a form of assignment. Right... in essence, you're using a "pseudovariable", replacing a specified substring in a subject string, in an assignment statement. This is one very reasonable definition for a pseudovariable (okay, I agree that the syntax is a little different than would be done in other languages, but anyhow that's typical for S-BOL in a lot of ways!) >But that alone does not make a substring, either identified through pattern matching or using SUBSTR into a pseudovariable; one can't form the NAME of any sort of expression including a substring -- that's reserved to variables -- It's pretty trivial to evaluate the string value of the substring and put that into a variable. >to pass it as an argument IN SITU to a called function for example. Okay, but it's certainly easy enough to pass the VALUE to a called function in S-BOL (okay, not in SIL SNOBOL4): func(p1,(str ? pattern),p3) Admittedly that wouldn't allow modifying the substring in place from within the function. >Passing cross-sections of arrays to a routine is a bit more interesting in Algol 68 than in PL/I; I *do* think it curious that Algol (and particularly Burroughs Extended Algol, which was very highly regarded by those friends who used it back when I was at the University of Illinois) seems to have really disappeared as a language for current development. At the time, I used PL/1 quite heavily, and liked the language a lot. I think I would enjoy having a good PL/1 compiler for my PC, although I'm not really certain right at this instant what specific things I would do with it if I had it... perhaps mostly for nostalgia value, but I think I'd find stuff to do with it. >>>I'm interested in generalized macro processing, where the macro >processing becomes a method - a dynamic method - of program >language development, and that plays just as much a part in program >development as algorithm design, module design and data structure >design. One specifies the TRANSLATION of algorithms, data >specifications, ... into code. Previous passes over the text or previous >work in the same pass where rescanning is allowed, besides perhaps >transforming the text, may decorate it with tokens (roughtly, a structure >containing a source string and other information), or with trees or with >other structures and with other information. Then one has to recognize >patterns among the tag-along information and source text, and to >process it both by generating new information and transforming the >structures and data that exist. >>One of the shortcomings of Icon (compared with S-BOL), IMO, is that Icon >supports neither EVAL() nor CODE(). Admittedly these are features that one >doesn't use often in most S-BOL programs, but when you -do- need them, they are absolutely indispensable! >Right ! >>In the case in question, you could use the full features of S-BOL to modify the >program itself at source level, and to replace almost any desired part of it >with an "enhanced" version during program execution... even in the middle of a >statement! >Right, but I'm considering general macro processing, and trying to avoid fixing it to any one language or compiler, even though for what I'm doing, there has to be a base language for the macro stuff. Obviously. I think that a language like S-BOL would be ideal for macro processing, due to the intrinsic features in the language. Part of what makes it *especially* interesting is the ability to have the S-BOL macro processor PERMANENTLY augment its own features by adding code and using SAVE() to update its own code file with new features... allowing for a kind of persistence which is very difficult, I think, to do with other languages (even Icon) as a base. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Wed Mar 5 11:55:10 1997 Received: by cheltenham.cs.arizona.edu; Wed, 5 Mar 1997 12:24:02 MST To: icon-group@cs.arizona.edu Date: Wed, 05 Mar 1997 11:55:10 -0800 From: John Lindsay Message-Id: <331DCF9E.5B@rmc.ca> Organization: Royal Military College Sender: icon-group-request@cs.arizona.edu Subject: Anyone know Python & (Icon | SNOBOL4) ? Comments ? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 250 I just wandered into the Python newsgroup and saw posts referring to patterns -- !!! ??? !!! Can anone here comment on differences ? What sort of patterns are they talking about ? (I've asked for references and reading material there too.) From icon-group-sender Wed Mar 5 11:33:35 1997 Received: by cheltenham.cs.arizona.edu; Wed, 5 Mar 1997 16:29:51 MST Message-Id: <199703051933.LAA22373@newcs.ucsd.edu> To: John Lindsay Cc: icon-group@cs.arizona.edu Subject: Re: Anyone know Python & (Icon | SNOBOL4) ? Comments ? In-Reply-To: Your message of "Wed, 05 Mar 1997 11:55:10 PST." <331DCF9E.5B@rmc.ca> Date: Wed, 05 Mar 1997 11:33:35 -0800 From: William Griswold Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 612 They may mean ``Design Patterns''. It is a software design technique. You identify the problems you want to avoid in your code, which is a ``pattern'', and then the design pattern guide tells you what design solutions might work. Very popular in the OO world, but it is generally applicable. --bill In msg <331DCF9E.5B@rmc.ca>, John Lindsay writes: >I just wandered into the Python newsgroup and >saw posts referring to patterns -- !!! ??? !!! > >Can anone here comment on differences ? What >sort of patterns are they talking about ? (I've >asked for references and reading material there >too.) > From icon-group-sender Wed Mar 5 10:44:03 1997 Received: by cheltenham.cs.arizona.edu; Wed, 5 Mar 1997 16:30:01 MST To: icon-group@cs.arizona.edu Date: Wed, 5 Mar 1997 10:44:03 -0800 From: Brian Rogoff Message-Id: Sender: icon-group-request@cs.arizona.edu Subject: Recursive directory traversal in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 672 Hi, I've been reading the Icon web references, trying to decide if I should forsake Perl in favor of Icon, and I have two questions. (1) How do I traverse a hierarchical directory structure in Icon? I found chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there a way to do this in Icon, or do you rely on the external environment? (2) Why no module system? I've found modules helpful in every language I've worked with, and Icon doesn't seem to be different in that it could use such a system. I noticed someone else mention this, but it is not in the FAQ. Perl has benefitted greatly from the inclusion of modules. -- Brian From icon-group-sender Wed Mar 5 21:02:39 1997 Received: by cheltenham.cs.arizona.edu; Thu, 6 Mar 1997 09:23:14 MST Date: Wed, 5 Mar 1997 21:02:39 -0600 Message-Id: <199703060302.VAA29037@ns1.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Recursive directory traversal in Icon To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1979 >I've been reading the Icon web references, trying to decide if I should forsake Perl in favor of Icon, and I have two questions. >(1) How do I traverse a hierarchical directory structure in Icon? I found chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there a way to do this in Icon, or do you rely on the external environment? In SNOBOL4+, what I did was to write a loadable function DIRFNC() which allows you to get all the directory information for a given file (or other directory entry, and accepting wildcards). It also permits you to get volume labels and subdirectory names in the same way... once you have that, it's fairly simple to write a recursive tree traversing routine. The alternative (and which honestly I use a significant fraction of the time, even having the loadable function I wrote) is to simply execute the external MS-DOS DIR command (which now permits getting all the directory recursions with the /S option) and either route the output into a temporary file, or pipe it directly into the S-BOL program. Regenerating all the complete filenames with paths is a pretty trivial pattern match from that point. I think the reason why this kind of thing hasn't been incorporated into the language itself is because by its nature it's quite operating system dependent, whereas both Icon and S-BOL are designed to be as independent of the underlying operating system as possible. >(2) Why no module system? I've found modules helpful in every language I've worked with, and Icon doesn't seem to be different in that it could use such a system. I noticed someone else mention this, but it is not in the FAQ. Perl has benefitted greatly from the inclusion of modules. The inclusion feature in SNOBOL4+ makes it quite simple to load subroutines as needed from one or more library subdirectories, and automatically suppresses duplicate requests. Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Thu Mar 6 08:55:25 1997 Received: by cheltenham.cs.arizona.edu; Thu, 6 Mar 1997 13:36:14 MST Date: Thu, 6 Mar 1997 08:55:25 -0800 From: kwalker@orville.premenos.com (Ken Walker) Message-Id: <199703061655.IAA10379@varda.premenos.com> To: icon-group@cs.arizona.edu, bpr@best.com Subject: Re: Recursive directory traversal in Icon Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Md5: /S59TrK46z3UOLzx5KRRtA== Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1715 > From: Brian Rogoff > Subject: Recursive directory traversal in Icon > > (2) Why no module system? I've found modules helpful in every language I've > worked with, and Icon doesn't seem to be different in that it could use > such a system. I noticed someone else mention this, but it is not in > the FAQ. Perl has benefitted greatly from the inclusion of modules. 6 or 7 years ago, I implemented modules in ISI's attempt at a commercial version of Icon (technicall, the U of A's version with proprietary extensions). We produced a product, but the venture didn't get anywhere. The module feature allowed better information hiding and helped manage the global name space. A more "modern" approach to dealing with these (and other) problems is "objects". Even before ISI's version of Icon, Clint Jeffery created IDOL, an object-oriented version of Icon, implemented with a preprocessor. The preprocessor is distributed as a part of the "Icon Program Library". It is possible to have both objects and modules in a language. Java packages are modules. Within them you can declare classes. Because classes cannot be nested and give the user of the class no control over visability, classes don't give implementer as much cabability for information hiding and doesn't give users as much control over their the global name space as you'd like. Note that while objects are useful for projects of all sizes, modules really become helpful only for larger projects. Maybe someday there will be a verion of Icon with both features, but someone will have to be interested enough and have the resources to implement it. Ken Walker, kwalker@premenos.com Premenos Coporation, Concord, Ca. 94520 From icon-group-sender Thu Mar 6 09:54:22 1997 Received: by cheltenham.cs.arizona.edu; Thu, 6 Mar 1997 13:36:24 MST Date: Thu, 6 Mar 1997 09:54:22 -0800 (PST) From: Brian Rogoff To: Ken Walker Cc: bpr@best.com, icon-group@cs.arizona.edu Subject: Modules in Icon (Was Re: Recursive directory traversal in Icon) In-Reply-To: <199703061655.IAA10379@varda.premenos.com> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2693 On Thu, 6 Mar 1997, Ken Walker wrote: > > From: Brian Rogoff > > Subject: Recursive directory traversal in Icon > > > > (2) Why no module system? I've found modules helpful in every language I've > > worked with, and Icon doesn't seem to be different in that it could use > > such a system. I noticed someone else mention this, but it is not in > > the FAQ. Perl has benefitted greatly from the inclusion of modules. > > 6 or 7 years ago, I implemented modules in ISI's attempt at a commercial > version of Icon (technicall, the U of A's version with proprietary extensions). > We produced a product, but the venture didn't get anywhere. The module > feature allowed better information hiding and helped manage the global > name space. A more "modern" approach to dealing with these (and other) > problems is "objects". Even before ISI's version of Icon, Clint Jeffery > created IDOL, an object-oriented version of Icon, implemented with a > preprocessor. The preprocessor is distributed as a part of the "Icon > Program Library". Given the choice between an object system, and a package/module system, I'll take the package system. I see from your post that you are a follower of Bertrandd Meyer ;-). > It is possible to have both objects and modules in a language. Java packages > are modules. Within them you can declare classes. Because classes cannot > be nested and give the user of the class no control over visability, > classes don't give implementer as much cabability for information hiding > and doesn't give users as much control over their the global name space > as you'd like. Note that while objects are useful for projects of all > sizes, modules really become helpful only for larger projects. (1) Lots of languages have both objects and modules. Ada 95, Perl 5, Common Lisp, C++ (namespaces), ... (2) Classes *can* be nested. Simula, BETA, Java 1.1, etc. Most OO languages don't support this, but that just shows that there is no consensus. (3) I don't find objects all that useful for small projects. I've even used languages without objects that had modules (SML) which were quite pleasant. All that said, an object system would be nice too, and maybe Idol is good enough for now. > Maybe someday there will be a verion of Icon with both features, but someone > will have to be interested enough and have the resources to implement it. It would be nice if this were standard Icon. You saw a need for it, I see a need for it, some other guy on the net who is a user found its omission distressing. Anyone from the Icon group at U of A ever address this issue? -- Brian From icon-group-sender Thu Mar 6 11:24:38 1997 Received: by cheltenham.cs.arizona.edu; Sun, 9 Mar 1997 06:28:54 MST To: icon-group@cs.arizona.edu Date: Thu, 06 Mar 1997 11:24:38 -0700 From: Alan Watson Message-Id: <331F0BE6.819@oldp.nmsu.edu> Organization: New Mexico State University Sender: icon-group-request@cs.arizona.edu Subject: More General Events In Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3429 I'm new to Icon. I came to it as something to add to the two tools I have for solving problems: C on one hand and contortions with awk, sed, m4, and other shell tools on the other. Until recently I was singularly impressed and very optimistic, but I've come across what appears to be a fundamental problem and it's making me think again. I'd be very grateful if someone more experienced with Icon than I could comment on this. -------- A number of applications require responses to events. These events are commonly: a mouse or keyboard action in a window (graphics events); the passage of a certain amount of time (alarm events); and the presense of data ready to be read from a file (input events). Icon provides a general means to respond to graphics events in isolation (using Event(), Pending(), and Active()) and limited means to respond to alarm events in isolation (wait for a single alarm with delay() and WDelay()), and very limited means to respond to input events (poll stdin with kbhit() or wait for input from a single file with read() or reads()). However, it provides no means to respond to combinations of these events. -------- Do combinations occur in practice? I think they do: (a) As my very first exercise in learning Icon's graphics facilities, I wrote a clock. My first attempt was: link graphics procedure main() WOpen("lines=1","columns=5") | stop("can't open window"); repeat { GotoRC(1,1); WWrites(&clock[1:6]); WFlush(); delay(10*1000); } end The problem with this is that the window is not implicitly refreshed as required (e.g., when it is exposed by the window manager). Replacing the WFlush() and delay() with WDelay() does not help. Instead, the program need to call Event(): link graphics procedure main() WOpen("lines=1","columns=5") | stop("can't open window"); repeat { GotoRC(1,1); WWrites(&clock[1:6]); Event(); } end The window is now implicitly refreshed as required. Unfortunately, the clock only tells the right time once each day. To get this to work properly, I need to combine graphics events with alarm events. (b) An application I use on a regular basis for image processing combines a command line interface with a graphics browser. The requires responding to both graphics events and input events. (Re-writing xterm within the application would not be acceptable!) (c) A guy down the corridor is implementing the user interface to a telescope control system. The telescope is controlled by a networked PC. The user interface runs on a (remote) UNIX work station. The user interface and the PC communicate by writing and reading NFS files. The user interface also has a command line interface and a graphical display. The program must respond to all three kinds of events: it handles graphical and input events as expected, but in addition must check for a NFS file every half second or so. -------- Throwing everything into a language is probably not a good idea. Therefore, we should not expect one language to be able to do everything. However, the unsuitability of Icon to these three applications astonished me; they seemed at first glance well within the domain of problems it is intended to solve. Am I missing something? Alan From icon-group-sender Sun Mar 9 09:10:12 1997 Received: by cheltenham.cs.arizona.edu; Sun, 9 Mar 1997 09:30:28 MST Date: Sun, 9 Mar 1997 09:10:12 -0700 (MST) From: Dan Nicolaescu X-Sender: done@florence To: icon-group@cs.arizona.edu Subject: icon.el updated Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Length: 26545 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Hi all! I have tweaked a little the icon.el file to add support for syntax coloring for icon files in emacs. Use (setq font-lock-maximum-decoration t) to see all the effects. I also added imenu support (do a M-x imenu-add-to-menubar and you will get a menu containing the procedures in the icon file where when selecting an entry the point is moved the the beginning of the coresponding procedure). I added hideshow support. This enables hiding the bodies of the procedures (and when emacs-19.35 will be out also the comments) to ease the navigation in an icon file. Use M-x hs-minor-mode and then M-x hs-hide-all to see the effects. About syntax coloring there are some limitations: -curently the "end" "global" "initial" "local" "link" "procedure" "$include" "$define" keywords are showed in the same color as the types. The next version of font-lock.el (it was posted in gnu.emacs.sources in november-december I think) will have a new face font-lock-builtin-face which will be used for this. -the only the first variable from a local/global declaration will be colored using font-lock-variable-face. it's not very likely to that I am going to fix this, so if somebody does it, please let me know. If you want to do this, take a look how this is done for c/c++. -am working on adding some more coloring in a $define statement. Please take a look at the way I have grouped the keywords for coloring and email me your ideas, comments and critics. Everything was only teste using emacs-19.34. I have no idea if it works with any other versions. Enjoy, Dan Here is the file: ;;; icon.el --- mode for editing Icon code ;; Copyright (C) 1989 Free Software Foundation, Inc. ;; Author: Chris Smith ;; Created: 15 Feb 89 ;; Keywords: languages ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; A major mode for editing the Icon programming language. ;;; Code: (defvar icon-mode-abbrev-table nil "Abbrev table in use in Icon-mode buffers.") (define-abbrev-table 'icon-mode-abbrev-table ()) (defvar icon-mode-map () "Keymap used in Icon mode.") (if icon-mode-map () (let ((map (make-sparse-keymap "Icon"))) (setq icon-mode-map (make-sparse-keymap)) (define-key icon-mode-map "{" 'electric-icon-brace) (define-key icon-mode-map "}" 'electric-icon-brace) (define-key icon-mode-map "\e\C-h" 'mark-icon-function) (define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun) (define-key icon-mode-map "\e\C-e" 'end-of-icon-defun) (define-key icon-mode-map "\e\C-q" 'indent-icon-exp) (define-key icon-mode-map "\177" 'backward-delete-char-untabify) (define-key icon-mode-map "\t" 'icon-indent-command) (define-key icon-mode-map [menu-bar] (make-sparse-keymap)) (define-key icon-mode-map [menu-bar icon] (cons "Icon" map)) (define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun)) (define-key map [end-of-icon-defun] '("End of function" . end-of-icon-defun)) (define-key map [comment-region] '("Comment Out Region" . comment-region)) (define-key map [indent-region] '("Indent Region" . indent-region)) (define-key map [indent-line] '("Indent Line" . icon-indent-command)) (put 'eval-region 'menu-enable 'mark-active) (put 'comment-region 'menu-enable 'mark-active) (put 'indent-region 'menu-enable 'mark-active))) (defvar icon-mode-syntax-table nil "Syntax table in use in Icon-mode buffers.") (if icon-mode-syntax-table () (setq icon-mode-syntax-table (make-syntax-table)) (modify-syntax-entry ?\\ "\\" icon-mode-syntax-table) (modify-syntax-entry ?# "<" icon-mode-syntax-table) (modify-syntax-entry ?\n ">" icon-mode-syntax-table) (modify-syntax-entry ?$ "." icon-mode-syntax-table) (modify-syntax-entry ?/ "." icon-mode-syntax-table) (modify-syntax-entry ?* "." icon-mode-syntax-table) (modify-syntax-entry ?+ "." icon-mode-syntax-table) (modify-syntax-entry ?- "." icon-mode-syntax-table) (modify-syntax-entry ?= "." icon-mode-syntax-table) (modify-syntax-entry ?% "." icon-mode-syntax-table) (modify-syntax-entry ?< "." icon-mode-syntax-table) (modify-syntax-entry ?> "." icon-mode-syntax-table) (modify-syntax-entry ?& "." icon-mode-syntax-table) (modify-syntax-entry ?| "." icon-mode-syntax-table) (modify-syntax-entry ?\' "\"" icon-mode-syntax-table)) (defvar icon-indent-level 4 "*Indentation of Icon statements with respect to containing block.") (defvar icon-brace-imaginary-offset 0 "*Imagined indentation of a Icon open brace that actually follows a statement.") (defvar icon-brace-offset 0 "*Extra indentation for braces, compared with other text in same context.") (defvar icon-continued-statement-offset 4 "*Extra indent for lines not starting new statements.") (defvar icon-continued-brace-offset 0 "*Extra indent for substatements that start with open-braces. This is in addition to icon-continued-statement-offset.") (defvar icon-auto-newline nil "*Non-nil means automatically newline before and after braces inserted in Icon code.") (defvar icon-tab-always-indent t "*Non-nil means TAB in Icon mode should always reindent the current line, regardless of where in the line point is when the TAB command is used.") (defvar icon-imenu-generic-expression '((nil "^[ \t]*procedure[ \t]*\\(\\sw+\\)[ \t]*(" 1)) "Imenu expression for Icon-mode. See `imenu-generic-expression'.") ;;;###autoload (defun icon-mode () "Major mode for editing Icon code. Expression and list commands understand all Icon brackets. Tab indents for Icon code. Paragraphs are separated by blank lines only. Delete converts tabs to spaces as it moves back. \\{icon-mode-map} Variables controlling indentation style: icon-tab-always-indent Non-nil means TAB in Icon mode should always reindent the current line, regardless of where in the line point is when the TAB command is used. icon-auto-newline Non-nil means automatically newline before and after braces inserted in Icon code. icon-indent-level Indentation of Icon statements within surrounding block. The surrounding block's indentation is the indentation of the line on which the open-brace appears. icon-continued-statement-offset Extra indentation given to a substatement, such as the then-clause of an if or body of a while. icon-continued-brace-offset Extra indentation given to a brace that starts a substatement. This is in addition to `icon-continued-statement-offset'. icon-brace-offset Extra indentation for line if it starts with an open brace. icon-brace-imaginary-offset An open brace following other text is treated as if it were this far to the right of the start of its line. Turning on Icon mode calls the value of the variable `icon-mode-hook' with no args, if that value is non-nil." (interactive) (kill-all-local-variables) (use-local-map icon-mode-map) (setq major-mode 'icon-mode) (setq mode-name "Icon") (setq local-abbrev-table icon-mode-abbrev-table) (set-syntax-table icon-mode-syntax-table) (make-local-variable 'paragraph-start) (setq paragraph-start (concat "$\\|" page-delimiter)) (make-local-variable 'paragraph-separate) (setq paragraph-separate paragraph-start) (make-local-variable 'indent-line-function) (setq indent-line-function 'icon-indent-line) (make-local-variable 'require-final-newline) (setq require-final-newline t) (make-local-variable 'comment-start) (setq comment-start "# ") (make-local-variable 'comment-end) (setq comment-end "") (make-local-variable 'comment-column) (setq comment-column 32) (make-local-variable 'comment-start-skip) (setq comment-start-skip "# *") (make-local-variable 'comment-indent-function) (setq comment-indent-function 'icon-comment-indent) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(( icon-font-lock-keywords icon-font-lock-keywords-1 icon-font-lock-keywords-2 ) nil nil ((?_ . "w")) beginning-of-defun (font-lock-comment-start-regexp . "#") (font-lock-mark-block-function . mark-defun))) (make-local-variable 'imenu-generic-expression) (setq imenu-generic-expression icon-imenu-generic-expression) (pushnew '(icon-mode "procedure" "end" icon-forward-sexp-function) hs-special-modes-alist :test 'equal) ; (setq hs-block-start-regexp "procedure") ; (setq hs-block-end-regexp "^end") ; (setq hs-forward-sexp-func 'icon-forward-sexp-function) (run-hooks 'icon-mode-hook)) ;; This is used by indent-for-comment to decide how much to ;; indent a comment in Icon code based on its context. (defun icon-comment-indent () (if (looking-at "^#") 0 (save-excursion (skip-chars-backward " \t") (max (if (bolp) 0 (1+ (current-column))) comment-column)))) (defun electric-icon-brace (arg) "Insert character and correct line's indentation." (interactive "P") (let (insertpos) (if (and (not arg) (eolp) (or (save-excursion (skip-chars-backward " \t") (bolp)) (if icon-auto-newline (progn (icon-indent-line) (newline) t) nil))) (progn (insert last-command-char) (icon-indent-line) (if icon-auto-newline (progn (newline) ;; (newline) may have done auto-fill (setq insertpos (- (point) 2)) (icon-indent-line))) (save-excursion (if insertpos (goto-char (1+ insertpos))) (delete-char -1)))) (if insertpos (save-excursion (goto-char insertpos) (self-insert-command (prefix-numeric-value arg))) (self-insert-command (prefix-numeric-value arg))))) (defun icon-indent-command (&optional whole-exp) (interactive "P") "Indent current line as Icon code, or in some cases insert a tab character. If `icon-tab-always-indent' is non-nil (the default), always indent current line. Otherwise, indent the current line only if point is at the left margin or in the line's indentation; otherwise insert a tab. A numeric argument, regardless of its value, means indent rigidly all the lines of the expression starting after point so that this line becomes properly indented. The relative indentation among the lines of the expression are preserved." (if whole-exp ;; If arg, always indent this line as Icon ;; and shift remaining lines of expression the same amount. (let ((shift-amt (icon-indent-line)) beg end) (save-excursion (if icon-tab-always-indent (beginning-of-line)) (setq beg (point)) (forward-sexp 1) (setq end (point)) (goto-char beg) (forward-line 1) (setq beg (point))) (if (> end beg) (indent-code-rigidly beg end shift-amt "#"))) (if (and (not icon-tab-always-indent) (save-excursion (skip-chars-backward " \t") (not (bolp)))) (insert-tab) (icon-indent-line)))) (defun icon-indent-line () "Indent current line as Icon code. Return the amount the indentation changed by." (let ((indent (calculate-icon-indent nil)) beg shift-amt (case-fold-search nil) (pos (- (point-max) (point)))) (beginning-of-line) (setq beg (point)) (cond ((eq indent nil) (setq indent (current-indentation))) ((eq indent t) (setq indent (calculate-icon-indent-within-comment))) ((looking-at "[ \t]*#") (setq indent 0)) (t (skip-chars-forward " \t") (if (listp indent) (setq indent (car indent))) (cond ((and (looking-at "else\\b") (not (looking-at "else\\s_"))) (setq indent (save-excursion (icon-backward-to-start-of-if) (current-indentation)))) ((or (= (following-char) ?}) (looking-at "end\\b")) (setq indent (- indent icon-indent-level))) ((= (following-char) ?{) (setq indent (+ indent icon-brace-offset)))))) (skip-chars-forward " \t") (setq shift-amt (- indent (current-column))) (if (zerop shift-amt) (if (> (- (point-max) pos) (point)) (goto-char (- (point-max) pos))) (delete-region beg (point)) (indent-to indent) ;; If initial point was within line's indentation, ;; position after the indentation. Else stay at same point in text. (if (> (- (point-max) pos) (point)) (goto-char (- (point-max) pos)))) shift-amt)) (defun calculate-icon-indent (&optional parse-start) "Return appropriate indentation for current line as Icon code. In usual case returns an integer: the column to indent to. Returns nil if line starts inside a string, t if in a comment." (save-excursion (beginning-of-line) (let ((indent-point (point)) (case-fold-search nil) state containing-sexp toplevel) (if parse-start (goto-char parse-start) (setq toplevel (beginning-of-icon-defun))) (while (< (point) indent-point) (setq parse-start (point)) (setq state (parse-partial-sexp (point) indent-point 0)) (setq containing-sexp (car (cdr state)))) (cond ((or (nth 3 state) (nth 4 state)) ;; return nil or t if should not change this line (nth 4 state)) ((and containing-sexp (/= (char-after containing-sexp) ?{)) ;; line is expression, not statement: ;; indent to just after the surrounding open. (goto-char (1+ containing-sexp)) (current-column)) (t (if toplevel ;; Outside any procedures. (progn (icon-backward-to-noncomment (point-min)) (if (icon-is-continuation-line) icon-continued-statement-offset 0)) ;; Statement level. (if (null containing-sexp) (progn (beginning-of-icon-defun) (setq containing-sexp (point)))) (goto-char indent-point) ;; Is it a continuation or a new statement? ;; Find previous non-comment character. (icon-backward-to-noncomment containing-sexp) ;; Now we get the answer. (if (icon-is-continuation-line) ;; This line is continuation of preceding line's statement; ;; indent icon-continued-statement-offset more than the ;; first line of the statement. (progn (icon-backward-to-start-of-continued-exp containing-sexp) (+ icon-continued-statement-offset (current-column) (if (save-excursion (goto-char indent-point) (skip-chars-forward " \t") (eq (following-char) ?{)) icon-continued-brace-offset 0))) ;; This line starts a new statement. ;; Position following last unclosed open. (goto-char containing-sexp) ;; Is line first statement after an open-brace? (or ;; If no, find that first statement and indent like it. (save-excursion (if (looking-at "procedure\\s ") (forward-sexp 3) (forward-char 1)) (while (progn (skip-chars-forward " \t\n") (looking-at "#")) ;; Skip over comments following openbrace. (forward-line 1)) ;; The first following code counts ;; if it is before the line we want to indent. (and (< (point) indent-point) (current-column))) ;; If no previous statement, ;; indent it relative to line brace is on. ;; For open brace in column zero, don't let statement ;; start there too. If icon-indent-level is zero, ;; use icon-brace-offset + icon-continued-statement-offset ;; instead. ;; For open-braces not the first thing in a line, ;; add in icon-brace-imaginary-offset. (+ (if (and (bolp) (zerop icon-indent-level)) (+ icon-brace-offset icon-continued-statement-offset) icon-indent-level) ;; Move back over whitespace before the openbrace. ;; If openbrace is not first nonwhite thing on the line, ;; add the icon-brace-imaginary-offset. (progn (skip-chars-backward " \t") (if (bolp) 0 icon-brace-imaginary-offset)) ;; Get initial indentation of the line we are on. (current-indentation)))))))))) ;; List of words to check for as the last thing on a line. ;; If cdr is t, next line is a continuation of the same statement, ;; if cdr is nil, next line starts a new (possibly indented) statement. (defconst icon-resword-alist '(("by" . t) ("case" . t) ("create") ("do") ("dynamic" . t) ("else") ("every" . t) ("if" . t) ("global" . t) ("initial" . t) ("link" . t) ("local" . t) ("of") ("record" . t) ("repeat" . t) ("static" . t) ("then") ("to" . t) ("until" . t) ("while" . t))) (defun icon-is-continuation-line () (let* ((ch (preceding-char)) (ch-syntax (char-syntax ch))) (if (eq ch-syntax ?w) (assoc (buffer-substring (progn (forward-word -1) (point)) (progn (forward-word 1) (point))) icon-resword-alist) (not (memq ch '(0 ?\; ?\} ?\{ ?\) ?\] ?\" ?\' ?\n)))))) (defun icon-backward-to-noncomment (lim) (let (opoint stop) (while (not stop) (skip-chars-backward " \t\n\f" lim) (setq opoint (point)) (beginning-of-line) (if (and (nth 5 (parse-partial-sexp (point) opoint)) (< lim (point))) (search-backward "#") (setq stop t))))) (defun icon-backward-to-start-of-continued-exp (lim) (if (memq (preceding-char) '(?\) ?\])) (forward-sexp -1)) (beginning-of-line) (skip-chars-forward " \t") (cond ((<= (point) lim) (goto-char (1+ lim))) ((not (icon-is-continued-line)) 0) ((and (eq (char-syntax (following-char)) ?w) (cdr (assoc (buffer-substring (point) (save-excursion (forward-word 1) (point))) icon-resword-alist))) 0) (t (end-of-line 0) (icon-backward-to-start-of-continued-exp lim)))) (defun icon-is-continued-line () (save-excursion (end-of-line 0) (icon-is-continuation-line))) (defun icon-backward-to-start-of-if (&optional limit) "Move to the start of the last \"unbalanced\" if." (or limit (setq limit (save-excursion (beginning-of-icon-defun) (point)))) (let ((if-level 1) (case-fold-search nil)) (while (not (zerop if-level)) (backward-sexp 1) (cond ((looking-at "else\\b") (setq if-level (1+ if-level))) ((looking-at "if\\b") (setq if-level (1- if-level))) ((< (point) limit) (setq if-level 0) (goto-char limit)))))) (defun mark-icon-function () "Put mark at end of Icon function, point at beginning." (interactive) (push-mark (point)) (end-of-icon-defun) (push-mark (point)) (beginning-of-line 0) (beginning-of-icon-defun)) (defun beginning-of-icon-defun () "Go to the start of the enclosing procedure; return t if at top level." (interactive) (if (re-search-backward "^procedure\\s \\|^end[ \t\n]" (point-min) 'move) (looking-at "e") t)) (defun end-of-icon-defun () (interactive) (if (not (bobp)) (forward-char -1)) (re-search-forward "\\(\\s \\|^\\)end\\(\\s \\|$\\)" (point-max) 'move) (forward-word -1) (forward-line 1)) (defun indent-icon-exp () "Indent each line of the Icon grouping following point." (interactive) (let ((indent-stack (list nil)) (contain-stack (list (point))) (case-fold-search nil) restart outer-loop-done inner-loop-done state ostate this-indent last-sexp at-else at-brace at-do (opoint (point)) (next-depth 0)) (save-excursion (forward-sexp 1)) (save-excursion (setq outer-loop-done nil) (while (and (not (eobp)) (not outer-loop-done)) (setq last-depth next-depth) ;; Compute how depth changes over this line ;; plus enough other lines to get to one that ;; does not end inside a comment or string. ;; Meanwhile, do appropriate indentation on comment lines. (setq innerloop-done nil) (while (and (not innerloop-done) (not (and (eobp) (setq outer-loop-done t)))) (setq ostate state) (setq state (parse-partial-sexp (point) (progn (end-of-line) (point)) nil nil state)) (setq next-depth (car state)) (if (and (car (cdr (cdr state))) (>= (car (cdr (cdr state))) 0)) (setq last-sexp (car (cdr (cdr state))))) (if (or (nth 4 ostate)) (icon-indent-line)) (if (or (nth 3 state)) (forward-line 1) (setq innerloop-done t))) (if (<= next-depth 0) (setq outer-loop-done t)) (if outer-loop-done nil (if (/= last-depth next-depth) (setq last-sexp nil)) (while (> last-depth next-depth) (setq indent-stack (cdr indent-stack) contain-stack (cdr contain-stack) last-depth (1- last-depth))) (while (< last-depth next-depth) (setq indent-stack (cons nil indent-stack) contain-stack (cons nil contain-stack) last-depth (1+ last-depth))) (if (null (car contain-stack)) (setcar contain-stack (or (car (cdr state)) (save-excursion (forward-sexp -1) (point))))) (forward-line 1) (skip-chars-forward " \t") (if (eolp) nil (if (and (car indent-stack) (>= (car indent-stack) 0)) ;; Line is on an existing nesting level. ;; Lines inside parens are handled specially. (if (/= (char-after (car contain-stack)) ?{) (setq this-indent (car indent-stack)) ;; Line is at statement level. ;; Is it a new statement? Is it an else? ;; Find last non-comment character before this line (save-excursion (setq at-else (looking-at "else\\W")) (setq at-brace (= (following-char) ?{)) (icon-backward-to-noncomment opoint) (if (icon-is-continuation-line) ;; Preceding line did not end in comma or semi; ;; indent this line icon-continued-statement-offset ;; more than previous. (progn (icon-backward-to-start-of-continued-exp (car contain-stack)) (setq this-indent (+ icon-continued-statement-offset (current-column) (if at-brace icon-continued-brace-offset 0)))) ;; Preceding line ended in comma or semi; ;; use the standard indent for this level. (if at-else (progn (icon-backward-to-start-of-if opoint) (setq this-indent (current-indentation))) (setq this-indent (car indent-stack)))))) ;; Just started a new nesting level. ;; Compute the standard indent for this level. (let ((val (calculate-icon-indent (if (car indent-stack) (- (car indent-stack)))))) (setcar indent-stack (setq this-indent val)))) ;; Adjust line indentation according to its contents (if (or (= (following-char) ?}) (looking-at "end\\b")) (setq this-indent (- this-indent icon-indent-level))) (if (= (following-char) ?{) (setq this-indent (+ this-indent icon-brace-offset))) ;; Put chosen indentation into effect. (or (= (current-column) this-indent) (progn (delete-region (point) (progn (beginning-of-line) (point))) (indent-to this-indent))) ;; Indent any comment following the text. (or (looking-at comment-start-skip) (if (re-search-forward comment-start-skip (save-excursion (end-of-line) (point)) t) (progn (indent-for-comment) (beginning-of-line)))))))))) ;;"break" "do" "next" "repeat" "to" "by" "else" "if" "not" "return" "until" "case" "of" "static" "while" "create" "every" "suspend" "default" "fail" "record" "then" "?" (defconst icon-keywords "?\\|b\\(reak\\|y\\)\\|c\\(ase\\|reate\\)\\|d\\(efault\\|o\\)\\|e\\(lse\\|very\\)\\|fail\\|if\\|n\\(ext\\|ot\\)\\|of\\|re\\(cord\\|peat\\|turn\\)\\|s\\(tatic\\|uspend\\)\\|t\\(hen\\|o\\)\\|until\\|while") ;; "end" "global" "initial" "local" "link" "procedure" "$include" "$define" (defconst icon-builtin "$\\(define\\|include\\)\\|end\\|global\\|initial\\|l\\(ink\\|ocal\\)\\|procedure") ;;"null" "string" "co-expression" "table" "integer" "cset" "set" "real" "file" "list" (defconst icon-type-types "c\\(o-expression\\|set\\)\\|file\\|integer\\|list\\|null\\|real\\|s\\(et\\|tring\\)\\|table") ;;"&allocated" "&ascii" "&clock" "&col" "&collections" "&column" "&control" "&cset" "¤t" "&date" "&dateline" "&digits" "&dump" "&error" "&errornumber" "&errortext" "&errorvalue" "&errout" "&eventcode" "&eventsource" "&eventvalue" "&fail" "&features" "&file" "&host" "&input" "&interval" "&lcase" "&ldrag" "&letters" "&level" "&line" "&lpress" "&lrelease" "&main" "&mdrag" "&meta" "&mpress" "&mrelease" "&null" "&output" "&phi" "&pi" "&pos" "&progname" "&random" "&rdrag" "®ions" "&resize" "&row" "&rpr ess" "&rrelease" "&shift" "&source" "&storage" "&subject" "&time" "&trace" "&ucase" "&version" "&window" "&x" "&y" (defconst icon-functions "&\\(a\\(llocated\\|scii\\)\\|c\\(lock\\|o\\(l\\(\\|lections\\|umn\\)\\|ntrol\\)\\|set\\|urrent\\)\\|d\\(ate\\(\\|line\\)\\|igits\\|ump\\)\\|e\\(rro\\(r\\(\\|number\\|text\\|value\\)\\|ut\\)\\|vent\\(code\\|source\\|value\\)\\)\\| f\\(ail\\|eatures\\|ile\\)\\|host\\|in\\(put\\|terval\\)\\|l\\(case\\|drag\\|e\\(tters\\|vel\\)\\|ine\\|press\\|release\\)\\|m\\(ain\\|drag\\|eta\\|press\\|release\\)\\|null\\|output\\|p\\(hi\\|i\\|os\\|rogname\\)\\|r\\(andom\\|drag\\|e\\(gions\\|size\\)\ \|ow\\|press\\|release\\)\\|s\\(hift\\|ource\\|torage\\|ubject\\)\\|t\\(ime\\|race\\)\\|ucase\\|version\\|window\\|[exy]\\)") (defvar icon-font-lock-keywords-1 nil) (defvar icon-font-lock-keywords icon-font-lock-keywords-1) (setq icon-font-lock-keywords-1 (list ;; Fontify function name definitions. (list (concat "^[ \t]*procedure[ \t]*\\(\\sw+\\)[ \t]*(") 1 'font-lock-function-name-face) )) (defvar icon-font-lock-keywords-2 nil) (setq icon-font-lock-keywords-2 (append icon-font-lock-keywords-1 (list ;; Fontify all type specifiers. (cons (concat "\\<\\(" icon-type-types "\\)\\>") 'font-lock-type-face) ;; ;; Fontify all builtin keywords. (cons (concat "\\(" icon-keywords "\\)") 'font-lock-keyword-face) (cons (concat "\\(" icon-builtin "\\)") 'font-lock-type-face) (cons (concat "\\(" icon-functions "\\)") 'font-lock-reference-face) (list "^[ \t]*\\(global\\|local\\)[ \t]+\\(\\sw+\\)+\\([ \t]*,[ \t]*\\(\\sw+\\)\\)" 2 'font-lock-variable-name-face) ))) (defun icon-forward-sexp-function (arg) (if (> arg 0) (re-search-forward "^[ \t]*end") (re-search-backward "^[ \t]procedure"))) ;;; icon.el ends here From icon-group-sender Sun Mar 9 19:18:10 1997 Received: by cheltenham.cs.arizona.edu; Mon, 10 Mar 1997 12:46:47 MST Date: Sun, 9 Mar 1997 19:18:10 +0200 (WET) From: Ehud Lamm To: gep2@computek.net Cc: icon-group@cs.arizona.edu Subject: Re: Icon and two-dimensional matching In-Reply-To: <199703042033.OAA32615@ns1.cmpu.net> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 141 IBM sells PL/I for Windows(tm) - so if anyone *really* wants it - just go ahead and buy it. Ehud Lamm mslamm@pluto.mscc.huji.ac.il From icon-group-sender Sun Mar 9 16:01:56 1997 Received: by cheltenham.cs.arizona.edu; Mon, 10 Mar 1997 12:47:12 MST Date: Sun, 9 Mar 1997 16:01:56 -0600 (CST) From: "Chris D. Tenaglia" To: Alan Watson Cc: icon-group@cs.arizona.edu Subject: Re: More General Events In Icon In-Reply-To: <331F0BE6.819@oldp.nmsu.edu> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 3321 > > I'm new to Icon. I came to it as something to add to the two tools I > have for solving problems: C on one hand and contortions with awk, > sed, m4, and other shell tools on the other. Until recently I was > singularly impressed and very optimistic, but I've come across what > appears to be a fundamental problem and it's making me think again. > I'd be very grateful if someone more experienced with Icon than I > could comment on this. Icon as a general shell and file tool is great. It's also well designed for trying out different algorythms and approaches to problems. But It's a high level language, so I wouldn't use it for things that require real time low level device control. > > -------- > > A number of applications require responses to events. These events are > commonly: a mouse or keyboard action in a window (graphics events); > the passage of a certain amount of time (alarm events); and the > presense of data ready to be read from a file (input events). > ...snip The clock. Maybe using more explicit file handles and keeping everything in a tight polling loop? > > (b) An application I use on a regular basis for image processing > combines a command line interface with a graphics browser. The requires > responding to both graphics events and input events. (Re-writing xterm > within the application would not be acceptable!) I wrote something like this back in '88. I used a Decwindows microvax I running vms 4, and it had both vt100 and tek4014 emulation. If I would telnet in a tek window to a supercomputer. I slapped together an icon graphics enviroment that was interactive. No mouse control, but on a 19" screen the icon code took up 2-4" and would compile, run and display. I could direct the output to a file and run tek2ps to make it printable. Primitive by todays measure, but pretty cool back then. > > (c) A guy down the corridor is implementing the user interface to a > telescope control system. The telescope is controlled by a networked > PC. The user interface runs on a (remote) UNIX work station. The user > interface and the PC communicate by writing and reading NFS files. The > user interface also has a command line interface and a graphical > display. The program must respond to all three kinds of events: it > handles graphical and input events as expected, but in addition must > check for a NFS file every half second or so. This is a real time hardware control problem. Using a shared file for a protocol is ok if the systems are fast enough. I can understand telescopes getting computers in them as a natural evolution. One would almost prefer a telescope be dumber like a plotter. It could almost run HPGL off a serial or HPIB interface. Then you could print to it. RA6h42.9m DEC-16d39' FOCUS FILTERR100G100B78 etc,... > > -------- > > Throwing everything into a language is probably not a good idea. > Therefore, we should not expect one language to be able to do > everything. However, the unsuitability of Icon to these three > applications astonished me; they seemed at first glance well within > the domain of problems it is intended to solve. > > Am I missing something? > > Alan > But I wouldn't use it to write an OS kernal , file system, or re-invent someone elses wheel IMHO. Chris. From icon-group-sender Mon Mar 10 15:13:12 1997 Received: by cheltenham.cs.arizona.edu; Mon, 10 Mar 1997 15:18:30 MST Date: Mon, 10 Mar 1997 15:13:12 -0600 From: gep2@computek.net Message-Id: <199703102113.PAA18999@ns2.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Subject: Re: Icon and two-dimensional matching To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 439 >IBM sells PL/I for Windows(tm) - so if anyone *really* wants it - just go ahead and buy it. Yes, I looked into that at IBM's Web site. It certainly looks like a decent compiler, but the price ($749 for the base, plus various addons) is a bit stiff for mostly just for fun. I will keep it in mind, though, and perhaps I'll find a project where it would be the tool of choice! Gordon Peterson http://www.computek.net/public/gep2/ From icon-group-sender Wed Mar 12 10:01:04 1997 Received: by cheltenham.cs.arizona.edu; Fri, 14 Mar 1997 10:39:14 MST To: icon-group@cs.arizona.edu Date: Wed, 12 Mar 1997 10:01:04 -0800 From: Brian Rogoff Message-Id: Sender: icon-group-request@cs.arizona.edu References: , <01bc2d80$5cac97d0$5f030514@dschauma> Subject: Modules in Icon (Was Re: Recursive directory traversal in Icon) Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2180 Dave Schaumann wrote: > Brian Rogoff wrote in article > ... > > Hi, > > I've been reading the Icon web references, trying to decide if I > > should forsake Perl in favor of Icon, and I have two questions. > > > > (1) How do I traverse a hierarchical directory structure in Icon? I found > > > chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there > > a way to do this in Icon, or do you rely on the external environment? > > This is one of the biggest weaknessess of Icon, especially wrt languages > like Perl -- the support for access to the OS is highly limited. The file > IO system works pretty good, as does the extension to X. But other than > that, about all that's available is system() and popen() (which may or may > not have a reasonable analog available on non-Un*x systems). As I suspected. Some people sent me system dependent solutions to the problem, but that's not what I wanted. This is really too bad. Icon has some terrific ideas in it, but it looks like it isn't for me. > > (2) Why no module system? > > I can't answer this directly. However, there is Idol, which has been > described > as "Object Oriented Icon". That's pretty much all I know about it, so I > don't > know if it supports modules. I assume that "Object Oriented" means > inheritence, > which means classes, which means some form of encapsulation/data hiding... Yup, I looked at Idol. What I want are modules or packages. In *my* religion, import is not inheritance ;-). The Eiffel heretics among you probably disagree. OTOH, an object system would be nice too, but modules are way more important. Consider that with modules, all of that system stuff like chdir and "lsdir" and "stat" could go into an Icon.File_Systems module and not pollute the global name space. > I agree with your point, though. Another big weakness of Icon is that > there's just too much stuff that goes in the global name space. Exactly the problem that modules would solve. I'm beginning to think that lots of people have asked about this or wanted it, but this isn't in the FAQ. -- Brian From icon-group-sender Thu Mar 13 16:58:46 1997 Received: by cheltenham.cs.arizona.edu; Fri, 14 Mar 1997 10:39:29 MST To: icon-group@cs.arizona.edu Date: Thu, 13 Mar 1997 16:58:46 -0500 From: Jan Galkowski Message-Id: <33287896.167EB0E7@digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu References: , <01bc2d80$5cac97d0$5f030514@dschauma>, <33285B2F.41C67EA6@digicomp.com> Subject: Re: Recursive directory traversal in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 327 Jan Galkowski wrote: > [snip] While speculating on intent may be interesting, it's usually a waste {darn those pesty pronouns} [snip] -- Jan Theodore Galkowski, developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 jan@digicomp.com (also jtgalkowski@worldnet.att.net) From icon-group-sender Mon Mar 10 18:35:57 1997 Received: by cheltenham.cs.arizona.edu; Fri, 14 Mar 1997 10:39:40 MST To: icon-group@cs.arizona.edu Date: 10 Mar 1997 18:35:57 GMT From: "Dave Schaumann" Message-Id: <01bc2d80$5cac97d0$5f030514@dschauma> Organization: CSC Sender: icon-group-request@cs.arizona.edu References: Subject: Re: Recursive directory traversal in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1329 Brian Rogoff wrote in article ... > Hi, > I've been reading the Icon web references, trying to decide if I > should forsake Perl in favor of Icon, and I have two questions. > > (1) How do I traverse a hierarchical directory structure in Icon? I found > chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there > a way to do this in Icon, or do you rely on the external environment? This is one of the biggest weaknessess of Icon, especially wrt languages like Perl -- the support for access to the OS is highly limited. The file IO system works pretty good, as does the extension to X. But other than that, about all that's available is system() and popen() (which may or may not have a reasonable analog available on non-Un*x systems). > (2) Why no module system? I can't answer this directly. However, there is Idol, which has been described as "Object Oriented Icon". That's pretty much all I know about it, so I don't know if it supports modules. I assume that "Object Oriented" means inheritence, which means classes, which means some form of encapsulation/data hiding... I agree with your point, though. Another big weakness of Icon is that there's just too much stuff that goes in the global name space. -Dave From icon-group-sender Thu Mar 13 14:53:19 1997 Received: by cheltenham.cs.arizona.edu; Fri, 14 Mar 1997 10:40:05 MST To: icon-group@cs.arizona.edu Date: Thu, 13 Mar 1997 14:53:19 -0500 From: Jan Galkowski Message-Id: <33285B2F.41C67EA6@digicomp.com> Organization: Digicomp Research Corporation Sender: icon-group-request@cs.arizona.edu References: , <01bc2d80$5cac97d0$5f030514@dschauma> Subject: Re: Recursive directory traversal in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 4485 Dave Schaumann wrote: > > Brian Rogoff wrote in article > ... > > Hi, > > I've been reading the Icon web references, trying to decide if I > > should forsake Perl in favor of Icon, and I have two questions. > > [snip] > > (2) Why no module system? While it speculating on intent may be interesting, it's usually a waste of time. Better, IMO, is looking at the product and seeing what it has and provides and what it doesn't. A "module system" is essentially a device for managing globs of text, naming them, and performing controlled substitutions upon them. (I don't mean "glob" in any Unix-ish or Perl-ish sense.) To only slightly exaggerate, there's nothing in any "module system" which can't be modelled in a proper implementation of the lambda calculus, e.g., in SCHEME. So, one possible explanation is that a "module system" is in some important sense excess baggage. [The idea of using the lambda calculus for a "macro level language" isn't original-- Peter Henderson and a coworker documented such a system for reconstructing a very large and old FORTRAN program someplace in _Software: Practise and Experience_ in the mid-'80s.] > > I can't answer this directly. However, there is Idol, which has been > described > as "Object Oriented Icon". That's pretty much all I know about it, so I > don't > know if it supports modules. I assume that "Object Oriented" means > inheritence, > which means classes, which means some form of encapsulation/data hiding... > > I agree with your point, though. Another big weakness of Icon is that > there's > just too much stuff that goes in the global name space. > With Icon's power and support of functions and procedures as first-class objects, I wonder whether when we all -- and I very much include myself -- feel the pressure for adding more to Icon, we just aren't being imaginative enough in using the tool we're given. Yes, we're products of a community of programming artists and so fads and traditions weigh heavily upon our practice. But Icon isn't a run-of-the-mill language by any means, and it is freed of many of the constraints which the usual languages are. C.A.R.Hoare (I believe) once wrote a position paper on the then-evolving programming language Ada entitled "Generalzing Ada by removing limitations". I'm investing in this post so heavily because I am on a search for such a means of expression which is strictly supported by the existing Version 9.3 of Icon, yet addresses some of these concerns regarding big programs and modules and all that. In fact, one of my reasons for asking after people's "biggest Icon programs" was to see how far people had carried Icon itself. One could, for example, without that much effort and _without_ clobbering the problem by using excessive string invocation, imitate all the packaging and generic facilities of Ada95, leaving aside Ada's tasking facilities for the moment. (They could be modelled, too, but that discussion, I believe, degenerates into one over what constitutes an adequate simulation of asychronicity.) Similarly, there really is no compelling reason to include events and event-handlers in Icon simply because one has popular languages like Tcl/Tk, Visual Basic, etc., which offer built-in events and support a certain style of GUI programming. In the small, one can imitate these facilities and in the large I really think that style of GUI design deserves challenging: Not all applications are Web pages, after all, and introducing problems of synchronization and data sharing in contexts which really doesn't need them hardly seems like progress. Besudes, at some level, Tcl/Tk and Visual Basic embody a polling loop in their design, even if it is a machine interrupt handler. At least Icon provides an explicit one. I'm sorry for going on so long, but I invite people to challenge themselves to think how clear and neat expressions of what they might want in this area could be expressed in the _existing_ Icon language. This isn't because the Icon definition would be that hard to change, but because IMO programming languages are supposed to be tools to think with creatively, not be simply a sugar-coated subroutine library. > -Dave -- Jan Theodore Galkowski, developer, tool & numerical methods elf Digicomp Research Corporation, Ithaca, NY 14850-5720 jan@digicomp.com (also jtgalkowski@worldnet.att.net) From icon-group-sender Fri Mar 14 18:13:45 1997 Received: by cheltenham.cs.arizona.edu; Sat, 15 Mar 1997 05:54:12 MST Date: Fri, 14 Mar 97 18:13:45 GMT Message-Id: <16791.9703141813@subnode.aiai.ed.ac.uk> From: Jeff Dalton Subject: Re: Recursive directory traversal in Icon To: Jan Galkowski , icon-group@cs.arizona.edu In-Reply-To: Jan Galkowski's message of Thu, 13 Mar 1997 14:53:19 -0500 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 857 In-Reply-To: Jan Galkowski's message of Thu, 13 Mar 1997 14:53:19 -0500 > To only slightly exaggerate, there's nothing in any "module > system" which can't be modelled in a proper implementation of the lambda > calculus, e.g., in SCHEME. So, one possible explanation is that a > "module system" is in some important sense excess baggage. An important reason why Scheme does not have modules is that people are not able to agree on what the module system should be. Some particular Scheme implementations do have modules, though. Some Scheme module systems can be implemented entirely in Scheme, but they would typically use Scheme's macros was well as the lambda calculus parts of the language. To me, at least, Scheme's lack of modules is a serious limitation and one of the main reasons I usually use Common Lisp rather than Scheme. -- jeff From icon-group-sender Fri Mar 14 12:27:18 1997 Received: by cheltenham.cs.arizona.edu; Sat, 15 Mar 1997 05:54:42 MST Message-Id: <1.5.4.32.19970314182718.006f6888@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Fri, 14 Mar 1997 12:27:18 -0600 To: "Dave Schaumann" , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: Recursive directory traversal in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1816 Traverse a hierarchical directory structure? Less theory, more samples. How about : produre dirtrace() command := "ls -alR" info := open(command,"pr") while crunch(read(info)) close(info) end procedure crunch(file) ... do something with the files ... end I suppose you can modify the ls command to focus the search, or repackage it using the unix find command. In the MSDOS world you might try something like : procedure dirtrace() command := "DIR/S C:\\ >XXX.XXX" system(command) info := open("C:\\XXX.XXX") while crunch(read(info)) close(info) end procedure crunch(file) ... do something with the files ... end Chris. At 06:35 PM 3/10/97 GMT, Dave Schaumann wrote: > > >Brian Rogoff wrote in article >... >> Hi, >> I've been reading the Icon web references, trying to decide if I >> should forsake Perl in favor of Icon, and I have two questions. >> >> (1) How do I traverse a hierarchical directory structure in Icon? I found > >> chdir, but I didn't find the equivalent of 'ls' and 'stat'. Is there >> a way to do this in Icon, or do you rely on the external environment? > >This is one of the biggest weaknessess of Icon, especially wrt languages >like Perl -- the support for access to the OS is highly limited. The file >IO system works pretty good, as does the extension to X. But other than >that, about all that's available is system() and popen() (which may or may >not have a reasonable analog available on non-Un*x systems). > Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Tue Mar 18 21:37:05 1997 Received: by cheltenham.cs.arizona.edu; Wed, 19 Mar 1997 05:50:26 MST To: icon-group@cs.arizona.edu Date: Tue, 18 Mar 1997 21:37:05 GMT From: kehandley@amherst.edu Message-Id: <332f030d.1635075184@news-server> Organization: Amherst College, Amherst MA, USA Sender: icon-group-request@cs.arizona.edu Subject: Icon for Alpha VMS? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 311 Hello, I checked the 1994-1996 archives of this list and could find no help, so now I ask: Has anyone gotten Icon Version 8 or above to work on an Alpha running VMS? I don't need any X-Windows stuff. I would appreciate any help. Keith Handley, Amherst College Academic Computer Center kehandley@amherst.edu From icon-group-sender Tue Mar 18 20:58:11 1997 Received: by cheltenham.cs.arizona.edu; Wed, 19 Mar 1997 05:50:06 MST To: icon-group@cs.arizona.edu Date: Tue, 18 Mar 1997 20:58:11 +0100 From: Finn Ekberg Christiansen Message-Id: <332EF3D3.5635@Ekberg.com> Organization: Copenhagen Sender: icon-group-request@cs.arizona.edu Reply-To: Finn@Ekberg.com Subject: any icon apps. to try out anywhere? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 571 Hi guys, I've just learned of icon, bought the Griswold book, downloaded the language and now I would like to try out a couple of Windows applications written in icon. Do you know of any? Do you know of any websites other than the home of icon (http://www.cs.arizona.edu/icon/)? ys Finn ********************************************************************* * Finn Ekberg Christiansen - Phone: 33.79.13.15 - Finn@Ekberg.com * * Http://www2.dk-online.dk/users/Finn_Ekberg_Christiansen/index.htm * ********************************************************************* From icon-group-sender Wed Mar 19 08:18:08 1997 Received: by cheltenham.cs.arizona.edu; Wed, 19 Mar 1997 12:23:50 MST Message-Id: <1.5.4.32.19970319141808.006e0114@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 19 Mar 1997 08:18:08 -0600 To: kehandley@amherst.edu, icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: Icon for Alpha VMS? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1445 I found nothing in existance. So I downloaded the sources to an alpha vms workstation and tried recompiling it for a couple days. While I am a wiz at icon programming my C skills are novice at best, so I gave up that path. I couldn't couldn't do the vest (binary->binary translation) either, because there are some incompatible system calls and libraries between them. There are also 2 different file systems for vms now. The original rms (slow and reliable) and a newer spiralog (faster than unix and NT). So I don't think this port is trivial by any stretch of the imagination. The VMS versions after V8.6 could not read or write \xff alias char(255) which made some binary file manipulations impossible. I could use Icon for alpha too. Sure the DCL runs faster, but the code is so much uglier and verbose. Chris. At 09:37 PM 3/18/97 GMT, kehandley@amherst.edu wrote: >Hello, I checked the 1994-1996 archives of this list and could find no >help, so now I ask: Has anyone gotten Icon Version 8 or above to work >on an Alpha running VMS? I don't need any X-Windows stuff. I would >appreciate any help. > >Keith Handley, Amherst College Academic Computer Center >kehandley@amherst.edu > > Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Wed Mar 19 13:33:14 1997 Received: by cheltenham.cs.arizona.edu; Wed, 19 Mar 1997 17:36:17 MST Message-Id: <332FEB1A.7BBC@charlie.cns.iit.edu> Date: Wed, 19 Mar 1997 13:33:14 +0000 From: "Thomas W. Christopher" Reply-To: tc@charlie.cns.iit.edu Organization: Illinois Institute of Technology X-Mailer: Mozilla 3.01Gold (WinNT; I) Mime-Version: 1.0 To: Finn@Ekberg.com Cc: icon-group@cs.arizona.edu Subject: Re: any icon apps. to try out anywhere? References: <332EF3D3.5635@Ekberg.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 666 Finn Ekberg Christiansen wrote: > > Hi guys, > I've just learned of icon, bought > the Griswold book, downloaded the > language and now I would like to > try out a couple of Windows applications > written in icon. > > Do you know of any? > > Do you know of any websites other than the home > of icon (http://www.cs.arizona.edu/icon/)? There's some stuff available through http://www.iit.edu/~tc/iconprogs.htm mainly parser generators and some simple compilers, but the link to "graphics used in these pages" will give you some Icon programs that use windows. -- -Thomas W. Christopher http://www.iit.edu/~tc tc@charlie.cns.iit.edu From icon-group-sender Sat Mar 22 17:31:59 1997 Received: by cheltenham.cs.arizona.edu; Sat, 22 Mar 1997 16:11:52 MST To: icon-group@cs.arizona.edu Date: Sat, 22 Mar 1997 17:31:59 +1000 From: Stuart Robinson Message-Id: <33338AEF.420@anu.edu.au> Sender: icon-group-request@cs.arizona.edu Subject: Problem with Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1091 Hello. I've run into a problem with a program that I've written and I was hoping that someone would tell what is wrong. I'm sure it's silly and stupid but I am a newcomer to programming in general and Icon in particular. This short little program is meant to read a line and write either (1) a tab followed by the line or (2) simply the line. It should do (1) if the line either contains "{Q" or follows a line with "{Q"; otherwise, it should do (2). I would greatly appreciate it if someone could tell me I have slipped up. Also, if anyone knows of an alternative strategy, I would appreciate hearing about it. Thanks. (The program follows.) ====================================================================== procedure main() lastline := "" while line := read() do { line ? { if find( "{Q" ) then presentline := "quote" write( "\t" || line ); else if lastline == "quote" then write( "\t" || line ) presentline := "notquote"; else other write( line ) presentline := "notquote" } } lastline := presentline end From icon-group-sender Sat Mar 22 16:50:45 1997 Received: by cheltenham.cs.arizona.edu; Sat, 22 Mar 1997 16:12:10 MST To: icon-group@cs.arizona.edu Date: 22 Mar 1997 16:50:45 GMT From: espie@drakkar.ens.fr (Marc Espie) Message-Id: <5h12l5$6m3$1@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu References: <33338AEF.420@anu.edu.au> Subject: Re: Problem with Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1123 In article <33338AEF.420@anu.edu.au>, Stuart Robinson wrote: >Hello. > >I've run into a problem with a program that I've written and I was >hoping that someone would tell what is wrong. I'm sure it's silly and >stupid but I am a newcomer to programming in general and Icon in >particular. > >This short little program is meant to read a line and write either (1) >a tab followed by the line or (2) simply the line. It should do (1) >if the line either contains "{Q" or follows a line with "{Q"; >otherwise, it should do (2). Relax your strategy, it will work better: procedure main() while line := read() do if find("{Q", line) then { write("\t"||line) write("\t"||read()) } else write(line) end - using string scanning is more confusing than anything in that context. - you have to use two write() for the comments case, as read() can fail. -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Sun Mar 23 18:40:10 1997 Date: Sun, 23 Mar 1997 18:40:10 MST From: icon-group-sender Message-Id: <199703240140.AA22121@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:40:10 MST Errors-To: icon-group-errors@cs.arizona.edu Apparently-To: icon-group-addresses Status: RO Content-Length: 479 2:3 7 X:X B:B 2:3 8 Y:Y B:B where the first column provides the two successive lines are concerned; the second provides the index number which unites them; the third provides the members of one category; and the fourth provides the members of another category. Any ideas about how to solve the problem of multiple indexes? I don't need a full program so much as advice on a good strategy. Thanks in advance. Cheers, Stuart Robinson From icon-group-sender Sun Mar 23 15:59:28 1997 Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:39:54 MST To: icon-group@cs.arizona.edu Date: Sun, 23 Mar 1997 15:59:28 +1000 From: Stuart Robinson Message-Id: <3334C6C0.3538@anu.edu.au> Sender: icon-group-request@cs.arizona.edu Subject: Problem with Another Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2429 Hello. Marc Espie provided a solution to my last problem, for which I am very thankful, but I have another problem which I was hoping someone on comp.lang.icon could help me with. A few weeks ago I posted a query to the newsgroup about a text analysis program that I was trying to write. Here is the original posting. >I have a number of texts each line of which has been coded for three types >of information. Each line of the text will be assigned a number and a >code for two categories. The numbers are just whole numbers (raning from 1 >to 20 or so) and each category has four members (say, ABCD and WXYZ). >Here is an example text: > >1 A X >1 A Y >1 B Y >2 B Y > >Note that some successive lines share an index number (as in lines 1 and >2 and 2 and 3). When that is the case, I would like the program to >output the members of each category for the matched lines, as below: > >1-2 AA XY >2-3 AB YY I received responses from Jan Theodore Galkowski/Helen Andrea Galkowski, Bob Alexander, and Todd A. Proebsting--each of whom I would like to thank. Todd Proebsting contributed the following program: procedure main() count := 0 last_index := "" last_cat1 := "" last_cat2 := "" while s := read() do { count +:= 1 s ? { tab(upto(&digits++&letters)) # skip initial non-letters/digits index := tab(many(&digits++&letters)) # get letters/digits tab(upto(&digits++&letters)) cat1 := tab(many(&digits++&letters)) tab(upto(&digits++&letters)) cat2 := tab(many(&digits++&letters)) } if index == last_index then { write(count-1, "-", count, " ", last_cat1, cat1, " ", last_cat2, cat2) } last_index := index; last_cat1 := cat1; last_cat2 := cat2; } end This program is great, but it keeps track of only one index number per line. However, the texts I will use the program to analyze contain more than one index number per line. (Unfortunately, I failed to make this clear in my original posting.) To highlight the problem, I will provide an extract from a text (with inessential info ommitted): {V.A 1{X {V.B 7{X 8{Y {V.B 7{X 8{Y From icon-group-sender Sun Mar 23 07:14:34 1997 Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:40:39 MST Date: Sun, 23 Mar 1997 07:14:34 -0600 (CST) From: "Chris D. Tenaglia" To: Stuart Robinson Cc: icon-group@cs.arizona.edu Subject: Re: Problem with Program In-Reply-To: <33338AEF.420@anu.edu.au> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1427 I assume that code snippit was pseudocode? If not, there is also the need to put multiple expressions of a clause between curly braces { presentline := "quote" write( "\t" || line ); } String scanning has it uses, but it makes the problem harder in this case. There are many ways to skin this cat. procedure main() while line := read() do { line := if find("{Q",line) then "\t" || line || "\n\t" else line writes(line) } end Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | ce que vous obtenez ! On Sat, 22 Mar 1997, Stuart Robinson wrote: > This short little program is meant to read a line and write either (1) > a tab followed by the line or (2) simply the line. It should do (1) > if the line either contains "{Q" or follows a line with "{Q"; > otherwise, it should do (2). > > > procedure main() > > lastline := "" > > while line := read() do > { > line ? > { > if find( "{Q" ) > then > presentline := "quote" > write( "\t" || line ); > > else > if lastline == "quote" > then > write( "\t" || line ) > presentline := "notquote"; > > else other > write( line ) > presentline := "notquote" > } > } > > lastline := presentline > > end > From icon-group-sender Sun Mar 23 07:32:50 1997 Received: by cheltenham.cs.arizona.edu; Sun, 23 Mar 1997 18:40:55 MST Date: Sun, 23 Mar 1997 07:32:50 -0600 (CST) From: "Chris D. Tenaglia" To: icon-group@cs.arizona.edu Subject: {Q Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 740 Oops. Forgot a little something. procedure main() while line := read() do { line := if find("{Q",line) then "\t" || line || "\n\t" else line || "\n" writes(line) } end Amazing what a sip of coffee can accomplish. Another nice feature of icon is that you don't have to terminate statements with ; I use ; to put multiple expressions on one line when it helps the code. While || appends strings and it works in a write() context, write(a,b,c,d) is more traditional, with comma separation. Chris Tenaglia (system manager) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | ce que vous obtenez ! From icon-group-sender Sat Mar 29 17:17:46 1997 Received: by cheltenham.cs.arizona.edu; Sat, 29 Mar 1997 06:45:55 MST To: icon-group@cs.arizona.edu Date: Sat, 29 Mar 1997 17:17:46 +0500 From: Stuart Robinson Message-Id: <333D086A.1C1B@anu.edu.au> Sender: icon-group-request@cs.arizona.edu Reply-To: Stuart.Robinson@anu.edu.au Subject: Text Analysis Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 454 My last posting on a problem with text analysis was roundly ignored, due--I suppose--to its excessive length. Let me recapitulate more succintly. Suppose that I have a text composed of lines such as the following: {V.A 1{X {V.A 1{Y {V.B 7{Y {V.B 7{X 8{Y {V.B 7{X 8{Y On each line, there is information about the verb (marked with "{V") and its arguments (marked by either "{X" or "{Y"). Each argument is labelled with an index number. From icon-group-sender Sat Mar 29 06:46:07 1997 Date: Sat, 29 Mar 1997 06:46:07 MST From: icon-group-sender Message-Id: <199703291346.AA26978@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Sat, 29 Mar 1997 06:46:07 MST Errors-To: icon-group-errors@cs.arizona.edu Apparently-To: icon-group-addresses Status: RO Content-Length: 705 1:2 1 X:Y A:A 3:4 7 Y:X B:B 4:5 7 X:X B:B 4:5 8 Y:Y B:B which tells me whenever an index number appears in two consecutive lines (note that there may be more than one index number uniting in two consecutive lines, as in lines 4 and 5 above). The first column provides the two successive lines involved; the second provides the index number which unites them; the third provides the members of one category; and the fourth provides the members of another category. Any suggestions? I need advice on a basic strategy, not a complete solution. Thanks in advance and apologies for posting twice with essentially the same issue. Cheers, Stuart Robinson From icon-group-sender Tue Apr 1 02:33:20 1997 Received: by cheltenham.cs.arizona.edu; Tue, 1 Apr 1997 05:46:32 MST To: icon-group@cs.arizona.edu Date: Tue, 1 Apr 1997 02:33:20 GMT From: nr@viper.cs.Virginia.EDU (Norman Ramsey) Message-Id: <5hps5g$5kg@viper.cs.Virginia.EDU> Organization: University of Virginia Computer Science Department Sender: icon-group-request@cs.arizona.edu Subject: file locking in unix Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 644 I need an Icon program to maintain a database of received messages. Because these messages come in the mail, multiple copies of the program can be running at one time. I'd like to lock the database. The Unix flock() primitive provides a readers/writers locking capability, which is just what I need, but I'm not sure how to import it into Icon. (I figure it can be done using the dynamic loading capability, which I don't understand.) Does anybody out there have C code that will implement Icon functions to acquire and release locks on the file descriptors underlying Icon files? Norman -- Norman Ramsey http://www.cs.virginia.edu/~nr From icon-group-sender Tue Apr 1 13:38:29 1997 Received: by cheltenham.cs.arizona.edu; Tue, 1 Apr 1997 16:42:30 MST Message-Id: <334101C5.6EED@charlie.cns.iit.edu> Date: Tue, 01 Apr 1997 13:38:29 +0100 From: "Thomas W. Christopher" Reply-To: tc@charlie.cns.iit.edu Organization: Illinois Institute of Technology X-Mailer: Mozilla 3.01Gold (WinNT; I) Mime-Version: 1.0 To: Norman Ramsey Cc: icon-group@cs.arizona.edu Subject: Re: file locking in unix Icon References: <5hps5g$5kg@viper.cs.Virginia.EDU> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1166 Norman Ramsey wrote: > > I need an Icon program to maintain a database of received messages. > Because these messages come in the mail, multiple copies of the > program can be running at one time. I'd like to lock the database. > The Unix flock() primitive provides a readers/writers locking > capability, which is just what I need, but I'm not sure how to import > it into Icon. (I figure it can be done using the dynamic loading > capability, which I don't understand.) > > Does anybody out there have C code that will implement Icon functions > to acquire and release locks on the file descriptors underlying Icon > files? The usual UNIX trick is to use an empty file to be a lock. If the file exists, it means the lock is set. If it doesn't exist, it means unlocked. You execute a UNIX "creat" for the file. If the file exists (and you are not superuser) the creation will fail. If, however, the file does not exist, the creation will be successful. Close and remove the file to unlock. I'm guessing this will work in Icon with open(lockfilename,"c"). -- -Thomas W. Christopher http://www.iit.edu/~tc tc@charlie.cns.iit.edu From icon-group-sender Tue Apr 1 14:39:52 1997 Received: by cheltenham.cs.arizona.edu; Tue, 1 Apr 1997 16:42:49 MST Message-Id: <199704011939.OAA19258@archive.cs.Virginia.EDU> To: tc@charlie.cns.iit.edu Cc: icon-group@cs.arizona.edu Subject: Re: file locking in unix Icon In-Reply-To: Your message of "Tue, 01 Apr 1997 13:38:29 +0100." <334101C5.6EED@charlie.cns.iit.edu> Date: Tue, 01 Apr 1997 14:39:52 -0500 From: Norman Ramsey Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 119 Sounds like I'll have to spin: f := &null while /f do f := open("lockfile", "c") does this sound right? Norman From icon-group-sender Wed Apr 2 09:35:43 1997 Received: by cheltenham.cs.arizona.edu; Thu, 3 Apr 1997 06:18:11 MST Date: Wed, 2 Apr 1997 09:35:43 -0800 (PST) From: Tom Mitchell To: Norman Ramsey Cc: tc@charlie.cns.iit.edu, icon-group@cs.arizona.edu Subject: Re: file locking in unix Icon In-Reply-To: <199704011939.OAA19258@archive.cs.Virginia.EDU> Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2635 If you want to go fast and or be reliable there is work to do. A simple spin loop is brutal on the system. It is implicit that another process must run to free the lock. Thus it is important to let that other process run. See the bsd system call nap() or sleep(0). Busy wait loops are evil. If the system is a true multiprocessing system spin locks might play as long as the number of possible spinners is equal to or less than the number of processes AND the time in the lock is very small compared to the slice time. On a single processor system or an oversubscribed multiprocessing machine it is also important to ensure fair sharing of the locked resources. It is very easy to have one process capture the lock. Consider the odds that a given process will time slice out while holding the lock. The ratio of locked vs. unlocked time matters here. Again see the bsd system call nap() or sleep(0) and consider "stepping aside" after the unlock(). Also if more than one lock or locked file is involved you will need to eliminate deadlock risks by design. Check out "Concurrent Programming... by Gregory Andrews or other operating system texts like Per Brinch Hanson(sp). It may be that the best way to get where you need to be is to look at all the work that needs to be done then hide that in a small set of modules/functions that you can improve over time. Start with something simple and correct then work for speed... Networking adds more ... On Tue, 1 Apr 1997, Norman Ramsey wrote: > To: tc@charlie.cns.iit.edu > Cc: icon-group@cs.arizona.edu > Subject: Re: file locking in unix Icon > > Sounds like I'll have to spin: > > f := &null > while /f do f := open("lockfile", "c") > > does this sound right? Close but not strong enough of itself without OS support of exclusive locking of the file by the operating system. Check out mail file locking in public packages like pine or elm, also vipw. Consider a look into perl because there are some perl library packages that work when the OS does not support strong locking. i.e. build on a working lock strategy, building from scratch is hard to get right (but fun). Know also that NFS does not support locking of files and depends on an external agent like 'lockd' to do the very hard work and make it look as if NFS does support locking. Again watch for deadlocks. Spinning forever is a big risk. Always build in an escape or some "continue, retry, abort" sequence. > Norman > -- Thomas Mitchell -- mitch@sgi.com mitch@relay.csd.sgi.com mitch@acm.org "Spring has sprung the grass is riz... I wonder where the birdies is." From icon-group-sender Mon Apr 7 12:28:36 1997 Received: by cheltenham.cs.arizona.edu; Tue, 8 Apr 1997 13:31:19 MST Sender: ko@surya.ho.att.com Message-Id: <334920B4.59CE@surya.ho.att.com> Date: Mon, 07 Apr 1997 12:28:36 -0400 From: Kostas Oikonomou Organization: AT&T Bell Labs X-Mailer: Mozilla 3.0 (X11; I; SunOS 5.5.1 sun4c) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Subject: Problem with Icon 9.3 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 613 Hi, I have the following simple (I think) program: link ximage procedure main() # The state diagram. sd := table([]) sd[["q0","ok"]] := "q1" sd[["q0","nok"]] := "q0" sd[["q1","nok"]] := "q0" sd[["q1","ok"]] := "q2" # q2 is the final state every x := key(sd) do write(ximage(x), ":", sd[x]) end This doesn't behave as I think it should. The problem seems to be a table whose keys are lists. Is there something wrong with this kind of structure? I don't see anything to that effect in the 3d edition of the Icon book, Ch. 6 on tables. I'd appreciate your help. -- Kostas Oikonomou From icon-group-sender Wed Apr 9 08:34:22 1997 Received: by cheltenham.cs.arizona.edu; Wed, 9 Apr 1997 06:35:46 MST Message-Id: <1.5.4.32.19970409133422.00702988@post.its.mcw.edu> X-Sender: cdt@post.its.mcw.edu X-Mailer: Windows Eudora Light Version 1.5.4 (32) Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 09 Apr 1997 08:34:22 -0500 To: Kostas Oikonomou , icon-group@cs.arizona.edu From: Chris Tenaglia Subject: Re: Problem with Icon 9.3 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1487 I think lists are a different kind of data than strings. I think it has something to do with pointers and addresses. That's why I do arrays using keys of concatenated strings. # The state diagram. sd := table([]) sd["q0,ok"] := "q1" sd["q0,nok"] := "q0" sd["q1,nok"] := "q0" sd["q1,ok"] := "q2" # q2 is the final state or # The state diagram. sd := table([]) sd[q0 || "," || ok] := "q1" sd[q0 || "," || nok] := "q0" sd[q1 || "," || nok] := "q0" sd[q1 || "," || ok] := "q2" # q2 is the final state Chris At 12:28 PM 4/7/97 -0400, Kostas Oikonomou wrote: >Hi, > >I have the following simple (I think) program: > >link ximage > >procedure main() > > # The state diagram. > sd := table([]) > sd[["q0","ok"]] := "q1" > sd[["q0","nok"]] := "q0" > sd[["q1","nok"]] := "q0" > sd[["q1","ok"]] := "q2" > # q2 is the final state > > every x := key(sd) do write(ximage(x), ":", sd[x]) > >end > >This doesn't behave as I think it should. The problem seems to be a >table whose keys are lists. Is there something wrong with this kind of >structure? I don't see anything to that effect in the 3d edition of the >Icon book, Ch. 6 on tables. > >I'd appreciate your help. >-- > Kostas Oikonomou > > Chris Tenaglia (system manag r) | cdt@post.its.mcw.edu Medical College of Wisconsin | 8701 W. Watertown Plank Rd. | Ce que vous voyez est Milwaukee, WI 53226 (414)456-8765 | Ce que vous obtenez ! From icon-group-sender Wed Apr 9 06:50:35 1997 Message-Id: <199704091946.AA11186@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Wed, 9 Apr 1997 12:46:46 MST From: swampler@noao.edu (Steve Wampler) Date: Wed, 9 Apr 1997 06:50:35 MST To: icon-group@cs.arizona.edu Subject: Re: Problem with Icon 9.3 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1626 On Apr 8 at 2:02pm, Eka Laiman writes: } > I have the following simple (I think) program: } > } > link ximage } > } > procedure main() } > } > # The state diagram. } > sd := table([]) } > sd[["q0","ok"]] := "q1" } > sd[["q0","nok"]] := "q0" } > sd[["q1","nok"]] := "q0" } > sd[["q1","ok"]] := "q2" } > # q2 is the final state } > } > every x := key(sd) do write(ximage(x), ":", sd[x]) } > } > end } > } > This doesn't behave as I think it should. The problem seems to be a } > table whose keys are lists. Is there something wrong with this kind of } > structure? I don't see anything to that effect in the 3d edition of the } > Icon book, Ch. 6 on tables. } } Wow, indexing using "list"s? } } I do not know if ICON's tables are built with this kind of operation in } mind. I personally think that ICON tables are like "hash table" where the } indexing can be done using both "strings" or "integers". According to the } definition: "Tables resemble lists, except that the keys, or 'subscripts', } need not be integers but can be *values of any type*." I have not tried to } do indexing based on "float" yet, although theoretically that's possible } :-) } } If I were you, I would first convert the list into "string" and use the } resulting string as the key. There is nothing at all wrong with indexing tables with anything, including lists, sets, and tables. In fact, his code works on my system exactly as I would expect. -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Wed Apr 9 09:14:10 1997 Message-Id: <199704091947.AA11216@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Wed, 9 Apr 1997 12:47:37 MST Date: Wed, 9 Apr 97 17:09:32 BST From: Jeff Dalton Subject: Re: Problem with Icon 9.3 To: eka@corp.cirrus.com (Eka Laiman), ko@surya.ho.att.com (Kostas Oikonomou) Cc: icon-group@cs.arizona.edu Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 895 > Wow, indexing using "list"s? > > I do not know if ICON's tables are built with this kind of operation in > mind. I personally think that ICON tables are like "hash table" where the > indexing can be done using both "strings" or "integers". According to the > definition: "Tables resemble lists, except that the keys, or 'subscripts', > need not be integers but can be *values of any type*." I have not tried to > do indexing based on "float" yet, although theoretically that's possible > :-) But doesn't "list" fall under "any type". Hash tables in Common Lisp can be indexed by lists. (How it depends on the "test" specified when the table is created. For a table where the test is "equal", the contents of the list matter. For one there the test is "eql" (which is pretty close to identity), only the "address" of the lisyt would be used. A similar rule applies to strings.) -- jeff From icon-group-sender Wed Apr 9 15:06:07 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Thu, 10 Apr 1997 08:25:31 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA01070; Thu, 10 Apr 1997 08:25:31 -0700 Sender: rpereda@micro.ti.com Message-Id: <334BF6AF.485EBC12@micro.ti.com> Date: Wed, 09 Apr 1997 15:06:07 -0500 From: Ray Pereda Organization: Texas Instruments X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 4.1.4 sun4m) Mime-Version: 1.0 To: Eka Laiman Cc: Kostas Oikonomou , icon-group@cs.arizona.edu Subject: Re: Problem with Icon 9.3 References: <9704082058.AA18878@ss492.corp.cirrus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2489 Kka, Indexing table by say an integer is different than indexing by a list. An integer is treated like a value. One integer 3 is the same as another integer 3. A list is treated more like an object. ["q0", "ok"] could generate a list object in one part of the code. ["q0", "ok"] generates an entirely new list in another place in the code. When a list a created, an anonymous name or tag is also created. This anonymous tag is what is really indexing the table. If you want to index by some value then you need to translate the list into some unique string, and then use that string to index. What do you think about making tables index-able by either values or objects? link ximage procedure main() sd := table([], "object") sd[[1]] := 1 sd[[1]] := 2 every write(ximage(sd)) end would produce T1 := table({L1 := list(0) L1}) T1[{L2 := list(1) L2[1] := 1 L2}] := 1 T1[{L3 := list(1) L3[1] := 1 L3}] := 2 and link ximage procedure main() sd := table([], "value") sd[[1]] := 1 sd[[1]] := 2 every write(ximage(sd)) end T1 := table({L1 := list(0) L1}) T1[{L2 := list(1) L2[1] := 1 L2}] := 2 -Ray Pereda Eka Laiman wrote: > > > I have the following simple (I think) program: > > > > link ximage > > > > procedure main() > > > > # The state diagram. > > sd := table([]) > > sd[["q0","ok"]] := "q1" > > sd[["q0","nok"]] := "q0" > > sd[["q1","nok"]] := "q0" > > sd[["q1","ok"]] := "q2" > > # q2 is the final state > > > > every x := key(sd) do write(ximage(x), ":", sd[x]) > > > > end > > > > This doesn't behave as I think it should. The problem seems to be a > > table whose keys are lists. Is there something wrong with this kind of > > structure? I don't see anything to that effect in the 3d edition of the > > Icon book, Ch. 6 on tables. > > Wow, indexing using "list"s? > > I do not know if ICON's tables are built with this kind of operation in > mind. I personally think that ICON tables are like "hash table" where the > indexing can be done using both "strings" or "integers". According to the > definition: "Tables resemble lists, except that the keys, or 'subscripts', > need not be integers but can be *values of any type*." I have not tried to > do indexing based on "float" yet, although theoretically that's possible > :-) > > If I were you, I would first convert the list into "string" and use the > resulting string as the key. > > -eka- From icon-group-sender Wed Apr 9 15:06:07 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Thu, 10 Apr 1997 12:33:56 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA00534; Thu, 10 Apr 1997 12:33:56 -0700 Sender: rpereda@micro.ti.com Message-Id: <334BF6AF.485EBC12@micro.ti.com> Date: Wed, 09 Apr 1997 15:06:07 -0500 From: Ray Pereda Organization: Texas Instruments X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 4.1.4 sun4m) Mime-Version: 1.0 To: Eka Laiman Cc: Kostas Oikonomou , icon-group@cs.arizona.edu Subject: Re: Problem with Icon 9.3 References: <9704082058.AA18878@ss492.corp.cirrus.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2489 Kka, Indexing table by say an integer is different than indexing by a list. An integer is treated like a value. One integer 3 is the same as another integer 3. A list is treated more like an object. ["q0", "ok"] could generate a list object in one part of the code. ["q0", "ok"] generates an entirely new list in another place in the code. When a list a created, an anonymous name or tag is also created. This anonymous tag is what is really indexing the table. If you want to index by some value then you need to translate the list into some unique string, and then use that string to index. What do you think about making tables index-able by either values or objects? link ximage procedure main() sd := table([], "object") sd[[1]] := 1 sd[[1]] := 2 every write(ximage(sd)) end would produce T1 := table({L1 := list(0) L1}) T1[{L2 := list(1) L2[1] := 1 L2}] := 1 T1[{L3 := list(1) L3[1] := 1 L3}] := 2 and link ximage procedure main() sd := table([], "value") sd[[1]] := 1 sd[[1]] := 2 every write(ximage(sd)) end T1 := table({L1 := list(0) L1}) T1[{L2 := list(1) L2[1] := 1 L2}] := 2 -Ray Pereda Eka Laiman wrote: > > > I have the following simple (I think) program: > > > > link ximage > > > > procedure main() > > > > # The state diagram. > > sd := table([]) > > sd[["q0","ok"]] := "q1" > > sd[["q0","nok"]] := "q0" > > sd[["q1","nok"]] := "q0" > > sd[["q1","ok"]] := "q2" > > # q2 is the final state > > > > every x := key(sd) do write(ximage(x), ":", sd[x]) > > > > end > > > > This doesn't behave as I think it should. The problem seems to be a > > table whose keys are lists. Is there something wrong with this kind of > > structure? I don't see anything to that effect in the 3d edition of the > > Icon book, Ch. 6 on tables. > > Wow, indexing using "list"s? > > I do not know if ICON's tables are built with this kind of operation in > mind. I personally think that ICON tables are like "hash table" where the > indexing can be done using both "strings" or "integers". According to the > definition: "Tables resemble lists, except that the keys, or 'subscripts', > need not be integers but can be *values of any type*." I have not tried to > do indexing based on "float" yet, although theoretically that's possible > :-) > > If I were you, I would first convert the list into "string" and use the > resulting string as the key. > > -eka- From icon-group-sender Thu Apr 10 21:53:31 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 11 Apr 1997 08:46:35 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA00848; Fri, 11 Apr 1997 08:46:35 -0700 To: icon-group@cs.arizona.edu Date: Thu, 10 Apr 1997 21:53:31 +0200 From: Stuart Robinson Message-Id: <334D453B.72FD@anu.edu.au> Organization: ANU Sender: icon-group-request@cs.arizona.edu Reply-To: Stuart.Robinson@anu.edu.au Subject: Records in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 754 Does anyone know a way to check two fields of two entries in a record to see whether either one of the fields in the two entries share an identical value? For example, given a record with three entries and 5 fields like the following (where the 4th and 5th field are empty in entries 1 and 3) 1 5 X 2 5 X 6 Y 3 6 X how could one check to see whether successive entires (1 and 2 or 2 and 3) share a common value in either the second or the fourth field? In other words, how could one write a program that would tell you both when 1 and 2 share a common value (5) via the 2nd field and when 2 and 3 share a common value (6) via the 4th field of 2 and the 2nd field of 3? Thanks in advance. Cheers, Stuart Robinson From icon-group-sender Fri Apr 11 10:44:43 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 11 Apr 1997 08:46:48 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA01154; Fri, 11 Apr 1997 08:46:48 -0700 To: icon-group@cs.arizona.edu Date: 11 Apr 1997 10:44:43 GMT From: eddie@tattoo.ed.ac.uk (Eddie Corns) Message-Id: <5il4mr$gr6@scotsman.ed.ac.uk> Organization: Edinburgh University Sender: icon-group-request@cs.arizona.edu References: <334D453B.72FD@anu.edu.au> Subject: Re: Records in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 414 Re: checking common elements in a record Extract all the fields from the record that you want to compare (2 and 4 in your example) into a set for each record, then compare the sets for a non zero length intersection. That's assuming you don't care which ones actually matched. If you wanted that then I suppose comparing each field for membership of the intersection set would be about the easiest way. Eddie From icon-group-sender Wed Apr 9 08:00:41 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 11 Apr 1997 08:47:27 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA01105; Fri, 11 Apr 1997 08:47:27 -0700 To: icon-group@cs.arizona.edu Date: 9 Apr 1997 08:00:41 -0700 From: icon-project@cs.arizona.edu Message-Id: <5igaup$7m5@cheltenham.CS.Arizona.EDU> Organization: University of Arizona CS Department, Tucson AZ Sender: icon-group-request@cs.arizona.edu Reply-To: icon-project@cs.arizona.edu Subject: Icon Programming Language FAQ Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 14760 Archive-name: comp-lang-icon-faq Posting-Frequency: monthly Frequently Asked Questions About The Icon Programming Language Last updated: December 11, 1996 This FAQ answers various questions about the Icon programming language, ranging from what it is to how you can get it. The master copy of this FAQ is the Web page http://www.cs.arizona.edu/icon/faq.html. Other on-line documentation is available via the main Icon page at http://www.cs.arizona.edu/icon/. This FAQ is written by Ralph Griswold and Gregg Townsend, with help from Cliff Hathaway, Clint Jeffery, and Bob Alexander. * 1. What is Icon? * 2. What is Icon good for? * 3. Where did Icon come from? * 4. What does "Icon" stand for? * 5. On what computers does Icon run? * 6. Who did all these implementations? * 7. Are there other implementations in the works? * 8. What about different versions of Icon? * 9. Which implementations of Icon have graphics/window capabilities? * 10. Where can I get Icon? * 11. Where can I get documentation about Icon? * 12. How do I get started with Icon? * 13. What is the Icon Project? * 14. Where can I find examples of Icon programs? * 15. What is Idol? * 16. How often is material in Icon's FTP area updated? * 17. How do I stay up to date with what's going on with Icon? * 18. Is there a users' group for Icon? * 19. How do I get technical support? * 20. What do I need to run Icon? * 21. Can I build my own implementation of Icon for a new platform? ---------------------------------------------------------------------------- 1. What is Icon? Icon is a very high level general-purpose programming language with extensive features for processing strings (text) and data structures. Icon is an imperative, procedural language with a syntax that is reminiscent of C and Pascal, but its semantics are at a much higher level than those languages. Icon has a novel expression-evaluation mechanism that integrates goal-directed evaluation and backtracking with conventional control structures. It has a string scanning facility for pattern matching that avoids the tedious details usually associated with analyzing strings. Icon's built-in data structures include sets and tables with associative lookup, lists that can be used as vectors or stacks and queues, and records. Icon is a strongly, though not statically, typed language. It provides transparent automatic type conversion. For example, if an integer is used in an operation that requires a string, the integer is automatically converted to a string. Several implementations of Icon have high-level graphics facilities with an easily programmed window interface. Icon manages storage automatically. Objects are created as needed during program execution and space is reclaimed by garbage collection as needed. The sizes of strings and data structures are limited only by the amount of available memory. 2. What is Icon good for? As a general-purpose programming language with a large computational repertoire, Icon can be used for most programming tasks. It's at its best when used build software tools, for processing text, and when ease of programming is needed for experimental and research applications. Paradoxically, Icon is used most often for short, one-shot tasks and for very complex applications. Icon is designed to make programming easy; it emphasizes the value of programmer's time and the importance of getting programs to work quickly. This explains its usefulness for prototyping as well as the apparent paradox of applicability to simple and complex applications. 3. Where did Icon come from? Icon is the latest in a series of high-level programming languages designed to facilitate programming tasks involving strings and structures. The original language, SNOBOL, was developed at Bell Telephone Laboratories in the early 60s. SNOBOL evolved into SNOBOL4, which is still in use. Subsequent languages were developed at The University of Arizona with support from the National Science Foundation. Incidentally, Icon bears little physical resemblance to SNOBOL4, although it has similar objectives and many similar capabilities. 4. What does "Icon" stand for? The name Icon (which is not spelled ICON) is not an acronym nor does it stand for anything in particular, although the word "iconoclastic" was mentioned at the time the name was chosen. The name predates the now common use of "icon" to refer to small images used in graphical user interfaces. This latter usage sometimes causes persons to think mistakenly that Icon is designed to create or manipulate icons. There's not much that can be done about this. 5. On what computers does Icon run? The implementation of Icon is highly portable. Version 9 runs on UNIX, MS-DOS, Windows, NT, Macintosh/MPW, VAX/VMS, the Amiga, and the Acorn Archimedes. There are older versions for the Atari ST, IBM CMS and MVS, the Macintosh, and OS/2. Icon programs also are highly portable. Most Icon programs can run on any platform that supports Icon. 6. Who did all these implementations? The original implementation of Icon for UNIX was done at The University of Arizona. Most of the other implementations originally were done by volunteers scattered around the world. It's worth noting that all implementations of Icon are based on the same source code, which is written in C. This contributes to the portability of Icon itself, as well as to the portability of programs written in Icon. 7. Are there other implementations in the works? Work is constantly underway on implementations of Icon for new platforms. Microsoft Windows and Windows NT implementations are in beta testing. 8. What about different versions of Icon? Icon has evolved through a series of versions with improved and extended capabilities. The latest major version number is 9. This version includes recent changes and additions, notably in the graphics area, and runs on UNIX, MS-DOS, Macintosh/MPW, VAX/VMS, the Amiga, and Acorn Archimedes. Other implementations presently are at Version 8. Almost all programs that run under Version 8 and that do not use graphics will run under Version 9. 9. Which implementations of Icon have graphics/window capabilities? Icon's graphics facilities presently are supported on UNIX and VAX/VMS. Windows NT and Microsoft Windows implementations that support Icon's graphics facilities are in beta testing. 10. Where can I get Icon? Icon is available via anonymous FTP and on the Web. For FTP, use ftp.cs.arizona.edu and cd /icon. For the Web, use http://www.cs.arizona.edu/icon/ and check out the links there. For FTP, the directory /icon/binaries contains executable versions of Icon for several systems, including several popular UNIX platforms. The directory /icon/packages contains source code, test programs, related material, and, most cases, executable binaries as well. All directories have README files with additional information. 11. Where can I get documentation about Icon? The definitive work on Icon is the book The Icon Programming Language, Griswold and Griswold, third edition, Peer-to-Peer Communications, Inc, 1996, 386 pages, ISBN 1-57398-001-3. This book is a complete description and reference manual for Version 9 of Icon. A technical report describes changes since that version. There also is a book on the implementation of Icon: The Implementation of the Icon Programming Language, Griswold and Griswold, Princeton University Press, 1986, 336 pages, ISBN 0-691-08431-9. This book describes the implementation as of Version 6 of Icon. Although the implementation has changed considerably since then, the basic structure is the same. Technical reports describing recent implementation changes are included with copies of the book purchased from the Icon Project. These books are available from the Icon Project. Additional documentation is available via FTP in /icon/doc. Notable documents are: * IPD266: An Overview of Icon (text, PostScript, PDF) * IPD281: Graphics/window facilities (PostScript, PDF) * IPD278: Version 9.3 of Icon (text, PostScript, PDF) There are manual pages for UNIX systems, and more documentation under the Icon web page, but there is no complete on-line documentation. The Icon Newsletter, which includes topical material about Icon and a list of material available from the Icon Project, is published three times a year and is available on the Web. There is a subscription fee for an on-going subscription by postal mail. The Icon Analyst, a technically-oriented newsletter that features articles about programming, is published six times a year. There is a subscription fee for the Analyst. A sample copy is available on the Web. All back issues of both newsletters are available for purchase. 12. How do I get started with Icon? If you're running under UNIX, check first in the /icon/binaries/unix FTP directory to see if there is a "starter kit" for your platform. Starter kits include executables, documentation, and other material. Otherwise, go to the /icon/packages directory and get the appropriate package. Packages include documentation and other material; see the README file in that directory for more details. There is a UNIX package for platforms that lack starter kits. If the non-UNIX package you pick up does not contain executable files, check /icon/binaries. You also may want to get the overview of Icon: /icon/doc/ipd266.txt or ipd266.ps.Z. You'll find pointers to other documents of interest in the package you pick up. 13. What is the Icon Project? The Icon Project is a name used by the group that develops, implements, distributes, and supports the Icon programming language. The Icon Project is not commercial organization. It derives support from The University of Arizona, revenue from the sale of program material and documentation, and user contributions. 14. Where can I find examples of Icon programs? There is a large program library for Icon. It is an excellent resource for both new and experienced programmers. The library contains numerous examples of how to do things with Icon. The library also provides many useful applications, as well as hundreds of procedures that supplement Icon's built-in repertoire. The library, like other Icon material, is available via FTP in /icon/library. 15. What is Idol? Idol is an object-oriented extension to Icon that provides concepts such as classes and multiple inheritance. Idol is written in Idol and is distributed as part of the Icon program library. Idol runs on almost all of the platforms that support Icon. Additional Idol information is available from Clint Jeffery, jeffery@ringer.cs.utsa.edu. 16. How often is material in Icon's FTP area updated? New material is added when it's available. Established implementations usually are updated only when there's a new version. This typically is every year or two. The Icon program library is updated on a similar schedule. 17. How do I stay up to date with what's going on with Icon? The best way to find out about developments related to Icon is to read the Icon Newsletter. You can stay up to date on the source code, which is changed much more frequently than the version on FTP is updated, by subscribing to the source update service, which provides a new version about twice a year. There also is a subscription service for updates to the Icon program library, which provides new material about twice a year. There is on-line information about subscribing to these services. 18. Is there a users' group for Icon? There is no official Icon users' group. The Icon Project maintains an electronic mailing list, icon-group@cs.arizona.edu. Mail sent to this address is forwarded to subscribers. To subscribe (or unsubscribe), send a message to icon-group-request@cs.arizona.edu. There is a gateway between icon-group and comp.lang.icon, an unmoderated newsgroup for discussing issues related to Icon. The gateway, which exchanges messages between the two systems, is imperfect and not under the control of the Icon Project. The newsgroup generally provides faster response than the mailing list, is less intrusive, but sometimes suffers from inappropriate postings. The Icon Project usually sends messages of interest to the Icon community to icon-group. 19. How do I get technical support? The Icon Project is not a commercial organization, and its capacity for providing technical support is limited. Please use the appropriate resource when you need assistance: Ordering Icon Material mail: Icon Project Department of Computer Science The University of Arizona P.O. Box 210077 Tucson, Arizona 85721-0077 U.S.A. fax: (520) 621-4246 voice: (520) 621-6613 e-mail: icon-orders@cs.arizona.edu Getting On-Line Information and Material web: http://www.cs.arizona.edu/icon/ ftp: ftp.cs.arizona.edu (cd /icon) e-mail: ftpmail@cs.arizona.edu Send a message consisting of the word help. Assistance with Installing Icon e-mail: icon-project@cs.arizona.edu Bug Reports e-mail: icon-project@cs.arizona.edu fax: (520) 621-4246 Assistance with Programming Problems e-mail: icon-group@cs.arizona.edu news: comp.lang.icon Uploading Files ftp: ftp.cs.arizona.edu (cd /incoming) After uploading, send e-mail to icon-project@cs.arizona.edu. 20. What do I need to run Icon? Icon will run on most computers. Under MS-DOS, the Icon interpreter needs at least 500 KB of application RAM to work well. 21. Can I build my own implementation of Icon for a new platform? As mentioned above, Icon is written in C and the source code is available. The existing implementations are testament to its portability. (A small amount of assembly-language code is required for a context switch, but this is only needed for an optional feature -- co-expressions -- that can be disabled without affecting other features of Icon.) New ports involve platform-specific configuration parameters and, in some cases, platform-specific code. The feasibility of a new port and the amount of work it may take depends on the platform -- its architecture, its C compiler, and its environment. Ports to new UNIX platforms generally are easy, although novel architectures may present problems. Ports to new operating systems generally are more difficult, especially if Icon's graphics facilities are implemented. The Icon Project provides what help it can with new ports. In return, it asks that code related to the port to be returned to the Icon Project for inclusion in future versions of the source code for Icon. This makes the new port available to others as well as to the porter when Icon is updated. From icon-group-sender Fri Apr 11 15:48:30 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 09:14:30 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA03102; Mon, 14 Apr 1997 09:14:30 -0700 To: icon-group@cs.arizona.edu Date: Fri, 11 Apr 1997 15:48:30 GMT From: feustel@netcom.com (Dave Feustel) Message-Id: Organization: DAFCO Sender: icon-group-request@cs.arizona.edu Subject: New WebBoard for Icon Discussions Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 360 I have set up an O'Reilly WebBoard at my website with a Conference area for discussion of topics related to CGI, ICON and Spitbol. Please check it out and give me feedback about the way the board works for you. Visit the Conference at http://feustel.mixi.net:8080/~2 Thanks. -- Dave Feustel http://feustel.mixi.net 219-483-1857 mailto:feustel@netcom.com From icon-group-sender Fri Apr 11 08:13:13 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 09:14:12 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA03068; Mon, 14 Apr 1997 09:14:12 -0700 To: icon-group@cs.arizona.edu Date: Fri, 11 Apr 1997 08:13:13 -0700 From: Steve Wampler Message-Id: <334E5509.2A4@gemini.edu> Organization: Gemini 8m Telescopes Project Sender: icon-group-request@cs.arizona.edu References: <334D453B.72FD@anu.edu.au> Subject: Re: Records in Icon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1266 Stuart Robinson wrote: > > Does anyone know a way to check two fields of two entries in a record to > see whether either one of the fields in the two entries share an > identical value? > > For example, given a record with three entries and 5 fields like the > following (where the 4th and 5th field are empty in entries 1 and 3) > > 1 5 X > 2 5 X 6 Y > 3 6 X > > how could one check to see whether successive entires (1 and 2 or 2 and > 3) share a common value in either the second or the fourth field? > > In other words, how could one write a program that would tell you both > when 1 and 2 share a common value (5) via the 2nd field and when 2 and 3 > share a common value (6) via the 4th field of 2 and the 2nd field of 3? Do you care why the two records 'match'? That is, do you need to distinguish between your two example cases, or is it sufficient to simply say "the records 'match'"? Here's a procedure that handles the latter case: procedure weakMatch(r1,r2) return !r1 ~=== !r2 end Why are you doing these things, though? -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Sat Apr 12 17:10:21 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 09:15:33 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02722; Mon, 14 Apr 1997 09:15:32 -0700 To: icon-group@cs.arizona.edu Date: Sat, 12 Apr 1997 17:10:21 +1000 From: Stuart.Robinson@anu.edu.au (Stuart Robinson) Message-Id: Organization: ANU Sender: icon-group-request@cs.arizona.edu Subject: More on Records Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 940 Suppose you want to scan through each line of a text looking for a particular type of word. Roughly speaking, the first time you find it, it should go to one field of a record and the second time you find it, it should go to another field of the same record. (The word will appear at most two times in a line, possibly not at all.) How would you do it? More concretely, if you have the following line {T.p istam eCel 3{O stuK 1{A and a record with four fields like the following record[index1, arg1, index2, arg2] how do you write code that would take the first word with "{" followed by "S", "A", or "O" and put it into arg1 and its accompanying number into index1 and then take the second word in the same line with "{" followed by "S", "A", or "O" and put it into arg2 and its accompanying number into index2, as below? record[3, {O, 1, {A] -- Stuart Robinson The Australian National University From icon-group-sender Sat Apr 12 06:34:26 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 09:16:18 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02978; Mon, 14 Apr 1997 09:16:17 -0700 Date: Sat, 12 Apr 1997 06:34:26 -0700 From: GMCMILLAN@pimacc.pima.edu Subject: Intro. me To: icon-group@cs.arizona.edu Message-Id: <01IHLWP7QIZS934SXX@pimacc.pima.edu> X-Vms-To: IN::"icon-group@cs.arizona.edu" Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1280 Hi! My name is Gloria McMillan. I teach computer-assisted writing at Pima College and I've been using computers to do literary text analysis. I've wroked about half way through Waite's C Primer Plus, but Jose Durazo (a student in comp. sci. at U of A) has helped me to install an Icon compiler on my 386/87 machine here. Jose think Icon would be much easier to program for SGML tag-finding operations. TEI-SGML is the mark-up language used by the Oxford text Archive. I have made a completely-tagged version of Bram Stoker's _Dracula_ (that is, each speech of each character is tagged and there are tags on the diaries, journals and letters, as well as chapter divisions, etc.) With this text to practice on, I have already done one research paper for ENGL 597r, a Grad. Rhetoric course. There are many texts that are being marked in this fashion--or marked in broad divisions so scholars can add more fine-tagging. I hope to go on in this area of computer text analysis. It seems that Icon is a language suited to this purpose. Is there an online course in progress for beginners like me? Or--what more convetnional class might I audit at U of AZ to learn the rudiments of Icon? I am a non-tech person with some experience in C, but little else. Thanks! Gloria From icon-group-sender Mon Apr 14 17:25:04 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 14 Apr 1997 12:43:27 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA03699; Mon, 14 Apr 1997 12:43:27 -0700 To: icon-group@cs.arizona.edu Date: 14 Apr 1997 17:25:04 GMT From: eddie@tattoo.ed.ac.uk (Eddie Corns) Message-Id: <5itp9g$4l5@scotsman.ed.ac.uk> Organization: Edinburgh University Sender: icon-group-request@cs.arizona.edu References: Subject: Re: More on Records Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1561 Stuart.Robinson@anu.edu.au (Stuart Robinson) writes: >Suppose you want to scan through each line of a text looking for a >particular type of word. Roughly speaking, the first time you find it, it >should go to one field of a record and the second time you find it, it >should go to another field of the same record. (The word will appear at >most two times in a line, possibly not at all.) How would you do it? I wouldn't. I would just use a list, they're wonderful things. >More concretely, if you have the following line >{T.p istam eCel 3{O stuK 1{A I would probably try decrytping it! >and a record with four fields like the following >record[index1, arg1, index2, arg2] >how do you write code that would take the first word with "{" followed by >"S", "A", or "O" and put it into arg1 and its accompanying number into >index1 and then take the second word in the same line with "{" followed by >"S", "A", or "O" and put it into arg2 and its accompanying number into >index2, as below? >record[3, {O, 1, {A] Well, assuming a split function to return an array of items: rec := [] x := split(line) every i := 1 to *x do x[i] ? if tab(find("{")+1) & =("A"|"S"|"O") then put(rec,i) & put(rec,x[i]) (Hmmm that's a bit clumsy, can I do =!"ASO" - can't be bothered typing it in again to try it) This creates a list of found items rather than a record. I'm not sure if put() works on records, if not and you really want to use a record you'd just need a counter to keep track (since you _can_ address elements of a record by position). Eddie From icon-group-sender Tue Apr 15 00:29:00 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 15 Apr 1997 16:29:18 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA01597; Tue, 15 Apr 1997 16:29:18 -0700 Date: Tue, 15 Apr 1997 00:29:00 GMT From: ia@stryx.demon.co.uk (Iain Alexander) Reply-To: ia@stryx.demon.co.uk Message-Id: <19674@stryx.demon.co.uk> To: icon-group@cs.arizona.edu Subject: Re: Records in Icon X-Mailer: PCElm 1.10 Lines: 22 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 922 In message <334E5509.2A4@gemini.edu> Steve Wampler writes: > > Do you care why the two records 'match'? That is, do you need to > distinguish between your two example cases, or is it sufficient to > simply say "the records 'match'"? > > Here's a procedure that handles the latter case: > > procedure weakMatch(r1,r2) > return !r1 ~=== !r2 > end Eh? What's that "~" doing there? (BTW, it wasn't clear to me whether the word "record" in the original was intended to refer to the Icon structure of that name. Your code (modulo suspected typo) obviously works just as well with a list, which might be a more appropriate data structure, depending on how variable the input is. But Stuart, it might be better to avoid the word "record" if what you actually meant was a structured line of text.) -- Iain Alexander PGP 1024-bit key id B501A0AD ia@stryx.demon.co.uk I.Alexander@bsn0106.wins.icl.co.uk From icon-group-sender Tue Apr 15 16:48:02 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 16 Apr 1997 08:26:36 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02061; Wed, 16 Apr 1997 08:26:36 -0700 Date: Tue, 15 Apr 1997 16:48:02 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: Records in Icon To: icon-group@cs.arizona.edu Message-Id: In-Reply-To: <19674@stryx.demon.co.uk> Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1103 Iain Alexander wrote: > In message <334E5509.2A4@gemini.edu> Steve Wampler writes: > > > > Do you care why the two records 'match'? That is, do you need to > > distinguish between your two example cases, or is it sufficient to > > simply say "the records 'match'"? > > > > Here's a procedure that handles the latter case: > > > > procedure weakMatch(r1,r2) > > return !r1 ~=== !r2 > > end > > Eh? What's that "~" doing there? > (BTW, it wasn't clear to me whether the word "record" in the original > was intended to refer to the Icon structure of that name. Your code > (modulo suspected typo) obviously works just as well with a list, > which might be a more appropriate data structure, depending on how > variable the input is. But Stuart, it might be better to avoid the > word "record" if what you actually meant was a structured line of text.) Mea culpa - Ian is right - that is a typo. Thanks for catching that! -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Wed Apr 16 00:13:55 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 16 Apr 1997 16:57:00 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02428; Wed, 16 Apr 1997 16:57:00 -0700 Date: Wed, 16 Apr 1997 00:13:55 GMT From: ia@stryx.demon.co.uk (Iain Alexander) Reply-To: ia@stryx.demon.co.uk Message-Id: <19729@stryx.demon.co.uk> To: icon-group@cs.arizona.edu Subject: Re: Records in Icon X-Mailer: PCElm 1.10 Lines: 27 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 815 A further thought: In message <334E5509.2A4@gemini.edu> Steve Wampler writes: > Do you care why the two records 'match'? That is, do you need to > distinguish between your two example cases, or is it sufficient to > simply say "the records 'match'"? > > Here's a procedure that handles the latter case: > > procedure weakMatch(r1,r2) > return !r1 ~=== !r2 > end If you want a bit more information about which items matched, I think you can do something like procedure indexMatch(l1, l2) if l1[i:= 1 to *l1] === l2[j:= 1 to *l2] then return [i, j] end (and if you wanted to allow for multiple matches, you could change it to suspend l1[i:= 1 to *l1] === l2[j:= 1 to *l2] & [i, j] ) -- Iain Alexander PGP 1024-bit key id B501A0AD ia@stryx.demon.co.uk I.Alexander@bsn0106.wins.icl.co.uk From icon-group-sender Sat Apr 19 08:08:45 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 21 Apr 1997 09:27:46 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA04801; Mon, 21 Apr 1997 09:27:45 -0700 Message-Id: <3358C3DD.23EE@airmail.net> Date: Sat, 19 Apr 1997 08:08:45 -0500 From: Nathanael Graham X-Mailer: Mozilla 2.01 (Win95; U) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Subject: Comments on Icon Routine Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2775 To fellow Iconers: This week at work I wanted to take documents created by MS-Word or WordPerfect and break down the 80+ character lines into lines of no more than 80 characters and I figured that this would be a perfect use for Icon. The routine did not take too long to code and, at the suggestion of a fellow worker, I generalized it to allow for lines of any specified length. Assuming the Icon routine is called truncate.icn/truncate.exe, one would type the following on the command line: truncate infile.txt outfile.txt 80 This would: . Read in each record from infile.txt . After deleting leading spaces, it would write the record to outfile.txt, if the record length was 80 or less . If the record length was greater than 80, then it would "break up" the record on spaces, scanning for them from position 81 and going backwards. Once it found the space, it would write from the beginning of the record to the space and repeat the same algorithm starting with what was left of the record after the space. If no space was found in any record or piece thereof of length 80 or more, then the first 80 characters would be written, and the rest of the record would be handled per above. I've been writing Icon utilities for a number of years off and on, but still consider myself somewhat of a beginner. I am posting this routine to the Icon list in the hopes that more experienced practicioners of the language will point out ways in which I can more fully utilize the unique strengths of Icon. Thanks for your help in advance. Steve Graham ======================================================================== procedure main(files) in := open(files[1],"r") | stop("Problem opening " || files[1]) out := open(files[2],"w") | stop("Problem opening " || files[2]) rmargin := files[3] while line := read(in) do { if *(line := ltrim(line)) < (rmargin + 1) then write(out,line) else { while *(line := ltrim(line)) > rmargin do { if line[rmargin+1] == " " then { write(out,line[1:rmargin + 1]) line[1:rmargin + 1] := "" } else { i := upto(" ",reverse(line[1:rmargin + 1])) | 0 write(out,line[1:(rmargin + 1)-i]) line[1:(rmargin + 1)-i] := "" } } if *line > 0 then write(out,line) } } close(out) close(in) end procedure ltrim(txt) while any(' ',txt) do txt[1] := "" return txt end From icon-group-sender Mon Apr 21 10:25:00 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 21 Apr 1997 13:23:14 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA05093; Mon, 21 Apr 1997 13:23:14 -0700 Date: Mon, 21 Apr 1997 10:25:00 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: Comments on Icon Routine To: icon-group@cs.arizona.edu Message-Id: In-Reply-To: <3358C3DD.23EE@airmail.net> Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2322 Nathanael Graham wrote: > To fellow Iconers: > > This week at work I wanted to take documents created by MS-Word or > WordPerfect and break down the 80+ character lines into lines of no more > than 80 characters and I figured that this would be a perfect use for > Icon. The routine did not take too long to code and, at the suggestion > of a fellow worker, I generalized it to allow for lines of any specified > length. Assuming the Icon routine is called truncate.icn/truncate.exe, > one would type the following on the command line: > > truncate infile.txt outfile.txt 80 > > This would: > > . Read in each record from infile.txt > . After deleting leading spaces, it would write the record to > outfile.txt, if the record length was 80 or less > . If the record length was greater than 80, then it would "break up" > the record on spaces, scanning for them from position 81 and going > backwards. Once it found the space, it would write from the > beginning of the record to the space and repeat the same > algorithm starting with what was left of the record after the > space. If no space was found in any record or piece thereof of > length 80 or more, then the first 80 characters would be written, > and the rest of the record would be handled per above. > I suspect you're going to see a lot of different ways to do this! Here's one off the top of my head - I'm sure there are better ways. procedure main(args) in := open(args[1], "r") | stop("Cannot open ", args[1]) out := open(args[2], "w") | stop("Cannot open ", args[2]) rmargin := args[3] | 80 while produce(out, read(in), rmargin) end procedure produce(f, s, rm) s := ltrim(s) if *s <= rm then write(f, s) else { reverse(s[1+:rm]) ? { suffix := reverse(tab(upto(' \t'))) | "" write(f, reverse(tab(0))) produce(f, suffix||s[rm+1:0], rm) } } return end procedure ltrim(s) return s ?:= (tab(many(' ')), tab(0)) end -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Mon Apr 21 10:51:56 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 21 Apr 1997 13:23:26 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA05136; Mon, 21 Apr 1997 13:23:26 -0700 Date: Mon, 21 Apr 1997 10:51:56 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: Comments on Icon Routine (redux) To: icon-group@cs.arizona.edu Message-Id: In-Reply-To: <3358C3DD.23EE@airmail.net> Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1273 In thinking about Steve Graham's problem a bit more, it occurred to me that some of the tests in the solution can be eliminated. Here's a second solution that is a revised version of the earlier one (note that the procedure ltrim has been improved slightly): procedure main(args) in := open(args[1], "r") | stop("Cannot open ", args[1]) out := open(args[2], "w") | stop("Cannot open ", args[2]) rmargin := args[3] | 80 while produce(out, read(in), rmargin) end procedure produce(f, s, rm) ltrim(s) ? { if reverse(move(rm)) ? { # line is too long... suffix := reverse(tab(upto(' \t'))) | "" # ... split it apart write(f, reverse(tab(0))) # ... print first part } then # ... produce the rest of it produce(f, suffix||tab(0), rm) else # line is ok, print it write(f, tab(0)) } return end procedure ltrim(s) # return trimmed line return s ? (tab(many(' ')), tab(0)) | tab(0) end -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Sat Apr 26 20:12:24 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 28 Apr 1997 13:01:54 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08760; Mon, 28 Apr 1997 13:01:54 -0700 To: icon-group@cs.arizona.edu Date: 26 Apr 1997 20:12:24 GMT From: jsampson@indexes.u-net.com (J R Sampson) Message-Id: <5jtnj8$i1$1@despair.u-net.com> Organization: U-NET Ltd Sender: icon-group-request@cs.arizona.edu Subject: Fuzzy matching program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 133 I am trying to understand how the program fuzz.icn by Alex Cecil works. What is the purpose of the variable 'bias'? _John Sampson_ From icon-group-sender Fri May 2 10:07:12 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 6 May 1997 12:24:33 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA00675; Tue, 6 May 1997 12:24:32 -0700 To: icon-group@cs.arizona.edu Date: 2 May 1997 10:07:12 -0700 From: icon-project@cs.arizona.edu Message-Id: Organization: University of Arizona CS Department, Tucson AZ Sender: icon-group-request@cs.arizona.edu Reply-To: icon-project@cs.arizona.edu Subject: Icon Programming Language FAQ Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 14761 Archive-name: comp-lang-icon-faq Posting-Frequency: monthly Frequently Asked Questions About The Icon Programming Language Last updated: December 11, 1996 This FAQ answers various questions about the Icon programming language, ranging from what it is to how you can get it. The master copy of this FAQ is the Web page http://www.cs.arizona.edu/icon/faq.html. Other on-line documentation is available via the main Icon page at http://www.cs.arizona.edu/icon/. This FAQ is written by Ralph Griswold and Gregg Townsend, with help from Cliff Hathaway, Clint Jeffery, and Bob Alexander. * 1. What is Icon? * 2. What is Icon good for? * 3. Where did Icon come from? * 4. What does "Icon" stand for? * 5. On what computers does Icon run? * 6. Who did all these implementations? * 7. Are there other implementations in the works? * 8. What about different versions of Icon? * 9. Which implementations of Icon have graphics/window capabilities? * 10. Where can I get Icon? * 11. Where can I get documentation about Icon? * 12. How do I get started with Icon? * 13. What is the Icon Project? * 14. Where can I find examples of Icon programs? * 15. What is Idol? * 16. How often is material in Icon's FTP area updated? * 17. How do I stay up to date with what's going on with Icon? * 18. Is there a users' group for Icon? * 19. How do I get technical support? * 20. What do I need to run Icon? * 21. Can I build my own implementation of Icon for a new platform? ---------------------------------------------------------------------------- 1. What is Icon? Icon is a very high level general-purpose programming language with extensive features for processing strings (text) and data structures. Icon is an imperative, procedural language with a syntax that is reminiscent of C and Pascal, but its semantics are at a much higher level than those languages. Icon has a novel expression-evaluation mechanism that integrates goal-directed evaluation and backtracking with conventional control structures. It has a string scanning facility for pattern matching that avoids the tedious details usually associated with analyzing strings. Icon's built-in data structures include sets and tables with associative lookup, lists that can be used as vectors or stacks and queues, and records. Icon is a strongly, though not statically, typed language. It provides transparent automatic type conversion. For example, if an integer is used in an operation that requires a string, the integer is automatically converted to a string. Several implementations of Icon have high-level graphics facilities with an easily programmed window interface. Icon manages storage automatically. Objects are created as needed during program execution and space is reclaimed by garbage collection as needed. The sizes of strings and data structures are limited only by the amount of available memory. 2. What is Icon good for? As a general-purpose programming language with a large computational repertoire, Icon can be used for most programming tasks. It's at its best when used build software tools, for processing text, and when ease of programming is needed for experimental and research applications. Paradoxically, Icon is used most often for short, one-shot tasks and for very complex applications. Icon is designed to make programming easy; it emphasizes the value of programmer's time and the importance of getting programs to work quickly. This explains its usefulness for prototyping as well as the apparent paradox of applicability to simple and complex applications. 3. Where did Icon come from? Icon is the latest in a series of high-level programming languages designed to facilitate programming tasks involving strings and structures. The original language, SNOBOL, was developed at Bell Telephone Laboratories in the early 60s. SNOBOL evolved into SNOBOL4, which is still in use. Subsequent languages were developed at The University of Arizona with support from the National Science Foundation. Incidentally, Icon bears little physical resemblance to SNOBOL4, although it has similar objectives and many similar capabilities. 4. What does "Icon" stand for? The name Icon (which is not spelled ICON) is not an acronym nor does it stand for anything in particular, although the word "iconoclastic" was mentioned at the time the name was chosen. The name predates the now common use of "icon" to refer to small images used in graphical user interfaces. This latter usage sometimes causes persons to think mistakenly that Icon is designed to create or manipulate icons. There's not much that can be done about this. 5. On what computers does Icon run? The implementation of Icon is highly portable. Version 9 runs on UNIX, MS-DOS, Windows, NT, Macintosh/MPW, VAX/VMS, the Amiga, and the Acorn Archimedes. There are older versions for the Atari ST, IBM CMS and MVS, the Macintosh, and OS/2. Icon programs also are highly portable. Most Icon programs can run on any platform that supports Icon. 6. Who did all these implementations? The original implementation of Icon for UNIX was done at The University of Arizona. Most of the other implementations originally were done by volunteers scattered around the world. It's worth noting that all implementations of Icon are based on the same source code, which is written in C. This contributes to the portability of Icon itself, as well as to the portability of programs written in Icon. 7. Are there other implementations in the works? Work is constantly underway on implementations of Icon for new platforms. Microsoft Windows and Windows NT implementations are in beta testing. 8. What about different versions of Icon? Icon has evolved through a series of versions with improved and extended capabilities. The latest major version number is 9. This version includes recent changes and additions, notably in the graphics area, and runs on UNIX, MS-DOS, Macintosh/MPW, VAX/VMS, the Amiga, and Acorn Archimedes. Other implementations presently are at Version 8. Almost all programs that run under Version 8 and that do not use graphics will run under Version 9. 9. Which implementations of Icon have graphics/window capabilities? Icon's graphics facilities presently are supported on UNIX and VAX/VMS. Windows NT and Microsoft Windows implementations that support Icon's graphics facilities are in beta testing. 10. Where can I get Icon? Icon is available via anonymous FTP and on the Web. For FTP, use ftp.cs.arizona.edu and cd /icon. For the Web, use http://www.cs.arizona.edu/icon/ and check out the links there. For FTP, the directory /icon/binaries contains executable versions of Icon for several systems, including several popular UNIX platforms. The directory /icon/packages contains source code, test programs, related material, and, most cases, executable binaries as well. All directories have README files with additional information. 11. Where can I get documentation about Icon? The definitive work on Icon is the book The Icon Programming Language, Griswold and Griswold, third edition, Peer-to-Peer Communications, Inc, 1996, 386 pages, ISBN 1-57398-001-3. This book is a complete description and reference manual for Version 9 of Icon. A technical report describes changes since that version. There also is a book on the implementation of Icon: The Implementation of the Icon Programming Language, Griswold and Griswold, Princeton University Press, 1986, 336 pages, ISBN 0-691-08431-9. This book describes the implementation as of Version 6 of Icon. Although the implementation has changed considerably since then, the basic structure is the same. Technical reports describing recent implementation changes are included with copies of the book purchased from the Icon Project. These books are available from the Icon Project. Additional documentation is available via FTP in /icon/doc. Notable documents are: * IPD266: An Overview of Icon (text, PostScript, PDF) * IPD281: Graphics/window facilities (PostScript, PDF) * IPD278: Version 9.3 of Icon (text, PostScript, PDF) There are manual pages for UNIX systems, and more documentation under the Icon web page, but there is no complete on-line documentation. The Icon Newsletter, which includes topical material about Icon and a list of material available from the Icon Project, is published three times a year and is available on the Web. There is a subscription fee for an on-going subscription by postal mail. The Icon Analyst, a technically-oriented newsletter that features articles about programming, is published six times a year. There is a subscription fee for the Analyst. A sample copy is available on the Web. All back issues of both newsletters are available for purchase. 12. How do I get started with Icon? If you're running under UNIX, check first in the /icon/binaries/unix FTP directory to see if there is a "starter kit" for your platform. Starter kits include executables, documentation, and other material. Otherwise, go to the /icon/packages directory and get the appropriate package. Packages include documentation and other material; see the README file in that directory for more details. There is a UNIX package for platforms that lack starter kits. If the non-UNIX package you pick up does not contain executable files, check /icon/binaries. You also may want to get the overview of Icon: /icon/doc/ipd266.txt or ipd266.ps.Z. You'll find pointers to other documents of interest in the package you pick up. 13. What is the Icon Project? The Icon Project is a name used by the group that develops, implements, distributes, and supports the Icon programming language. The Icon Project is not commercial organization. It derives support from The University of Arizona, revenue from the sale of program material and documentation, and user contributions. 14. Where can I find examples of Icon programs? There is a large program library for Icon. It is an excellent resource for both new and experienced programmers. The library contains numerous examples of how to do things with Icon. The library also provides many useful applications, as well as hundreds of procedures that supplement Icon's built-in repertoire. The library, like other Icon material, is available via FTP in /icon/library. 15. What is Idol? Idol is an object-oriented extension to Icon that provides concepts such as classes and multiple inheritance. Idol is written in Idol and is distributed as part of the Icon program library. Idol runs on almost all of the platforms that support Icon. Additional Idol information is available from Clint Jeffery, jeffery@ringer.cs.utsa.edu. 16. How often is material in Icon's FTP area updated? New material is added when it's available. Established implementations usually are updated only when there's a new version. This typically is every year or two. The Icon program library is updated on a similar schedule. 17. How do I stay up to date with what's going on with Icon? The best way to find out about developments related to Icon is to read the Icon Newsletter. You can stay up to date on the source code, which is changed much more frequently than the version on FTP is updated, by subscribing to the source update service, which provides a new version about twice a year. There also is a subscription service for updates to the Icon program library, which provides new material about twice a year. There is on-line information about subscribing to these services. 18. Is there a users' group for Icon? There is no official Icon users' group. The Icon Project maintains an electronic mailing list, icon-group@cs.arizona.edu. Mail sent to this address is forwarded to subscribers. To subscribe (or unsubscribe), send a message to icon-group-request@cs.arizona.edu. There is a gateway between icon-group and comp.lang.icon, an unmoderated newsgroup for discussing issues related to Icon. The gateway, which exchanges messages between the two systems, is imperfect and not under the control of the Icon Project. The newsgroup generally provides faster response than the mailing list, is less intrusive, but sometimes suffers from inappropriate postings. The Icon Project usually sends messages of interest to the Icon community to icon-group. 19. How do I get technical support? The Icon Project is not a commercial organization, and its capacity for providing technical support is limited. Please use the appropriate resource when you need assistance: Ordering Icon Material mail: Icon Project Department of Computer Science The University of Arizona P.O. Box 210077 Tucson, Arizona 85721-0077 U.S.A. fax: (520) 621-4246 voice: (520) 621-6613 e-mail: icon-orders@cs.arizona.edu Getting On-Line Information and Material web: http://www.cs.arizona.edu/icon/ ftp: ftp.cs.arizona.edu (cd /icon) e-mail: ftpmail@cs.arizona.edu Send a message consisting of the word help. Assistance with Installing Icon e-mail: icon-project@cs.arizona.edu Bug Reports e-mail: icon-project@cs.arizona.edu fax: (520) 621-4246 Assistance with Programming Problems e-mail: icon-group@cs.arizona.edu news: comp.lang.icon Uploading Files ftp: ftp.cs.arizona.edu (cd /incoming) After uploading, send e-mail to icon-project@cs.arizona.edu. 20. What do I need to run Icon? Icon will run on most computers. Under MS-DOS, the Icon interpreter needs at least 500 KB of application RAM to work well. 21. Can I build my own implementation of Icon for a new platform? As mentioned above, Icon is written in C and the source code is available. The existing implementations are testament to its portability. (A small amount of assembly-language code is required for a context switch, but this is only needed for an optional feature -- co-expressions -- that can be disabled without affecting other features of Icon.) New ports involve platform-specific configuration parameters and, in some cases, platform-specific code. The feasibility of a new port and the amount of work it may take depends on the platform -- its architecture, its C compiler, and its environment. Ports to new UNIX platforms generally are easy, although novel architectures may present problems. Ports to new operating systems generally are more difficult, especially if Icon's graphics facilities are implemented. The Icon Project provides what help it can with new ports. In return, it asks that code related to the port to be returned to the Icon Project for inclusion in future versions of the source code for Icon. This makes the new port available to others as well as to the porter when Icon is updated. From icon-group-sender Sat May 10 14:23:36 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 12 May 1997 08:23:14 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02954; Mon, 12 May 1997 08:23:13 -0700 To: icon-group@cs.arizona.edu Date: Sat, 10 May 1997 14:23:36 +1200 From: craigw@ihug.co.nz (Craig Whitmore) Message-Id: Organization: The Internet Group Sender: icon-group-request@cs.arizona.edu Subject: ProIcon Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 107 Does anyone know whether ProIcon for the Mac is still being marketed, if so, by whom & where. Rod Harries From icon-group-sender Sat May 10 20:35:43 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 12 May 1997 08:24:04 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA02983; Mon, 12 May 1997 08:24:04 -0700 To: icon-group@cs.arizona.edu Date: Sat, 10 May 1997 20:35:43 +1000 From: Stuart.Robinson@anu.edu.au (Stuart Robinson) Message-Id: Organization: ANU Sender: icon-group-request@cs.arizona.edu Subject: Problem with Program Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1528 Could someone tell me why the program below isn't working? It's late and I must be overlooking something. Given input like the following This is a sample line 1{S {S This is a sample line 2{A {A This is a sample line 3{O {O it should be produce the following output S: 2 A: 2 O: 2 Thanks in advance. ---------------- procedure main() chars := &letters ++ &digits ++ '{.*[]?' #valid characters noS := 0 noA := 0 noO := 0 while line := read() do #read in line { line ? #textscan line { while tab(upto(chars)) do #look for valid character { word := tab(many(chars)) #word = valid character through next invalid character word ? #textscan word { while tab(upto("{") +1) do #move just past bracket (will fail if there is none) { wordfrag := move(1) #wordfrag = one character past bracket case wordfrag of #if wordfrag is { "S" : noS +:= 1 #S, then increment noS by 1 "A" : noA +:= 1 #A, then increment noA by 1 "O" : noO +:= 1 #O, then increment noO by 1 } } } } } } write( "S: " || noS || \n || "A: " || noA || \n || "O: " || noO ) end -- Stuart Robinson The Australian National University From icon-group-sender Sun May 18 12:31:04 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 19 May 1997 09:55:21 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA07392; Mon, 19 May 1997 09:55:21 -0700 Date: Sun, 18 May 1997 12:31:04 -0400 Message-Id: <199705181631.MAA19857@axp.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Problem with Program To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2453 >Could someone tell me why the program below isn't working? It's late and I must be overlooking something. Given input like the following >This is a sample line 1{S {S This is a sample line 2{A {A This is a sample line 3{O {O >it should be produce the following output S: 2 A: 2 O: 2 >Thanks in advance. ---------------- >procedure main() chars := &letters ++ &digits ++ '{.*[]?' #valid characters noS := 0 noA := 0 noO := 0 while line := read() do #read in line { line ? #textscan line { while tab(upto(chars)) do #look for valid character { word := tab(many(chars)) #word = valid character through next invalid character word ? #textscan word { while tab(upto("{") +1) do #move just past bracket (will fail if there is none) { wordfrag := move(1) #wordfrag = one character past bracket case wordfrag of #if wordfrag is { "S" : noS +:= 1 #S, then increment noS by 1 "A" : noA +:= 1 #A, then increment noA by 1 "O" : noO +:= 1 #O, then increment noO by 1 } } } } } } write( "S: " || noS || \n || "A: " || noA || \n || "O: " || noO ) end To start with, you're writing this in what seems like a terribly convoluted way, and not letting yourself take advantage of the kinds of things that set Icon/S*BOL apart from other languages (notably, tables). Secondly, I'd look for the "{" character followed by something, and then use that something to increment a counter in a table. This prevents you having to hardwire in just three key letters. For instance, if I were going to write the same program in S*BOL, it might look like: t = table() pat = fence breakx("{") "{" notany(" ") . key readrec line = input :f(donerd) countlp line pat = :f(readrec) t[key] = t[key] + 1 :(countlp) donerd a = convert(t,"ARRAY") :f(end) outlp output = a[(i = i + 1), 1] " " a[i,2] :s(outlp) end Gordon Peterson http://www.computek.net/public/gep2/ Support the Anti-SPAM Amendment! Join at http://www.cauce.org/ From icon-group-sender Fri Jun 6 09:56:47 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Fri, 6 Jun 1997 14:37:02 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA06364; Fri, 6 Jun 1997 14:37:02 -0700 Message-Id: <3398333F.6E1D@simpson.edu> Date: Fri, 06 Jun 1997 09:56:47 -0600 From: dfgfshhghfhg Reply-To: newell@simpson.edu Organization: simpson college X-Mailer: Mozilla 2.02 (Macintosh; I; 68K) Mime-Version: 1.0 To: icon-group@cs.arizona.edu Subject: Hello folks - question about win95 impl. and drawop X-Url: http://cs.arizona.edu/icon/faq.html#How do I get technical support Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 2121 Hello folks, Nice to talk to you all again (even if it is via email) after quite awhile.... I have a question/problem. I use Icon in a few of my courses here at Simpson (AI,Prog Langs and Graphics). I decided to try to use the Win95 implementation in my adult learning Graphics course (i.e. continuing ed.) this semester in order to allow the students, many of whom work full-time, to be able to code at home. In the past, I have used the UNIX version. My problem is this - during class I noticed that a program I had written some time ago that more or less implemented a drawing program (on the order of the old MacDraw) did not operate correctly. I had not tested the program before class on Win95 (an obvious mistake) and spent some time spinning my wheels trying to figure out the problem. As you might have guessed the problem was with the attribute drawop. The students were trying to implement standard rubber-banding techniques which require lines to be put down in exclusive-or mode (reverse) until the final drawing when they are drawn in copy mode (Or mode). I eventually noticed the mention in the win95 report that drawop does not work in "some" example programs and that it "does not work the same as in other implementations". Is there a way around this or a fix available? I can't see anyway to work with interactive graphics without the ability to change drawing modes at will. Any sort of CAD program would seem to be out of the question wihtout some very messy work-arounds. I'm trying to figure out if I need to switch them all over to the Unix box or if I can perhaps manage to keep them in the environment most of them are most comfortable around. I'm curious too, about the nature of the problem as it resulted in some bizarre behavior in some programs. I appreciate any help or insight you might be able to put on this - thanks, Gary Newell p.s. I would have sent this to Clint but I've been bugging him quite a bit lately with stupid Icon questions and I thought I should spread the wealth of stupid questions I have around :-) From icon-group-sender Mon Jun 9 09:11:52 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 9 Jun 1997 09:11:52 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA06998; Mon, 9 Jun 1997 09:11:51 -0700 Message-Id: <199706070652.HAA08649@holyrood.ed.ac.uk> Date: 07 Jun 97 07:52:01 BST From: Roger Hare Subject: Windows CE To: icon-group@cs.arizona.edu Reply-To: rjhare@ed.ac.uk Organisation: Edinburgh University Computing Services Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 313 I asked this question about a week ago, but I never saw it appear, so, on the basis that it somehow disappeared down a black hole, I will ask again: Has anyone tried running Icon on any of the new generation of palmtops running Windows CE. Is this a meaningful question in the first case? Thanks. Roger Hare. From icon-group-sender Tue Jun 10 22:30:39 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 10 Jun 1997 09:12:46 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08156; Tue, 10 Jun 1997 09:12:46 -0700 To: icon-group@cs.arizona.edu Date: Tue, 10 Jun 1997 22:30:39 +1000 From: Stuart.Robinson@anu.edu.au (Stuart Robinson) Message-Id: Organization: ANU Sender: icon-group-request@cs.arizona.edu Subject: searching with variables Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 784 A quick question. If you wanted to use the function find() to search for a particular strings of characters, how would it be possible to define character variables? For example, suppose you want to search for the following sequences al el il ol ul which are really just Vl (where V stands for a vowel). Could you simply define a character set for vowels (V := 'aeiou') and then refer to that character set in the find() function? If so, what would it look like? I tried something like the following and it didn't work. find( V || "l") I realise it's a pretty trivial task but I don't have the manual at the moment and I'd like an answer within the next couple of days. Thanks in advance. -- Stuart Robinson The Australian National University From icon-group-sender Tue Jun 10 14:00:39 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 10 Jun 1997 12:28:00 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08374; Tue, 10 Jun 1997 12:28:00 -0700 Sender: rpereda@micro.ti.com Message-Id: <339DA457.592990BB@micro.ti.com> Date: Tue, 10 Jun 1997 14:00:39 -0500 From: Ray Pereda Organization: Texas Instruments X-Mailer: Mozilla 3.0Gold (X11; I; SunOS 4.1.4 sun4m) Mime-Version: 1.0 To: Stuart Robinson Cc: icon-group@cs.arizona.edu Subject: Re: searching with variables References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1206 Stuart Robinson wrote: Consider something like this: sparrow:[icon] ==> more vl.icn procedure main() line := "abc al el abc il ol abc ul" V := 'aeiou' line ? { while (tab(upto(V)) & a := move(1) & b := ="l" ) do { write("matched = ", a, b) } } end sparrow:[icon] ==> vl matched = al matched = el matched = il matched = ol matched = ul -ray > > A quick question. If you wanted to use the function find() to search for > a particular strings of characters, how would it be possible to define > character variables? For example, suppose you want to search for the > following sequences > > al > el > il > ol > ul > > which are really just Vl (where V stands for a vowel). Could you simply > define a character set for vowels (V := 'aeiou') and then refer to that > character set in the find() function? If so, what would it look like? I > tried something like the following and it didn't work. > > find( V || "l") > > I realise it's a pretty trivial task but I don't have the manual at the > moment and I'd like an answer within the next couple of days. Thanks in > advance. > > -- > Stuart Robinson > The Australian National University From icon-group-sender Tue Jun 10 09:34:24 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 10 Jun 1997 12:27:50 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08354; Tue, 10 Jun 1997 12:27:50 -0700 Date: Tue, 10 Jun 1997 09:34:24 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: searching with variables To: icon-group@cs.arizona.edu Message-Id: Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1654 - Forwarded message from Stuart.Robinson@anu.edu.au on Tue, 10 Jun 1997 22:30:39 +1000 - > > A quick question. If you wanted to use the function find() to search for > a particular strings of characters, how would it be possible to define > character variables? For example, suppose you want to search for the > following sequences > > al > el > il > ol > ul > > which are really just Vl (where V stands for a vowel). Could you simply > define a character set for vowels (V := 'aeiou') and then refer to that > character set in the find() function? If so, what would it look like? I > tried something like the following and it didn't work. > > find( V || "l") > > I realise it's a pretty trivial task but I don't have the manual at the > moment and I'd like an answer within the next couple of days. Thanks in > advance. You can try: find( !V || "l" ) which will work, *but*, the order of the two generators (find and !) means that you will look throughout the subject for the first string ("al") before backtracking and looking throughout the subject for the second string ("el"), etc. This means you find "al" anywhere in the subject before finding "el" anywhere in the subject. All occurrences will be found, just not necessarily in the order you might have expected. It's an interesting exercise to come up with a clean approach that locates any of "al","el","il","ol","ul" in the order they appear in the subject. Perhaps others can suggest solutions to this? -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Wed Jun 11 11:19:55 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 10:42:00 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08863; Wed, 11 Jun 1997 10:42:00 -0700 Message-Id: <339E7BCB.1B3F@charlie.cns.iit.edu> Date: Wed, 11 Jun 1997 11:19:55 +0100 From: "Thomas W. Christopher" Reply-To: tc@charlie.cns.iit.edu Organization: Illinois Institute of Technology X-Mailer: Mozilla 3.01Gold (WinNT; I) Mime-Version: 1.0 To: newell@simpson.edu Cc: icon-group@cs.arizona.edu Subject: Re: Hello folks - question about win95 impl. and drawop References: <3398333F.6E1D@simpson.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 197 Gary, I should have pointed you straight to the programs: http://www.iit.edu/~tc/toolsfor.htm -- -Thomas W. Christopher http://www.iit.edu/~tc tc@charlie.cns.iit.edu From icon-group-sender Wed Jun 11 00:09:36 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 10:41:18 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA07916; Wed, 11 Jun 1997 10:41:17 -0700 To: icon-group@cs.arizona.edu Date: 11 Jun 1997 00:09:36 GMT From: bbadger@jade.ssd.hcsc.com (Bernard Badger) Message-Id: Organization: Concurrent Computer Corp, Ft. Lauderdale, FL Sender: icon-group-request@cs.arizona.edu References: Reply-To: bbadger@mail.ccur.com Subject: Re: searching with variables Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1517 In article Stuart.Robinson@anu.edu.au (Stuart Robinson) writes: > A quick question. If you wanted to use the function find() to search for > a particular strings of characters, how would it be possible to define > character variables? For example, suppose you want to search for the > following sequences > > al > el > il > ol > ul > > which are really just Vl (where V stands for a vowel). Could you simply > define a character set for vowels (V := 'aeiou') and then refer to that > character set in the find() function? If so, what would it look like? I > tried something like the following and it didn't work. > > find( V || "l") > > I realise it's a pretty trivial task but I don't have the manual at the > moment and I'd like an answer within the next couple of days. Thanks in > advance. > > -- > Stuart Robinson > The Australian National University Well you don't (want to use find()). Function find() only matches substrings. Try this (based on "The Icon Programming Language" (1983), p 177): procedure Vl(line) static vowel local line, i initial vowel := 'aeiou' i := 1 while i := upto(vowel,line,i) do { suspend line[i+:2] i += 2 } end procedure testVl() local line while line := read() do { every write(Vl(line)) } end Sorry, it's untested and I can't easily test it myself. -- Bernard A. Badger bbadger@mail.ccur.com 11. Thou shalt not Spam! From icon-group-sender Wed Jun 11 16:17:05 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 10:42:20 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08879; Wed, 11 Jun 1997 10:42:19 -0700 To: icon-group@cs.arizona.edu Date: 11 Jun 1997 16:17:05 GMT From: espie@felouque.ens.fr (Marc Espie) Message-Id: <5nmj21$qj8$1@nef.ens.fr> Organization: Ecole Normale Superieure, Paris Sender: icon-group-request@cs.arizona.edu References: Subject: Re: searching with variables Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1368 In article , Stuart Robinson wrote: [searching for Vl, V being a vowel] >which are really just Vl (where V stands for a vowel). Could you simply >define a character set for vowels (V := 'aeiou') and then refer to that >character set in the find() function? If so, what would it look like? I >tried something like the following and it didn't work. >find( V || "l") You just forgot ONE character: find( !V || "l") Note that this won't be overtly fast, though, especially since find algorithm is rather dull. Or you can use: upto(V) = upto('l') - 1 (which is another waste.) or (better): upto('l', &subject, i <- upto(V), i+1) - 1 or even: tab(upto('l')) & move(-1) & any(V)-1 which moves the matching position, though. This kind of pattern matching is difficult to optimize, anyhow. It all depends too much on the frequency of the characters in presence... In general, icon pattern matching is not too great at stupid regular expression emulation. They're much better at building intricate mechanisms that wouldn't work with regular expression. -- [nosave] microsoft network is EXPLICITLY forbidden to redistribute this message. `Seiza no matataki kazoe, uranau koi no yuku e.' Marc Espie (Marc.Espie@ens.fr) From icon-group-sender Wed Jun 11 11:16:51 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Wed, 11 Jun 1997 12:25:58 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA08982; Wed, 11 Jun 1997 12:25:57 -0700 Date: Wed, 11 Jun 1997 11:16:51 -0700 From: swampler@noao.edu (Steve Wampler) Subject: Re: searching with variables To: icon-group@cs.arizona.edu Message-Id: Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1132 - Forwarded message from espie@felouque.ens.fr on 11 Jun 1997 16:17:05 GMT - > > In general, icon pattern matching is not too great at stupid regular > expression emulation. They're much better at building intricate mechanisms > that wouldn't work with regular expression. Well, it certainly isn't as concise as RE's, but the following matching procedure isn't too horrible, I think: procedure Vl(l) static V initial V := 'aeiou' suspend ( tab(upto(V)), move(1)||tab(any(l)) ) end And, if you wanted to parameterize it a bit more: # match pairs of a letter in a followed by a letter in b procedure pair(a,b) suspend ( tab(upto(a)), move(1)||tab(any(b)) ) end Both upto() and any() are efficient functions when given csets... Here's a test driver for the second version: procedure main() every line := !&input do { line ? every write( pair('aeiou', 'l') ) } end -- Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)] O Sibile, si ergo, fortibus es inero. Nobile, demis trux. Demis phulla causan dux. From icon-group-sender Thu Jun 12 02:23:25 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 16 Jun 1997 08:42:32 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA10666; Mon, 16 Jun 1997 08:42:32 -0700 Date: Thu, 12 Jun 1997 02:23:25 -0300 From: Eduardo Ochs Message-Id: <199706120523.CAA07658@ns1.inx.com.br> To: icon-group@cs.arizona.edu Subject: anonymous FTP restricted? Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 832 Hi, After years of happy Icon hacking I finally tried to access ftp.cs.arizona.edu from home, through my ISP, instead of from my university, and all I could get was something like this: 530-Our FTP server will only grant access to those machines 530-whose IP address can be mapped to a hostname. 530-Unfortunately, we're unable to map your IP address 200.240.18.28 to a 530-hostname in the DNS (Domain Name Service). This is probably ... What should I do? Tell my friends that Icon isn't a dying language, it's just depressed and doesn't want to see anybody except the doctor and some old friends? Or start describing Icon as a "well-kept secret"? OK, I could start using ftpmail, but it's very inconvenient... Thanks in advance (sorry for the silly jokes!) Eduardo Ochs edrx@inx.com.br edrx@saci.mat.puc-rio.br From icon-group-sender Sat Jun 14 18:51:24 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 16 Jun 1997 08:43:33 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA10788; Mon, 16 Jun 1997 08:43:32 -0700 To: icon-group@cs.arizona.edu Date: 14 Jun 1997 18:51:24 GMT From: guy@orion.math.tau.ac.il (Guy Laden) Message-Id: <5nup7c$6lp$1@beet.tau.ac.il> Organization: School of Mathematical Sciences, Tel Aviv University, Israel. Sender: icon-group-request@cs.arizona.edu Subject: Writing daemons in Icon - signal handling Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 436 Can anybody offer any advice or examples of _robust_ daemons which listen to network sockets, written in Icon. How should signals be handled? Whats the 'right' way of handling timeouts of network connections? Does one just write wrappers for the corresponding C functions? I need to implement a small but reliable client-server system and am hoping others can verify its been done before and that Icon is up to the job. Thanks, Guy From icon-group-sender Thu Jun 12 17:53:32 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Mon, 16 Jun 1997 08:43:02 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA10747; Mon, 16 Jun 1997 08:43:02 -0700 Date: Thu, 12 Jun 1997 17:53:32 -0400 Message-Id: <199706122153.RAA05260@axp.cmpu.net> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit From: gep2@computek.net Subject: Re: searching with variables To: icon-group@cs.arizona.edu X-Mailer: SPRY Mail Version: 04.00.06.17 Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 1644 >> A quick question. If you wanted to use the function find() to search for > a particular strings of characters, how would it be possible to define > character variables? For example, suppose you want to search for the > following sequences > > al > el > il > ol > ul > > which are really just Vl (where V stands for a vowel). Could you simply > define a character set for vowels (V := 'aeiou') and then refer to that > character set in the find() function? If so, what would it look like? I > tried something like the following and it didn't work. > > find( V || "l") > > I realise it's a pretty trivial task but I don't have the manual at the > moment and I'd like an answer within the next couple of days. Thanks in > advance. >Well you don't (want to use find()). Function find() only matches substrings. >Try this (based on "The Icon Programming Language" (1983), p 177): procedure Vl(line) static vowel local line, i initial vowel := 'aeiou' i := 1 while i := upto(vowel,line,i) do { suspend line[i+:2] i += 2 } end >procedure testVl() local line while line := read() do { every write(Vl(line)) } end This is another example of where SNOBOL4/SPITBOL is easier and simpler and more direct than Icon. In SNOBOL4 one can simply use: &TRIM = 1 PAT = FENCE (BREAKX("aeiou") LEN(1) "l") $ OUTPUT FAIL RDLOOP LINE = INPUT :F(END) LINE PAT :F(RDLOOP) END Gordon Peterson http://www.computek.net/public/gep2/ Support the Anti-SPAM Amendment! Join at http://www.cauce.org/ From icon-group-sender Tue Jun 17 19:12:24 1997 Received: from kingfisher.CS.Arizona.EDU by cheltenham.cs.arizona.edu; Tue, 17 Jun 1997 17:25:14 MST Received: by kingfisher.CS.Arizona.EDU; (5.65v3.2/1.1.8.2/08Nov94-0446PM) id AA11695; Tue, 17 Jun 1997 17:25:14 -0700 To: icon-group@cs.arizona.edu Date: 17 Jun 1997 19:12:24 GMT From: shamim@synopsys.com (Shamim Zvonko Mohamed) Message-Id: <5o6nio$i09@hermes.synopsys.com> Organization: Synopsys Inc., Mountain View, CA 94043-4033 Sender: icon-group-request@cs.arizona.edu References: <5nup7c$6lp$1@beet.tau.ac.il> Subject: Re: Writing daemons in Icon - signal handling Errors-To: icon-group-errors@cs.arizona.edu Status: RO Content-Length: 893 In article <5nup7c$6lp$1@beet.tau.ac.il>, Guy Laden wrote: >Can anybody offer any advice or examples of _robust_ daemons which >listen to network sockets, written in Icon. >How should signals be handled? >Whats the 'right' way of handling timeouts of network connections? I have added the Unix system calls to Icon, allowing sockets, signals, timeouts etc. to be handled easily. An introduction is at: http://www.crl.com/~spm/unicon/ and it has pointers to the source. (It has been tested on Linux 2.0, SunOS 4.1, Solaris 2.4 and 2.5, and HPUX 9 and 10. Binaries are available for Linux, including RPM files for RedHat systems.) -s Shamim Mohamed A2-1 Synopsys Inc., 700 E Middlefield Rd., Mountain View, CA 94043-4033 -- Shamim Mohamed A2-1 Synopsys Inc., 700 E Middlefield Rd., Mountain View, CA 94043-4033