From icon-group-request Fri May 1 20:18:36 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Fri, 1 May 92 20:18:36 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA16097; Fri, 1 May 92 20:18:33 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA06324; Fri, 1 May 92 20:08:49 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 28 Apr 92 04:53:38 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!tira!stephen@ucbvax.berkeley.edu (Stephen P Spackman) Organization: University of Chicago CILS Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr24.162006.6210@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <1992Apr28.013928.873@coyote.datalog.com> jmh@coyote.datalog.com (John Hughes) writes: |But seriously, the technolgy and resources now exist to allow this type of |"electronic classroom" to exist in a way never before possible. I would |suggest that the collective minds of the Internet consider the possibilities |and weigh the benefits before hastily brandishing the "non-commercial" |club and beating such postings senseless. *Many* people here believe that all software should be free. There is a case to be made for this position, and you will note that the correlate attitude - that announcements of free software are far more welcome than those of commercial products - extend to this domain as well. Now I realise that this is a political position (and probably an unpopular one in this country) but while it might be a good thing for software to be free, it is VITAL that education be so. Education is not only one of the cornerstones of personal development, but it is essential to all sectors of public life as well. Denying it to people because of accidents of birth (that is, after all, what determines whether you have money - and hence health, education, and a hope in hell of putting what God gave you to some practical use - in this country, myths of classlessness be damned) is not merely morally suspect, it is socioeconomic suicide. You want the BEST minds in your company, and you want the BEST musicians on your radio. You get that by not garbaging them because they can't raise your student fees, and by not forcing them to do work that they don't believe in by putting them in hock for the rest of their lives. (And if the price for this is that a lot of people get paid to WASTE their time, you're STILL better off than having that same deadwood drawing a salary in position that could be filled by someone with the enthusiasm and dedication that would draw them to it in spite of a lower marginal return). A society that makes charging for sex illegal and considers charging for information only proper is *very seriously twisted*. This ends the party political broadcast ;-). ---------------------------------------------------------------------- stephen p spackman Center for Information and Language Studies stephen@estragon.uchicago.edu University of Chicago ---------------------------------------------------------------------- Note: the Univeristy of Chicago *without a doubt* disagrees with every single word of the above. Jack Mandora, me no choose NONE. From icon-group-request Sat May 2 12:21:27 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Sat, 2 May 92 12:21:27 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA10815; Sat, 2 May 92 12:21:24 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA06461; Sat, 2 May 92 12:19:21 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 28 Apr 92 07:10:39 GMT From: ryptyde!rjgrace@nosc.mil (Jeff Grace) Organization: NetLink Online Communications, San Diego CA Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr27.145008.22240@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu ghelmer@dsuvax.dsu.edu (Guy Helmer) writes: > In ara@zurich.ai.mit.edu (Allan Adler) > > >In article <1992Apr24.162006.6210@dsuvax.dsu.edu> ghelmer@dsuvax.dsu.edu > > (Guy Helmer) posted: > > >> Following is information about a three-credit graduate course > >> in programming for the humanities offered by Dakota State > >> University via BITNET (and other interconnected networks). > >> [ details of the course deleted] > >> The total cost of the course is $xxx.xx. No textbook is > ^^^^^^ > Actual cost deleted to avoid affending even more readers. :-) > > >> required. Students will be sent a disk containing a public-domain > >> SNOBOL4 compiler and a text editor. Lectures and data files will > >> be sent electronically. > > >I think this counts as commercial advertising. If someone wants to make the > >course materials available to people via anonymous ftp, that is one thing. > >If someone wants to organize a network of volunteers to help people in the > >humanities learn computers, that is still ok. But this is pure commerce. > > OK, this may be considered "commercial" advertising by some, but I submit it > it not "pure commerce", because: > > 1) This is an experimental program offering, where the experiment > is to offer an unusual course worldwide to users of the net, who, > without benefit of the Internet, would not be able to take advantage > of the offering. > > 2) In the spirit of the course (using Internet as the delivery > medium), the best method to contact potential "virtual attendees" > is Usenet. A very large share of the Internet is funded this > moment to promote communication between research and educational > institutions, which is what this course is based on. > > 3) Given tight budgets, lack of support, and funding of time, > the academic community must develop "free courses" so that we > may post announcements of innovative, experimental, > one-of-a-kind opportunities to Usenet? > > >Aren't there rules about this sort of thing? > > :-) Rules on Usenet? > > Seriously, I will grant that perhaps it would have been "more proper" > and "less offending" to have posted summary information. However, I > have a very hard time finding differences between my posting and the > postings you will find in news.announce.conferences, and I don't see > y'all flaming each post in n.a.c that lists course costs and materials > provided. > > Followups to misc.misc, since this thread probably doesn't interest everyone. > > >Allan Adler > >ara@altdorf.ai.mit.edu > -- > Guy Helmer, Dakota State University Computing Services - ghelmer@dsuvax.dsu.e > "Often you fix the wrong thing first." - Karl Auerbach, Interop 91 Computer Science Majors! Language taught is SNOTLIK 2000! The advatages of learning programming from a Humanities Expert are so mind-boggling that etiquette prevents me from elaborating! Suffice it to say that Computer Science Students will discover unknown horizons! New Territory! They might even forget that they aren't REAL SCIENTISTS!! -- INTERNET: rjgrace@netlink.cts.com (Jeff Grace) | This is a man...proud man, UUCP: ...!nosc!ryptyde!netlink!rjgrace | most ingnorant of what NetLink Online Communications | he's most assured, his Public access in San Diego, CA (619) 435-6181 | glassy essence. (CS Pierce) From icon-group-request Sat May 2 16:07:05 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Sat, 2 May 92 16:07:05 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA16895; Sat, 2 May 92 16:07:01 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA19860; Sat, 2 May 92 15:53:22 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 28 Apr 92 15:54:56 GMT From: jar@cu-arpa.cs.cornell.edu (Jonathan Rees) Organization: Cornell Univ. CS Dept, Ithaca NY 14853 Subject: Re: features from Icon Language in lisp Message-Id: <1992Apr28.155456.15893@cs.cornell.edu> References: <1992Apr14.173407.28762@adobe.com>, , <1992Apr25.185854.1374@cs.cornell.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Oops! I screwed up. To: jar@cs.cornell.edu Subject: Re: features from Icon Language in lisp Date: Tue, 28 Apr 92 11:10:19 -0400 From: Mark Saaltink I enjoyed your posting of "either" and "accumulate". Sadly, accumulate is not guaranteed to work properly in all Schemes (and in fact does not work properly in the scheme I use). Here's the problem. In the code (define (%accumulate thunk) (let ((results '())) (either (begin (set! results (cons (thunk) results)) (fail)) (reverse results)))) the continuation for (thunk) may have already evaluated "results" (and got '()). The standard, of course, allows cons to evaluate its arguments in either order. In this case, accumulate returns a list containing only the last result generated. The fix is really quite simple: (define (%accumulate thunk) (let ((results '())) (either (let ((x (thunk))) ;[minor edit of MS's fix --JAR] (set! results (cons x results)) (fail)) (reverse results)))) Programming with continuations is amazing (and subtle)! Mark Saaltink -- Jonathan Rees jar@cs.cornell.edu member, Cambridge Entomological Club / member, League for Programming Freedom From icon-group-request Sun May 3 19:44:09 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Sun, 3 May 92 19:44:09 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA04714; Sun, 3 May 92 19:44:06 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA00551; Sun, 3 May 92 19:28:25 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 28 Apr 92 17:18:36 GMT From: amethyst!organpipe.uug.arizona.edu!news@noao.edu (Dave Schaumann) Organization: University of Arizona Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr28.171836.12400@organpipe.uug.arizona.edu> References: <1992Apr27.145008.22240@dsuvax.dsu.edu>, <1992Apr28.013928.873@coyote.datalog.com>, Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu [Oh, boy. Are we having a flame war yet?] In article , stephen@estragon (Stephen P Spackman) writes: >Now I realise that this is a political position (and probably an >unpopular one in this country) but while it might be a good thing for >software to be free, it is VITAL that education be so. Perhaps so. But until and unless we have a *major* restructuring of our economy, it never will be. Instructors, equipment, classrooms, material, etc, etc, etc. all cost money. Unless that changes, education will never be free. I suppose what you meant was "eductaion should be free for students" (in which case, I suppose, education would be funded by the state (==taxes) and private donations). >Denying [education] to people because of accidents of birth (that is, >after all, what determines whether you have money - and hence health, >education, and a hope in hell of putting what God gave you to some >practical use I disagree. "Accidents of birth" determines whether you /start out/ with money. Too many people have managed to climb their way out of shit-holes of poverty to make me believe that where you start out is the only (or even the most important) determining factor about where you end up. And frankly, it seems to me that unless you are /very/ careful, increasing government hand outs doesn't teach anyone anything except how to depend on government hand outs. I think we'd be far better off teaching people how to make their own prosperity rather than trying to provide it for them. >A society that makes charging for sex illegal and considers charging >for information only proper is *very seriously twisted*. Anything that I might ever do with a computer is surely nothing more than creating information. And if information should not be charged for, how can I hope to make a living with computers? [Just in case its not completely obvious: ALL IMHO!] >This ends the party political broadcast ;-). -- Dave Schaumann dave@cs.arizona.edu From icon-group-request Mon May 4 09:46:48 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 09:46:48 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA05648; Mon, 4 May 92 09:46:45 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA17758; Mon, 4 May 92 05:10:26 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 28 Apr 92 16:32:16 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!sugar!ficc!peter@ucbvax.berkeley.edu (Peter da Silva) Organization: Xenix Support, FICC Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr27.145008.22240@dsuvax.dsu.edu>, <1992Apr28.013928.873@coyote.datalog.com>, Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article stephen@estragon.uchicago.edu (Stephen P Spackman) writes: > Now I realise that this is a political position (and probably an > unpopular one in this country) but while it might be a good thing for > software to be free, it is VITAL that education be so. It is possible to consider making software free, because the cost of duplication is negligable. This is NOT true for education, at least if you plan on having some sort of grading and accredition. Someone has to pay for the costs of training each student. I happen to agree that the cost of education should be shared by the general public, since the benefits outweigh the costs by orders of magnitude, but how much education to you give away? This is simply a matter of management of resources. And in this society resource management is handled by distributing tokens that represent resources to individuals, and letting individuals make their own decisions on how their share of their resources will be used. This has disadvantages, since people may use their share of resources unwisely. Or their parents may have, or other people may cheat. So we have a common pool of resources that are managed on people's behalf. This pool, however, is limited... so at some point you have to let people do their own resource allocation, and have people pay for continuing education with their own money. You may have problems with *where* the dividing line is... but I can't see any way you can seriously argue that this dividing line not exist. > (And if the price for this is that a lot of people get > paid to WASTE their time, you're STILL better off than having that > same deadwood drawing a salary in position that could be filled by > someone with the enthusiasm and dedication that would draw them to it > in spite of a lower marginal return). I think eastern europe demonstrates quite well that this is not true. > A society that makes charging for sex illegal and considers charging > for information only proper is *very seriously twisted*. Now that I can't argue with. But that's a different matter... this society was founded by seriously twisted people who couldn't make it in Europe. -- Peter da Silva `-_-' Programmer, network firefighter, thrillseeker 'U` Ferranti International Controls Corporation Have you hugged Sugar Land, TX 77487-5012 +1 713 274 5180 your wolf today? From lrw!leichter@lrw.com Mon May 4 11:49:12 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 11:49:12 MST Received: from uu.psi.com by optima.cs.arizona.edu (4.1/15) id AA11474; Mon, 4 May 92 11:49:01 MST Received: from lrw.UUCP by uu.psi.com (5.65b/4.1.031792-PSI/PSINet) id AA24943; Mon, 4 May 92 14:22:50 -0400 Message-Id: <9205041822.AA24943@uu.psi.com> Received: by lrw.UUCP (DECUS UUCP w/Smail); Mon, 4 May 92 13:52:44 EDT Date: Mon, 4 May 92 13:52:44 EDT From: Jerry Leichter To: ICON-GROUP@cs.arizona.edu Subject: Re: Computer Programming for Humanities ... [Political Flammage] X-Vms-Mail-To: ICON-GROUP@CS.ARIZONA.EDU Will all of you please just SHUT UP. This is the ICON mailing list. It's for the discussion of the ICON programming language and related issues. We don't need your naive, uninformed political ravings. We wouldn't need your them even if they WERE informed. Announcements of seminars and classes related to academic pursuits have long been considered fair game on the Internet, even when there was a charge for them. (Try and find an announcement of a truly free meeting, ACM, IEEE, AAAI, or otherwise.) The seminar that started all this extraordinary raving (by too many people for me to write to them individually, the best response to idiocy that won't go away when simply ignored) was clearly a legitimate academic effort. You don't like it? You think you know better what should be allowed on the net, or on this group? I don't give a damn. It's not your decision. Never was. Let's all hope it never will be. Go back to your little sandboxes and play nicely with your toys, children. -- Jerry From alex@laguna.metaphor.com Mon May 4 16:20:02 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 16:20:02 MST Received: from relay.metaphor.com by optima.cs.arizona.edu (4.1/15) id AA27463; Mon, 4 May 92 16:19:53 MST Received: from laguna.Metaphor.COM by relay.metaphor.com (4.1/SMI-4.1) id AA00252; Mon, 4 May 92 16:03:16 PDT Received: by laguna.Metaphor.COM (4.1/SMI-4.0) id AA01672; Mon, 4 May 92 15:28:51 PDT Date: Mon, 4 May 92 15:28:51 PDT From: alex@laguna.metaphor.com (Bob Alexander) Message-Id: <9205042228.AA01672@laguna.Metaphor.COM> To: icon-group@cs.arizona.edu Subject: Encryption in Icon? Can anyone point me to an encryption/decryption algorithm in Icon? -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex From icon-group-request Mon May 4 19:35:08 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 19:35:08 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA05370; Mon, 4 May 92 19:35:05 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA16922; Mon, 4 May 92 19:28:55 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 29 Apr 92 12:39:15 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!hri.com!noc.near.net!mv!jlc!john@ucbvax.berkeley.edu (John Leslie) Organization: John Leslie Consulting, Milford NH Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr29.123915.3952@jlc.mv.com> References: <1992Apr27.145008.22240@dsuvax.dsu.edu>, <1992Apr28.013928.873@coyote.datalog.com>, Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article stephen@estragon.uchicago.edu (Stephen P Spackman) writes: > >A society that makes charging for sex illegal and considers charging >for information only proper is *very seriously twisted*. > As it turns out, there's a very good reason for governments to prohibit free market sex -- the extreme costs of AIDS treatment make it entirely impractical to regulate such a market and allocate the true costs. Surely today's Internetters don't _still_ believe that *information* is as harmful? :) John Leslie From pbewig@netcom.com Mon May 4 20:50:13 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 20:50:13 MST Received: from netcom.netcom.com by optima.cs.arizona.edu (4.1/15) id AA07469; Mon, 4 May 92 20:50:11 MST Received: by netcom.netcom.com (4.1/SMI-4.1) id AA22471; Mon, 4 May 92 20:44:39 PDT Date: Mon, 4 May 92 20:44:39 PDT From: pbewig@netcom.com (Phil Bewig) Message-Id: <9205050344.AA22471@netcom.netcom.com> Apparently-To: icon-group@cs.arizona.edu Here is a short encryption program which I use occasionally. Do *not* use this in the face of competent cryptanalysis. # icrypt.icn - encrypt and decrypt # usage: [iconx] icrypt [key] outfile procedure main(args) local i, k, ky, l if *args = 1 then ky := get(args) else { con := open("/dev/tty", "b") writes(con, "Enter password: ") # NOTE: displays password! ky := read(con) close(con) } i := 1 l := 0 k := [] every put(k, ord(!ky)) do l +:= 1 while writes(char(ixor(ord(reads()), k[i]))) do i %:= l + 1 end From icon-group-request Mon May 4 23:47:12 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Mon, 4 May 92 23:47:12 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA12587; Mon, 4 May 92 23:47:09 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA05980; Mon, 4 May 92 23:31:56 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 29 Apr 92 15:18:28 GMT From: mcsun!uknet!edcastle!dcs.ed.ac.uk!nick@uunet.uu.net (Nick Rothwell) Organization: Friends of the Salter Duck Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr27.145008.22240@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <1992Apr29.123915.3952@jlc.mv.com> john@jlc.mv.com (John Leslie) writes: As it turns out, there's a very good reason for governments to prohibit free market sex -- the extreme costs of AIDS treatment make it entirely impractical to regulate such a market and allocate the true costs. Surely today's Internetters don't _still_ believe that *information* is as harmful? :) Computer viruses? Nick. -- Nick Rothwell, LFCS, Edinburgh | nick@dcs.ed.ac.uk | Julia Roberts as Tinkerbell ... Mentation Consultancy Services | ... hey, that's *my* kind of fantasy ... cassiel@cix.compulink.co.uk | From icon-group-request Tue May 5 08:02:48 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 08:02:48 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA03570; Tue, 5 May 92 08:02:45 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA05539; Tue, 5 May 92 07:55:18 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 29 Apr 92 16:51:23 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u47041@ucbvax.berkeley.edu Organization: University of Illinois at Chicago Subject: cms problem Message-Id: <92120.115123U47041@uicvm.uic.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu hi there i 'm trying to use icon in cms 5.0 when i enter ICONT HELLO -X to test the program from the distribution tape i get the foll. messg. from the machine dms116s loader table overflow invalid cms command (end of messg.) any sugestions? thanx u47041@uicvm.bitnet kapoulas@lac.math.uic.edu From icon-group-request Tue May 5 09:18:17 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 09:18:17 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA06676; Tue, 5 May 92 09:18:14 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA11024; Tue, 5 May 92 09:05:20 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 29 Apr 92 20:05:36 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!lobster!sugar!ficc!peter@ucbvax.berkeley.edu (Peter da Silva) Organization: Xenix Support, FICC Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr28.013928.873@coyote.datalog.com>, , <1992Apr29.123915.3952@jlc.mv.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <1992Apr29.123915.3952@jlc.mv.com> john@jlc.mv.com (John Leslie) writes: > In article stephen@estragon.uchicago.edu (Stephen P Spackman) writes: > >A society that makes charging for sex illegal and considers charging > >for information only proper is *very seriously twisted*. > As it turns out, there's a very good reason for governments to prohibit > free market sex -- the extreme costs of AIDS treatment make it entirely > impractical to regulate such a market and allocate the true costs. I see. So rather than trying to regulate the market and minimise the dangers, you ensure that it's going to be unregulated and maximise the dangers. Swift. -- Peter da Silva `-_-' Programmer, network firefighter, thrillseeker 'U` Ferranti International Controls Corporation Have you hugged Sugar Land, TX 77487-5012 +1 713 274 5180 your wolf today? From icon-group-request Tue May 5 09:19:14 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 09:19:14 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA06708; Tue, 5 May 92 09:19:11 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA11657; Tue, 5 May 92 09:13:08 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 5 May 92 15:39:40 GMT From: gln@arizona.edu (Gary L. Newell) Organization: U of Arizona CS Dept, Tucson Subject: Re: Icon for CS-1 Message-Id: <16147@optima.cs.arizona.edu> References: <1992Apr25.171211.6548@midway.uchicago.edu>, <15797@optima.cs.arizona.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <15797@optima.cs.arizona.edu>, cjeffery@optima.UUCP (Clinton Jeffery) writes: > > Is Icon suitable as an introductory language? > Yes, if Lisp is then Icon is. Some curriculums call for low-level > programming in the first course, but there is no consensus. I'd > rather teach algorithms and program design than syntax, but a first > programming course necessarily spends much of its time teaching > language syntax ("special forms" for you Lisp protesters) so ideally > one would have a very high level language whose syntax suggests > design principles. Not Lisp (not enough syntactic reinforcement > for good design, except in the huge variants that are too complex) > and not Modula-2 or Ada (syntax for modules, but way too much syntax > for the boring stuff). Hmmm. As someone who has taught a number of courses here at Arizona, I thought I might throw my 1.5 cents worht in. I've often thought about the possibility of teaching Icon at the CS-1 level and have come to the following conclusions: 1) It would be superb in allowing students to focus more on the design of a solution to a problem in general terms, rather than the usual "design of a solution with a very specific syntax with little rhyme or reason to the new programmer". 2) Icon's use of failure as a natural occurance would also allow for easier programming and thus give more time to students for learning the more important tasks. 3) The string and list capabilities would allow the types of problems examined in such a course to far out-reach those commonly taught with languages such as Pascal. However, as I see it there are at least two major problems: 1) At some point you need to get the students into the grunge (so to speak) and more or less force them to hack out Pascal-like or C-like code. Their ability to compete in the market (both business and grad school) is likely to depend upon their exposure to "traditional" languages. It *could* be more difficult to move them into a language like C after exposure to a language with as high a level as Icon than it would be from Pascal. 2) I don't know about other folks out there, but I find myself frequently wishing that I could program a certain piece of software using Icon rather than say C++, as it simply saves so much design time. It has definately been a bad influence on me (in a very good way of course) and tends to color my thinking about programming in general - thankfully I hope to enter academia upon receipt of my PhD (knock on wood) and intend to take X-Icon anywhere I go so as to never have to look at another C++ program again for the rest of my life.... From icon-group-request Tue May 5 13:03:58 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 13:03:58 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA16752; Tue, 5 May 92 13:03:56 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA28920; Tue, 5 May 92 12:57:09 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 24 Apr 92 00:41:43 GMT From: wmichgw!561sleda@gumby.wisc.edu Organization: Western Michigan University Subject: TEST: Which lang. needs least lines? Message-Id: <1992Apr23.194143.3970@gw.wmich.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Hello fellow programmers, A professor here at Western Michigan University recently put the question shown below (or one very similar) on the final exam for an introductory computer course. Besides the fact that usage of only the BASIC language was discussed to any degree of depth, what is your opinion to, and what do you think the answer is to the question? Please expound. Send E-Mail to: 561sleda@gw.wmich.edu. Thanks in advance for the input!! Question: If you were writing a program, which of the following languages would require to most lines? A) COBOL B) BASIC C) FORTRAN D) PASCAL _____________________________ From callas@eris.enet.dec.com Tue May 5 14:09:06 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 14:09:06 MST Received: from enet-gw.pa.dec.com by optima.cs.arizona.edu (4.1/15) id AA20429; Tue, 5 May 92 14:08:58 MST Received: by enet-gw.pa.dec.com; id AA25539; Tue, 5 May 92 14:08:40 -0700 Message-Id: <9205052108.AA25539@enet-gw.pa.dec.com> Received: from eris.enet; by decwrl.enet; Tue, 5 May 92 14:08:48 PDT Date: Tue, 5 May 92 14:08:48 PDT From: What good is rain that falls up? 05-May-1992 1704 To: 561sleda@gw.wmich.edu Cc: icon-group@cs.arizona.edu, callas@eris.enet.dec.com Apparently-To: icon-group@cs.arizona.edu, 561sleda@gw.wmich.edu Subject: Re: TEST: Which lang. needs least lines? There's one small problem with your missive. Your subject line asks what program needs the *least* lines to code in, yet the question you give in the body asks for the *most* lines. They are two different questions. If your question is the latter (most lines), then here are some possible answers: An answer to your question is "mu." It should properly be accompanied by a sharp blow with a cane to the asker's occipital lobe in an attempt to bring the asker to true enlightenment. I believe that this is the best answer, as it indicates that the person who asked it does not understand a few very fundamental things about programming, like that "lines" are irrelevant in most cases. That this misunderstanding comes from a professor is alarming, but not surprising. One can only hope that it is an untenured position or that in spite of being a teacher, this professor is capable of learning. Another answer to your question would be, "What does the program do?" All programs do some things better than others, and if allowed, a properly jesuitical or rabbinical person could construct a case for any of those languages. Another answer would be to say (A) -- COBOL. COBOL is a very verbose language, and a betting person would bet on COBOL being longest on a non-rigged case. I might even go so far as to say that if Cobol is *not* the longest, then the case is rigged. Now then, the other question -- which language would give you the least lines. The best answer for this question, in my opinion, is also the best answer for the other one, for the same reasons. The next best answer is to unequovably state that Pascal wins. (Note that it is *not* PASCAL -- Pascal is a proper name, not an acronym; if your professor put it in upper case, then they not only lose points on content, but on style as well.) Pascal is the *only* language of those four that allows you to put your whole program on one arbitrarily long line (if it's a good Pascal, anyway). Meditate on this for a moment, and see if you can see why this tells me that "mu" (and the blow on the head) is a better answer. Jon. From icon-group-request Tue May 5 14:48:29 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 14:48:29 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA22306; Tue, 5 May 92 14:48:26 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA04905; Tue, 5 May 92 14:18:38 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 30 Apr 92 07:52:36 GMT From: mcsun!sunic2!dkuug!diku!klaus@uunet.uu.net (Klaus Ole Kristiansen) Organization: Department of Computer Science, U of Copenhagen Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr30.075236.5667@odin.diku.dk> References: , <1992Apr29.123915.3952@jlc.mv.com>, Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu ara@zurich.ai.mit.edu (Allan Adler) writes: >The cost of ignorance is also quite high. That is a good argument for free >information. Huh? "Having this thing will save me a lot, therefore it is not fair that I should have to pay for it." I am all for free information, but this argument is absurd. Klaus O K From icon-group-request Tue May 5 15:19:00 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 5 May 92 15:19:00 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA24385; Tue, 5 May 92 15:18:58 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA09076; Tue, 5 May 92 15:08:53 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 30 Apr 92 10:49:49 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!sun1.ruf.uni-freiburg.de!news.belwue.de!news.uni-stuttgart.de!helpdesk.rus.uni-stuttgart.de!zrzm0111@ucbvax.Berkeley (MUFTI) Organization: User Helpdesk Comp. Cent. (RUS) U of Stuttgart, FRG Subject: Re: cms problem Message-Id: <1992Apr30.104949.24461@news.uni-stuttgart.de> References: <92120.115123U47041@uicvm.uic.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <92120.115123U47041@uicvm.uic.edu> writes: >hi there i 'm trying to use icon in cms 5.0 >when i enter ICONT HELLO -X >i get the foll. messg. from the machine > >dms116s loader table overflow >invalid cms command > Don't now what's going on, but try to extent the loadertable: Query the actuell numbers of loadertables with query ldrtbls and set a higher number with set ldrtbls number (the default number is 3) so long MUFTI From icon-group-request Wed May 6 00:49:27 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Wed, 6 May 92 00:49:27 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA19006; Wed, 6 May 92 00:49:23 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA25167; Wed, 6 May 92 00:36:59 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 30 Apr 92 10:49:49 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!sun1.ruf.uni-freiburg.de!news.belwue.de!news.uni-stuttgart.de!helpdesk.rus.uni-stuttgart.de!zrzm0111@ucbvax.Berkeley (MUFTI) Organization: User Helpdesk Comp. Cent. (RUS) U of Stuttgart, FRG Subject: Re: cms problem Message-Id: <1992Apr30.104949.24461@news.uni-stuttgart.de> References: <92120.115123U47041@uicvm.uic.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <92120.115123U47041@uicvm.uic.edu> writes: >hi there i 'm trying to use icon in cms 5.0 >when i enter ICONT HELLO -X >i get the foll. messg. from the machine > >dms116s loader table overflow >invalid cms command > Don't now what's going on, but try to extent the loadertable: Query the actuell numbers of loadertables with query ldrtbls and set a higher number with set ldrtbls number (the default number is 3) so long MUFTI From icon-group-request Wed May 6 05:51:20 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Wed, 6 May 92 05:51:20 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA01498; Wed, 6 May 92 05:51:17 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA23083; Wed, 6 May 92 05:49:12 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 1 May 92 00:54:45 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!tira!stephen@ucbvax.berkeley.edu (Stephen P Spackman) Organization: University of Chicago CILS Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr27.145008.22240@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <1992Apr30.075236.5667@odin.diku.dk> klaus@diku.dk (Klaus Ole Kristiansen) writes: |ara@zurich.ai.mit.edu (Allan Adler) writes: |>The cost of ignorance is also quite high. That is a good argument for free |>information. |Huh? "Having this thing will save me a lot, therefore it is not fair that |I should have to pay for it." | |I am all for free information, but this argument is absurd. I think the idea here is that the cost to OTHERS of ignorance is high. Which has always been my experience: I suffer as much from other people's mistakes as from my own, and sometimes a lot more. stephen From KARCZMA@FRCAEN51.BITNET Wed May 6 06:33:45 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Wed, 6 May 92 06:33:45 MST Received: from SKYBLU.CCIT.ARIZONA.EDU by optima.cs.arizona.edu (4.1/15) id AA03000; Wed, 6 May 92 06:33:44 MST Received: from FRCAEN51.BITNET (KARCZMA@FRCAEN51) by CCIT.ARIZONA.EDU (PMDF #12663) id <01GJOJUPYA748WZ50B@CCIT.ARIZONA.EDU>; Wed, 6 May 1992 06:34 MST Date: 6 MAY 92 15:35:20.10-GMT From: KARCZMA@FRCAEN51.BITNET Subject: This time NOTHING about Humanities, etc. To: ICON-GROUP@cs.arizona.edu Message-Id: <01GJOJUPYA748WZ50B@CCIT.ARIZONA.EDU> X-Envelope-To: ICON-GROUP@CS.ARIZONA.EDU OK, gentlemen. I agree that the problem of free software is extremely interesting, and that this discussion will never end, but let me ask something different. Did anybody try to implement the co-expressions in Icon-V8 on a Sun 4 (Sparc)? In "C"? In assembly code? Could you share your experiences? Jerzy Karczmarczuk karczma@frcaen51.bitnet Lab. d'Informatique, University of Caen, France From ralph Wed May 6 06:45:50 1992 Date: Wed, 6 May 92 06:45:50 MST From: "Ralph Griswold" Message-Id: <9205061345.AA08807@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Wed, 6 May 92 06:45:50 MST To: ICON-GROUP@cs.arizona.edu, KARCZMA@FRCAEN51.BITNET Subject: Re: This time NOTHING about Humanities, etc. Cc: q Co-expressions were implemented for Version 8 of Icon on the Sparc some time ago. They are included in the recent Version 8.6 release as announced on this newsgroup. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-request Wed May 6 07:54:05 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Wed, 6 May 92 07:54:05 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA05647; Wed, 6 May 92 07:54:01 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA02916; Wed, 6 May 92 07:36:17 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 6 May 92 15:08:36 GMT From: eru.mt.luth.se!lunic!sunic2!sics.se!eua.ericsson.se!euas20!konhks@bloom-beacon.mit.edu (Hakan.Soderstrom) Organization: Ellemtel Telecom Systems Labs, Stockholm, Sweden Subject: Re: features from Icon Language in lisp Message-Id: References: <1992Apr14.173407.28762@adobe.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu The original post on this subject seems to be In article <1992Apr14.173407.28762@adobe.com> yost@adobe.COM (David Yost) writes: > Has anyone implemented any other of our favorite iconish things > in Common Lisp or Scheme? Like goal-directed evaluation, > string scanning, ... ? As one who has coded a lot in Icon, but is a newcomer to Scheme, the following observations might be of interest. The reason I turned to Scheme was mainly its interactive nature plus the Elk implementation. Scheme has several very significant strenghts. What I needed was an extension language. Here are a few things which I think could make their way into Scheme without disrupting its general flavour. -- Equal opportunity for the various datatypes. There is an uneven-ness in Scheme. There are terribly general and well exploited concepts like lists, procedures and continuations. But strings and vectors are treated on a quite low level of abstraction. Among the first things that amazed me was that for-each only worked on lists. Why? In Icon the '!' operator works on strings, lists, sets, tables, and files. Scheme procedures working on lists usually refer (recursively) to "this guy" (car) and "the next guy" (cdr) in a relative way. With strings and vectors one has to use "absolute addressing" like vector-ref. You also have to explicitly find the length of what you are working on in order to know when to stop. There is append, string-append, but not vector-append. A simple, but very useful concept is the way you specify string positions in Icon. Positions are located *between* characters. The first position has number 1; numbering increases to the right. But there is also a second numbering. The last position has number 0 (zero); numbering decreases towards the left. So, there are two ways to define every position, and you can use whichever is most convenient. This means that taking the last few characters of a string is as easy as taking the first few. You don't have to find the length explicitly. Of course the same thing works with lists; why not? Then there is a host of string scanning functions that elevate strings to a productive level of abstraction. -- The table datatype in Icon is extremely useful. I can hardly think of an application where I did not use a table. I have made applications work well with a megabyte of data in tables. I think this is a reasonable level of abstraction for a language in the 90's. -- Icon is expression oriented; i.e. a statement is also an expression. This is true in many cases in Scheme, but not in set!. This is strange to me, but there may be some theory behind. I think it is very useful to see mutation as pure side-effect. I.e. (set! a x) would evaluate to x, but with a side-effect. (Same with append! etc.) -- Dare I mention syntax? A (load 'foo.scm) results in "File ended prematurely". In my 2000 line program a parenthesis is missing, and, by virtue of the underlying theory, the 'compiler' can't give me a clue. But there is Emacs. Oh well, I shouldn't have mentioned the last one. And, yes, you are absolutely right, this is only my $ 0.02 worth. Of course I would like goal-directed evaluation (including failure and generators) that pervades Icon, but I think it would rock the foundations of Scheme. Hakan (for-each standard-disclaimer (string->list message)) -- ----------------------------------------------- Hakan.Soderstrom@eua.ericsson.se 08 - 727 4235 From MATH0022@rmc.ca Wed May 6 11:03:54 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Wed, 6 May 92 11:03:54 MST Received: from Arizona.edu (Hopey.Telcom.Arizona.EDU) by optima.cs.arizona.edu (4.1/15) id AA15855; Wed, 6 May 92 11:03:49 MST Received: from RMC.CA (MAILER@RMC) by Arizona.edu (PMDF #12663) id <01GJOT8XFOSKAKTUH0@Arizona.edu>; Wed, 6 May 1992 11:03 MST Received: by RMC (Mailer) id 45270000416; Wed, 06 May 92 14:00:33 EST Date: Wed, 06 May 92 14:00:01 EST From: MATH0022@rmc.ca Subject: Data structures text with ICON, SNOBOL? To: icon-group@cs.arizona.edu Reply-To: LINDSAY_JH@rmc.ca Message-Id: <920506.14000144.004394@RMC.CP6> X-Envelope-To: icon-group@cs.Arizona.edu I'm looking for a text for a course on Data Structures and Algorithm Analysis, and I'd very much like to find one that uses (ICON | SNOBOL) & (Pascal | Modula | C | Ada | .... ) ... any suggestions ? (I know of Gimpel's Algorithms in SNOBOL4 and Griswold's String and List Processing (is the latter still available ?), both useful references.) -------------------------------------------------------------------------------- John H. Lindsay, Department of Mathematics and Computer Science, Royal Military College of Canada, Kingston, Ontario, Canada, K7K 5L0. Phones: Office, (613) 541-6419 Messages, 541-6343 or 541-6458 Home, 546-6988 E-Mail: From Bitnet, NetNorth, ONet: LINDSAY_JH@RMC.CA From Canadian Military Colleges: LINDSAY JH@RMC Fax: (613) 542-8129 From icon-group-request Thu May 7 06:10:58 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 06:10:58 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA03458; Thu, 7 May 92 06:10:54 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA01127; Thu, 7 May 92 06:01:07 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 24 Apr 92 16:20:06 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!mips!darwin.sura.net!wupost!dsuvax.dsu.edu!ghelmer@ucbvax.berkeley.edu (Guy Helmer) Organization: Dakota State University, Madison, SD Subject: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr24.162006.6210@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu [ The following is a description of an offering of a course via electronic mail by Dakota State University's College of Liberal Arts. Reply-To: is set to ERIC%SDNET.BITNET@vm1.nodak.edu, which is where queries regarding the course should be sent. Flames regarding this massive cross-post should be directed to ghelmer@dsuvax.dsu.edu :-) ] Following is information about a three-credit graduate course in programming for the humanities offered by Dakota State University via BITNET (and other interconnected networks). Students in the course can be anywhere in the world if they can send and receive electronic mail. CHUM 650, COMPUTER PROGRAMMING FOR THE HUMANITIES, is an introduction to programming using SNOBOL4 for applications in the humanities such as analysis of texts, arranging data from research, and formatting for printing and desktop publishing. The primary emphasis in the course will be on computer applications with texts. The course is designed for humanists who want to learn to write useful computer programs for research and teaching. The language of choice for this course is SNOBOL4 because it is a powerful language designed for non-numeric computing; students can write useful programs in SNOBOL4 almost from the start. The course will begin with an introduction to programming, then cover techniques of structuring SNOBOL4 programs, and it will finish with students completing individual projects of their own creation. Students in the course can work at their own pace; they can begin immediately. Students should plan to finish all course requirements by August 1. Programming assignments for the course will be designed for MS-DOS microcomputers. Although most assignments can be modified for Macintosh users, students using a Macintosh would have to purchase MaxSPITBOL, and they would need an understanding of Macintosh file structures. It is a prerequisite for the course that students have a sound understanding of how to upload and download files from the mainframe that runs electronic mail to the DOS microcomputer used for the programming assignments. In addition, students must be familiar with DOS commands. The total cost of the course is $239.82. No textbook is required. Students will be sent a disk containing a public-domain SNOBOL4 compiler and a text editor. Lectures and data files will be sent electronically. Students may audit the course or enroll for credit and receive a grade of Pass or Fail. The cost to audit the course is the same as enrolling for credit. Those who want an electronic registration form or who have questions about the course should send a message to Eric Johnson ERIC@SDNET.BITNET -- Guy Helmer, Dakota State University Computing Services - ghelmer@dsuvax.dsu.edu "Often you fix the wrong thing first." - Karl Auerbach, Interop 91 From janpeter@mpi.kun.nl Thu May 7 09:00:01 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 09:00:01 MST Received: from wn1.sci.kun.nl by optima.cs.arizona.edu (4.1/15) id AA09268; Thu, 7 May 92 08:59:56 MST Received: by wn1.sci.kun.nl (5.57/2.1) on NUNET id AA29058; Thu, 7 May 92 18:00:47 +0200 Received: by mpix10.mpi.kun.nl (5.57/2.0) on NUNET id AA00364; Thu, 7 May 92 18:00:54 +0200 Date: Thu, 7 May 92 18:00:54 +0200 From: Jan Peter de Ruiter Message-Id: <9205071600.AA00364@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: NAGBOL Why the hell do we get the SNOBOL course message /again/? Is this a provocation? Is there some SNOBOL masochist out there that lives on Flames from ICON users? Anyhow, let's be constructive. I'd like to know if there is a specific class of programming problems / algorithms for which SNOBOL is a more natural language than Icon. I am aware of the more esoteric capabilities of SNOBOL, but I'd like to know in what situations these functions are actually /useful/. Many years ago someone told me enthusiastically that one could write a LISP program that could modify itself! Since that day I've never seen one useful LISP program that used this capability. Is that the case with SNOBOL too, or are there many SNOBOL programmers who use those (e.g. CODE, or "variable labels") capacities daily? Comments welcome, especially from SNOBOL freaks. Jan P.A. de Ruiter janpeter@mpi.kun.nl "Often you marry the wrong person first", Swami Brahparthivishnibraphutha. From icon-group-request Thu May 7 11:37:38 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 11:37:38 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA27991; Thu, 7 May 92 11:37:35 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA00990; Thu, 7 May 92 11:29:52 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 24 Apr 92 21:27:53 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!hri.com!noc.near.net!chaos!random.ccs.northeastern.edu!news@ucbvax.berkeley.edu (mitchell wand) Organization: College of Computer Science, Northeastern University Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr24.162006.6210@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu I didn't think there were any living SNOBOL programmers left! But seriously, I can't imagine doing applications in the humanities such as analysis of texts, arranging data from research, and formatting for printing and desktop publishing. in SNOBOL, which is hardly an industrial-strength language with widespread support! If you want to teach humanists about programming, use Friedman and Felleisen's {Little Lisper}, which converts everything to the kind of game even humanists can understand (:-). If you want to do quick-and-dirty text processing, you can either use Scheme or awk or Icon (or even C!), all of which are widely supported. If you want to do formatting and desktop publishing, you'd be far better off using all the good tools that are available for that, rather than struggling to do it in SNOBOL. [OK, my flameproof suit is on now.] --Mitch -- Mitchell Wand College of Computer Science, Northeastern University 360 Huntington Avenue #161CN, Boston, MA 02115 Phone: (617) 437 2072 Internet: wand@{corwin|flora}.ccs.northeastern.edu Fax: (617) 437 5121 From berstis@watson.ibm.com Thu May 7 11:50:37 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 11:50:37 MST Message-Id: <9205071850.AA28706@optima.cs.arizona.edu> Received: from watson.ibm.com by optima.cs.arizona.edu (4.1/15) id AA28706; Thu, 7 May 92 11:50:33 MST Received: from YKTVMV by watson.ibm.com (IBM VM SMTP V2R2) with BSMTP id 1454; Thu, 07 May 92 14:50:32 EDT Date: Thu, 7 May 92 14:16:36 EDT From: "Viktors Berstis" To: icon-group@cs.arizona.edu Subject: "NAGBOL" >Is that the case with SNOBOL too, or are there many SNOBOL programmers who >use those (e.g. CODE, or "variable labels") capacities daily? >Comments welcome, especially from SNOBOL freaks. I must admit that I still use SNOBOL quite a bit, including CODE and other such facilities. Even building a pattern at run time is like compiling code and this is quite useful in many situations. One program I wrote, that sticks out in my mind as most dependent on these facilities, was one which solved an unusually constrained scheduling problem. Another was a prototype for an interpreter of another computer language. I would not have attempted these in another language, given the time I had to write them. And for lines-of-code counters, I have yet to see a program which solves the N - queens problem, where N is specified at run time, and prints the solution boards, with fewer tokens than SNOBOL (although I admit it probably looks as cryptic as APL to the uninitiated): * N-Queens solving program written in SNOBOL4 N = INPUT NM1 = N - 1; NP1 = N + 1; NSZ = N * NP1; &ANCHOR = 1 DEFINE('SOLVE(B)I') TEST = BREAK('Q') 'Q' (ARBNO(LEN(N) '-') LEN(N) 'Q' + | ARBNO(LEN(NP1) '-') LEN(NP1) 'Q' + | ARBNO(LEN(NM1) '-') LEN(NM1) 'Q') P = LEN(NM1) . X LEN(1); L = 'Q' DUPL('-',NM1) ' ' SOLVE() :(END) SOLVE SOLUTION = EQ(SIZE(B),NSZ) SOLUTION + 1 :S(PRINT) B = L B LOOP I = LT(I,N) I + 1 :F(RETURN) B TEST :S(NEXT) SOLVE(B) NEXT B P = '-' X :(LOOP) PRINT OUTPUT = 'Solution number ' SOLUTION ' is:' PRTLOOP B LEN(NP1) . OUTPUT = :S(PRTLOOP)F(RETURN) END 8 -V Berstis From icon-group-request Thu May 7 13:24:59 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 13:24:59 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA04046; Thu, 7 May 92 13:24:52 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA09832; Thu, 7 May 92 13:15:16 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 7 May 92 00:35:34 GMT From: hsi!mlfarm!rosie!ron@uunet.uu.net (Ronald Florence) Organization: Maple Lawn Farm, Stonington, CT Subject: Menu (searches, maintains, displays, & prints recipes) Message-Id: <1992May7.003534.22272@mlfarm.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Every computer has menues. This menu is for food. Menu and the companion program nr (mnemonic for new recipe) maintain and search an index and database of recipes -- from the rec.food newsgroups, email, cookbooks, or notebooks. No special recipe format is required. Menu displays and/or prints on-line recipes, and gives page references for recipes in cookbooks or notebooks. Nr adds new recipes to the database with a few keystrokes. We use the programs on a Sun workstation in our kitchen; a version for Unix systems without X-windows, or ms-dos computers, is also included. Enjoy. Ronald Florence ron@mlfarm.com #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # Readme # Makefile # menu.man # xmenu.S # menu.S # nr.S # xdefault.icn # 1 # 2 # 3 # This archive created: Wed May 6 20:34:57 1992 # By: Ronald Florence (Maple Lawn Farm, Stonington, CT ) export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "extracting 'Readme'" '(6220 characters)' if test -f 'Readme' then echo shar: "will not over-write existing file 'Readme'" else sed 's/^X//' << \SHAR_EOF > 'Readme' XMENU XCopyright 1992 Ronald Florence X XEvery computer has menues. This menu is for food. Menu and the Xcompanion program nr (mnemonic for new recipe) maintain and search an Xindex and database of recipes -- from the rec.food newsgroups, email, Xcookbooks, or notebooks. No special recipe format is required. Menu Xdisplays and/or prints on-line recipes, and gives page references for Xrecipes in cookbooks or notebooks. Searches can use multiple keywords Xor regular expressions; case and word order are not significant. X X menu chicken 'garlic|lemon' --> recipes with chicken AND X either garlic or lemon X X menu venison chili --> recipes for venison chili X X menu 'blond|brown' --> brownies or blondies X X menu '^comp' prune --> on-line recipes with prunes X X menu '^Julia' --> Julia [Child] recipes X XThere are two versions of menu. The X-windows version uses the mouse Xto select on-line recipes for display in separate windows. The Xtermcap-based version, for Unix or ms-dos systems, displays one Xon-line recipe at a time. Both versions include commands for printing Xa recipe. X XSOURCE CODE X XThe source code for menu and nr is in Icon. If your system does not Xhave the Icon programming language, it is available for Unix, ms-dos, Xand many other operating systems from the icon-project@cs.arizona.edu. XThe code for menu uses procedures from the IPL (Icon Program Library) Xdistributed with Icon: the termcap version uses iolib.icn, and the Xms-dos version also uses either regexp.icn or findre.icn. The XX-windows version of menu requires evmux.icn and button.icn, which are Xdistributed with the Icon source code. X XCONFIGURATION X XFor Unix systems, all configuration can be done by setting the Xfollowing variables at the top of the Makefile: X X Indexfile = the full path of the recipe index X Datadir = the full path of the recipe directory, X terminated with `/'. X Printcmd = a command to pretty-print and/or spool an ascii X file. The name of the recipe will be substituted X for a %s in the string. Not used for ms-dos. X Compress = Optional, to store the recipes compressed. X Not used for ms-dos. X Mansuffix = the suffix for local man pages on your system. X X For X-windows sites, set the following: X X Maxwin = maximum number of lines on the windows. X Font = display font. X X For non-X-Windows Unix, you can optionally set: X X Pager = an optional external pager such as more or less, X used instead of the built-in pager. X XFor ms-dos systems, the files have to be configured manually: X X Rename menu.S to menu.icn and nr.S to nr.icn. X Use an editor to substitute the full path of your recipe X index for %INDEXFILE% and the full path of your recipe X directory for %DATADIR% in menu.icn, nr.icn, and menu.man. X Use `\\' as the path separator and the terminator of the X recipe directory path. X Change the link list in menu.icn and the menu.icx entry of the X Makefile to include regexp findre. X If you use regexp, edit menu.icn so regexparser := ReFind; X with findre, regexparser := findre. X Create the recipe directory. X Make sure you have a dos termcap file in place and the TERM X and TERMCAP environment variables set (if you are not X familiar with termcap, see the comments to iolib.icn). X XMany of the configuration parameters can be overridden in the XXresource files for X-Windows, or with environment variables. See the Xman page for details. X XINSTALLATION X XAfter configuring the Makefile, do `make X' for the X-Windows version Xor `make unix' for the termcap version. For ms-dos, you can do `make Xdos' or X X icont menu iolib regexp [or findre] X icont nr X XInstall menu by copying the executables (menu and nr for unix, Xmenu.icx and nr.icx for ms-dos) to the appropriate local binary Xdirectory, and the man page to the appropriate man directory. See Xbelow for adding recipes. X XTo try the program, do `make test.' X XADDING RECIPES X XNr is a simple filter which saves and automatically indexes recipes Xfrom newsgroups, electronic mail, or a scanner. From a mail- or Xnews-reader use the pipe command on the current article: X X | nr "recipe name" "ingredients" X XWith a typed-in or scanned recipe: X X nr "recipe-name" "ingredients" < recipe-file X XYou can customize nr to eliminate additional headers by editing the Xignore list in the code. X XTo add recipes from cookbooks, or recipes pasted into notebooks, use Xan editor to append an entry like one of the following to your recipe Xindex. The first field is the name of the book and a page-number. XThe second field is the name of the recipe. The third field is Xkeywords or ingredients. Use tabs to separate the three fields: X X Julia I-496 Red Cabbage & Sauerkraut bacon, apples X Julia I-300 Bifteck Hache ground venison, wine, thyme, hamburger X Julia Way-340 Hominy Grits butter, milk, cheese, eggs, cream X Julia Way-70 Timbales corn, ham, asparagus, broccoli, eggs X Red-1 Skillet Corn Bread cornmeal X Red-1 Viennese Crescents Gisa, Christmas, almonds X Red-1 Indian Pudding corn meal, molasses, ginger X Red-1 Hickory Nut Cake hickory nuts, egg whites X Red-2 Norwegian Pancakes buttermilk, berries X XYou can use commas in the third field; they are not necessary. The Xfirst field for on-line recipes is Comp-#, where # is the file name of Xthe recipe. These recipes are entered automatically by nr, which Xkeeps track of the file numbers. The recipe index does not need to be Xsorted. X XPERFORMANCE X XThe Unix versions of menu use egrep. Searches with complex regular Xexpressions take less than one second with a 2000-item index on a XSun3. The ms-dos version is slower because it relies on regular Xexpression parsers written in Icon. Putting any regular expression Xlast in the search command may speed things up somewhat. X XDISCLAIMER X XPermission is hereby granted for unlimited non-commercial use of these Xprograms, on condition that the copyright notices are left intact and Xany modifications to the source code are noted as such. No warranty Xof any kind is implied or granted for this material. X XRonald Florence Xron@mlfarm.com X X@(#) version 1.0 (ron@mlfarm.com, 5 May 1992) SHAR_EOF if test 6220 -ne "`wc -c < 'Readme'`" then echo shar: "error transmitting 'Readme'" '(should have been 6220 characters)' fi fi echo shar: "extracting 'Makefile'" '(3035 characters)' if test -f 'Makefile' then echo shar: "will not over-write existing file 'Makefile'" else sed 's/^X//' << \SHAR_EOF > 'Makefile' X# Makefile for menu.icn X# copyright 1992 Ronald Florence X# @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X X# --- Change the following as needed. --- X X# Indexfile = full path of index X# Datadir = directory for recipes, with final path separator X# Printcmd = command to pretty-print and spool printed recipes; X# the name of the recipe will be substituted for %s. X# Compress = (Optional) path of compress command if you want X# recipes stored compressed. X# Mansuffix = system-dependent suffix for man pages X XIndexfile = /home/heather/lib/recipe.index XDatadir = /home/heather/recipes/ XPrintcmd = mp -o -s '%s' | lpr XCompress = XMansuffix = l X X# X-Windows only. X# Font = display font X# Maxwin = maximum lines in a window X XFont = lucidasans-typewriter-12 XMaxwin = 50 X X# Non-X-Windows only. X# Pager = (Optional) name of an external pager (e.g., more, less) X# to use instead of the built-in pager; the print command X# does not work if you use an external pager. X XPager = X X# --- You shouldn't need to make changes below here. --- X XSHELL = /bin/sh XICONT = icont XSRC = xmenu.S menu.S nr.S xdefault.icn X X.SUFFIXES: .icn .u1 .S X X.icn.u1: X icont -c $< X X.icn: X $(ICONT) $@ X X.S.icn: Makefile X rm -f $@ X sed -e 's|%INDEXFILE%|$(Indexfile)|g' \ X -e 's|%DATADIR%|$(Datadir)|g' \ X -e 's/%PRINTCMD%/$(Printcmd)/g' \ X -e 's|%COMPRESS%|$(Compress)|g' \ X -e 's|%MAXWIN%|$(Maxwin)|g' \ X -e 's|%FONT%|$(Font)|g' \ X -e 's|%PAGER%|$(Pager)|g' $< > $@ X chmod 444 $@ X Xdefault: X @echo "make what?" X Xx X: xmenu nr recipedir manpage X ln xmenu menu X Xunix Unix: menu nr recipedir manpage X Xdos ms-dos: menu.icx nr X Xrecipedir: X [ -d $(Datadir) ] || mkdir `dirname $(Datadir)BOGUS` X X# xmenu: xmenu.icn Xxmenu: xdefault.u1 xmenu.icn evmux.u1 button.u1 X $(ICONT) -u $@ X X# menu: menu.icn Xmenu: menu.icn iolib.u1 X $(ICONT) -u $@ X Xnr: nr.icn X $(ICONT) -u $@ X Xmanpage: menu.man Makefile X sed -e 's|%INDEXFILE%|$(Indexfile)|g' \ X -e 's|%DATADIR%|$(Datadir)|g' menu.man > menu.$(Mansuffix) X X# if you use findre.icn instead of regexp.icn, the dependency list X# for menu.icx should be: menu.icn iolib.u1 findre.u1 X Xmenu.icx: menu.icn iolib.u1 regexp.u1 X icont -u menu X Xshar: $(SRC) Readme Makefile menu.man 1 2 3 X shar -a Readme Makefile menu.man $(SRC) 1 2 3 > menu.shar X Xtest: nr 1 2 3 X nr "Best Brownies" "chocolate" < 1 X nr "Blondie Brownies" "chips chocolate" < 2 X nr "Blondies" "butterscotch brownies" < 3 X @echo X @echo "Now try a menu command, like" X @echo " menu 'brown|blond' " X @echo " menu chocolate" X @echo X @echo "If you haven't read the man page (shame!), for X-Windows" X @echo "use the left mouse button to select a recipe, the buttons," X @echo ", m, or b, to page the recipes, or p in a" X @echo "recipe window to print the recipe." X @echo X @echo "For character displays, enter the number of the recipe X @echo "to display, to page, or q to quit. To" X @echo "print a recipe, enter p before the recipe number." X @echo X @echo "Enjoy." X Xclean: X rm -f *.u[12] xmenu menu nr *menu.icn nr.icn X SHAR_EOF if test 3035 -ne "`wc -c < 'Makefile'`" then echo shar: "error transmitting 'Makefile'" '(should have been 3035 characters)' fi fi echo shar: "extracting 'menu.man'" '(2213 characters)' if test -f 'menu.man' then echo shar: "will not over-write existing file 'menu.man'" else sed 's/^X//' << \SHAR_EOF > 'menu.man' X.\" menu.man X.\" copyright 1992 Ronald Florence X.\" @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X.\" X.TH menu LOCAL "4 May 1992" X.SH NAME Xmenu \- recipe database searcher X.br Xnr \- adds recipes to the database X.SH SYNOPSIS X.B menu Xkeyword X[ keyword, ... ] X.PP X.B "| nr" X"recipe name" "ingredients-or-keywords" X.PP X.B nr X"recipe name" "ingredients-or-keywords" < recipe-file X.SH DESCRIPTION X.I Menu Xlooks up on-line and indexed recipes from keywords in the name of the Xrecipe, the list of ingredients, or other information in the index Xentry. Regular expressions can be used in the search: X X menu 'chick.*' 'garlic|coriander' lemon X Xwould find all recipes with chicken X.I or Xchickpeas X.I and Xlemon X.I and Xgarlic or coriander. On most systems regular expressions must be quoted. X XOn-line recipes found in a search can be paged in a window or printed. X.PP X.I Nr Xis used with a pipe command from the newsreader or mailer, or with Xredirction from the command line, to add recipes to the database and Xthe index. Both arguments to X.I nr Xare required; use quotation Xmarks for multi-word arguments. X.SH COMMANDS (X-Windows Version) X.IP "Main Window" X.I Left Xbutton to select a recipe. X.br X.IR Q ", " ^C " or " ^D Xto quit. X.IP "Recipe Windows" X.IR M ", <" space "> or the " left Xbutton to page down X.RI ( more ). X.br X.IR B " or the " middle Xbutton to page up X.RI ( less ). X.br X.IR Q " or the " right Xbutton to return to the main menu. X.br X.I P Xto print the recipe. X.SH COMMANDS (Termcap Version) XEnter the number of an on-line recipe to display the recipe. Precede Xthe number with `p' to print the recipe. The print command works only Xwith the built-in pager. X.SH CONFIGURATION XFor the X-Windows version, the following program defaults can be set Xin $HOME/.Xdefaults or $XAPPLRESDIR/Xmenu: X.nf X.RS XXmenu.font XXmenu.maxwin XXmenu.index XXmenu.datadir X.RE X.fi XFor the Termcap version, an external pager such as X.IR more " or " less Xcan be substituted for the built-in pager, and the program defaults Xfor the index and data directory can be reset with the environment Xvariables X.SM PAGER, X.SM INDEXFILE, Xand X.SM DATADIR. X.fi X.SH FILES X%INDEXFILE% X.br X%DATADIR%* X.SH AUTHOR XRonald Florence (ron\s-2@\s0mlfarm.com). X SHAR_EOF if test 2213 -ne "`wc -c < 'menu.man'`" then echo shar: "error transmitting 'menu.man'" '(should have been 2213 characters)' fi fi echo shar: "extracting 'xmenu.S'" '(5016 characters)' if test -f 'xmenu.S' then echo shar: "will not over-write existing file 'xmenu.S'" else sed 's/^X//' << \SHAR_EOF > 'xmenu.S' X# X# xmenu.icn X# copyright 1992 Ronald Florence X# @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X# X# main window: X# left button to select recipe X# q, ^c, ^d to quit X# recipe windows: X# , m, or left button for more X# b or middle button for less X# p to print X# q or right button to return to main screen X# .Xdefaults options: X# Xmenu.maxwin X# Xmenu.index X# Xmenu.datadir X# Xmenu.font X# Configuration: X# Maxwin : maximum # of lines in the windows X# indexfile: full path of the indexfile X# Data_dir: full path of directory with recipe files X# Font: X-Windows display font X# Print_cmd: pretty-printer and/or spooler; the name of X# the recipe will be substituted for %s X# X Xlink evmux, button, xdefault Xrecord rec_record (win, title, recipe, proc, but) Xglobal Data_dir, Maxwin, Font, Print_cmd, Zcat, R, W X Xprocedure main(arg) X local indexfile, pchar, hits, online, meta_keys, keys, xres, X egrep_cmd, k, m, found, r, index, winsize, title, but X X "X Windows" == &features | stop("Sorry, requires X-Windows.") X xres := xdefault("Xmenu") X Maxwin := \xres["maxwin"] | %MAXWIN% X indexfile := \xres["index"] | "%INDEXFILE%" X Data_dir := \xres["datadir"] | "%DATADIR%" X Font := \xres["font"] | "%FONT%" X Print_cmd := "%PRINTCMD%" X X (*arg > 0) | stop("usage: menu keyword [keyword,...]") X close(open(indexfile)) | stop("can't read indexfile") X pchar := &ascii[32:127] X hits := [] X online := [] X meta_keys := [] X keys := [] X egrep_cmd := "cat " || indexfile X every k := !arg do put(if metas(k) then meta_keys else keys, map(k)) X \meta_keys[1] | put(meta_keys, pop(keys)) X every k := !meta_keys do egrep_cmd ||:= " | egrep -i '" || k || "'" X index := open(egrep_cmd || " 2>&1", "rp") X every !index ? { X find("error"|"grep") & stop("search expression error") X m := map(&subject) X found := 1 X every k := !keys do { find(k, m) | break found := &null } X \found & { X put(if match("Comp-", &subject) then online else hits, X left(tab(many(pchar)), 20) || (tab(upto(pchar)), tab(many(pchar)))) X tab(0) X } X } X *hits + *online = 0 & stop("No matching recipes.") X (winsize := *online * 2 + *hits + 2) <= Maxwin | { X hits |||:= online X online := [] X winsize := *hits + 1 X } X winsize >=:= Maxwin X W := open("menu", "x", "font=" || Font, "cursor=off", "lines=" || winsize, X "columns=80") | stop("no window") X quitsensor(W) X if (*hits + 1) >= winsize then page(W, hits, "menu") X else every write(W, !hits) X R := table() X X every !online ? { X ="Comp-" X r := tab(many(&digits)) X title := (tab(many(' \t')), tab(0)) X but := button(W, r, setup, r, XAttrib(W, "x"), XAttrib(W, "y"), 70, 20) X XGotoRC(W, XAttrib(W, "row"), 21) X write(W, title) X R[r] := rec_record (&null, title, [], &null, but) X } X if *online > 0 then evmux(W) Xend X X Xprocedure setup(win, r) X local rpath, rf, heading X X if *R[r].recipe = 0 then { X rpath := Data_dir || r X rf := open(rpath) | open("zcat " || rpath || ".Z", "rp") | X return writes("\^g") X every put(R[r].recipe, !rf) X close(rf) X } X if /R[r].win then { X heading := R[r].title || " [" || r || "]" X R[r].win := open(heading, "x", "font=" || Font, "cursor=off", X "lines=" || (Maxwin > (*R[r].recipe + 2) | Maxwin), X "columns=80") | stop("no page window") X shadebutton(R[r].but) X R[r].proc := create page(R[r].win, R[r].recipe, R[r].title) X } X @R[r].proc | (R[r].win := &null) Xend X X Xprocedure page(win, rec, title) X local base, x, k, i, e, lines X X lines := XAttrib(win, "lines") X base := 0 X repeat { X XClearArea(win) X XGotoRC(win,1,1) X every i := 0 to lines - 2 do { X if i + base < *rec then writes(win, rec[i+base+1]) X write(win) X } X if lines = Maxwin then { X XAttrib(win, "reverse=on") X writes(win, "--More--(", ((100 > (base+lines-2) * 100/*rec) | 100), "%)") X XAttrib(win, "reverse=off") X } X case (x := XActive()) of { X win : &null X W : @&main X default: every k := key(R) do if (x === R[k].win) then break @R[k].proc X } X if type(e := XEvent(win)) == "integer" then XEvent(win) X else e := map(e) X case e of { X " "|"m"|&lpress: base := *rec > (base+lines-2) X "b"|&mpress: base := (0 < (base-lines+2) | 0) X "q"|&rpress: close(win) & fail X "p": print(rec, title) X } X } Xend X X Xprocedure print(recipe, head) X local prn, rp X X Print_cmd ? { X prn := (/tab(find("%s")) || head) | tab(0) X move(2) & prn ||:= tab(0) X } X rp := open(prn, "wp") X every write(rp, !recipe) X return close(rp) Xend X X Xprocedure metas(str) X X str ? { X tab(many('*+?|')) # initials don't count X while tab(upto('\\*+()|?.$^[')) do { X # a naked backslash is NG X if ="\\" then move(1) | stop("badly-formed search string") X else return .&pos X } X } X fail Xend X X Xprocedure shadebutton(b) X X XAttrib(W, "fillstyle=opaquestippled") X XSetStipple(W, 4, 10, 7, 5, 15) X XFillRectangle(b.win, b.x+1, b.y+1, b.w-1, b.h-1) X XGotoXY(b.win, b.lx, b.ly) X writes(b.win, b.label) Xend X X SHAR_EOF if test 5016 -ne "`wc -c < 'xmenu.S'`" then echo shar: "error transmitting 'xmenu.S'" '(should have been 5016 characters)' fi fi echo shar: "extracting 'menu.S'" '(5268 characters)' if test -f 'menu.S' then echo shar: "will not over-write existing file 'menu.S'" else sed 's/^X//' << \SHAR_EOF > 'menu.S' X# X# menu.icn X# copyright 1992 Ronald Florence X# @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X# X# See xmenu.icn for the X-Windows/X-Icon version. X# X# configuration: X# indexfile := full path of index file X# data_dir := recipe directory X# pager := optional external pager (instead of built-in pager) X# Print_cmd := pretty-printer and/or spooler (for OS with pipes) X# regexparser := (ms-dos only) findre ReFind X X# for ms-dos, use: link iolib, findre link iolib, regexp X Xlink iolib Xglobal Pipes, Print_cmd X Xprocedure main(arg) X local indexfile, data_dir, pager, zcat, hits, online, keys, pchar, X egrep, meta_keys, egrep_cmd, k, index, m, found, search, putout, X out, recipe, rpath, rf, regexparser X X # configuration X indexfile := getenv("INDEXFILE") | "%INDEXFILE%" X data_dir := getenv("RECIPEDIR") | "%DATADIR%" X pager := getenv("PAGER") | "%PAGER%" X Print_cmd := "%PRINTCMD%" X regexparser := X # end of configuration X X (*arg > 0) | stop("usage: menu keyword [regexp,...]") X close(open(indexfile)) | stop("can't read index") X hits := [] X online := [] X keys := [] X pchar := &ascii[32:127] X Pipes := "pipes" == &features X # If we have pipes and egrep (Unix), X # separate the keywords into those with X # metacharacters and those without. If X # there are none with metacharacters, pop X # one off the non-meta list to use with X # an egrep search. X if \Pipes & close(open("/bin/" | "/usr/bin/" | "/usr/ucb/bin" || "egrep")) X then { X meta_keys := [] X egrep_cmd := "cat " || indexfile X regexparser := find X every k := !arg do put(if metas(k) then meta_keys else keys, map(k)) X \meta_keys[1] | put(meta_keys, pop(keys)) X every k := !meta_keys do egrep_cmd ||:= " | egrep -i '" || k || "'" X index := open(egrep_cmd || " 2>&1", "rp") X } X # Without pipes and egrep use findre X # or ReFind for the regular expression X # search. S-l-o-w. X else { X index := open(indexfile) X every put(keys, map(!arg)) X } X # The search is a generator, breaking X # when the find or regexparser fails. We X # then put online recipes in one list X # and the reference recipes in another. X every !index ? { X \egrep_cmd & find("error"|"grep") & stop("search expression error") X m := map(&subject) X found := 1 X every k := !keys do { X search := if /egrep & metas(k) then regexparser else find X search(k, m) | break found := &null X } X \found & { X put(if ="Comp-" then online else hits, X left(tab(many(pchar)), 20) || (tab(upto(pchar)), tab(many(pchar)))) X tab(0) X } X } X X *hits + *online = 0 & stop("No matching recipes.") X \hits[1] & more("RECIPES", hits) X \online[1] & repeat { X more("ON-LINE RECIPES", online) X writes("\nEnter recipe numbers(s): ") X read() ? { X (*&subject = 0) | upto('qQ') & exit(1) X # Print code for the built-in pager. X putout := if upto('pP') then print else more X while tab(upto(&digits)) do { X out := [] X recipe := tab(many(&digits)) X rpath := data_dir || recipe X if close(open(rpath)) then { X if *pager > 0 then system(pager || " " || rpath) X # Put the recipe in a list, so more X # will know how big it is. X else rf := open(rpath) & every put(out, !rf) X } X else if \Pipes then { X rpath ||:= ".Z" X if *pager > 0 then system("zcat " || rpath || " | " || pager) X else { X rf := open("zcat " || rpath, "rp") X every put(out, !rf) X close(rf) X } | write("Can't find " || rpath) X } X \out[1] & putout("RECIPE " || recipe, out, "End of Recipe " || recipe) X } X } X } Xend X X Xprocedure print(recipe, head) X local prn, rp, mode X X if \Print_cmd & \Pipes then { X Print_cmd ? { X prn := (/tab(find("%s")) || head) | tab(0) X move(2) & prn ||:= tab(0) X } X mode := "wp" X } X else if not "MS-DOS" == &features then X return write("Sorry, not configured to print.") X else { X mode := "w" X prn := "PRN" X } X rp := open(prn, "wp") X every write(rp, !recipe) X return close(rp) Xend X X # Procedured modified from R.Goerwitz X # to detect whether a keyword contains X # meta-characters, e.g., whether we X # need a regular expression search. Xprocedure metas(str) X X str ? { X tab(many('*+?|')) X while tab(upto('\\*+()|?.$^[')) do { X if ="\\" then move(1) | stop("badly-formed search string") X else return .&pos X } X } X fail Xend X X # This is kluged to not clear the X # screen or show the percentage X # after -MORE- for the lists of recipes. Xprocedure more(header, what, footer) X static lines X local ans X X initial { X writes(getval("cl")) X lines := 0 X } X /footer | { X writes(getval("cl")) X lines := 0 X } X \header & { X write(getval("md"|"so") || header || ":" || getval("me"|"se")) X lines +:= 1 X } X every !what ? { X write(tab(0)) X ((lines +:= 1 + *&subject/getval("co")) % (getval("li") - 1) = 0) & { X writes(getval("so") || "-MORE-") X \footer & writes("(", (100 > (lines - 2)*100/*what) | 100, "%)") X writes(getval("se")) X ans := read() & writes(getval("up") || getval("ce")) X upto('nNqQ', ans) & fail X } X } X \footer & { X writes(getval("so") || footer || getval("se")) X read() & writes(getval("up") || getval("ce")) X } Xend X SHAR_EOF if test 5268 -ne "`wc -c < 'menu.S'`" then echo shar: "error transmitting 'menu.S'" '(should have been 5268 characters)' fi fi echo shar: "extracting 'nr.S'" '(1535 characters)' if test -f 'nr.S' then echo shar: "will not over-write existing file 'nr.S'" else sed 's/^X//' << \SHAR_EOF > 'nr.S' X# X# nr.icn X# copyright 1992 Ronald Florence X# @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X# X# usage (from news- or mail-reader): X# | nr "recipe name" "keywords" X# X Xprocedure main(arg) X local indexfile, data_dir, noshow, compress, index, num, X seqfile, recipefile, eoh X X indexfile := getenv("INDEXFILE") | "%INDEXFILE%" X data_dir := getenv("RECIPEDIR") | "%DATADIR%" X noshow := ["From ", "Message-Id: ", "Received: ", "Return-path: ", X "Path: ", "Xref: ", "References: ", "Lines: ", "Expires: ", X "Approved: ", "Newsgroups: ", "Subject: ", "Summary: ", X "Keywords: ", "Followup-To: ", "Date: ", "Nf-", "From: ", X "Distribution: ", "In-Reply-to: ", "Reply-To: ", "NNTP-", X "Article-I.D.: ", "Organization: "] X compress := "%COMPRESS%" X X (*arg < 2) & stop("usage: nr \"recipe-name\" \"keywords\" < posted-recipe") X index := open(indexfile, "a") | stop("Can't append to recipe index") X num := 1 X if seqfile := open(data_dir || "seq") then num +:= read(seqfile) X { if (*compress > 0) & "pipes" == &features then X recipefile := open(compress || " -c > " || data_dir || num || ".Z", "wp") X else recipefile := open(data_dir || num, "w") } | X stop("Can't write recipe file") X every !&input ? { X /eoh := *&subject = 0 X if \eoh | not match(map(!noshow), map(&subject)) then X write(recipefile, tab(0)) X } X write(index, "Comp-", num, "\t", arg[1], "\t", arg[2]) X close(\seqfile) X seqfile := open(data_dir || "seq", "w") | stop("Can't update seq file") X write(seqfile, num) Xend X X SHAR_EOF if test 1535 -ne "`wc -c < 'nr.S'`" then echo shar: "error transmitting 'nr.S'" '(should have been 1535 characters)' fi fi echo shar: "extracting 'xdefault.icn'" '(513 characters)' if test -f 'xdefault.icn' then echo shar: "will not over-write existing file 'xdefault.icn'" else sed 's/^X//' << \SHAR_EOF > 'xdefault.icn' X# X# xdefault.icn X# copyright 1992 Ronald Florence X# @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) X# X Xprocedure xdefault(prog) X local res, sys_r, user_r, r X X sys_r := open(\getenv("XAPPLRESDIR") || "/" || prog) | [] X user_r := open(getenv("HOME") || "/.Xdefaults") | [] X res := table() X every !sys_r | !user_r ? if =prog then { X move(1) X r := tab(upto(':')) X tab(many(': \t')) X res[r] := tab(0) X } X type(sys_r) == "file" & close(sys_r) X type(user_r) == "file" & close(user_r) X return res Xend X SHAR_EOF if test 513 -ne "`wc -c < 'xdefault.icn'`" then echo shar: "error transmitting 'xdefault.icn'" '(should have been 513 characters)' fi fi echo shar: "extracting '1'" '(918 characters)' if test -f '1' then echo shar: "will not over-write existing file '1'" else sed 's/^X//' << \SHAR_EOF > '1' XDeirdre's Chocolate Lovers Brownies X XI have tried dozens of brownie recipes over the years and I finally got Xone that has the right flavor and the right consistency. Many thanks to XDeirdre Christman for this fool-proof (it worked for me!) and easy one.. X XIngredients: X X2 sticks of unsalted butter X4 squares of unsweetened chocolate X2 cups sugar (I like a tad less) X4 eggs (if they are jumbo use only 3) X1 cup flour Xpinch salt X1/2 teaspoon vanilla X1 cup chocolate chips X1 cup walnuts (optional) X XTechnique: X XMelt butter and chocolate slowly in a pot large enough to hold all of Xthe ingredients. Cool slightly then add sugar and then beat in one egg Xat a time. Then add vanilla and all of the rest of the ingredients, Xmixing enough just to blend the flour. X XSpread evenly into a greased 9 X 13 pan and bake in a pre-heated 350 degree Xoven for 25 minutes. X XCool several hours before trying to cut or remove from pan. X SHAR_EOF if test 918 -ne "`wc -c < '1'`" then echo shar: "error transmitting '1'" '(should have been 918 characters)' fi fi echo shar: "extracting '2'" '(1423 characters)' if test -f '2' then echo shar: "will not over-write existing file '2'" else sed 's/^X//' << \SHAR_EOF > '2' XBLOND BROWNIES X XThe ingredients are the same as toll house cookies, but the mix is different. XThe beauty of the followin recipie is you can make with few measurements Xwith a minimum of dishes! X X2/3 c. butter or oleo (just chop two sticks at the 1/3 line) X1 lb. brown sugar (just by by the 1lb box and no measuring!) X or 2 1/4 cups X1 t. vanilla (I don't meausre because I love the stuff) X3 eggs X2 1/4 flour (when I'm lazy, I just stir it in until it looks X like enough!) X1/2 bag morsels any flavor, whole bag if you like, nuts too X X XMELT the butter in a 4 qt. sauce pan on low heat XSTIR in brown sugar XSTIR in vanilla XCOOL or the morsles will melt later X XSTIR in eggs X (so far, one pan and one spoon dirty!) XSTIR in flour, a rounded 2 cup liquid measure is about right X as much as 3 cups if you like them dry and cake like XSTIR in morsles X XGREASE a 12x8 pan, better yet a 13x9 baking pan XSPREAD batter in pan X XBAKE 350 oF for 20-25 minutes, use toothpick test. X even if you use less flour and they are gooey like they X should be, they won't stick to the toothpick when done X If you are using a smaller pan (say 11x7) and you brownies X are taller, bake a little longer but don't burn the bottom X-- X <=========================><===================================> X || Christopher Landers || Stamp out Silly Long Signatures! || X <================ landers@zeus.mgmt.purdue.edu ================> SHAR_EOF if test 1423 -ne "`wc -c < '2'`" then echo shar: "error transmitting '2'" '(should have been 1423 characters)' fi fi echo shar: "extracting '3'" '(596 characters)' if test -f '3' then echo shar: "will not over-write existing file '3'" else sed 's/^X//' << \SHAR_EOF > '3' XArchive-Name: recipes/ovo-lacto/butterscotch-brownies X X XButterscotch Brownies X X1/4 c. butter 1 tsp. baking powder X1 c. brown sugar (dark) 1/2 tsp. vanilla X1 egg 1/2 c. chopped nuts X3/4 c. flour X XMelt butter, add other ingredients. Spread in greased 8" x 8" Xpan. Bake 25 minutes at 350. X XNote: I haven't had these in a long, long time, but i seem to Xremember my mom adding butterscotch chips. You could substitute Xchocolate chips if you want. X XI would also sift the baking powder and flour together first Xthen add it to the mixed wet ingredients. X Xpauline Xpmmuggli@uokmax.ecn.uoknor.edu SHAR_EOF if test 596 -ne "`wc -c < '3'`" then echo shar: "error transmitting '3'" '(should have been 596 characters)' fi fi exit 0 # End of shell archive -- Ronald Florence ron@mlfarm.com From icon-group-request Thu May 7 14:23:00 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 14:23:00 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA07925; Thu, 7 May 92 14:22:57 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA15301; Thu, 7 May 92 14:20:23 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 24 Apr 92 21:25:52 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!uwm.edu!linac!uchinews!ellis!goer@ucbvax.berkeley.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr24.212552.9948@midway.uchicago.edu> References: <1992Apr24.162006.6210@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu While we're at it, I'd like to advertize a course in COBOL and FORTRAN programming for computer science students. An advanced course in BASIC will be offered as well. -- -Richard L. Goerwitz goer%ellis@uchicago.bitnet goer@ellis.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-request Thu May 7 16:39:58 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 16:39:58 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA13909; Thu, 7 May 92 16:39:55 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA25871; Thu, 7 May 92 16:36:32 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 25 Apr 92 01:41:36 GMT From: mintaka.lcs.mit.edu!zurich.ai.mit.edu!ara@yale-bulldog.arpa (Allan Adler) Organization: M.I.T. Artificial Intelligence Lab. Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: References: <1992Apr24.162006.6210@dsuvax.dsu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article <1992Apr24.162006.6210@dsuvax.dsu.edu> ghelmer@dsuvax.dsu.edu (Guy Helmer) writes: Following is information about a three-credit graduate course in programming for the humanities offered by Dakota State University via BITNET (and other interconnected networks). Students in the course can be anywhere in the world if they can send and receive electronic mail. [ details of the course deleted] The total cost of the course is $239.82. No textbook is required. Students will be sent a disk containing a public-domain SNOBOL4 compiler and a text editor. Lectures and data files will be sent electronically. Students may audit the course or enroll for credit and receive a grade of Pass or Fail. The cost to audit the course is the same as enrolling for credit. Those who want an electronic registration form or who have questions about the course should send a message to I think this counts as commercial advertising. If someone wants to make the course materials available to people via anonymous ftp, that is one thing. If someone wants to organize a network of volunteers to help people in the humanities learn computers, that is still ok. But this is pure commerce. Aren't there rules about this sort of thing? Allan Adler ara@altdorf.ai.mit.edu From icon-group-request Thu May 7 17:38:18 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 17:38:18 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (4.1/15) id AA16984; Thu, 7 May 92 17:38:15 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA29808; Thu, 7 May 92 17:31:16 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 25 Apr 92 01:37:07 GMT From: s5!sethb@uunet.uu.net (Seth Breidbart) Organization: Morgan Stanley & Co., New York, NY Subject: Re: Computer Programming for the Humanities Course Offering Message-Id: <1992Apr25.013707.17137@fid.morgan.com> References: <1992Apr24.162006.6210@dsuvax.dsu.edu>, Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu In article wand@corwin.ccs.northeastern.edu writes: >I didn't think there were any living SNOBOL programmers left! Well, I was once paid for programming in SNOBOL. Does that count? (But I remember how surprised I was the only time I saw a "help wanted" ad for a SNOBOL programmer!) >in SNOBOL, which is hardly an industrial-strength language with widespread >support! No, but it's a lot of fun! Seth sethb@fid.morgan.com From lrw!leichter@lrw.com Thu May 7 18:25:46 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Thu, 7 May 92 18:25:46 MST Received: from uu.psi.com by optima.cs.arizona.edu (4.1/15) id AA18365; Thu, 7 May 92 18:25:42 MST Received: from lrw.UUCP by uu.psi.com (5.65b/4.1.031792-PSI/PSINet) id AA14042; Thu, 7 May 92 21:00:09 -0400 Message-Id: <9205080100.AA14042@uu.psi.com> Received: by lrw.UUCP (DECUS UUCP w/Smail); Thu, 7 May 92 20:48:09 EDT Date: Thu, 7 May 92 20:48:09 EDT From: Jerry Leichter To: ICON-GROUP@cs.arizona.edu Subject: RE: NAGBOL X-Vms-Mail-To: UUCP%"janpeter@mpi.kun.nl" Why the hell do we get the SNOBOL course message /again/? Is this a provocation? Is there some SNOBOL masochist out there that lives on Flames from ICON users? I've saved up my flame for reposting. :-) (Just kidding.) Anyhow, let's be constructive. Yes, lets. I'd like to know if there is a specific class of programming problems / algorithms for which SNOBOL is a more natural language than Icon. It's hard to beat SNOBOL for specifying patterns and string operations, PURELY ON A SYNTACTIC LEVEL. Yes, Icon can do all of that - but you have to add various syntactic elements that are, in a way, extraneous to the problem. A grammer in traditional form pretty much IS a SNOBOL pattern definition. If what you are doing is easily and naturally describable as matching a pattern defined by a grammer against a string, SNOBOL will give you a very concise and transparent program for it. I am aware of the more esoteric capabilities of SNOBOL, but I'd like to know in what situations these functions are actually /useful/. Many years ago someone told me enthusiastically that one could write a LISP program that could modify itself! Since that day I've never seen one useful LISP program that used this capability. Is that the case with SNOBOL too, or are there many SNOBOL programmers who use those (e.g. CODE, or "variable labels") capacities daily? Absolutely! LISP users commonly use packages that read in code only when it is actually needed - one package I recall was named SLURP. Similar things have been done in SNOBOL - Gimpel's Algorithms in SNOBOL4 has a nice example. It's also possible to write debuggers which allow you to type in SNOBOL code on the fly and evaluate it. I've seen a number of tools of this general sort. I took it to its logical extreme in a system I wrote years ago called APLBOL. APLBOL, which was built on SITBOL on PDP-10's and -20's, had the same user interface as APL, although the language was (of course) SNOBOL. The only "fixed" code in the system was the APLBOL implementation; every line of code a user wrote was actually "established" by CODE(). Worked quite nicely, and it was great for quick and easy development. (Had some amazing hacks in it to make it work, though. Unfortunately, some of the central hacks were based on SITBOL-specific extensions, so it won't work on any other SNOBOL.) Now, you could argue that APLBOL wasn't SELF-modifying - the APLBOL code modified the user code, not itself, and the user code did NOT modify itself. But that's just the point: Self-modification if uncontrolled is a disaster; but self-modification fit into a rational scheme is extremely useful. (Actu- ally, it WAS possible to modify the APLBOL code, if you knew how and ignored the "don't do this or you may be screwed" rules, which basically reserved a certain name space to internal routines. This could be VERY handy for debugging, but was otherwise not recommended. However, there were a couple of "documented" hooks so that, for example, you could insert a pre-processor that would muck with code before it was handed to CODE().) -- Jerry From dnehme@ccwf.cc.utexas.edu Fri May 8 06:31:30 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Fri, 8 May 92 06:31:30 MST Received: from dopey.cc.utexas.edu by optima.cs.arizona.edu (4.1/15) id AA17389; Fri, 8 May 92 06:31:26 MST Received: by dopey.cc.utexas.edu (5.61/1.34/CCWF 1.18) id AA11767; Fri, 8 May 92 08:31:22 -0500 Date: Fri, 8 May 92 08:31:22 -0500 From: dnehme@ccwf.cc.utexas.edu (David Nehme) Message-Id: <9205081331.AA11767@dopey.cc.utexas.edu> To: icon-group@cs.arizona.edu Subject: unsubscribe me Please Unsubscribe me from this list. Thank you. David Nehme dnehme@ccwf.cc.utexas.edu (512) 343-6975 From MATH0022@rmc.ca Fri May 8 10:08:34 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Fri, 8 May 92 10:08:34 MST Received: from Arizona.edu (Merlin.Telcom.Arizona.EDU) by optima.cs.arizona.edu (4.1/15) id AA03206; Fri, 8 May 92 10:08:30 MST Received: from RMC.CA (MAILER@RMC) by Arizona.edu (PMDF #12663) id <01GJRJVZRYI8AKTJ91@Arizona.edu>; Fri, 8 May 1992 10:08 MST Received: by RMC (Mailer) id 45286592920; Fri, 08 May 92 12:06:11 EST Date: Fri, 08 May 92 12:05:24 EST From: MATH0022@rmc.ca Subject: SNOBOL 4 "far-out" features. To: icon-group@cs.arizona.edu Reply-To: LINDSAY_JH@rmc.ca Message-Id: <920508.12052540.004982@RMC.CP6> X-Envelope-To: icon-group@cs.Arizona.edu As a SNOBOL enthusiast ever since I ran into Mr. Poage (of the famous "green book" by Griswold, Poage and Polonsky) at a SHARE meeting in the sixties, perhaps I can add a few notes about some of the uses of CODE() and other SNOBOLish things that I'll probably miss in ICON as I start using it. As with other experienced programmers, experienced SNOBOL programmers don't pull rabbits out of hats unless (1) a rabbit is definitely called for, and (2) a hat is the most reasonable place to get the particular type of rabbit needed. The thing about SNOBOL is (1) that it has a few very nice hats complete with top-quality rabbits, and (2) any such infrequently used and hence less understood features, whether hats or programming language facilities, may be poorly used, misused, or abused. In our attempt to improve the quality of many programming languages, we have dropped some features with low frequency of use or which were subject to poor use and misuse, in spite of consequent loss of facilities in some cases. There are ways to code around almost any lack of features. I'm not speaking here of things which can't be done any other way, but of things that I have to do every once in a while, and then want to do in a simple, elegant, readable, understandable way at least to me, the one who has to construct and maintain the code for project, often a short-lived research-oriented one. Now, I have to concede that some aspects of SNOBOL, like Mathematical notation, are pretty dense to the uninitiated, but I'll add that the language and its customs and idioms grow on the user very quickly, and it becomes expressive and quite powerful. I've put away some of the things I find less desirable about SNOBOL with a bit of a preprocessor (PREP0); I'm pleased to note that I shouldn't need it with ICON, but then there are the other things like CODE() and the unary * operator (procedures and expressions as dynamically constructable, manipulable data), EVAL(), explicit names of variables (via the . operator) and indirects, and NRETURN, .... I coded an assembler of sorts a long time ago. It was a typical two- pass assembler with some macro capabilities. The easiest way to switch from pass 1 to pass 2 was to reDEFINE() a number of procedures. The ICON equivalent is just an assignment. But macro definitions were converted into executable code on the fly; the bodies of macro code were CONSTRUCTED out of the macro definitions as the definitions were read during assembly. In ICON, it appears that this sort of thing would be done in two ICON invocations, and then with the loss of a REdefinition capability. I've done several programs which involved complex ways of disposing of some values (other than just assigning them to a variable, or storing them in table or array elements, say with both constructing hash headers and making multiple connections to or from the data being stored), but where the complexities of the action hid the attempt to dispose of the data so that the overall handling of the data was hidden. I cooked up a SNOBOL4 way to write such disposition of data as the assignment to a pseudovariable -- if you like, a way to overload the assignment operator with a parameterized routine. Now don't think that such syntactical and symantic nicities don't have their very significant uses. There's a "war story" about a service bureau in Ottawa in the days before PC's with word processors. They offered a text entry and retrieval service based on a then-old I.B.M. mainframe system called ATS (Administrative Terminal System). About the 3rd. or 4th. release of ATS, there was a change in the internal format of the archive tapes of ATS, and users going to the next version of ATS would have lost access to their archived material. First, the service bureau did a utility to convert old format archive tapes to new format ones in a system language called PL360 -- a language which gave access to most of the mainframe machine instructions and data types with a syntax that was based on ALGOL 60. It took about 10 minutes of C.P.U. time on an I.B.M. model 65 to convert a full 2400 foot archive tape reel. But there were a few glitches, the complexity of which made it unreasonable to do a thorough job in PL360 or any other available 'normal' language. Enter SPITBOL 360, a very fast implementation of SNOBOL4. It was reasonable and simple to write a SNOBOL4 routine which recognized and processed the old format archive tapes into new format ones. Running speed ? About 30 minutes per full tape on the same machine, and most importantly, because of the expressiveness of SNOBOL4, the reformatting was without error. Not industrial strength ? Of course, I don't know if that application used any of my list of far-out features, but we can see the rather large number of prototypes and first versions of compilers and preprocessors that have been done in SNOBOL4, many of which did use one or perhaps two of them. I consulted with a colleague who did simulation of learning processes in SNOBOL4 (my suggestion for the language). The thing that gave him a plus in SNOBOL4 was the ability to determine and compute a learning process during processing, CODE() it, and use it. Later on, he switched to a Lisp, initially with the loss of some of the facilities he had been making good use of. Mostly, that was because he found that the rest of the community he was working and communicating with were also using Lisp, and it wasn't until later versions of Interlisp became available that he recovered the features he had been using, and could persue some of his own thoughts. Yes, I say some of the far-out features, features which in other languages would be thought of as giving rise to uncontroled, unstructured programming are important, even if used only once in a while and by a few. -------------------------------------------------------------------------------- John H. Lindsay, Department of Mathematics and Computer Science, Royal Military College of Canada, Kingston, Ontario, Canada, K7K 5L0. Phones: Office, (613) 541-6419 Messages, 541-6343 or 541-6458 Home, 546-6988 E-Mail: From Bitnet, NetNorth, ONet: LINDSAY_JH@RMC.CA From Canadian Military Colleges: LINDSAY JH@RMC Fax: (613) 542-8129 John H. Lindsay, Dept. of Math. & C. S., Royal Military College of Canada From cliff Fri May 8 16:05:42 1992 Received: from javelina.cs.arizona.edu by cheltenham.cs.arizona.edu; Fri, 8 May 92 16:05:42 MST Date: Fri, 8 May 92 16:05:42 MST From: "Cliff Hathaway" Message-Id: <9205082305.AA12509@javelina.cs.arizona.edu> Received: by javelina.cs.arizona.edu; Fri, 8 May 92 16:05:42 MST To: icon-group-file Subject: Icon-group mailing list You have been added to the Icon-Group list. This mailing list is meant to be a common meeting area for persons interested in the Icon programming language. Topics for discussion include (but are not limited to): Programming Techniques - Style - Efficiency - Idioms - Pros and Cons of certain constructs - Clever ways to accomplish a certain task Theoretical Aspects Icon in relation to other languages Applications of Icon Implementation Issues Porting Icon to other machines History/Origins Idea/Wish Lists Announcement/Exchange of programs and procedures Bugs Items of interest should be mailed to icon-group@cs.arizona.edu. Mail is immediately redistributed to all persons on the list. It's good practice to include a signature giving your name and email address, because not all mailers preserve these. Requests for addition or removal from the list should be sent to icon-group-request@cs.arizona.edu. This mailing list does not subsume the function of the icon-project mailbox that we currently maintain. Rather, the mailing list supplements it. Icon questions that may not be appropriate for icon-group can be sent to icon-project. If you are in doubt, send to icon-project, note your uncertainty, and we'll see it ends up in the correct place. If you submit an item to Icon-group and get back failure notifications for individuals, you can help eliminate this problem by mailing such messages to icon-group-REQUEST. (Our software tries to arrange for failure notifications to be sent to us, but it's a moving target type problem.) From icon-group-sender Tue May 12 22:20:31 1992 Received: by cheltenham.cs.arizona.edu; Wed, 13 May 92 05:58:29 MST Date: 13 May 92 01:21:45 GMT From: hsi!mlfarm!rosie!ron@uunet.uu.net (Ronald Florence) Organization: Maple Lawn Farm, Stonington, CT Subject: menu (recipe database parser) - patch 1 Message-Id: <1992May13.012145.2360@mlfarm.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Last week I posted menu, a set of programs which search and maintain a recipe database. The following patch covers some minor `oops' in the termcap and X-windows versions. To apply, cut on the dotted lines, run through `patch' and rebuild. ----------------------[menu patch]--------------------- *** Makefile.orig Fri May 8 13:05:25 1992 --- Makefile Tue May 12 21:12:24 1992 *************** *** 1,6 **** # Makefile for menu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) # --- Change the following as needed. --- --- 1,6 ---- # Makefile for menu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.1 (ron@mlfarm.com, 12 May 1992) # --- Change the following as needed. --- *************** *** 50,56 **** rm -f $@ sed -e 's|%INDEXFILE%|$(Indexfile)|g' \ -e 's|%DATADIR%|$(Datadir)|g' \ ! -e 's/%PRINTCMD%/$(Printcmd)/g' \ -e 's|%COMPRESS%|$(Compress)|g' \ -e 's|%MAXWIN%|$(Maxwin)|g' \ -e 's|%FONT%|$(Font)|g' \ --- 50,56 ---- rm -f $@ sed -e 's|%INDEXFILE%|$(Indexfile)|g' \ -e 's|%DATADIR%|$(Datadir)|g' \ ! -e "s/%PRINTCMD%/$(Printcmd)/g" \ -e 's|%COMPRESS%|$(Compress)|g' \ -e 's|%MAXWIN%|$(Maxwin)|g' \ -e 's|%FONT%|$(Font)|g' \ *** menu.S.orig Fri May 8 13:10:34 1992 --- menu.S Tue May 12 21:12:43 1992 *************** *** 1,7 **** # # menu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) # # See xmenu.icn for the X-Windows/X-Icon version. # --- 1,7 ---- # # menu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.1 (ron@mlfarm.com, 12 May 1992) # # See xmenu.icn for the X-Windows/X-Icon version. # *************** *** 119,125 **** if \Print_cmd & \Pipes then { Print_cmd ? { ! prn := (/tab(find("%s")) || head) | tab(0) move(2) & prn ||:= tab(0) } mode := "wp" --- 119,125 ---- if \Print_cmd & \Pipes then { Print_cmd ? { ! prn := (\tab(find("%s")) || head) | tab(0) move(2) & prn ||:= tab(0) } mode := "wp" *** xmenu.S.orig Fri May 8 13:10:00 1992 --- xmenu.S Tue May 12 21:13:00 1992 *************** *** 1,7 **** # # xmenu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.0 (ron@mlfarm.com, 5 May 1992) # # main window: # left button to select recipe --- 1,7 ---- # # xmenu.icn # copyright 1992 Ronald Florence ! # @(#) version 1.1 (ron@mlfarm.com, 12 May 1992) # # main window: # left button to select recipe *************** *** 65,81 **** } } *hits + *online = 0 & stop("No matching recipes.") ! (winsize := *online * 2 + *hits + 2) <= Maxwin | { hits |||:= online online := [] ! winsize := *hits + 1 } winsize >=:= Maxwin W := open("menu", "x", "font=" || Font, "cursor=off", "lines=" || winsize, "columns=80") | stop("no window") quitsensor(W) ! if (*hits + 1) >= winsize then page(W, hits, "menu") ! else every write(W, !hits) R := table() every !online ? { --- 65,84 ---- } } *hits + *online = 0 & stop("No matching recipes.") ! (winsize := *online * 2 + *hits + 1) <= Maxwin | { hits |||:= online online := [] ! winsize := *hits } winsize >=:= Maxwin W := open("menu", "x", "font=" || Font, "cursor=off", "lines=" || winsize, "columns=80") | stop("no window") quitsensor(W) ! if *hits > winsize then page(W, hits, "menu") ! else { ! every write(W, !hits) ! (*online > 0) | evhandle(W) ! } R := table() every !online ? { *************** *** 151,157 **** local prn, rp Print_cmd ? { ! prn := (/tab(find("%s")) || head) | tab(0) move(2) & prn ||:= tab(0) } rp := open(prn, "wp") --- 154,160 ---- local prn, rp Print_cmd ? { ! prn := (\tab(find("%s")) || head) | tab(0) move(2) & prn ||:= tab(0) } rp := open(prn, "wp") --------------------------[eof]------------------------ -- Ronald Florence ron@mlfarm.com From icon-group-sender Sat May 16 00:41:37 1992 Received: by cheltenham.cs.arizona.edu; Sat, 16 May 92 11:34:42 MST Date: 14 May 92 16:31:16 GMT From: emory!gwinnett!yngbld!zeta@gatech.edu (SYSTEM OPERATOR) Organization: TCS Constulting Services, Peachtree City, GA Subject: Latest icon version...what is it? Message-Id: Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Errors-To: icon-group-errors@cs.arizona.edu I've been out of the mainstream for a while.. what is the latest version if Icon? both for DOS and OS/2? Is the os/2 version for 2.0? Is one planned? When will it be out if it isn't now? I'm also interested in getting a compiler and not just interpreter...how much does it cost? [Note-I have 386-33, 8 megs ram, dos 5, and soon os/2 2.0] thanx Gre From icon-group-sender Tue May 19 18:55:54 1992 Received: by cheltenham.cs.arizona.edu; Wed, 20 May 92 04:35:50 MST Date: 1 May 92 09:17:56 GMT From: eru.mt.luth.se!lunic!sunic2!mcsun!uknet!ox-prg!onions.natcorp!dominic@bloom-beacon.mit.edu (Dominic Dunlop) Organization: British National Corpus, Oxford University, GB Subject: Icon documentation in info format anywhere? Message-Id: <3397@inca.comlab.ox.ac.uk> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Has anybody out there taken the time and trouble to cast the Icon documentation into info format so that it can be accessed on-line from inside emacs? A search by the nearest Archie server reveals nothing hopeful, so I'm asking in this forum on the off-chance. (And because I'm too lazy to do the work myself...) Thanks... -- Dominic Dunlop From icon-group-sender Wed May 20 00:11:39 1992 Received: by cheltenham.cs.arizona.edu; Wed, 20 May 92 04:36:22 MST Date: 1 May 92 14:35:36 GMT From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!stortek!LSTC2VM.stortek.com!WILLS@ucbvax.berkeley.edu (Cheyenne Wills) Organization: StorageTek SW Engineering Subject: Re: cms problem Message-Id: <167DA78DC.WILLS@LSTC2VM.stortek.com> References: <92120.115123U47041@uicvm.uic.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In article <92120.115123U47041@uicvm.uic.edu> writes: > >hi there i 'm trying to use icon in cms 5.0 >when i enter ICONT HELLO -X >to test the program from the distribution tape >i get the foll. messg. from the machine > > >dms116s loader table overflow >invalid cms command > > >(end of messg.) >any sugestions? >thanx >u47041@uicvm.bitnet >kapoulas@lac.math.uic.edu You want to issue "SET LDRTBLS 12" from the cms command line (or place the statement into your "PROFILE EXEC"). Cheyenne Wills From icon-group-sender Wed May 20 10:14:11 1992 Received: by cheltenham.cs.arizona.edu; Wed, 20 May 92 14:10:29 MST Date: 19 May 92 11:30:14 GMT From: hsi!mlfarm!rosie!ron@uunet.uu.net (Ronald Florence) Organization: Maple Lawn Farm, Stonington, CT Subject: menu (recipe database parser & maintainer) Message-Id: <1992May19.113014.8093@mlfarm.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu The source code for the menu and nr programs are now available via anonymous ftp from cs.arizona.edu, in directory /icon/contrib/menu. The distribution includes the source for X-windows, Unix, and ms-dos implementations, auxiliary files, and files from the Icon Program Library which are used in building menu. Menu and nr parse, display, and maintain a database of recipes. The programs are written in Icon. If you do not have Icon for your system, it is available via ftp from cs.arizona.edu, or on various media from icon-project@cs.arizona.edu. -- Ronald Florence ron@mlfarm.com From icon-group-sender Wed May 20 11:18:20 1992 Received: by cheltenham.cs.arizona.edu; Wed, 20 May 92 14:10:42 MST Date: Wed, 20 May 92 11:18:20 MST From: "Ralph Griswold" Message-Id: <9205201818.AA26342@cheltenham.cs.arizona.edu> To: icon-group Subject: UNIX Executables for Version 8.6 of Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu Precompiled packages containing the Version 8.6 Icon interpreter and compiler are now available via FTP for the following UNIX platforms: Convex C240 DEC MIPS HP 9000/800 Intel 386, System V, Release 4 SGI Iris NeXT Sun 3 Sun 4 (Sparc) Sequent Symmetry In addition to the executable files, the libraries and other files needed by the Icon compiler are included in the packages. X facilities are enabled for most platforms. To get a package, do an anonymous FTP to cs.arizona.edu and cd /icon/binaries/unix The READ.ME there contains instructions for installing packages. The subdirectories identify the platforms for which packages are available. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sat May 23 07:18:58 1992 Received: by cheltenham.cs.arizona.edu; Sat, 23 May 92 14:29:13 MST Date: 21 May 92 16:10:12 GMT From: wupost!cs.utexas.edu!utgpu!cunews!nrcnet0!furlong@gumby.wisc.edu Organization: National Research Council of Canada Subject: Icon for reading 16-bit bytes Message-Id: <1992May21.161012.24026@nrcnet0.nrc.ca> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Does anyone know if it is possible to modify Icon so that byte size (when reading data is 16 bits, and not 8? We are working on a project in which we need to readinput files which may have various formatting done to them (i.e different fonts, type size, underlining, etc.) and it would be useful to be able to read this as part of a single character (i.e. one 16-bit byte) instead of an on/off "flag",as in "underlining starts here" "underlining ends here". If anyone has heard/done anything involving this kind of modification, please respond by e-mail to the either of the following addresses: furlong@selaix.iit.nrc.ca furlong@iit.nrc.ca Thanks in advance, Andrew Furlong -- Andrew Furlong | The views expressed herein are mine alone, Summer Research Assistant | and may not reflect those of the National furlong@selaix.iit.nrc.ca | Research Council of Canada or the Government National Research Council (NRCC) | of Canada. From icon-group-sender Sat May 23 19:50:42 1992 Received: by cheltenham.cs.arizona.edu; Sun, 24 May 92 06:06:03 MST Date: 21 May 92 18:21:16 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.berkeley.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: Icon for reading 16-bit bytes Message-Id: <1992May21.182116.16103@midway.uchicago.edu> References: <1992May21.161012.24026@nrcnet0.nrc.ca> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu furlong@selaix.iit.nrc.ca writes: > > Does anyone know if it is possible to modify Icon so that byte size (when > reading data is 16 bits, and not 8? We are working on a project in which > we need to readinput files which may have various formatting done to them > (i.e different fonts, type size, underlining, etc.) and it would be useful > to be able to read this as part of a single character (i.e. one 16-bit byte) > instead of an on/off "flag",as in "underlining starts here" > "underlining ends here". (BTW: Isn't this how the standard curses libraries work?) This is surely of general interest. If anyone has modified Icon to support long characters, please *post* as well. The ANSI specs actually include a lot of library functions for "long" characters, and 10646 and Unicode specify 32 and 16-bit specs for international character assortments. People have been talking about long characters for a long time, and nothing so far has material- ized. Ken, Ralph, Clint, etc.: How easy would it be to modify Icon to accept alternate character sizes? -- -Richard L. Goerwitz goer%ellis@uchicago.bitnet goer@ellis.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Sun May 24 07:28:52 1992 Received: by cheltenham.cs.arizona.edu; Sun, 24 May 92 07:29:06 MST Date: Sun, 24 May 92 07:28:52 MST From: "Ralph Griswold" Message-Id: <9205241428.AA29946@cheltenham.cs.arizona.edu> To: goer@midway.uchicago.EDU, icon-group Subject: "large" characters Status: R Errors-To: icon-group-errors@cs.arizona.edu We've thought off and on about extended character sets -- it's a "natural" for a language like Icon. There are design problems, but the real problems are in the implementation. Since Icon has so many operations on strings, any changes to the handling of characters would require massive changes in the implementation. The plain fact is that we're unlikely to do anything along these lines. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sun May 24 11:47:55 1992 Received: by cheltenham.cs.arizona.edu; Sun, 24 May 92 15:47:49 MST Date: Sun, 24 May 92 11:47:47 PDT From: wgg@cs.ucsd.edu (William Griswold) Message-Id: <9205241847.AA25923@gremlin.ucsd.edu> To: icon-group@cs.arizona.edu Subject: Re: "large" characters Status: R Errors-To: icon-group-errors@cs.arizona.edu Another approach to handling this problem is for the programmer to create his/her own abstractions for long characters, defining long-character operations that are analogous to the existing operations. This would surely be tedious to get started, but once done could be very useful. Because Icon does not have extendable operations (e.g., being able to overload or redefine "?"), this would not be syntically pretty. bill From icon-group-sender Sun May 24 13:07:22 1992 Received: by cheltenham.cs.arizona.edu; Sun, 24 May 92 15:47:58 MST Date: 24 May 92 18:42:56 GMT From: att!linac!uchinews!ellis!goer@ucbvax.berkeley.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: "large" characters Message-Id: <1992May24.184256.1039@midway.uchicago.edu> References: <9205241428.AA29946@cheltenham.cs.arizona.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu ralph@CS.ARIZONA.EDU ("Ralph Griswold") writes: > >The plain fact is that we're unlikely to do anything along [the lines >of 16-bit or greater character widths]. I've heard the word "never" many, many times from you and your tireless staff, and later seen things nobody imagined would happen come to realiz- ation. Not that wide characters should necessarily be on the list; just that some day there might be sufficient demand and intrinsic C library/ OS support that wide characters might seem a more natural thing than they might seem now. Right now, I admit that there's not much point, since nobody really does anything standard with the upper 8 bits anyway. ISO 10646 and Unicode are still under development, and none of the vendors has done anything more than to express a commitment for the long haul. Just how ingrained is the 8-bit character in Icon, anyway? Isn't it more the assumption character width = byte width = unit returned by the sizeof operator in C? I read the implementation book cover to cover a year ago, but some of the details have escaped me. Could somebody (not necessarily Ralph) perhaps refresh our collective memories on where the implementation, as it stands, really has to have a specific character size? -- -Richard L. Goerwitz goer%ellis@uchicago.bitnet goer@ellis.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Mon May 25 05:25:26 1992 Received: by cheltenham.cs.arizona.edu; Mon, 25 May 92 05:41:08 MST Date: Mon, 25 May 1992 07:26 CST From: Chris Tenaglia - 257-8765 Subject: Re: Icon for reading 16-bit bytes To: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.berkeley.edu Cc: icon-group@cs.arizona.edu Message-Id: <01GKF57CGJIO984PUJ@mis.mcw.edu> X-Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.berkeley.edu" X-Vms-Cc: IN%"icon-group@cs.arizona.edu" Status: R Errors-To: icon-group-errors@cs.arizona.edu From: IN%"cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.berkeley.edu" 24-MAY-1992 08:11:56.52 To: IN%"icon-group@cs.arizona.edu" Subj: RE: Icon for reading 16-bit bytes furlong@selaix.iit.nrc.ca writes: > > Does anyone know if it is possible to modify Icon so that byte size (when > reading data is 16 bits, and not 8? We are working on a project in which > we need to readinput files which may have various formatting done to them > (i.e different fonts, type size, underlining, etc.) and it would be useful > to be able to read this as part of a single character (i.e. one 16-bit byte) > instead of an on/off "flag",as in "underlining starts here" > "underlining ends here". I think this particular application is best handled as a separate case. It is best done coding with extant icon rather than trying to force it thru a reimplementation of the language. There is something called UNICODE which is a 16bit character set designed to include all the characters of most languages. The concept of having 256 copies of ascii to handle every imaginable permutation of video attributes and font selection is not what UNICODE is about. In the case of video attributes, they are done usually at the hardware level usually as a bit mask, and the roms in a terminal map these via escape sequences. Fonts are actually another issue altogether. If there was an easy work around, I'm sure postscript would not be where it is today. When UNICODE is widespread, it will probably be built into the operating system (wel it better be) and little or no reeingineering should be required. Perhaps edit a few #DEFINEs and mass compile, and poof! 16 bit byte icon. Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu From icon-group-sender Mon May 25 05:36:44 1992 Received: by cheltenham.cs.arizona.edu; Mon, 25 May 92 05:41:27 MST Date: Mon, 25 May 1992 07:37 CST From: Chris Tenaglia - 257-8765 Subject: Holiday Offering To: icon-group@cs.arizona.edu Message-Id: <01GKF5LBRLEE984PUJ@mis.mcw.edu> X-Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Status: R Errors-To: icon-group-errors@cs.arizona.edu Bizaare Verse Generator: This is another holiday, and I have a splash of code. It's not real pretty. But it's fun to watch. I don't remember if I posted this one, but I'm sure there are new subscribers who might get a kick out of it. This verse maker was initially published in an early 1980s Byte magazine in TRS80 Basic. In 1985 I translated it to BASICA, and in 1987 I translated it icon. Recently, I've polished it to fetch the vocabulary all from one file. This message contains the program. A subsequent message will contain a sample vocabulary file. You'll notice that ! beginning a line designate a comment, and %xxx designates the parts of speech to be loaded. There are 19 sentense patterns, 4 title patterns, and 2 concluding patterns. Usage: iconx verse [vocab] If you don't specify a vocabulary file it looks for verse.dat by default. ################################################################### # # # VERSE.ICN 1/9/92 BY CHRIS TENAGLIA # # # # NOW ICON CAN GENERATE WIERD POETRY ! # # # ################################################################### global nouns,nounp,adjt,advb,more,most,ivpre,ivpas,tvpre,tvpas,prep global being,art,ques,cond,nompro,punc,noun1,noun2,tv,iv,adjv,prpo global be,pun,pron,con,ar,tnnum,tadjno,ttvnum,tprnum,cls,name,watch procedure main(param) &random := map(&clock,":","0") #randomize nouns := [] #singular nouns nounp := [] #plural nouns adjt := [] #adjectives advb := [] #adverbized more := [] #more adjective most := [] #most adjective tvpas := [] #transitive verb past tvpre := [] #transitive verb present ivpas := [] #intransitive verb past ivpre := [] #intransitive verb present prep := [] #prepositions punc := [] #punctuations art := [] #articles of speech ques := [] #question words being := [] #being verbs cls := "\e[H\e[2J" #clear screen string (or system("clear")) ############################################################## # # # load the vocabulary arrays # # # ############################################################## name := param[1] | "verse.dat" (in := open(name)) | stop("Can't open vocabulary file (",name,")") part := "?" ; watch := "?" write(cls,"VERSE : AI Mysterious Poetry Generator\n\nInitializing\n\n") while line := read(in) do { if match("%",line) then { part := map(trim(line[2:0])) write("Loading words of type ",part) next } tmp := parse(line,'|@#') case part of { "noun" : { put(nouns,tmp[1]) put(nounp,tmp[2]) } "adjt" : { put(adjt,tmp[1]) put(advb,tmp[2]) put(more,tmp[3]) put(most,tmp[4]) } "ivrb" : { put(ivpre,tmp[1]) put(ivpas,tmp[2]) } "tvrb" : { put(tvpre,tmp[1]) put(tvpas,tmp[2]) } "prep" : put(prep,line) "been" : put(being,line) default: write("Such Language!") } loadrest() } close(in) reply := "" while map(reply) ~== "q" do { # # output the title # (Out := open("a.out","w")) | stop ("can't open a.out for some reason!") t := ?7 tnnum := ?*(nouns) #title noun selector tadjno:= ?*(adjt) #title adjective selector ttvnum:= ?*(tvpre) #title transitive verb selector tprnum:= ?*(prep) #title preposition selector clrvdu() write(title(t)) write(Out,title(t)) write() write(Out) # # output the lines # every 1 to (12+?6) do { noun1 := ?*(nouns) noun2 := ?*(nouns) tv := ?*(tvpre) iv := ?*(ivpre) adjv := ?*(adjt) prpo := ?*(prep) be := ?*(being) pun := ?*(punc) pron := ?*(nompro) con := ?*(cond) ar := ?*(art) case ?19 of { 1 : {write(form1()) ; write(Out,form1())} 2 : {write(form2()) ; write(Out,form2())} 3 : {write(form3()) ; write(Out,form3())} 4 : {write(form4()) ; write(Out,form4())} 5 : {write(form5()) ; write(Out,form5())} 6 : {write(form6()) ; write(Out,form6())} 7 : {write(form7()) ; write(Out,form7())} 8 : {write(form8()) ; write(Out,form8())} 9 : {write(form9()) ; write(Out,form9())} 10 : {write(form10()) ; write(Out,form10())} 11 : {write(form11()) ; write(Out,form11())} 12 : {write(form12()) ; write(Out,form12())} 13 : {write(form13()) ; write(Out,form13())} 14 : {write(form14()) ; write(Out,form14())} 15 : {write(form15()) ; write(Out,form15())} 16 : {write(form16()) ; write(Out,form16())} 17 : {write(form17()) ; write(Out,form17())} 18 : {write(form18()) ; write(Out,form18())} 19 : {write(form19()) ; write(Out,form19())} } } # last line case ?2 of { 1 : { write(nounp[tnnum]," ",prep[prpo]," THE ",nouns[noun1], " ",being[be]," ",adjt[tadjno],".") write(Out,nounp[tnnum]," ",prep[prpo]," THE ",nouns[noun1], " ",being[be]," ",adjt[tadjno],".") } 2 : { write("THE ",nounp[tnnum]," OR ",nouns[noun1]," ", adjt[adjv]," ",being[be],".") write(Out,"THE ",nounp[tnnum]," OR ",nouns[noun1]," ", adjt[adjv]," ",being[be],".") } } close(Out) write() writes("Press for another, Q to quit, or a name to save it>") reply := read() if (reply ~== "Q") & (trim(reply) ~== "") then { (In := open("a.out")) | stop ("can't open a.out for some reason!") (Out := open(reply,"w")) | stop ("can't open ",reply) while write(Out,read(In)) close(In) ; close(Out) } } end ####################################################################### procedure aoran(word) vowels := 'AEIOU' if any(vowels,word) then return ("AN " || word) else return ("A " || word) end ####################################################################### procedure clrvdu() writes(cls) end ####################################################################### procedure gerund(word) static vowel initial vowel := 'AEIOU' if word[-1] == "E" then word[-1] := "" return(word || "ING") end ###################################################################### procedure title(a) local text case a of { 1 : text := aoran(adjt[tadjno]) || " " || nouns[tnnum] 2 : text := "TO " || tvpre[ttvnum] || " SOME " || nouns[tnnum] 3 : text := prep[tprnum] || " " || nounp[tnnum] 4 : text := "THE " || nouns[tnnum] 5 : text := prep[tprnum] || " " || aoran(nouns[tnnum]) || " " || advb[tadjno] 6 : text := "THE " || more[tadjno] || " " || nouns[tnnum] 7 : text := "THE " || most[tadjno] || " " || nouns[tnnum] } return(text) end ####################################################################### procedure form1() local text,n n := 1 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || nounp[noun1] || " " || tvpre[tv] || " THE " text ||:= more[adjv] || " " || nouns[noun2] || punc[pun] return(text) end procedure form2() local text,n n := 2 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || nounp[noun1] || " " || tvpre[tv] || " THE " text ||:= most[adjv] || " " || nouns[noun2] || punc[pun] return(text) end procedure form3() local text,n n := 3 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || adjt[adjv] || " " || nounp[noun1] || " " || being[be] text ||:= " " || gerund(ivpre[iv]) || " " || punc[pun] return(text) end procedure form4() local text,n n := 4 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || adjt[adjv] || " " || nounp[noun1] || " " || ivpre[iv] text ||:= " " || punc[pun] return(text) end procedure form5() local text,n n := 5 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || ques[?*ques] || " " || adjt[adjv] || " " text ||:= nounp[noun1] || " " || ivpre[iv] || "?" return(text) end procedure form6() local text,n n := 6 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || art[ar] || " " || adjt[adjv] || " " || nouns[noun1] text ||:= " " || tvpas[tv] || " THE " || nouns[noun2] || punc[pun] return(text) end procedure form7() local text,n n := 7 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || "THE " || nounp[tnnum] || " " || ivpas[iv] text ||:= " " || prep[prpo] || " THE " || more[tadjno] || " " text ||:= nounp[noun1] || " " || punc[pun] return(text) end procedure form8() local text,n n := 8 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || "THE " || nounp[tnnum] || " " || ivpas[iv] || " " text ||:= prep[prpo] || " THE " || most[tadjno] || " " || nounp[noun1] text ||:= " " || punc[pun] return(text) end procedure form9() local text,n n := 9 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || ques[?*ques] || " " || nounp[tnnum] || " " || ivpre[iv] text ||:= " " || prep[prpo] || " " || aoran(adjt[adjv]) || " " text ||:= nouns[noun2] || "?" return(text) end procedure form10() local text,n n := 10 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || nounp[noun1] || " " || ivpre[iv] || " " || advb[adjv] text ||:= " " || prep[prpo] || " " || nompro[pron] || punc[pun] return(text) end procedure form11() local text,n n := 11 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || adjt[adjv] || " " || nounp[noun1] || " " || being[be] text ||:= " " || adjt[tadjno] || " " || cond[con] return(text) end procedure form12() local text,n n := 12 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || art[ar] || " " || nouns[noun1] || " " || ivpas[iv] text ||:= " " || advb[adjv] || punc[pun] return(text) end procedure form13() local text,n n := 13 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || cond[con] || " " || nounp[noun1] || " " || being[be] text ||:= " " || gerund(tvpre[ttvnum]) || " " || prep[prpo] || " " text ||:= gerund(ivpre[iv]) || " " || nounp[noun2] || punc[pun] return(text) end procedure form14() local text,n n := 14 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || art[ar] || " " || adjt[adjv] || " " || gerund(tvpre[tv]) text ||:= " OF THE " || nouns[tnnum] || " AND " || nouns[noun1] || punc[pun] return(text) end procedure form15() local text,n n := 15 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || gerund(tvpre[ttvnum]) || " " || nouns[noun1] text ||:= " AND " || nouns[noun2] return(text) end procedure form16() local text,n n := 16 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || "THE " || nounp[tnnum] || " " || ivpre[iv] || punc[pun] return(text) end procedure form17() local text,n n := 17 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || nompro[pron] || " " || tvpas[ttvnum] || " THE " text ||:= adjt[adjv] || " " || nouns[noun1] || punc[pun] return(text) end procedure form18() local text,n n := 18 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || adjt[adjv] || " " || nounp[noun2] || " " || being[be] text ||:= " " || nounp[noun1] || punc[pun] return(text) end procedure form19() local text,n n := 19 if watch=="true" then prefix := "(" || n || ") " else prefix := "" text := prefix || "THE " || nounp[tnnum] || "'S " || nounp[noun1] || " " text ||:= adjt[adjv] || " " || being[be] || punc[pun] return(text) end ################################################################### procedure parse(line,delims) static chars chars := &cset -- delims tokens := [] line ? while tab(upto(chars)) do put(tokens,tab(many(chars))) return tokens end procedure loadrest() art := ["ITS" , "THIS" , "SOME", "ANY" , "ONE" , "THAT" , "ITS" , "MY" , "YOUR" , "OUR"] ques := ["WHY DO" , "WHEN DO" , "WHERE DO" , "HOW DO" , "CANNOT" , "HOW COME" , "WHY DON'T"] nompro := ["SOMETHING" , "ANYTHING" , "IT" , "THAT" , "ONE" , "YOU" , "THIS"] cond := ["SINCE" , "BECAUSE" , "UNTIL" , "IF" , "THEN" , "OR" , "UNLESS" , "THEREFORE" , "AND THEN" , "OR ELSE" , "ELSE IF"] punc := ["." , "," , "?" , "!" , "," , "-" , ";"] end From icon-group-sender Mon May 25 05:40:09 1992 Received: by cheltenham.cs.arizona.edu; Mon, 25 May 92 05:41:38 MST Date: Mon, 25 May 1992 07:41 CST From: Chris Tenaglia - 257-8765 Subject: Holiday Offering To: icon-group@cs.arizona.edu Message-Id: <01GKF5PLTI6I984PUJ@mis.mcw.edu> X-Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Status: R Errors-To: icon-group-errors@cs.arizona.edu Here is a sample vocabulary file. I choose computer and science related stuff which seems to fit together well. I've tried farming and agriculture, but it got pretty gross. Great stuff for talk.bizaare! Happy holidays! Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu ! ! This is the vocabulary of the AI verse generator. Its filename is passed ! as a parameter. This should run under VMS, Unix, and MS-DOS. Lines until ! the %noun line are ignored and will generate 'Such Language!' messages ! when the program is run. ! %noun ABEND|ABENDS ABUSE|ABUSES ACCEPTANCE|ACCEPTANCES ACCOUNT|ACCOUNTS ACTION|ACTIONS ADDRESS|ADDRESSES ALGORITHM|ALGORITHMS AMAZEMENT|AMAZEMENTS ANOMALY|ANOMALIES ANSWER|ANSWERS APPLICATION|APPLICATIONS ARGUMENT|ARGUMENTS ARITHMETIC|ARITHMETICS ASSEMBLER|ASSEMBLERS ASSEMBLY|ASSEMBLIES BASE|BASES BASIC|BASICS BATCH|BATCHES BAUD RATE|BAUD RATES BENCHMARK|BENCHMARKS BIT|BITS BIT BUCKET|BIT BUCKETS BLANK|BLANKS BLOCK|BLOCKS BOOK|BOOKS BREAKPOINT|BREAKPOINTS BUFFER|BUFFERS BUG|BUGS BYTE|BYTES CALENDER|CALENDERS CAPACITY|CAPACITIES CATALOG|CATALOGS CAUSE|CAUSES CHAMBER|CHAMBERS CHANGE|CHANGES CHARACTER|CHARACTERS CHECK|CHECKS CLASS|CLASSES CHIP|CHIPS CIRCUIT|CIRCUITS CIRCUIT CARD|CIRCUIT CARDS CIRCUIT CHIP|CIRCUIT CHIPS CLUSTER|CLUSTERS CODE|CODES COMMAND|COMMANDS COMPILER|COMPILERS COMPONENT|COMPONENTS COMPUTER|COMPUTERS CONCEPT|CONCEPTS CONDITION|CONDITIONS CONFUSION|CONFUSIONS CONNECTION|CONNECTIONS CONTROL|CONTROLS CONVERSION|CONVERSIONS COPROCESSOR|COPROCESSORS COPY|COPIES CRASH|CRASHES CUBE|CUBES CURSOR|CURSORS CYCLE TIME|CYCLE TIMES DATA|DATA DATA|SET DATA SETS DATABASE|DATABASES DEFECT|DEFECTS DEFINITION|DEFINITIONS DELETION|DELETIONS DERIVATIVE|DERIVATIVES DESCRIPTION|DESCRIPTIONS DESIGN|DESIGNS DEVELOPEMENT|DEVELOPEMENTS DEVICE|DEVICES DIAGRAM|DIAGRAMS DIGIT|DIGITS DIRECTORY|DIRECTORIES DISK|DISKS DISPLAY|DISPLAYS DIVISION|DIVISIONS DOCUMENT|DOCUMENTS DOCUMENTATION|DOCUMENTATIONS DOMAIN|DOMAINS DRAWING|DRAWINGS DRIVER|DRIVERS EFFECT|EFFECTS ELEMENT|ELEMENTS EMPTY SET|EMPTY SETS ENGINE|ENGINES ENGINEER|ENGINEERS ENTROPY|ENTROPIES ENTRY|ENTRIES ENTRYPOINT|ENTRYPOINTS ENVIRONMENT|ENVIRONMENTS EQUATION|EQUATIONS ERROR|ERRORS ESCAPE|ESCAPES EUPHEMISM|EUPHEMISMS EXAMPLE|EXAMPLES EXPONENT|EXPONENTS FACT|FACTS FAILURE|FAILURES FANTASY|FANTASIES FAX|FAXES FEATURE|FEATURES FIELD|FIELDS FILE|FILES FIRMWARE|FIRMWARES FLAG|FLAGS FLOPPY|FLOPPIES FORM|FORMS FORMAT|FORMATS FROTH|FROTHS FUNCTION|FUNCTIONS GAME|GAMES GENERATOR|GENERATORS GLITSCH|GLITSCHES GRAPH|GRAPHS HACKER|HACKERS HARDWARE|HARDWARES HASH|HASHES HEXIDECIMAL|HEXIDECIMALS HOLLERITH CARD|HOLLERITH CARDS HYPERCUBE|HYPERCUBES IDIOT|IDIOTS IMAGE|IMAGES IMPLEMENTATION|IMPLEMENTATIONS INDEX|INDICES INDIVIDUAL|INDIVIDUALS INFORMATION|INFORMATIONS INITIALIZATION|INITIALIZATIONS INHERITANCE|INHERITANCES INPUT|INPUTS INQUIRY|INQUIRIES INSERTION|INSERTIONS INSTALLATION|INSTALLATIONS INSTRUCTION|INSTRUCTIONS INTEGER|INTEGERS INTEGRAL|INTEGRALS INTEGRATED CIRCUIT|INTEGRATED CIRCUITS INTELLECT|INTELLECTS INTERFACE|INTERFACES INTERPRETER|INTERPRETERS INTERRUPT|INTERRUPTS INTERVAL|INTERVALS INTRODUCTION|INTRODUCTIONS INVENTOR|INVENTORS ITEM|ITEMS ITERATION|ITERATIONS JOB|JOBS JOBSTREAM|JOBSTREAMS JOYSTICK|JOYSTICKS KEYPAD|KEYPADS KEYWORD|KEYWORDS KLOOJE|KLOOJES KRUFT|KRUFTS LABEL|LABELS LABORATORY|LABORATORIES LANGUAGE|LANGUAGES LIBRARY|LIBRARIES LINKAGE|LINKAGES LINKER|LINKERS LIQUID|LIQUIDS LIST|LISTS LOAD|LOADS LOGIC|LOGICS LOOP|LOOPS MACHINE|MACHINES MAINFRAME|MAINFRAMES MANUAL|MANUALS MEMBER|MEMBERS MEMORY|MEMORIES MENU|MENUS MERGE|MERGES MESSAGE|MESSAGES METHOD|METHODS MICROPROCESSOR|MICROPROCESSORS MODE|MODES MODEL|MODELS MODEM|MODEMS MODIFICATION|MODIFICATIONS MODULE|MODULES MONITOR|MONITORS MOTHERBOARD|MOTHERBOARDS MOVE|MOVES MUTANT|MUTANTS NAND|GATE NAND GATES NETWORK|NETWORKS NO-OP|NO-OPS NODE|NODES NONSENSE|NONSENSES NULL DEVICE|NULL DEVICES NUMBER|NUMBERS NUMBER CRUNCHER|NUMBER CRUNCHERS OBJECT|OBJECTS OCCURENCE|OCCURENCES OPERAND|OPERANDS OPERATING SYSTEM|OPERATING SYSTEMS OPERATION|OPERATIONS OPTION|OPTIONS ORDER|ORDERS OUTPUT|OUTPUTS PACKAGE|PACKAGES PAGE|PAGES PARADIGM|PARADIGMS PARAMETER|PARAMETERS PARITY BIT|PARITY BITS PART NUMBER|PART NUMBERS PARTITION|PARTITIONS PARTNER|PARTNERS PASSWORD|PASSWORDS PATCH|PATCHES PATH|PATHS PERSON|PERSONS POINT|POINTS POINTER|POINTERS PREFERENCE|PREFERENCES PRICE|PRICES PRINTER|PRINTERS PRINTOUT|PRINTOUTS PROCEDURE|PROCEDURES PROCESS|PROCESSES PRODUCT|PRODUCTS PROFESSOR|PROFESSORS PROGRAM|PROGRAMS PROGRAMMER|PROGRAMMERS PROJECT|PROJECTS PURGE|PURGES QUALITY|QUALITIES QUANTITY|QUANTITIES QUERY|QUERIES QUESTION|QUESTIONS QUOTE|QUOTES RAM|DUMP RAM DUMPS RANDOM NUMBER|RANDOM NUMBERS RATIO|RATIOS REALITY|REALITIES REASON|REASONS RECORD|RECORDS REFERENCE|REFERENCES REFLECTION|REFLECTIONS REFUSAL|REFUSALS REGION|REGIONS REGISTER|REGISTERS REPLENISHMENT|REPLENISHMENTS REQUIREMENT|REQUIREMENTS ROBOT|ROBOTS ROUTINE|ROUTINES SAMPLE|SAMPLES SCHEMA|SCHEMAS SCIENCE|SCIENCES SEARCH|SEARCHES SECTION|SECTIONS SELECTION|SELECTIONS SELF|SELFS SEQUENCE|SEQUENCES SHOW|SHOWS SITUATION|SITUATIONS SIZE|SIZES SOCKET|SOCKETS SOFTWARE|SOFTWARES SOLUTION|SOLUTIONS SORT|SORTS SPACE|SPACES SPARK|SPARKS SPECTRUM|SPECTRUMS SPHERE|SPHERES SPREAD SHEET|SPREAD SHEETS STANDARD|STANDARDS STATUS|STATUSES STEP|STEPS STORAGE|STORAGES STRUCTURE|STRUCTURES SUBJECT|SUBJECTS SUBSCHEMA|SUBSCHEMAS SUBSECTION|SUBSECTIONS SUBSTITUTE|SUBSTITUTES SUPER COMPUTER|SUPER COMPUTERS SURPRISE|SURPRISES SWITCH|SWITCHES SYMBOL|SYMBOLS SYNTAX ERROR|SYNTAX ERRORS SYSTEM|SYSTEMS TABLE|TABLES TECHNICIAN|TECHNICIANS TESSARECT|TESSARECTS TEST|TESTS THOUGHT|THOUGHTS TIME|TIMES TOOL|TOOLS TRACE|TRACES TRANSACTION|TRANSACTIONS TRANSFER|TRANSFERS TREE|TREES TRIANGLE|TRIANGLES TWOS-COMPLEMENT|TWOS-COMPLEMENTS UNIT|UNITS UPDATE|UPDATES USAGE|USAGES USER|USERS UTILITY|UTILITIES VACUUM|VACUUMS VALUE|VALUES VARIABLE|VARIABLES VECTOR|VECTORS VERSION|VERSIONS VIOLATION|VIOLATIONS VOLUME|VOLUMES WARRANTY|WARRANTIES WORD|WORDS WORD PROCESSOR|WORD PROCESSORS WORK|WORKS %adjt ABRASIVE|ABRASIVELY@MORE ABRASIVE#MOST ABRASIVE ABSURD|ABSURDLY@ABSURDER#ABSURDEST ACTIVE|ACTIVELY@MORE ACTIVE#MOST ACTIVE ALARMING|ALARMINGLY@MORE ALARMING#MOST ALARMING ALERT|ALERTLY@MORE ALERT#MOST ALERT AMORPHOUS|AMORPHOUSLY@MORE AMORPHOUS#MOST AMORPHOUS APATHETIC|APATHETICALLY@MORE APATHETIC#MOST APATHETIC ASTONISHING|ASTONISHINGLY@MORE ASTONISHING#MOST ASTONISHING AUTOMATIC|AUTOMATICALLY@MORE AUTOMATIC#MOST AUTOMATIC AVERAGE|AVERAGELY@MORE AVERAGE#MOST AVERAGE BAD|BADLY@BADDER#BADDEST BASIC|BASICALLY@MORE BASIC#MOST BASIC BEAUTIFUL|BEAUTIFULLY@MORE BEAUTIFUL#MOST BEAUTIFUL BERZERK|BERZERKLY@BERZERKER#BERZERKEST BIZAAR|BIZAARLY@BIZAARER#BIZAAREST BLETCHEROUS|BLETCHEROUSLY@MORE BLETCHEROUS#MOST BLETCHEROUS BLIND|BLINDLY@BLINDER#BLINDEST BLINKING|BLINKINGLY@MORE BLINKING#MOST BLINKING BOGUS|BOGUSLY@MORE BOGUS#MOST BOGUS BOLD|BOLDLY@BOLDER#BOLDEST BORING|BORINGLY@MORE BORING#MOST BORING BRAVE|BRAVELY@BRAVER#BRAVEST CAUSTIC|CAUSTICALLY@MORE CAUSTIC#MOST CAUSTIC CHEAP|CHEAPLY@CHEAPER#CHEAPEST COLD|COLDLY@COLDER#COLDEST COBOL|COBOL LIKE|MORE COBOL LIKE|MOSTLY COBOL CONCISE|CONCISELY@CONCISER#CONCISEST CONSIDERATE|CONSIDERATELY@MORE CONSIDERATE#MOST CONSIDERATE CONVOLUTED|CONVOLUTEDLY@MORE CONVOLUTED#MOST CONVOLUTED CORRECT|CORRECTLY@MORE CORRECT#MOST CORRECT COURTEOUS|COURTEOUSLY@MORE COURTEOUS#MOST COURTEOUS CREATIVE|CREATIVELY@MORE CREATIVE#MOST CREATIVE DEAR|DEARLY@DEARER#DEAREST DEEP|DEEPLY@DEEPER#DEEPEST DEFECTIVE|DEFECTIVELY@MORE DEFECTIVE#MOST DEFECTIVE DELIGHTFUL|DELIGHTFULLY@MORE DELIGHTFUL#MOST DELIGHTFUL DEPLETED|DEPLETEDLY@MORE DEPLETED#MOST DEPLETED DESTRUCTIVE|DESTRUCTIVELY@MORE DESTRUCTIVE#MOST DESTRUCTIVE DETACHED|DETACHEDLY|MORE DETACHED|MOST DETACHED DEVOUT|DEVOUTLY@DEVOUTER#DEVOUTEST DIFFERENT|DIFFERENTLY@MORE DIFFERENT#MOST DIFFERENT DIFFUSE|DIFFUSELY@MORE DIFFUSE#MOST DIFFUSE DISPOSABLE|DISPOSABLY@MORE DISPOSABLE#MOST DISPOSABLE DISTANT|DISTANTLY@MORE DISTANT#MOST DISTANT DROWSY|DROWSILY@DROWSIER#DROWSIEST DRY|DRYLY@DRIER#DRIEST DUMB|DUMBLY@DUMBER#DUMBEST DUSTY|DUSTILY@DUSTIER#DUSTIEST EASY|EASILY@EASIER#EASIEST EDUCATED|EDUCATEDLY@MORE EDUCATED#MOST EDUCATED ELECTRIC|ELECTRICALLY@MORE ELECTRIC#MOST ELECTRIC ENERGETIC|ENERGETICALLY@MORE ENERGETIC#MOST ENERGETIC EVEN|EVENLY@MORE EVEN#MOST EVEN EVIL|EVILY@MORE EVIL#MOST EVIL EXCITABLE|EXCITABLY@MORE EXCITABLE#MOST EXCITABLE EXUBERANT|EXUBERANTLY@MORE EXUBERANT#MOST EXUBERANT FAIR|FAIRLY@FAIRER#FAIREST FANTASTIC|FANTASTICALLY@MORE FANTASTIC#MOST FANTASTIC FEARFUL|FEARFULLY@MORE FEARFUL#MOST FEARFUL FLEXIBLE|FLEXIBLY@MORE FLEXIBLE#MOST FLEXIBLE FLUID|FLUIDLY@MORE FLUID#MOST FLUID FOAMING|FOAMINGLY@MORE FOAMING#MOST FOAMING FOOLISH|FOOLISHLY@MORE FOOLISH#MOST FOOLISH FORBIDDING|FORBIDDINGLY@MORE FORBIDDING#MOST FORBIDDING FREEZING|FREEZINGLY@MORE FREEZING#MOST FREEZING FRESH|FRESHLY@FRESHER#FRESHEST FROTHING|FROTHINGLY@MORE FROTHING#MOST FROTHING FUNNY|FUNNY@FUNNIER#FUNNIEST FUZZY|FUZZILY@FUZZIER#FUZZIEST GENERAL|GENERALLY@MORE GENERAL#MOST GENERAL GLORIOUS|GLORIOUSLY@MORE GLORIOUS#MOST GLORIOUS GLOWING|GLOWINGLY@MORE GLOWING#MOST GLOWING GRAND|GRANDLY@GRANDER#GRANDEST GREESY|GREESILY@GREESIER#GREESIEST GRINDING|GRINDINGLY@MORE GRINDING#MOST GRINDING GROSS|GROSSLY@GROSSER#GROSSEST GULLIBLE|GULLIBLY@MORE GULLIBLE#MOST GULLIBLE HAPPY|HAPPILY@HAPPIER#HAPPIEST HARD|HARDLY@HARDER#HARDEST HATEFUL|HATEFULLY@MORE HATEFUL#MOST HATEFUL HEATED|HEATEDLY@MORE HEATED#MOST HEATED HEAVY|HEAVILY@HEAVIER#HEAVIEST HELPFUL|HELPFULLY@MORE HELPFUL#MOST HELPFUL HIGH|HIGHLY@HIGHER#HIGHEST HOPELESS|HOPELESSLY@MORE HOPELESS#MOST HOPELESS HORRIBLE|HORRIBLY@MORE HORRIBLE#MOST HORRIBLE HOT|HOTLY@HOTTER#HOTTEST HUMOROUS|HUMOROUSLY@MORE HUMOROUS#MOST HUMOROUS HUNGRY|HUNGRILY@HUNGRIER#HUNGRIEST IDIOTIC|IDIOTICALLY@MORE IDIOTIC#MOST IDIOTIC IGNORANT|IGNORANTLY@MORE IGNORANT#MOST IGNORANT IMPORTANT|IMPORTANTLY@MORE IMPORTANT#MOST IMPORTANT IMPRESSIVE|IMPRESSIVELY@MORE IMPRESSIVE#MOST IMPRESSIVE INDEFINITE|INDEFINITELY@MORE INDEFINITE#MOST INDEFINITE INDESCRIBABLE|INDESCRIBABLY@MORE INDESCRIBABLE#MOST INDESCRIBABLE INDIRECT|INDIRECTLY@MORE INDIRECT#MOST INDIRECT INSTANT|INSTANTLY@MORE INSTANT#MOST INSTANT INTERACTIVE|INTERACTIVELY|MORE INTERACTIVE|MOST INTERACTIVE INTERMITANT|INTERMITANTLY@MORE INTERMITANT#MOST INTERMITANT JOYOUS|JOYOUSLY@MORE JOYOUS#MOST JOYOUS JUBILANT|JUBILANTLY@MORE JUBILANT#MOST JUBILANT KIND|KINDLY@KINDER#KINDEST KNOWING|KNOWINGLY@MORE KNOWING#MOST KNOWING LAMENTABLE|LAMENTABLY@MORE LAMENTABLE#MOST LAMENTABLE LATE|LATELY@LATER#LATEST LAZY|LAZILY@LAZIER#LAZIEST LOGICAL|LOGICALLY@MORE LOGICAL#MOST LOGICAL LONG|LONGLY@LONGER#LONGEST LOQUACIOUS|LOQUACIOUSLY@MORE LOQUACIOUS#MOST LOQUACIOUS LOUSY|LOUSILY@LOUSIER#LOUSIEST LOW|LOWLY@LOWER#LOWEST LUSCIOUS|LUSCIOUSLY@MORE LUSCIOUS#MOST LUSCIOUS MAGIC|MAGICALLY@MORE MAGIC#MOST MAGIC MAGNIFICENT|MAGNIFICENTLY@MORE MAGNIFICENT#MOST MAGNIFICENT MANIACAL|MANIACALLY@MORE MANIACAL#MOST MANIACAL MASTERFUL|MASTERFULLY@MORE MASTERFUL#MOST MASTERFUL MEANINGFUL|MEANINGFULLY@MORE MEANINGFUL#MOST MEANINGFUL METALLIC|METALLICALLY@MORE METALLIC#MOST METALLIC MISERABLE|MISERABLY@MORE MISERABLE#MOST MISERABLE MONOLITHIC|MONOLITHICALLY@MORE MONOLITHIC#MOST MONOLITHIC MONSTROUS|MONSTROUSLY@MORE MONSTROUS#MOST MONSTROUS MUNDANE|MUNDANELY@MUNDANER#MUNDANEST NATURAL|NATURALLY@MORE NATURAL#MOST NATURAL NEAR|NEARLY@NEARER#NEAREST NEAT|NEATLY@NEATER#NEATEST NOISOME|NOISOMELY@MORE NOISOME#MOST NOISOME NONEXISTANT|NONEXISTANTLY@MORE NONEXISTANT#MOST NONEXISTANT NUCLEAR|NUCLEARLY@MORE NUCLEAR#MOST NUCLEAR OBEDIENT|OBEDIENTLY@MORE OBEDIENT#MOST OBEDIENT OBVIOUS|OBVIOUSLY@MORE OBVIOUS#MOST OBVIOUS ODD|ODDLY@ODDER#ODDEST ODIFEROUS|ODIFEROUSLY@MORE ODIFEROUS#MOST ODIFEROUS OMNIVOROUS|OMNIVOROUSLY@MORE OMNIVOROUS#MOST OMNIVOROUS OPEN|OPENLY@MORE OPEN#MOST OPEN PAINLESS|PAINLESSLY@MORE PAINLESS#MOST PAINLESS PATHETIC|PATHETICALLY@MORE PATHETIC#MOST PATHETIC PECULIAR|PECULIARLY@MORE PECULIAR#MOST PECULIAR PERCEPTIVE|PERCEPTIVELY@MORE PERCEPTIVE#MOST PERCEPTIVE PERSISTANT|PERSISTANTLY@MORE PERSISTANT#MOST PERSISTANT PLASTIC|PLASTICALLY@MORE PLASTIC#MOST PLASTIC PLEASANT|PLEASANTLY@MORE PLEASANT#MOST PLEASANT PONDEROUS|PONDEROUSLY@MORE PONDEROUS#MOST PONDEROUS POWERFUL|POWERFULLY@MORE POWERFUL#MOST POWERFUL PRECIOUS|PRECIOUSLY@MORE PRECIOUS#MOST PRECIOUS PRECISE|PRECISELY@MORE PRECISE#MOST PRECISE PRETTY|PRETTILY@PRETTIER#PRETTIEST PROPER|PROPERLY@MORE PROPER#MOST PROPER PROUD|PROUDLY@PROUDER#PROUDEST QUEER|QUEERLY@QUEERER#QUEEREST QUICK|QUICKLY@QUICKER#QUICKEST READY|READILY@MORE READY#MOST READY RELENTING|RELENTINGLY@MORE RELENTING#MOST RELENTING RELUCTANT|RELUCTANTLY@MORE RELUCTANT#MOST RELUCTANT REVERENT|REVERENTLY@MORE REVERENT#MOST REVERENT ROUDY|ROUDILY@ROUDIER#ROUDIEST ROUGH|ROUGHLY@ROUGHER#ROUGHEST RUDE|RUDELY@RUDER#RUDEST SAD|SADLY@SADDER#SADDEST SALIENT|SALIENTLY@MORE SALIENT#MOST SALIENT SAVAGE|SAVAGELY@MORE SAVAGE#MOST SAVAGE SCRUFFY|SCRUFFILY@SCRUFFIER#SCRUFFIEST SELF MODIFYING|SELF MODIFYINGLY@MORE SELF MODIFYING#MOST SELF MODIFYING SHARP|SHARPLY@SHARPER#SHARPEST SHORT|SHORTLY@SHORTER#SHORTEST SKEWED|SKEWEDLY@MORE SKEWED#MOST SKEWED SLOPPY|SLOPPILY@SLOPPIER#SLOPPIEST SLOW|SLOWLY@SLOWER#SLOWEST SMOOTH|SMOOTHLY@SMOOTHER#SMOOTHEST SOFT|SOFTLY@SOFTER#SOFTEST SOULFUL|SOULFULLY@MORE SOULFUL#MOST SOULFUL SPACIOUS|SPACIOUSLY@MORE SPACIOUS#MOST SPACIOUS SPASTIC|SPASTICALLY@MORE SPASTIC#MOST SPASTIC SPECKLED|SPECKLEDLY@MORE SPECKLED#MOST SPECKLED SPECTACULAR|SPECTACULARLY@MORE SPECTACULAR#MOST SPECTACULAR SPIFFY|SPIFFILY@SPIFFIER#SPIFFIEST SQUEEKING|SQUEEKINGLY@MORE SQUEEKING#MOST SQUEEKING STATIC|STATICALLY@MORE STATIC#MOST STATIC STRANGE|STRANGELY@STRANGER#STRANGEST STRATEGIC|STRATEGICALLY@MORE STRATEGIC#MOST STRATEGIC STUDIOUS|STUDIOUSLY@MORE STUDIOUS#MOST STUDIOUS STUPID|STUPIDLY@MORE STUPID#MOST STUPID SUBNORMAL|SUBNORMALLY@MORE SUBNORMAL#MOST SUBNORMAL SUCCESSFUL|SUCCESSFULLY@MORE SUCCESSFUL#MOST SUCCESSFUL SWIFT|SWIFTLY@SWIFTER#SWIFTEST TANGIBLE|TANGIBLY@MORE TANGIBLE#MOST TANGIBLE TEPID|TEPIDLY@MORE TEPID#MOST TEPID TERSE|TERSELY@TERSER#TERSEST THRASHING|THRASHINGLY@MORE THRASHING#MOST THRASHING TIGHT|TIGHTLY@TIGHTER#TIGHTEST TIRED|TIREDLY@TIREDER#TIREDEST TRAGIC|TRAGICALLY@MORE TRAGIC#MOST TRAGIC TWISTED|TWISTEDLY@MORE TWISTED#MOST TWISTED TYPICAL|TYPICALLY@MORE TYPICAL#MOST TYPICAL UNBELIEVABLE|UNBELIEVABLY@MORE UNBELIEVABLE#MOST UNBELIEVABLE UNIFORM|UNIFORMLY@MORE UNIFORM#MOST UNIFORM URBANE|URBANELY@URBANER#URBANEST VACANT|VACANTLY@MORE VACANT#MOST VACANT VAIN|VAINLY@VAINER#VAINEST VENOMOUS|VENOMOUSLY@MORE VENOMOUS#MOST VENOMOUS VERBOSE|VERBOSELY@VERBOSER#VERBOSEST VIBRANT|VIBRANTLY@MORE VIBRANT#MOST VIBRANT VIRTUOUS|VIRTUOUSLY@MORE VIRTUOUS#MOST VIRTUOUS VITAL|VITALLY@MORE VITAL#MOST VITAL WEAK|WEAKLY@WEAKER#WEAKEST WET|WETLY@WETTER#WETTEST WHOLESOME|WHOLESOMELY@MORE WHOLESOME#MOST WHOLESOME WIDE|WIDELY@WIDER#WIDEST WIERD|WIERDLY@WIERDER#WIERDEST WILD|WILDLY@WILDER#WILDEST WISE|WISELY@WISER#WISEST WONDERFUL|WONDERFULLY@MORE WONDERFUL#MOST WONDERFUL WRETCHED|WRETCHEDLY@MORE WRETCHED#MOST WRETCHED WRITHING|WRITHINGLY@MORE WRITHING#MOST WRITHING %been AIN'T BE SHOULD BE COULD BE WOULD BE CAN'T BE MIGHT BE NOT MAY BE MIGHT BE MAY BE NOT COULD NOT BE SHOULD NOT BE WOULD NOT BE MAY NOT BE MIGHT NOT BE WILL BE WILL NOT BE WON'T BE COULD HAVE BEEN SHOULD HAVE BEEN WOULD HAVE BEEN WILL HAVE BEEN COULD BE NOT SHOULD BE NOT WOULD BE NOT COULDN'T HAVE BEEN SHOULDN'T HAVE BEEN WOULDN'T HAVE BEEN SHOULD BE %ivrb ADD|ADDED ASSEMBLE|ASSEMBLED ATTEMPT|ATTEMPTED CALCULATE|CALCULATED CLIMB|CLIMBED CLOSE|CLOSED CODE|CODED COMBINE|COMBINED COMPARE|COMPARED COMPILE|COMPILED COMPUTE|COMPUTED CONCLUDE|CONCLUDED CONTEND|CONTENDED CONTINUE|CONTINUED CONVERT|CONVERTED CRASH|CRASHED CRUNCH|CRUNCHED DECREASE|DECREASED DECREMENT|DECREMENTED DIGEST|DIGESTED DOUBLE|DOUBLED DUMP|DUMPED ENHANCE|ENHANCED ENTER|ENTERED EXIST|EXISTED EXPLODE|EXPLODED EXTEND|EXTENDED FLASH|FLASHED FLOAT|FLOATED FRY|FRIED HIT|HITTED GENERATE|GENERATED IMPLODE|IMPLODED INCREASE|INCREASED INCREMENT|INCREMENTED JUGGLE|JUGGLED JUMP|JUMPED LINK|LINKED LISTEN|LISTENED MANIPULATE|MANIPULATED MUNCH|MUNCHED OPEN|OPENED OPERATE|OPERATED OVERFLOW|OVERFLOWED PASS|PASSED PERFORM|PERFORMED PLAN|PLANNED PREPARE|PREPARED RAIN|RAINED REJECT|REJECTED REPEAT|REPEATED SHOW|SHOWED SPIT|SPITTED SLIP|SLIPPED SUMMARIZE|SUMMARIZED TERMINATE|TERMINATED TOGGLE|TOGGLED TRIPLE|TRIPLED TURN|TURNED TWITCH|TWITCHED WRIGGLE|WRIGGLED %tvrb ABSORB|ABSORBED ACCESS|ACCESSED ALLOCATE|ALLOCATED ALLOW|ALLOWED ASSEMBLE|ASSEMBLED ASSIGN|ASSIGNED BENEFIT|BENEFITTED CALCULATE|CALCULATED CLIMB|CLIMBED CLOSE|CLOSED CODE|CODED COLLIDE|COLLIDED COMBINE|COMBINED COMMAND|COMMANDED COMPARE|COMPARED COMPILE|COMPILED CONCLUDE|CONCLUDED CONTAIN|CONTAINED CONVERT|CONVERTED COOK|COOKED COPY|COPIED CRASH|CRASHED CRUNCH|CRUNCHED DEBUG|DEBUGGED DECREASE|DECREASED DECREMENT|DECREMENTED DELETE|DELETED DELIVER|DELIVERED DESCRIBE|DESCRIBED DESTROY|DESTROYED DETECT|DETECTED DEVISE|DEVISED DIGEST|DIGESTED DIRECT|DIRECTED DISPLAY|DISPLAYED DIVIDE|DIVIDED DOUBLE|DOUBLED DUMP|DUMPED EDIT|EDITED EMPHASIZE|EMPHASIZED EMULATE|EMULATED ENCRYPT|ENCRYPTED ENHANCE|ENHANCED ERASE|ERASED EVALUATE|EVALUATED EXECUTE|EXECUTED EXPLODE|EXPLODED EXPRESS|EXPRESSED EXTEND|EXTENDED FACILITATE|FACILITATED FLASH|FLASHED FLIP|FLIPPED FORMAT|FORMATTED FRY|FRIED GATHER|GATHERED IDENTIFY|IDENTIFIED IGNORE|IGNORED IMPLEMENT|IMPLEMENTED IMPLODE|IMPLODED INCLUDE|INCLUDED INCREASE|INCREASED INCREMENT|INCREMENTED INSTALL|INSTALLED INDICATE|INDICATED INSTRUCT|INSTRUCTED INVOKE|INVOKED JUGGLE|JUGGLED KICK|KICKED KLOOJE|KLOOJED LIFT|LIFTED LIGHT|LIGHTED LIMIT|LIMITED LINK|LINKED LOAD|LOADED LOCATE|LOCATED MANIPULATE|MANIPULATED MULTIPLY|MULTIPLIED MUNCH|MUNCHED NEGATE|NEGATED NUMBER|NUMBERED OPEN|OPENED ORDER|ORDERED OUTPUT|OUTPUTTED OVERFLOW|OVERFLOWED PAINT|PAINTED PASS|PASSED PERCEIVE|PERCEIVED PERFORM|PERFORMED PICK|PICKED PLAN|PLANNED POKE|POKED PORT|PORTED PREPARE|PREPARED PROCESS|PROCESSED PRODUCE|PRODUCED PROGRAM|PROGRAMMED PROTECT|PROTECTED PROMPT|PROMPTED PUNCH|PUNCHED QUESTION|QUESTIONED RANDOMIZE|RANDOMIZED READ|READ REJECT|REJECTED RENAME|RENAMED REPEAT|REPEATED REPRESENT|REPRESENTED SAVE|SAVED SCRATCH|SCRATCHED SCRAWL|SCRAWLED SELECT|SELECTED SHOW|SHOWED SHREAD|SHREADED SPECIFY|SPECIFIED SPEW|SPEWED SPOOL|SPOOLED STIR|STIRRED SUPPORT|SUPPORTED TAG|TAGGED TAX|TAXED TERMINATE|TERMINATED TIME|TIMED TOAST|TOASTED TOGGLE|TOGGLED TOUCH|TOUCHED TRIPLE|TRIPLED TWEEK|TWEEKED TWIST|TWISTED TYPE|TYPED UNDERMINE|UNDERMINED UNLOAD|UNLOADED USE|USED WRIGGLE|WRIGGLED WRINKLE|WRINKLED ZAP|ZAPPED %prep ABOVE ABOUT AROUND ALONGSIDE ATOP BESIDE BETWEEN THROUGH AFTER WITH ON OVER UNDER NEXT TO OUTSIDE OF INSIDE BY FROM ACROSS FROM BELOW WITHOUT BY INSIDE OUTSIDE FROM ABOVE ABOUT AROUND BESIDE From icon-group-sender Wed May 27 09:17:27 1992 Received: by cheltenham.cs.arizona.edu; Wed, 27 May 92 09:47:19 MST Date: Wed, 27 May 92 18:18:28 +0200 From: Jan Peter de Ruiter Message-Id: <9205271618.AA07196@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: save() Status: R Errors-To: icon-group-errors@cs.arizona.edu A short question: is there (or will there be) a version of Icon for either Ultrix or MSDOS that implements the save() function, i.e. executable images? I'm working with version 8.5 on MSDOS and with 8.0 on Ultrix, and I do not know for certain whether I'm using the latest available version on Ultrix. If executable images are *not* supported on these platforms, then my question amounts to "why not?". Jan P.A. de Ruiter Max Planck Institute for Psycholinguistics janpeter@mpi.kun.nl From icon-group-sender Wed May 27 09:52:40 1992 Received: by cheltenham.cs.arizona.edu; Wed, 27 May 92 09:53:11 MST Date: Wed, 27 May 92 09:52:40 MST From: "Ralph Griswold" Message-Id: <9205271652.AA24941@cheltenham.cs.arizona.edu> To: janpeter@mpi.kun.nl Subject: Re: save() Cc: icon-group Status: R Errors-To: icon-group-errors@cs.arizona.edu Our configuration files show that save() is supported for Ultrix on VAX platforms for 8.0 and subsequent versions. I can't speak to Ultrix on other platforms. save() is not implemented for MS-DOS or most other platforms. The reason save() is not widely supported is that its implementation is difficult as well as system and architecture dependent. Icon source provides the hooks. Local code would be needed where it's not already provided. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Wed May 27 10:29:52 1992 Received: by cheltenham.cs.arizona.edu; Wed, 27 May 92 12:04:55 MST Date: Wed, 27 May 92 10:30:20 PDT From: alex@laguna.metaphor.com (Bob Alexander) Message-Id: <9205271730.AA00972@laguna.Metaphor.COM> To: icon-group@cs.arizona.edu Subject: Icon coding puzzle Status: R Errors-To: icon-group-errors@cs.arizona.edu I came across a simple but intriguing situation in Icon coding, and I wonder if anyone has a better solution than the hack I came up with. I wrote a procedure that is supposed to work in a string scanning context (a "matching" procedure) to match optional spaces: procedure OptSpace() suspend (tab(many(' ')) | "")\1 end The idea of the \1 is that I don't really want to match the empty string if there are blanks there, so the alternation is only allowed to produce one result. But there is a problem with this: if the suspend expression is resumed after spaces have been matched, the limitation operation prevents the first term of the alternation [ tab(many(' ')) ] from being resumed, therefore &pos is not restored to its position before the match (thus it's not a proper matching procedure). Here's one solution, but it doesn't seem very pretty to me -- I'd prefer a slicker one without auxiliary variables: procedure OptSpace() local x suspend (x := Space()) | (/x,"") end The generalization of what I am trying to do is a "selection" control structure that produces the result sequence of its first operand that succeeds, and no more. It is modelled by a PDCO, Cond(), that appears in the IPL (ipl/procs/pdco.icn): procedure Cond(L) local i, x every i := 1 to *L do if x := @L[i] then { suspend x suspend |@L[i] fail } end But what I *really* want is just a clever way to achieve the same effect with in-line code. Ideas??? I think this type of situation occurs often in goal-seeking Icon programming, where alternation might produce unnecessary results (e.g. tab(many(' ')) | ""). Does anyone out there agree? Could we use a new Icon selection control structure: ? ("<" and ">" taken literally -- I'm not sure about syntactic non-ambiguity here). -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex From icon-group-sender Thu May 28 07:25:03 1992 Received: by cheltenham.cs.arizona.edu; Thu, 28 May 92 10:05:16 MST Date: Thu, 28 May 92 16:26:01 +0200 From: Jan Peter de Ruiter Message-Id: <9205281426.AA09288@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu ## Hi, ## As a demonstration of the use of awk-like icon programming, I've ## written a simple but surprisingly useful program, that's now ## heavily used in 'data laundry' jobs at our institute. The program ## as it is *can* be written in AWK, by the way, but it can be very ## easily modified to handly specific (and more complex) jobs. I've ## adapted it once (using Icon sets) to check out all the cross- ## references in a multifile C program, for instance. Perhaps you'd ## find it useful. ## Jan P.A. de Ruiter ## janpeter@mpi.kun.nl # program peanuts; (C) 1992 J.P.A. de Ruiter # This program can be used to add information from some file to # a target file, provided there is a common element in both files # # The program makes use of the awk-emulation library called 'aweka.icn' # which is provided at the end of this file. For those who do not posess # the awk-lib: uncomment and save it and link it in with the # peanuts code. link aweka procedure main(argm) # argument handling if (*argm ~= 6) then usage() (vic := open(argm[1]) | stop("victim file cannot be opened.")) (tabelfile := open(argm[2]) | stop("table file cannot be opened.")) ((vicpos := +argm[3]) > 0 | stop("vicpos should be > 0.")) ((key := +argm[4]) > 0 | stop("key should be > 0.")) ((value := +argm[5]) > 0 | stop("value should be > 0.")) (outfile := open(argm[6],"w") | stop("outfile cannot be opened.")) # initialize table tabel := table() # load mapping table while (awk(tabelfile)) do { tabel[FLD[key]] := FLD[value] } while (entire_line := awk(vic)) do { if (\tabel[FLD[vicpos]]) then write(outfile,entire_line," ",tabel[FLD[vicpos]]) else stop("I\'m sorry, element \'",FLD[vicpos],"\' not present in table.") } # close and exit close(vic) close(outfile) close(tabelfile) end procedure usage() stop("usage: {icon} peanuts ", " .\n", "where: vicfile = file you want to add a column to.\n", " tabfile = file you want to look up the new column\n", " victim = position of index column in vicfile\n", " key = position of index column in tabfile\n", " value = position of value to be retrieved from tabfile\n", " outfile = the output file\n"); end # # # # awk - emulation lib. (c) 1992 J.P.A. de Ruiter # # # global NF, NR, FLD, FS # procedure awk(file) # static oldfile # initial { oldfile := &null } # # if (oldfile ~=== file) then { # NR := 0 # oldfile := file # } # # if (/FS) then FS := ' \t' # charset := &cset -- cset(FS) # NF := 0 # FLD := list() # # if(LSTR := !file) then NR +:= 1 else fail # LSTR ? while(tab(upto(charset))) do put(FLD,tab(many(charset))) # NF := *FLD # suspend LSTR # end From icon-group-sender Thu May 28 11:02:10 1992 Received: by cheltenham.cs.arizona.edu; Thu, 28 May 92 12:11:30 MST Date: Thu, 28 May 92 13:56:19 EST From: MATH0022@rmc.ca Subject: comp.compilers ? To: icon-group@cs.arizona.edu Reply-To: LINDSAY_JH@rmc.ca Message-Id: <920528.14003991.013486@RMC.CP6> X-Envelope-To: icon-group@cs.Arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I'd appreciate it if someone would fill me in on how to locate or use the bulletin board called comp.compilers (?) -------------------------------------------------------------------------------- John H. Lindsay, Department of Mathematics and Computer Science, Royal Military College of Canada, Kingston, Ontario, Canada, K7K 5L0. Phones: Office, (613) 541-6419 Messages, 541-6343 or 541-6458 Home, 546-6988 E-Mail: From Bitnet, NetNorth, ONet: LINDSAY_JH@RMC.CA From Canadian Military Colleges: LINDSAY JH@RMC Fax: (613) 542-8129 John H. Lindsay, Dept. of Math. & C. S., Royal Military College of Canada From icon-group-sender Mon Jun 1 19:36:22 1992 Received: by cheltenham.cs.arizona.edu; Tue, 2 Jun 1992 05:41:38 -0700 Date: Mon, 1 Jun 92 23:36:22 EDT From: Paul_Abrahams@MTS.cc.Wayne.edu To: icon-group@cs.arizona.edu Message-Id: <463262@MTS.cc.Wayne.edu> Subject: Concordance program from Icon Analyst #11 Status: R Errors-To: icon-group-errors@cs.arizona.edu Here's another wrinkle on the concordance program presented in Issue 11 (April 1992) of the Icon Analyst. We associate with each word a record containing the most recent line number where the word was encountered (as a number) and the list of previous line numbers (as a string). This version is possibly a little cleaner than the string version given in the Analyst and probably just as fast. Add the global declaration record word_data(prev, current) Initialize "uses" with uses := table(word_data("", 0)) Replace the tabulate and output routines by # Add line number to citations for a word procedure tabulate(word) if uses[word].current < lineno then uses[word] := word_data( uses[word].prev || (0 ~= uses[word].current) || "," | "", lineno) return end # Generate words procedure output() local word, lines write() uses := sort(uses, 3) while word := get(uses) do { lines := get(uses) write(left(word, width), lines.prev, lines.current) } end From icon-group-sender Tue Jun 2 01:06:01 1992 Received: by cheltenham.cs.arizona.edu; Tue, 2 Jun 1992 05:42:14 -0700 Via: festival.edinburgh.ac.uk; Tue, 2 Jun 1992 09:05:23 +0100 Date: 02 Jun 92 09:06:10 BST From: R J Hare Subject: Fast searching To: icon-group@cs.arizona.edu Message-Id: <9206020906.aa21959@uk.ac.ed.festival> Status: R Errors-To: icon-group-errors@cs.arizona.edu I am in a position where I may soon have to implement a fast search on large (Mbytes) files. The obvious way to do this is with a binary search on a record-based basis. However, as far as I can see, Icons random access features are character based. It would be easy to convert this to a record-based basis *if* the records in my files were fixed length - they aren't. Are there any elegant ways of implementing random access on a record based basis? I can think of at least two ways to do it; one involving the use of the length of the longest record, the other simply involving padding records to a fixed length - neither approach is attractive. Or, have I missed something vital in the manual? Thanks. Roger Hare. From icon-group-sender Tue May 29 12:41:17 1992 Received: by cheltenham.cs.arizona.edu; Thu, 4 Jun 1992 06:18:57 -0700 Date: 29 May 92 12:41:17 GMT From: overload.lbl.gov!agate!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!news.belwue.de!news.uni-stuttgart.de!@dog.ee.lbl.gov (MUFTI) Organization: User Help Desk, Comp. Cent. (RUS), U of Stuttgart, FRG Subject: question about "iconx" and "u1" files Message-Id: <1992May29.124117.15515@news.uni-stuttgart.de> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Can "iconx" and "u1" files be reconverted into icon source code files ? This question may be important, if someone want to keep his source secret ... thanks so long MUFTI From icon-group-sender Wed Jun 3 23:24:33 1992 Received: by cheltenham.cs.arizona.edu; Thu, 4 Jun 1992 09:09:45 -0700 Date: Thu, 4 Jun 1992 06:24:33 -0700 From: "Ralph Griswold" Message-Id: <199206041324.AA25278@cheltenham.cs.arizona.edu> To: icon-group@cs.arizona.edu, overload.lbl.gov!agate!spool.mu.edu!sdd.hp.com!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!news.belwue.de!news.uni-stuttgart.de!@dog.ee.lbl.gov Subject: Re: question about "iconx" and "u1" files Status: R Errors-To: icon-group-errors@cs.arizona.edu I suppose it's theoretically possible to reconstruct source code from Icon ucode and icode files, but no tools that I know of presently exist for doing this. Also, any source reconstruction probably is not going to be very useful -- it probably would be pretty much of a mess. It's worth noting that it's possible to "decompile" executables of most programming languages into some sort of source. Much more work usually is required to recover information about, say, algorithms used -- if it is, indeed, possible. I suppose there are ways of writing Icon programs to conceal important information about algorithms used, but I haven't given much thought to that. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Thu Jun 4 17:26:16 1992 Received: by cheltenham.cs.arizona.edu; Thu, 4 Jun 1992 09:09:58 -0700 Date: Thu, 4 Jun 92 15:26:16 +0200 From: Jan Peter de Ruiter Message-Id: <9206041326.AA25716@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: program Status: R Errors-To: icon-group-errors@cs.arizona.edu ## As a demonstration of the use of awk-like icon programming, I've ## written a simple but surprisingly useful program, that's now ## heavily used in 'data laundry' jobs at our institute. The program ## as it is *can* be written in AWK, by the way, but it can be very ## easily modified to handly specific (and more complex) jobs. I've ## adapted it once (using Icon sets) to check out all the cross- ## references in a multifile C program, for instance. Perhaps you'd ## find it useful. One final tip: with this program it really pays ## to use the icon compiler; the awk-processing tends to take up a lot ## of processing time. ## Jan P.A. de Ruiter ## janpeter@mpi.kun.nl # # program peanuts; # by Jan P. A. de Ruiter # # This program can be used to add information from some file to # a target file, provided there is a common element in both files # # For SPSSX users: 'peanuts' can be conceived of as an 'outboard' # JOIN MATCH function. # # The program makes use of the awk-emulation library called 'aweka.icn' # which is provided at the end of this file. For those who do not posess # the awk-lib: uncomment and save it and link it in with the # peanuts code. link aweka procedure main(argm) # argument handling if (*argm ~= 6) then usage() (vic := open(argm[1]) | stop("victim file cannot be opened.")) (tabelfile := open(argm[2]) | stop("table file cannot be opened.")) ((vicpos := +argm[3]) > 0 | stop("vicpos should be > 0.")) ((key := +argm[4]) > 0 | stop("key should be > 0.")) ((value := +argm[5]) > 0 | stop("value should be > 0.")) (outfile := open(argm[6],"w") | stop("outfile cannot be opened.")) # initialize table tabel := table() # load mapping table while (awk(tabelfile)) do { tabel[FLD[key]] := FLD[value] } while (entire_line := awk(vic)) do { if (\tabel[FLD[vicpos]]) then write(outfile,entire_line," ",tabel[FLD[vicpos]]) else stop("I\'m sorry, element \'",FLD[vicpos],"\' not present in table.") } # close and exit close(vic) close(outfile) close(tabelfile) end procedure usage() stop("usage: {icon} peanuts ", " .\n", "where: vicfile = file you want to add a column to.\n", " tabfile = file you want to look up the new column\n", " victim = position of index column in vicfile\n", " key = position of index column in tabfile\n", " value = position of value to be retrieved from tabfile\n", " outfile = the output file\n"); end # # # # AWK emulation library. # # by Jan P. A. de Ruiter. # # # global NF, NR, FLD, FS # procedure awk(file) # static oldfile # initial { oldfile := &null } # # if (oldfile ~=== file) then { # NR := 0 # oldfile := file # } # # if (/FS) then FS := ' \t' # charset := &cset -- cset(FS) # NF := 0 # FLD := list() # # if(LSTR := !file) then NR +:= 1 else fail # LSTR ? while(tab(upto(charset))) do put(FLD,tab(many(charset))) # NF := *FLD # suspend LSTR # end From icon-group-sender Thu Jun 4 04:13:54 1992 Received: by cheltenham.cs.arizona.edu; Thu, 4 Jun 1992 12:46:45 -0700 Date: Thu, 4 Jun 1992 11:13:54 -0700 From: "Kenneth Walker" Message-Id: <199206041813.AA10015@ponderosa.cs.arizona.edu> To: ercn72@festival.edinburgh.ac.uk, icon-group Subject: Re: Fast searching Status: R Errors-To: icon-group-errors@cs.arizona.edu > Date: 02 Jun 92 09:06:10 BST > From: R J Hare > I am in a position where I may soon have to implement a fast search on large > (Mbytes) files. > ... > Are there any elegant ways of implementing random access on a record based > basis? > ... > Or, have I missed something vital in the manual? I assume you are talking about too much data to read into memory or a volume which is too slow to read every time the program is called. Icon has no high-level facilities for structuring data on disk. On some systems, you can open files read-write and use where(), seek(), read() and write() to do random read, write, and update of data. These are very low-level features, but allow you to construct a complex data base system if you are willing to work at it. Note that you can effectively have pointers in "records" of the file by storing the seek() address of other records. I don't know enough about data base management to give you advice on the best way to go about it organizing the file. If you already have a data base management system, you may be able to store the data using it. If an Icon program only needs to work on a subset of the data, it can invoke data base query programs using system() to create a file containing the subset. The Icon program can then open the file and read it. I hope you find these ideas useful. Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721 +1 602 621-4252 kwalker@cs.arizona.edu uunet!arizona!kwalker From icon-group-sender Sat Jun 16 17:08:20 1992 Received: by cheltenham.cs.arizona.edu; Tue, 16 Jun 1992 13:18:22 -0700 Date: 16 Jun 92 17:08:20 GMT From: micro-heart-of-gold.mit.edu!wupost!spool.mu.edu!caen!kuhub.cc.ukans.edu!chris@bloom-beacon.mit.edu Organization: University of Kansas Academic Computing Services Subject: Context Free Grammar and Parsing Dictionary Message-Id: <1992Jun16.120820.40826@kuhub.cc.ukans.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I am interested in writing a Context free grammar in snobol and icon. I am interested in any citations that people would have, as well as suggestions on where to find a pd parsing dictionary. Thank you. Christopher Donald University of Kansas From icon-group-sender Sun Jun 17 17:11:47 1992 Received: by cheltenham.cs.arizona.edu; Wed, 17 Jun 1992 11:45:50 -0700 Path: ucbvax!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!cs.utexas.edu!utgpu!torn!cunews!nrcnet0!furlong From: furlong@selaix.iit.nrc.ca Newsgroups: comp.lang.icon Subject: string scanning and procedure calls Keywords: string, scan, procedure Message-Id: <1992Jun17.171147.20948@nrcnet0.nrc.ca> Date: 17 Jun 92 17:11:47 GMT Sender: root@nrcnet0.nrc.ca (Operator) Organization: National Research Council of Canada Lines: 59 Nntp-Posting-Host: selaix.iit.nrc.ca Apparently-To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I am scanning a string (&subject) for one of a set of words. If a particular word is found, a subroutine is called to scan the remainder of the string for some other value. If I do not pass the string in as a parameter, the remainder of &subject from the calling procedure is used, and the subroutine executes correctly. For example: string := read() string ? { tab(many(' \t')) do_something() } procedure do_something() word := tab(many(&letters)) word will be assigned the first string of letters after any preceding whitespace. However, if I pass &subject[&pos:0] to the subroutine as a parameter, and try to scan the parameter, an error occurs (the wrong value is assigned) string := read() string ? { word1 := tab(many(&letters)) tab(many(space)) do_something(&subject[&pos:0]) } procedure do_something(str) word := tab(many(&letters,str)) word here is assigned incorrectly (to some or all the letters in word1) This problem can be solved by reassigning &subject inside the called procedure via the ? operator, I'm just interested to know why it happens. Has anyone out there seen this before? Thanks, Andrew -- Andrew Furlong | The views expressed herein are mine alone, Summer Research Assistant | and may not reflect those of the National furlong@selaix.iit.nrc.ca | Research Council of Canada or the Government National Research Council (NRCC) | of Canada. From icon-group-sender Wed Jun 17 12:31:21 1992 Received: by cheltenham.cs.arizona.edu; Wed, 17 Jun 1992 14:08:15 -0700 Date: Wed, 17 Jun 92 16:31:21 -0400 From: isidev!nowlin@uunet.uu.net Message-Id: <9206172031.AA09780@relay1.UU.NET> To: uunet!cs.arizona.edu!icon-group@uunet.UU.NET Subject: Re: scanning in procedures Status: R Errors-To: icon-group-errors@cs.arizona.edu > From: furlong@selaix.iit.nrc.ca > Subject: string scanning and procedure calls > Date: 17 Jun 92 17:11:47 GMT > > I am scanning a string (&subject) for one of a set of words. > If a particular word is found, a subroutine is called to scan the > remainder of the string for some other value. > > If I do not pass the string in as a parameter, the remainder of &subject > from the calling procedure is used, and the subroutine executes correctly. > > ... > > However, if I pass &subject[&pos:0] to the subroutine as a parameter, > and try to scan the parameter, an error occurs (the wrong value is > assigned) > > string := read() > string ? { > word1 := tab(many(&letters)) > tab(many(space)) > do_something(&subject[&pos:0]) > } > > procedure do_something(str) > > word := tab(many(&letters,str)) > > word here is assigned incorrectly (to some or all the letters in word1) > > This problem can be solved by reassigning &subject inside the called > procedure via the ? operator, I'm just interested to know why it happens. > > Has anyone out there seen this before? > Thanks, > > Andrew Andrew, I added additional code to the fragment below to make it into a complete program. It's much easier to think of this stuff if you can really run it. procedure main() # mine space := ' \t' # mine string := read() string ? { word1 := tab(many(&letters)) tab(many(space)) do_something(&subject[&pos:0]) } end # mine procedure do_something(str) word := tab(many(&letters,str)) write("'",word,"'") # mine end # mine This is a neat puzzler. The real misconception seems to be associating the tab() in the expression: word := tab(many(&letters,str)) with the subject of the many(), str. Since you provided a second argument to this many() it's going to return the position in str after as many initial letters as it can find, but the &subject that tab() operates on is still the &subject from the main procedure since you haven't initiated another scanning expression. The tab() function is only meaningful in the context of string scanning since it potentially returns a portion of &subject and modifies &pos. If you try your routine with some careful input and an understanding of the above you'll see that the identifier "word" is being assigned what tab is supposed to return. It's just not what you expected. By the way, the use of "string" as a variable overrides it's definition as a built-in function. It's no problem here but can lead to very confusing errors under other circumstances. --- --- | S | Iconic Software, Inc. - Jerry Nowlin - uunet!isidev!nowlin --- --- From icon-group-sender Tue Jun 19 19:56:14 1992 Received: by cheltenham.cs.arizona.edu; Sat, 20 Jun 1992 05:39:08 -0700 Date: 19 Jun 92 19:56:14 GMT From: agate!pasteur!cory.Berkeley.EDU!hughett@ucbvax.Berkeley.EDU (Paul Hughett) Organization: University of California, at Berkeley Subject: Where to get icon? Message-Id: <1992Jun19.195614.19191@pasteur.Berkeley.EDU> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I am interested in using Icon to do some text hacking on an MS-DOS machine or Sparc station. Where can I get the source code (in C) or binary code to run Icon. Please reply to hughett@cory.berkeley.edu or post news for other interested parties. Thanks. * Paul Hughett hughett@cory.berkeley.edu * EECS Department, University of California at Berkeley From icon-group-sender Thu Jun 21 16:08:34 1992 Received: by cheltenham.cs.arizona.edu; Sun, 21 Jun 1992 12:02:44 -0700 Date: 21 Jun 92 16:08:34 GMT From: eru.mt.luth.se!lunic!sunic2!mcsun!corton!irisa!irisa.fr!bekkers@bloom-beacon.mit.edu (Yves Bekkers INRIA/IRISA) Organization: Irisa, Rennes(FR) Subject: IWMM Program Message-Id: <1992Jun21.160834.21999@irisa.fr> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Advance Program and registration information IWMM International Worshop on Memory Management September 16-18, 1992 Centre de la Briantais St Malo, France The International workshop on Memory Management covers state-of-the-art research on memory management in programming languages implementations. The program includes invited talks, reviewed presentations and panel discussions. The sessions have been scheduled around the areas of distributed systems, parallelism, fuctional programming, logic programming, object oriented programming, incremental garbage collection, improving locality, massively parallel architectures. PROGRAMME COMMITTEE Chairman Jacques Cohen Brandeis University, Waltham, MA, USA Joel F. Bartlett DEC, Palo Alto, CA, USA Yves Bekkers INRIA-IRISA, Rennes, France Hans-Jurgen Boehm Xerox Corporation, Palo Alto, CA, USA Maurice Bruynooghe Katholieke Universiteil, Leuven, Belgium Bernard Lang INRIA, Le Chesnay, France David A. Moon Apple Computer, Cambridge, MA, USA Christian Queinnec INRIA, Le Chesnay, France Dan Sahlin SICS, Kista, Sweden Taiichi Yuasa Toyohashi Univ. of tech., Toyohashi, Japan Workshop Coordinator Yves Bekkers Email : bekkers@irisa.fr INRIA-IRISA Tel : (+33) 99 84 73 24 Campus Universitaire de Beaulieu Fax : (+33) 99 38 38 32 35042 Rennes Cedex - France Telex : Unirisa 950 473 F In Cooperation with INRIA ACM SIGPLAN University of Rennes I CNRS-GRECO Programmation ADVANCE PROGRAM Wednesday September 16th 09:00 -- OPENING SESSION -- J. Cohen, Brandeis University, Waltham, MA, USA 09:15 -- DISTRIBUTED SYSTEMS I -- Distributed Garbage collection, G. Ringwood, E. Miranda, S. Abdullahi, Univ. of London, United Kingdom Comprehensive and robust garbage collection in a distributed system, N. C. Juul, E. Jul, DIKU, University of Copenhagen, Denmark 10:30 -- DISTRIBUTED SYSTEMS II -- Experience with fault-tolerant garbage collection in a distributed Lisp system, D. Plainfosse, M. Shapiro, INRIA, France Scalable distributed garbage collection for systems of active objects, N. Venkatasubramanian, G. Agha, C. Talcott, HP Comp., USA Distributed Garbage collection of active objects with no synchronisation, I. Puaut, INRIA/IRISA, France 13:30 -- PARALLELISM I -- Memory management for parallel tasks in shared memory, K. Langendoen, H. Muller, W.G. Vree, Univ. of Amsterdam, Netherland Incremental multi-threaded garbage collection on virtually shared memory architectures, T. Le Sergent, B. Bartholomieu, CNRS, France 14:45 -- FUNCTIONAL PROGRAMMING -- Generational garbage collection for lazy graph reduction, J. Seward, Victoria Univ. of Manchester, United Kingdom A conservative garbage collector with ambiguous roots, for static type checking languages, E. Chailloux, LIENS-LITP, France Efficient implementation for coroutines, L. Mateu, Universidade de Chile, An implementation of an applicative file system., B.C. Heck, D.S. Wise, Indiana University, USA. 17:00 -- DISCUSSION SESSION-- Garbage collection and memory hierarchy, P. Wilson, University of Texas, USA. Thursday September 17th 09:00 -- LOGIC PROGRAMMING I A survey on memory management for logic programming, Y. Bekkers, O. Ridoux, L. Ungaro, INRIA/IRISA, France A compile time memory-reuse scheme for concurrent logic programs, E. Tick, S. Duvvuru, R. Sundararajan, University of Oregon, USA 10:00 -- OBJECT ORIENTED PROGRAMMING -- Finalization of the collector interface, B. Hayes, Stanford University, USA Precompiling C++ for garbage collection, D. R. Edelson, INRIA, France Garbage collection-cooperative C++, A. D. Samples, University of Cincinnati, USA 13:30 -- LOGIC PROGRAMMING II -- Dynamic revision of choice points during garbage collection in Prolog, J. F. Pique, University of Aix-Marseille II, France Ecological memory management in a continuation passing Prolog engine, P. Tarau, Univ. de Moncton, Canada 15:00 -- INCREMENTAL -- Replication-based incremental copying collection, S. Nedttles, J. O'Toole, D. Pierce, N. Haines, Carnegie Mellon Univ., USA Atomic incremental garbage collection, E. K. Kolodner, W. E. Weihl, IBM Science and Technology, Israel Incremental garbage collection for mature objects, J. B. Moss, R. L. Hudson, Univ. of Massachusetts, USA 17:00 -- DISCUSSION SESSION -- Copying garbage collection is harmful, D. A. Moon, Apple Computer, Cambridge, USA Friday September 18th 09:00 -- INVITED SPEAKER -- Thermodynamics of Garbage collection, H. G. Baker, Nimble computer Corporation, USA 09:30 -- IMPROVING LOCALITY -- Object type directed garbage collection to improve locality, M. S. Lam, P.R. Wilson, T.G. Moher, University of Illinois, USA Allocation regions and implementation contracts, V. Delacour, Xerox Corporation, USA 11:00 -- PARALLELISM II -- A concurrent generational garbage collector for a parallel graph reducer, N. Rojemo, Chalmers University of technology, Sweden. Garbage collection in Aurora : an overview, P. Weemeeuw, K.U. Leuven, Belgium. 13:30 -- MASSIVELY PARALLEL ARCHITECTURES -- Collections and Garbage collection, S. C. Merrall, J.A. Padget, University of Bath, United Kingdom. Memory management and garbage collection of an extended Common Lisp system for massively parallel SIMD architecture, T. Yuasa, Toyohashi University of Technology, Japan. REGISTRATION FEES-ATTENDANCE The attendance is limited to 70 participants including the speakers. The registration fees are: - Participant 2 000 FF - Student 1 200 FF These fees include the right of access to the conference room, the proceedings, six meals (including the cold buffet on tuesday evening and the dinner cruise party on "La Rance"), coffee breaks, bus shuttles. Participants are in charge of their accomodation. There are limited rooms available in the workshop center. Hotels will otherwise be proposed. An optional night-tour is planned on Wednesday 16, to visit the "Mont Saint Michel". Registration starts on Tuesday the 15th at 17:00 at the workshop center: Le Centre de La Briantais 30 rue Maurice Nogues St MALO France Tel (33) 99 81 87 04 A cold buffet will be served at the center between 19:00 and 21:30. HOW TO GET THERE 1) By train from Paris A bus will pick up participants taking the following TGV at their arrival in Rennes and take them to the workshop center, a one hour drive: TGV BUS Paris/Montparnasse ---> Rennes ---> St Malo 15:20 17:25 18:30 For your return, a bus will take you to the following TGV in Rennes : BUS TGV St MALO ---> Rennes ---> Paris/Montparnasse 16:00 17:10 19:20 Important: reservations are required on French TGV which are usually fully booked a few days in advance, we can help taking train tickets and reservations on these two TGVs. 2) By plane via Jersey, the largest of the British Channel Islands There are no direct flight from Paris or London to Dinard/St Malo, you must come via Jersey. - from Jersey, there is a daily, one hour, flight to Dinard airport, (5 km from St Malo) which arrives at 19:05 in Dinard. Crossing by boat is also possible and very handy. - from Paris to Jersey, you can take the 16:40 flight and make your connection to the Dinard flight. - from London (Gatwick) to Jersey, there are several daily flights. 3) By plane and boat via Jersey The Channel Islands are very close from St Malo and there are plenty of daily large catamarans, almost one every hour, between Jersey and St Malo, it is only a one hour cruise. INFORMATIONS Isabelle Mescam Email : mescam@irisa.fr INRIA-IRISA Tel : (+33) 99 84 71 00 Campus Universitaire de Beaulieu Fax : (+33) 99 38 38 32 35042 Rennes Cedex - France Telex : Unirisa 950 473 F -- ==================================================================== Yves Bekkers Phone +33 99 84 73 24 IRISA/INRIA-Rennes FAX +33 99 38 38 32 Campus Universitaire de Beaulieu Telex UNIRISA 950 473F 35042 Rennes CEDEX - FRANCE e-mail bekkers@irisa.fr ==================================================================== From icon-group-sender Mon Jun 22 16:52:53 1992 Received: by cheltenham.cs.arizona.edu; Mon, 22 Jun 1992 07:15:57 -0700 Date: Mon, 22 Jun 92 14:52:53 +0200 From: Jan Peter de Ruiter Message-Id: <9206221252.AA21855@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: teaching Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu Hi, Since I'm considering giving a short introductory course on Icon programming to some interested people, I came across a sentence in the Icon Bible (I don't remeber the exact phrasing now) that expresses the opinion that in order to learn Icon, you have to have had some experience in "standard" programming languages. I tend to agree, but that could be a result of my own learning history in computer science. After getting sick and tired of all those boring loops (in C or Pascal) to run through a sequential data structure, or trying to find out if that file is really open now by checking error-codes/return values, the concepts of success/ failure and the generator metaphor are a true relief. Could it not be the case that for people without any programming experience at all, Icon is easier to learn than, say, Pascal? The Icon metaphors are more intuitive, and the student can learn to program algorithms without the need of low-level knowledge such as "a string is actually a series of unsigned short integers in C", or "every time you try to read from a file you should check for end-of-file by looking at this or that value". Perhaps students that learn Icon as their mother-tongue will be spoiled in a way; they may not be willing to learn the lower level stuff if they can use Icon for almost every application they would like to write. But I don't like that argument. It's too calvinistic. The first aim of computer education is to get students hooked on the use of computers without always having to rely on standard software, at least that is *my* aim. If Icon could get more people to *program* computers instead of doing absolutely everything in Lotus, SPSS, or WordPerfect (some people I know do data-laundry with WordPerfect macro's, since that all they know) that would be a great advance, in my opinion. So to wrap up: what's against teaching Icon as a first language? I'd like some thoughful comments, especially from people with didactic experience in computer education. Greetings, Jan P. A. de Ruiter janpeter@mpi.kun.nl From icon-group-sender Sat Jun 23 04:03:11 1992 Received: by cheltenham.cs.arizona.edu; Tue, 23 Jun 1992 05:23:41 -0700 Date: 23 Jun 92 04:03:11 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!usc!snorkelwacker.mit.edu!world!ksr!tim@ucbvax.Berkeley.EDU (Tim Peters) Organization: Kendall Square Research Corp. Subject: Re: teaching Icon Message-Id: <13184@ksr.com> References: <9206221252.AA21855@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In article <9206221252.AA21855@mpix10.mpi.kun.nl> janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: >Since I'm considering giving a short introductory course on Icon >programming to some interested people, I came across a sentence >in the Icon Bible (I don't remeber the exact phrasing now) that >expresses the opinion that in order to learn Icon, you have to >have had some experience in "standard" programming languages. >... From icon-group-sender Tue Jun 23 05:23:50 1992 Date: Tue, 23 Jun 1992 05:23:50 -0700 From: icon-group-sender Message-Id: <199206231223.AA20651@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Tue, 23 Jun 1992 05:23:50 -0700 Status: R Errors-To: icon-group-errors@cs.arizona.edu Apparently-To: icon-group-addresses The reader of this book should have a general understanding of the concepts of computer programming languages and a familiarity with the current terminology in the field. Programming experience with other programming languages, such as Pascal or C, is desirable. I take that to mean that the book intends to describe Icon, and does not intend to teach computer science or programming. I.e., that it's a statement about this specific book, not about Icon itself. >... >Could it not be the case that for people without any programming >experience at all, Icon is easier to learn than, say, Pascal? I would expect so, yes. Beginning programmers are just plain mystified, no matter what the language, and I expect that Icon as a first language would help them not to get hung up on trivialities (signed vs unsigned, packed vs unpacked, long vs short vs int vs char, etc etc). although-i-learned-fortran-first-&-think-everyone-else-should-suffer- the-way-i-did-ly y'rs - tim Tim Peters Kendall Square Research Corp tim@ksr.com, ksr!tim@uunet.uu.net From icon-group-sender Tue Jun 23 05:23:18 1992 Received: by cheltenham.cs.arizona.edu; Tue, 23 Jun 1992 07:44:22 -0700 Date: Tue, 23 Jun 92 09:23:18 -0400 From: isidev!nowlin@uunet.uu.net Message-Id: <9206231323.AA16239@relay1.UU.NET> To: uunet!cs.arizona.edu!icon-group@uunet.UU.NET Subject: Re: teaching Icon Status: RO Errors-To: icon-group-errors@cs.arizona.edu > >Could it not be the case that for people without any programming > >experience at all, Icon is easier to learn than, say, Pascal? > > I would expect so, yes. Beginning programmers are just plain mystified, > no matter what the language, and I expect that Icon as a first language > would help them not to get hung up on trivialities (signed vs unsigned, > packed vs unpacked, long vs short vs int vs char, etc etc). > > although-i-learned-fortran-first-&-think-everyone-else-should-suffer- > the-way-i-did-ly y'rs - tim > > Tim Peters Kendall Square Research Corp I too spoke fortran as a first language and it took years to overcome the compulsion to stick in a goto here and there. I number of years ago I mentored a summer intern between his freshman and sophomore years at MIT and taught him Icon in order to prototype a tool that would scan textual log files and display sections of the logs based on user specified patterns. Since he didn't have a lot of "conventional language" crap to overcome he took to Icon like a pig to mud. By the end of the summer he was trying things I wouldn't have thought to try and Icon made them simple. Of course he was a very sharp guy but Icon let him imagine how the program should work and then implement it without all the baggage Tim referred to above. I think Icon would be an excellent first language. I'm interested in what institutions are teaching Icon as a language, even as part of a larger course. For example, IIT teaches Icon in a "these are some neat languages" course and still uses it in a compiler construction course I believe. I know U of A teaches it. What other colleges are including Icon in their course offerings? --- --- | S | Iconic Software, Inc. - Jerry Nowlin - uunet!isidev!nowlin --- --- From icon-group-sender Tue Jun 23 04:54:53 1992 Received: by cheltenham.cs.arizona.edu; Tue, 23 Jun 1992 11:38:11 -0700 Date: Tue, 23 Jun 1992 9:54:53 -0500 (CDT) From: DJBAILEY@SKYLER.MAVD.HONEYWELL.COM Message-Id: <920623095453.2f2050bc@SKYLER.MAVD.HONEYWELL.COM> Subject: Re: teaching Icon To: X-Vmsmail-To: SMTP%"" Status: R Errors-To: icon-group-errors@cs.arizona.edu I am a professional programmer who is self-taught at Icon. One of the advantages to learning to program in Icon is ease of output. I wrote many small programs to test features of the language in order to learn how Icon behaved. My earliest programs had a Fortran-like design structure so I could understand them. Easy input and output is very important in a first computer language and Icon is one of the languages that has it. On the other hand, Icon has some unique and tricky concepts that could hurt a first time user. I still mix up "every" and "while." The success and failure concepts work very well some places and surprize me in others. It might be better to start with a simpler language like Basic or Pascal. When teaching programming, the teacher is more important than the language. You have to teach basic concepts like iteration, recursion, algorithm selection, and data organization. Icon might be a good choice for students with a poor math background because of Icon's suitability to non-numeric problems. Icon is a better first language than Fortran because of the easy I/O and the ability to demonstrate recursion. I'm not sure it's as good as Basic or Pascal. -- Don J. Bailey From icon-group-sender Sat Jun 23 22:28:25 1992 Received: by cheltenham.cs.arizona.edu; Tue, 23 Jun 1992 18:56:59 -0700 Date: 23 Jun 92 22:28:25 GMT From: att!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: teaching Icon Message-Id: <1992Jun23.222825.6180@midway.uchicago.edu> References: <9206221252.AA21855@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: > >Since I'm considering giving a short introductory course on Icon >programming to some interested people, I came across a sentence >in the Icon Bible (I don't remeber the exact phrasing now) that >expresses the opinion that in order to learn Icon, you have to >have had some experience in "standard" programming languages. Icon was the first programming language I learned really well. I do recall getting hung up on some basic concepts, but everything came together OK. If I'd taken it as part of an introductory programming course, and had an instructor to explain a couple of basic things, I'd guess it would have been just fine. In some ways, wouldn't Icon be harder to figure out after having had something like Pascal? (I'm not advocating Icon as a first language, by the way; just tos- sing in some ideas.) -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Wed Jun 24 08:59:58 1992 Received: by cheltenham.cs.arizona.edu; Wed, 24 Jun 1992 11:14:20 -0700 Date: Wed, 24 Jun 92 12:59:58 EDT From: Paul_Abrahams@MTS.cc.Wayne.edu To: icon-group@cs.arizona.edu Message-Id: <471789@MTS.cc.Wayne.edu> Subject: Icon as a first language Status: R Errors-To: icon-group-errors@cs.arizona.edu Icon would be a marvelous first language for computer science courses because, unlike its competitors, it encourages a high-level view of programming yet avoids the trap of appearing too abstract or theoretical. Were I teaching it, I'd downplay goal-directed evaluation and emphasize Icon's data structures: lists, tables, sets, strings, unbounded integers, etc. Moreover, Icon's error trapping is humane and reasonable; out-of-bounds array (list, that is) references can't clobber some other data that just happens to be sitting in the wrong place. Simple programs are easy to write; the initial hurdles are not large. Programming in a realistic setting often requires far more optimization and efficiency than Icon has any hope of ever providing. (When will we ever see a red-hot Icon implementation written in Icon itself?) But the right way to view an optimized program is as a derivative of a high-level program. If we don't have sets, we make do with arrays and pointer-based structures. But when obliged to do that, we should always keep in mind what those lower-level structures are really expressing. Realistic programming also often requires very specific communication with your environment (special system calls, etc.); Icon isn't terribly good at this, but it's not the kind of stuff that belongs in a first course anyway. I see two practical programs with using Icon as a first language, however: (1) There is no appropriate textbook. The Icon bible is marvelously written for its intended audience, but it isn't appropriate for beginners. To make it so would ruin it for the rest of us. (2) Icon is not very well known, particularly among people who teach beginning courses. The main competitors of Icon as a first language are probably Basic, Pascal, and Scheme. I'm not up on the recent extensions to Basic, but the original language showed its utter dependency on a very limited programming environment. It's hard to see how extending it could compensate for its weaknesses without losing compatibility with older versions. Pascal is optimized for obsolete programming environments and computers--there's a lot to be said for learning how to optimize for your environment and communicate with it, but if that's what you're after, you should be using C or even Ada. As to Scheme, it may be good for MIT students, but hardly for the multitudes---and even there, I wonder if Scheme really promotes the right high-level constructs. From icon-group-sender Thu Jun 25 10:02:22 1992 Received: by cheltenham.cs.arizona.edu; Thu, 25 Jun 1992 18:23:28 -0700 Date: Thu, 25 Jun 92 17:02:22 PDT From: alex@laguna.Metaphor.COM (Bob Alexander) Message-Id: <9206260002.AA06121@laguna.Metaphor.COM> To: icon-group@cs.arizona.edu Subject: Two-way conversations in Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu I would like to write an Icon program that carries on a two-way conversation with a remote service (in the UNIX world, mainly) -- a textual interface such as to a terminal-oriented service (like, for example, ftp). I'm not quite sure how to go about this, or if it's even possible -- any suggestions? -- Bob Alexander Metaphor Computer Systems (415) 961-3600 x751 alex@metaphor.com ====^=== Mountain View, CA ...{uunet}!{decwrl,apple}!metaphor!alex From icon-group-sender Sat Jun 27 02:54:00 1992 Received: by cheltenham.cs.arizona.edu; Sat, 27 Jun 1992 07:34:33 -0700 Date: Sat, 27 Jun 1992 08:54 CST From: Chris Tenaglia - 257-8765 Subject: Teaching Icon To: icon-group@cs.arizona.edu Message-Id: <01GLPBWGKX1W9FMHHL@mis.mcw.edu> X-Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Status: R Errors-To: icon-group-errors@cs.arizona.edu I first bought Icon 5.9 for MS-DOS in 1985. I still have it and use it because it doesn't use much memory. I also have Icon 8.5 for MS-DOS because of the added features. Having programmed BASIC for 10 years, and assembler for 5 years, I found the README files fascinating, but I couldn't write a single working program till I bought the book. I read it over a weekend back around 1988 and suddenly it all made sense. The knowledge of basic and assembler didn't seem to hurt. Later when I needed to write stuff in Pascal or C, I think the Icon knowledge helped. I found those languages a lot harder to grasp, and master. I always find myself crashing into their typed variables (even to this day). ADA which is the ultimate in typed variables, procedures, keywords, etc,... is so bad I couldn't bring myself to write the program exercizes because they were so much easier to do in icon. I ended up writing Icon in ADA style and the instructor wasn't amused. In this case Icon inhibited the learning of another language. Now the tables are turning. I've signed up for the chance to teach a session on Icon at the December 1992 DECUS symposium in Las Vegas this year. I'll be talking to a mixed crowd of users of VMS, Unix, and DOS backgrounds. Any one care to offer advice on an "Intro to Icon" 1 hour talk? If I remember, I'll share the results. Thanks, Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu From icon-group-sender Sat Jun 27 02:53:07 1992 Received: by cheltenham.cs.arizona.edu; Sat, 27 Jun 1992 13:56:01 -0700 Date: Sat, 27 Jun 92 09:53:07 -0700 From: Michael Shafto Message-Id: <9206271653.AA07183@eos.arc.nasa.gov> To: TENAGLIA@mis.mcw.edu, icon-group@cs.arizona.edu Subject: Re: Teaching Icon Cc: shafto@eos.arc.nasa.gov Status: R Errors-To: icon-group-errors@cs.arizona.edu I agree with Paul Abrahamson's recent note: The neatest thing about Icon is the range of datatypes and data structures it supports. I've been hacking away for 2-3 years on a distributed-processing simulation package based on Communicating Sequential Processes (CSP) by Tony Hoare. The most natural approach in Icon was to go directly to co-routines. But this quickly proved to be neat but impractical: stack space was eaten up and the system crasged fairly quickly for any but the smallest toy problems. So I went back to the drawing board and figured out a way to do it using concventional procedure call/routine protocols -- no co-routines, no user-defined control structures, no any of that jazz. But I still depend critically on sets, records, tables, lists, and -- of course -- on variable-length strings. Another mundane feature of Icon which I find amazingly helpful is the compile-link-run structure which encourages the building of libraries. On the negative side: For introductory purposes, I would stay away from string analysis. As one who has programmed for years in SNOBOL4, I still have one heck of a time doing anything but the simplest string-scanning in Icon. My personal opinion is that the *logical* structure of string scanning, from the user's viewpoint, is extremely opaque and confusing in Icon (as compared to SNOBOL4, which also has a few curves to throw at you, of course). It may be that I'm brain-damaged from SNOBOL4, but it seems that it's really hard to remember and envision just exactly what's happening in Icon string-scanning; and you have to do that in order not to be surprised by what you get a lot of them time. So, my advice is to stick to conventional control structures and focus on the nice range of datatypes at first. I have found sets to be amazingly useful. Good luck! Mike From icon-group-sender Sun Jun 28 18:51:55 1992 Received: by cheltenham.cs.arizona.edu; Sun, 28 Jun 1992 11:12:45 -0700 Via: uk.ac.manchester.computer-science; Sun, 28 Jun 1992 18:18:07 +0100 From: Steve Holden Date: Sun, 28 Jun 92 17:51:55 +0100 Message-Id: <2579.9206281651@desktop.desktop.co.uk> To: icon-group@cs.arizona.edu Subject: Re: Teaching Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu A further remark relevant to the teaching of Icon as a beginner's language. When I learned programming I started out with Algol 60, moved on to the assembly language for a now long-forgotten range of ICL machines, and went on picking up languages (PL/1, Fortran 2, Fortran 4, Snobol 4, etc.) as I needed them. Job mobility was much higher in those days. Icon has many features which are desirable in a language for beginners, but one thing which might stand in its way is the relatively overloaded operator set. For example, p!l (where p is a procedure and l is a list) really does mean something in Icon, but it is unlikely to be useful for beginners. The problem, as I see it, is that many sequences of symbols which a beginner might use incorrectly would be syntactically acceptable, and only at run-time would the errors become known. This gives the teacher two problems: 1. S/he has to explain what should have been written instead of what was. 2. S/he then has to explain why the erroneous construct was accepted by the translator. Perhaps we could discuss which operators were appropriate to a "beginners" version of the language, and produce a standard system with a trimmed-down lexical analyser to obviate this problem? regards Steve +-----------------------------------+-----------------------------------+ | Steve Holden, Managing Director | Desktop Connection Limited | | steve@desktop.co.uk | Manchester Science Park | |-----------------------------------+ Lloyd Street North | | Electronic Publishing Specialists | Manchester England M15 4EN | | Communication is Sharing | Tel: +44 61 227 9055 Fax: 226 4922| +-----------------------------------^-----------------------------------+ | Commercial Director: UK Internet Consortium Limited: 061 256 3955 | +-----------------------------------------------------------------------+ From icon-group-sender Sun Jun 28 11:26:21 1992 Received: by cheltenham.cs.arizona.edu; Sun, 28 Jun 1992 20:44:12 -0700 Date: Sun, 28 Jun 92 18:26:21 PDT From: rdm@cfcl.com (Rich Morin) Message-Id: <9206290126.AA00349@cfcl.com> To: icon-group@cs.arizona.edu, rdm@cfcl.com Subject: Re: Two-way conversations in Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu I hacked up something to do this, a few years back. I wanted icon to talk to NeWS interpreter, as I recall. I added a command to Icon to open I/O to a specified file. Using this, I had it open a pair of named pipes. I then invoked another program that set up named pipes to a NeWS shell (psh). All of this is pretty hacky, and some of the interfaces may have changed, but here is some sample code I dug up: # # foo.icn - check out ne3 # procedure main() if not (ne0 := open("/usr/local/ne0","w")) then stop("foo: Cannot open ne0") write("ready") while line := read() do write(ne0,line) end rdm@cfcl 617: cd ne3 rdm@cfcl 618: l foo* ne3* ne3.c ne3.o rdm@cfcl 619: more ne3.c /* || ne3.c - NeWS Environment, take 3 || || depends on the existence of named pipes /usr/local/ne[01] */ #include #include main() { int ne0, ne1; if ((ne0 = open("/usr/local/ne0",O_RDONLY)) < 0) syserr("open (ne0)"); if ((ne1 = open("/usr/local/ne1",O_WRONLY)) < 0) syserr("open (ne1)"); switch (fork()) { /* set up psh process */ case -1: syserr("fork (psh)"); case 0: /* child process (will be psh) */ if (close(0) == -1) /* set up ne0 as input stream */ syserr("close (psh 0)"); if (dup(ne0) != 0) syserr("dup (psh ne0)"); if (close(1) == -1) /* set up ne1 as output stream */ syserr("close (psh 1)"); if (dup(ne1) != 1) syserr("dup (psh ne1)"); /* execlp("psh","psh",NULL); */ execl("./psh","psh",NULL); syserr("execlp (psh)"); } switch (fork()) { /* set up "foo" process */ case -1: syserr("fork (foo)"); case 0: /* child process (will be "foo") */ execlp("foo","foo",NULL); syserr("execlp (foo)"); } while (wait(NULL) != -1) ; syserr("wait"); } Yours, Rich Morin rdm@cfcl.com From icon-group-sender Sun Jul 1 03:57:15 1992 Received: by cheltenham.cs.arizona.edu; Wed, 1 Jul 1992 05:45:27 -0700 Date: 1 Jul 92 03:57:15 GMT From: uxa.ecn.bgu.edu!mudrc@psuvax1.cs.psu.edu (Daniel R. Crowson) Organization: Educational Computing Network Subject: Icon help... Message-Id: <1992Jul1.035715.21311@uxa.ecn.bgu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Here's my problem: I want to use ICON to go through a Pascal file. The program can just type in sum and product notation into the program and then icon will go through and find these and convert them to the actual code, Example: temp1:=sum(i=1, n, (prod (j=1, 2*i, (i*(j+1)))+z) +z1 might convert to: i:=1 sumtem,p:=0; while (i<=n) do begin prodtemp:=1; j:=1; while (j<=2*i) do begin prodtemp:=prodtemp+(i*(j+1)): j:=j+1; end; sumtemp:=sumtemp+prodtemp+z1; i:=i+1; end; temp:=sumtemp+z1; There can be more than on sum statement in a given express: temp:=sum(i=1,n,i)+sum(i=1,n,i*i); Any help is greatly appreciated!!! Dan <- mudrc@uxa.ecn.bgu.edu From icon-group-sender Sun Jul 1 16:34:01 1992 Received: by cheltenham.cs.arizona.edu; Wed, 1 Jul 1992 11:33:23 -0700 Date: 1 Jul 92 16:34:01 GMT From: sun-barr!cs.utexas.edu!wupost!kuhub.cc.ukans.edu!spssig.spss.com!uchinews!ellis!goer@ames.arc.nasa.gov (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: Icon help... Message-Id: <1992Jul1.163401.8947@midway.uchicago.edu> References: <1992Jul1.035715.21311@uxa.ecn.bgu.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu mudrc@uxa.ecn.bgu.edu (Daniel R. Crowson) writes: > Here's my problem: > > I want to use ICON to go through a Pascal file. The program can just >type in sum and product notation into the program and then icon will go >through and find these and convert them to the actual code, > >a) temp1:=sum(i=1, n, (prod (j=1, 2*i, (i*(j+1)))+z) +z1 > >b) i:=1 > sumtem,p:=0; > while (i<=n) do begin > etc... I'd guess that the solution depended on whether the grammar of (a) above is parsable using recursive descent backtracking system. It's not, of course, because (a) may include left recursive elements. This renders Icon's natural control mechanisms ineffective. You have to do something fancier to reduce (a) to a tree or graph structure, and convert it to (b). I keep grumbling about how I ought to write a YACC-like tool for Icon, or at least try to rewrite a YACC version to output Icon code. I don't see how I'll get to this in the near future, though. If somebody wants to make us all jump with glee, they oughta write a Tomita-style parallel parser. Such parsers are almost as fast on simple grammars as traditional LALR(1) parser generators, and handle a much fuller range of context free grammars. If you want, I can send you a chart parser I wrote, which can be used to parse anything describable by a context-free grammar. It's set up, by default, to output a tree structure, which can then be converted into legal Pascal notation. Pascal has a very simple grammar. As I recall, it can be parsed using a simple top-down recursive system. You tech- nical guys: Is this right? If so, it should be *very* easy to convert a tree structure into good PASCAL code! -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Wed Jul 4 07:44:28 1992 Received: by cheltenham.cs.arizona.edu; Sat, 4 Jul 1992 06:07:02 -0700 Date: 4 Jul 92 07:44:28 GMT From: csus.edu!netcomsv!mork!ivan@decwrl.dec.com (Ivan Kissiov) Organization: Netcom - Online Communication Services (408 241-9760 guest) Subject: Where do I find the source code for Icon ? Message-Id: Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I just got the book "The Implementation of the Icon Programming Language" and it says that the source is in the public domain. ftp`ing into "cs.arizona.edu" left me with no source. Where do I go from here ? Please HELP? I am a language implementation junkie and I need a fix. Regards: - ivan From icon-group-sender Wed Jul 4 07:44:28 1992 Received: by cheltenham.cs.arizona.edu; Sat, 4 Jul 1992 06:15:07 -0700 Date: 4 Jul 92 07:44:28 GMT From: csus.edu!netcomsv!mork!ivan@decwrl.dec.com (Ivan Kissiov) Organization: Netcom - Online Communication Services (408 241-9760 guest) Subject: Where do I find the source code for Icon ? Message-Id: Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: RO Errors-To: icon-group-errors@cs.arizona.edu I just got the book "The Implementation of the Icon Programming Language" and it says that the source is in the public domain. ftp`ing into "cs.arizona.edu" left me with no source. Where do I go from here ? Please HELP? I am a language implementation junkie and I need a fix. Regards: - ivan From icon-group-sender Mon Jul 9 04:34:41 1992 Received: by cheltenham.cs.arizona.edu; Thu, 9 Jul 1992 07:01:09 -0700 Date: 9 Jul 92 04:34:41 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!quads!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: chart parser Message-Id: <1992Jul9.043441.8063@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I received a request for this, and since I've augmented it slightly (adding sample BNFs to the front matter, for example), it seemed worth a re-post. -Richard ############################################################################ # # Name: ichartp.icn # # Title: Iconish implementation of a simple chart parser # # Author: Richard L. Goerwitz # # Version: 1.5 # ############################################################################ # # General: # # Ichartp implements a simple chart parser - an only marginally # successful strategy for parsing context free grammars (it has a # cubic worst-case time factor), but one which at least allows enough # flexibility to enable it to handle a lot of natural language # constructs. It also lacks many of the troubles associated with # empty and left-recursive derivations. To obtain a parse, just # create a BNF file, obtain a line of input, and then invoke the # procedure parse_sentence(sentence, bnf_filename, start-symbol). # Parse_sentence suspends successive edge structures corresponding to # possible parses of the input sentence. There is a routine called # edge_2_tree() that converts these edges to a more standard form. # See the stub main() procedure for an example of how to make use of # all these facilities. # # Implementation details: # # The parser itself operates in bottom-up fashion, but it might # just as well have been coded top-down, or for that matter as a # combination bottom-up/top-down parser (chart parsers don't care). # The parser operates in breadth-first fashion, rather than walking # through each alternative until it is exhausted. As a result, there # tends to be a pregnant pause before any results appear, but when # they appear they come out in rapid succession. To use a depth-first # strategy, just change the "put" in "put(ch.active, new_e)" to read # "push." I haven't tried to do this, but it should be that simple # to implement. # BNFs are specified using the same notation used in Griswold & # Griswold, and as described in the IPL program "pargen.icn," with # the difference that all metacharacters (space, tab, vertical slash, # right/left parends, brackets and angle brackets) can be converted # to literals by prepending a backslash (rendering , , etc. # as notations for these characters unnecessary). Comments can be # include along with BNFs using the same notation as for Icon code # (i.e. #-sign). # # Gotchas: # # Pitfalls to be aware of include things like ::= | ha | # () (a weak attempt at a laugh recognizer). This grammar will # accept "ha," "ha ha," etc. but will suspend an infinite number of # possible parses. The right way to do this sort of thing is ::= # ha | ha, or if you really insist on having the empty string as # a possibility, try things like: # # ::= () | # ::= ha | ha # # Of course, the whole problem of infinite parses can be avoided by # simply invoking the parser in a context where it is not going to # be resumed, or else one in which it will be resumed a finite number # of times. # # Motivation: # # I was reading Byte Magazine (vol. 17:2 [February, 1992]), and # ran into an article entitled "A Natural Solution" (pages 237-244) # in which a standard chart parser was described in terms of its C++ # implementation. The author remarked at how his optimizations made # it possible to parse a 14-word sentence in only 32 seconds (versus # 146 for a straight Gazdar-Mellish LISP chart parser). 32 seconds # struck me as hardly anything to write home about, so I coded up a # quick system in Icon to see how it compared. This library is the # result. # I'm quite sure that this code could be very much improved upon. # As it stands, its performance seems as good as the C++ parser in # BYTE, if not better. It's hard to tell, though, seeing as I have # no idea what hardware the guy was using. I'd guess a 386 running # DOS. On a 386 running Xenix the Icon version beats the BYTE times # by a factor of about four. The Icon compiler creates an executable # that (in the above environment) parses 14-15 word sentences in # anywhere from 6 to 8 seconds. Once the BNF file is read, it does # short sentences in a second or two. If I get around to writing it, # I'll probably use the code here as the basic parsing engine for an # adventure game my son wants me to write. # ############################################################################ # # Links: structs, slashbal, rewrap, strip, stripcom (ximage for debugging) # # Requires: an up-to-date IPL # ############################################################################ # # Here's a sample BNF file (taken, modified, from the BYTE Magazine # article mentioned above). Note again the conventions a) that # terminals be enclosed in angle brackets & b) that overlong lines be # continued by terminating the preceding line with a backslash. # Although not illustrated below, the metacharacters <, >, (, ), and # | can all be escaped (i.e. can all have their special meaning # neutralized) with a backslash (e.g. \<). Comments can also be # included using the Icon #-notation. # # ::= | # ::= | ( () | ) | \ # ( | | | ) # ::= ( | | | ) | \ # | | | \ # # ::=

( | ) | # ::= # ::= and # ::= the | a | his | her # ::= her | he | they # ::= nurse | nurses | book | books | travel | arrow | arrows | \ # fortune | fortunes | report # ::= outrageous | silly | blue | green | heavy | white | red | \ # black | yellow # ::= travel | travels | report | see | suffer # ::= hear | see | suffer #

::= on | of # ::= that # ############################################################################ # I use ximage for debugging purposes. link structs, slashbal, rewrap, strip, stripcom#, ximage record stats(edge_list, lhs_table, term_set) record chart(inactive, active) # inactive - set; active - list record retval(no, item) record edge(LHS, RHS, LEN, DONE, BEG, END, SEEN) record short_edge(LHS, RHS) # # For debugging only. # procedure main(a) local res, filename # &trace := -1 filename := \a[1] | "bnfs.byte" while line := read(&input) do { every res := parse_sentence(line, filename, "S") do { if res.no = 0 then write(stree(edge2tree(res.item))) # write(ximage(res.item)) else if res.no = 1 then write("unknown terminal symbol, ", res.item) } } end # # parse_sentence: string x string -> edge records # (s, filename) -> Es # where s is a chunk of text presumed to constitute a sentence # where filename is the name of a grammar file containing BNFs # where Es are edge records containing possible parses of s # procedure parse_sentence(s, filename, start_symbol) local file, e, i, elist, ltbl, tset, ch, tokens, st, memb, new_e, token_set, none_found, active_modified static master, old_filename initial master := table() # # Initialize and store stats for filename (if not already stored). # if not (filename == \old_filename) then { file := open(filename, "r") | p_err(filename, 7) # # Read BNFs from file; turn them into edge structs, and # store them all in a list; insert terminal symbols into a set. # elist := list(); ltbl := table(); tset := set() every e := bnf_file_2_edges(file) do { put(elist, e) # main edge list (active) (/ltbl[e.LHS] := set([e])) | insert(ltbl[e.LHS], e) # index LHSs every i := 1 to e.LEN do # LEN holds length of e.RHS if /e.RHS[i].RHS then # RHS for terminals is null insert(tset, e.RHS[i].LHS) & break } insert(master, filename, stats(elist, ltbl, tset)) old_filename := filename close(file) } elist := fullcopy(master[filename].edge_list) ltbl := fullcopy(master[filename].lhs_table) tset := master[filename].term_set # # Make edge list into the active section of chart; tokenize the # sentence s & check for unrecognized terminals. # ch := chart(set(), elist) tokens := tokenize(s) # # Begin parse by entering all tokens in s into the inactive set # in the chart as edges with no RHS (a NULL RHS is characteristic # of all terminals). # token_set := set(tokens) every i := 1 to *tokens do { # Flag words not in the grammar as errors. if not member(tset, tokens[i]) then suspend retval(1, tokens[i]) # Now, give us an inactive edge corresponding to word i. insert(ch.inactive, e := edge(tokens[i], &null, 1, 1, i, i+1)) # Insert word i into the LHS table. (/ltbl[tokens[i]] := set([e])) | insert(ltbl[tokens[i]], e) # Watch out for those empty RHSs. insert(ch.inactive, e := edge("", &null, 1, 1, i, i)) (/ltbl[""] := set([e])) | insert(ltbl[""], e) } *tokens = 0 & i := 0 insert(ch.inactive, e := edge("", &null, 1, 1, i+1, i+1)) (/ltbl[""] := set([e])) | insert(ltbl[""], e) # # Until no new active edges can be built, keep ploughing through # the active edge list, trying to match unconfirmed members of their # RHSs up with inactive edges. # until \none_found do { # write(ximage(ch)) none_found := 1 every e := !ch.active do { active_modified := &null # keep track of inactive edges we've already tried /e.SEEN := set() # # e.RHS[e.DONE+1] is the first unconfirmed category in the # RHS of e; ltbl[e.RHS[e.DONE+1].LHS] are all edges having # as their LHS the LHS of the first unconfirmed category in # e's RHS; we simply intersect this set with the inactives, # and then subtract out those we've seen before in connec- # tion with this edge - # if *(st := \ltbl[e.RHS[e.DONE+1].LHS] ** ch.inactive -- e.SEEN) > 0 then { # record all the inactive edges being looked at as seen e.SEEN ++:= st every memb := !st do { # make sure this inactive edge starts where the # last confirmed edge in e.RHS ends! if memb.BEG ~= \e.RHS[e.DONE].END then next # set none_found to indicate we've created a new edge else none_found := &null # create a new edge, having the LHS of e, the RHS of e, # the start point of e, the end point of st, and one more # confirmed RHS members than e new_e := edge(e.LHS, fullcopy(e.RHS), e.LEN, e.DONE+1, e.BEG, memb.END) new_e.RHS[new_e.DONE] := memb /new_e.BEG := memb.BEG if new_e.LEN = new_e.DONE then { # it's inactive insert(ch.inactive, new_e) insert(ltbl[e.LHS], new_e) if new_e.BEG = 1 & new_e.END = (*tokens+1) then { if new_e.LHS == start_symbol # complete parse then suspend retval(0, new_e) } } else { put(ch.active, new_e) # it's active active_modified := 1 } } } # restart if the ch.active list has been modified if \active_modified then break next } } end # # tokenize: break up a sentence into constituent words, using spaces, # tabs, and other punctuation as separators (we'll need to # change this a bit later on to cover apostrophed words) # procedure tokenize(s) local l, word l := list() s ? { while tab(upto(&letters)) do put(l, map(tab(many(&letters)))) } return l end # # edge2tree: edge -> tree # e -> t # # where e is an edge structure (active or inactive; both are okay) # where t is a tree like what's described in Ralph Griswold's # structs library (IPL); I don't know about the 2nd ed. of # Griswold & Griswold, but the structure is described in the 1st # ed. in section 16.1 # # fails if, for some reason, the conversion can't be made (e.g. the # edge structure has been screwed around with in some way) # procedure edge2tree(e) local memb, t t := [e.LHS] \e.RHS | (return t) # a terminal type(e) == "edge" | (return put(t, [])) # An incomplete edge every memb := !e.RHS do # has daughters. put(t, edge2tree(memb)) return t end # # bnf_file_2_edges: concatenate backslash-final lines & parse # procedure bnf_file_2_edges(f) while line := read(f) do { line := stripcom(line) while line ?:= 1(tab(-2) || tab(slashupto('\\')), pos(-1)) || !f suspend bnf_2_edges(line) } end # # bnf_2_edges: string -> edge records # s -> Es (a generator) # where s is a CFPSG rule in BNF form # where Es are edges # procedure bnf_2_edges(s) # # Take out non-backslashed whitespace (i.e. spaces and tabs). # stripped_s := "" s ? { while stripped_s ||:= tab(slashupto(' \t')) do tab(many(' \t')) stripped_s ||:= tab(0) } # # Break BNF-style CFPSG rule into LHS and RHS. If there is more # than one RHS (a la the | alternation op), suspend multiple re- # sults. # stripped_s ? { LHS := 1("" ~== tab(slashbal(':', '<', '>')), ="::=") | p_err(s,1) LHS ?:= strip(2(="<", tab(-1), =">"), '\\') | p_err(s, 2) LHS == "" & p_err(s, 6) every RHS := do_slash(tab(0) \ 1) do { RHS := string_2_list(RHS) suspend edge(LHS, RHS, *RHS, 0, &null, &null) } } end # # string_2_list: string -> list # s -> L # where L is a list of partially constructed (short) edges, having # only LHS and RHS; in the case of nonterminals, the RHS is set # to 1, while for terminals the RHS is null (and remains that way # throughout the parse) # procedure string_2_list(s) local RHS_list, LHS (s || "\x00") ? { pos(-1) & (return [short_edge("", &null)]) RHS_list := list() until pos(-1) do { if match("<") then { LHS := ("" ~== tab(slashbal(&cset, '<', '>'))) | p_err(s, 4) LHS ?:= strip(2(="<", tab(-1), =">"), '\\') | p_err(s, 4) put(RHS_list, short_edge(LHS, 1)) } else { LHS := tab(slashupto('<') | -1) slashupto('>', LHS) & p_err(s, 5) put(RHS_list, short_edge(strip(LHS, '\\'), &null)) } } } return RHS_list end # # slashupto: cset x string x integer x integer -> integers # (c, s, i, j) -> Is (a generator) # where Is are the integer positions in s[i:j] before characters # in c that is not preceded by a backslash escape # procedure slashupto(c, s, i, j) if /s := &subject then /i := &pos else /i := 1 /j := *s + 1 /c := &cset c ++:= '\\' s[1:j] ? { tab(i) while tab(upto(c)) do { if (="\\", move(1)) then next suspend .&pos move(1) } } end # # fullcopy: make full recursive copy of object # procedure fullcopy(obj) local retval, i, k case type(obj) of { "co-expression" : return obj "cset" : return obj "file" : return obj "integer" : return obj "list" : { retval := list(*obj) every i := 1 to *obj do retval[i] := fullcopy(obj[i]) return retval } "null" : return &null "procedure" : return obj "real" : return obj "set" : { retval := set() every insert(retval, fullcopy(!obj)) return retval } "string" : return obj "table" : { retval := table(obj[[]]) every k := key(obj) do insert(retval, fullcopy(k), fullcopy(obj[k])) return retval } # probably a record; if not, we're dealing with a new # version of Icon or a nonstandard implementation, and # we're screwed default : { retval := copy(obj) every i := 1 to *obj do retval[i] := fullcopy(obj[i]) return retval } } end # # do_slash: string -> string(s) # Given a|b suspend a then b. Used in conjunction with do_parends(). # procedure do_slash(s) local chunk s ? { while chunk := tab(slashbal('|', '(', ')')) do { suspend do_parends(chunk) move(1) } suspend do_parends(tab(0)) } end # # do_parends: string -> string(s) # Given a(b)c suspend abc; given a(b|c)d suspend abd and acd, etc. # Used in conjuction with do_slash(). # procedure do_parends(s) local chunk, i, j s ? { if not (i := slashupto('(')) then { chunk := tab(0) slashupto(')') & p_err(s, 8) suspend chunk } else { j := i + slashbal(')', '(', ')', s[i+1:0]) | p_err(s, 9) suspend tab(i) || (move(1), do_slash(tab(j))) || (move(1), do_parends(tab(0))) } } end # # p_err: print error message to stderr & abort # procedure p_err(s, n) local i, msg static errlist initial { errlist := [[1, "malformed LHS"], [2, "nonterminal lacks proper <> enclosure"], [3, "missing left angle bracket"], [4, "unmatched left angle bracket"], [5, "unmatched right angle bracket"], [6, "empty symbol in LHS"], [7, "unable to open file"], [8, "unmatched right parenthesis"], [9, "unmatched left parenthesis"] ] } every i := 1 to *errlist do if errlist[i][1] = n then msg := errlist[i][2] writes(&errout, "error ", n, " (", msg, ") in \n") every write("\t", rewrap(s) | rewrap()) exit(n) end -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Mon Jul 13 15:21:48 1992 Received: by cheltenham.cs.arizona.edu; Mon, 13 Jul 1992 07:45:11 -0700 Date: Mon, 13 Jul 92 13:21:48 +0200 From: Jan Peter de Ruiter Message-Id: <9207131121.AA23567@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: Sets Cc: maarten@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu Hi, Recently I discovered that the set datatype in Icon is not as sophisticated as I would have liked. For instance, the following program: procedure main() a := set() b := set() superset := set() insert(a,"one") insert(a,"two") insert(b,"two") insert(b,"one") insert(superset, a) insert(superset, b) write(*superset) end writes a 2 on the screen. This means that if the elements of sets are sets, they don't work properly anymore in the mathematical sense. I can very well imagine that there are technical problems involved in implementing a set-type that would write a 1 in the above program, but alas, I really do neet that kind of set. Is there anyone out there with a suggestion of how to implement these meta-sets without sorting every set into a list and comparing the lists? I am trying to hack together an "insert2" routine, that checks whether the inserted set is already present in the victim-set. Any suggestion is welcome Jan P. A. de Ruiter janpeter@mpi.kun.nl From icon-group-sender Mon Jul 13 21:58:43 1992 Received: by cheltenham.cs.arizona.edu; Mon, 13 Jul 1992 18:21:06 MST Date: 13 Jul 92 21:58:43 GMT From: youngm@boulder.colorado.edu (Matthew Young) Organization: Center for Study of Earth from Space, U of Colorado, Boulder Subject: Superset Problem Message-Id: <1992Jul13.215843.1667@colorado.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Jan Peter: Did you intend to set superset to { {"one","two"} }? If so, I think I what the problem is. If not, please post the set you expected to get. mY  From icon-group-sender Tue Jul 14 01:03:42 1992 Received: by cheltenham.cs.arizona.edu; Mon, 13 Jul 1992 18:21:15 MST Date: 14 Jul 92 01:03:42 GMT From: elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!newsaintmail@ames.arc.nasa.gov (Michael Glass at Fermilab) Organization: Fermi National Accelerator Laboratory Subject: Re: Sets Message-Id: <13JUL92190342@adcalc.fnal.gov> References: <9207131121.AA23567@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu It was proposed that after executing the following, then *superset should produce the value 1: 1) a := set() # You may imagine a non-empty set of strings 2) b := set() # Imagine an identical LOOKING set 3) superset := set() 4) insert2(superset, a) 5) insert2(superset, b) I sat down to write insert2(), purely as an exercise, and the semantics confused me. () What happens to the the value of *superset if we add line 6), as follows: 3) superset := set() # *superset = 0 4) insert2(superset, a) # *superset = 1 5) insert2(superset, b) # *superset = 1 6) insert(a, stuff) # *superset = ? () Similarly, delete2(insert2(s, x), x) confuses me: 3) superset := set() # *superset = 0 4) insert2(superset, a) # *superset = 1 5) insert2(superset, b) # *superset = 1 6) delete2(superset, b) # *superset = ? () In mathematics, one cannot say "let a and b be empty sets." Is it true, then, that would you want "a === b" to succeed? () Suppose the sets contained other structures, e.g.: 1) a := set([table()]) # You may imagine here a non-empty table 2) b := set([table()]) # Imagine a similar-looking table 3) superset := set() 4) insert2(superset, a) 5) insert2(superset, b) # *superset = ? It seems to me that if these questions are answered, then it might be possible to write a more-or-less grungy "mathemetical set" package. I do not see how such a package can be beautiful code. -- Michael Glass, Fermilab GLASS@ADCALC.FNAL.GOV From icon-group-sender Mon Jul 13 23:28:26 1992 Received: by cheltenham.cs.arizona.edu; Mon, 13 Jul 1992 18:21:23 MST Date: 13 Jul 92 23:28:26 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!quads!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: Sets Message-Id: <1992Jul13.232826.21943@midway.uchicago.edu> References: <9207131121.AA23567@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: > >procedure main() >... > insert(superset, a) > insert(superset, b) > write(*superset) >end > > writes a 2 on the screen. This means that if the elements of sets > are sets, they don't work properly anymore in the mathematical > sense. > >Is there anyone out there with a suggestion of how to implement these >meta-sets without sorting every set into a list and comparing the >lists? I am trying to hack together an "insert2" routine, that checks >whether the inserted set is already present in the victim-set. As you probably know, Icon's sets, tables, and lists are actually pointers to unique structures. If you insert a set into a set, you are inserting a pointer to a unique set into a set. You are apparently confusing this operation with a 2-set union, which produces a new set, distinct from its component sets (see the "++" operator), possessing all the mem- bers of both original sets. Maybe I'm missing the point, though. Could you perhaps elaborate on just what it is you want to do? -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Tue Jul 14 12:07:45 1992 Received: by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 04:51:27 MST Date: Tue, 14 Jul 92 12:07:45 +0200 From: Jan Peter de Ruiter Message-Id: <9207141007.AA26490@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: Set(Set) Cc: maarten@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu The problem I have is the following: if I insert a string, (or a number) twice in the same set, only one is taken to be in the set. Therefore, a) the size of the resulting set is 1 b) generating all elements of the resulting set will procude one result So far, so good. If I try to insert (identical) sets instead of numbers/strings, the logic has suddenly changed, since: a) the size of the (meta)set is 2 b) generating the elements of the metaset will produce 2 results. What should happen, (ideally, I mean; I am fully aware of the implications of such a mechanism on the level of the implementation) is that since the sets { "one", "two" } and { "one", "two" } are identical, inserting the set {"one", "two" } twice in the same set (a set of sets) should result in a set containing ONE element, that element being the *set* { "one", "two" }. The problem, and also some of the apparent confusion, seems to come from the notion "identical". On the level of the implementation, "identical sets" means "sets being the same object in memory". In the mathematical sense, "identical sets " means "sets containing the same members". Now on the level of the implementation there is some inconsistency: If I insert the number 15 twice, the *value* 15 determines whether adding the element 15 will increase the size of the set. If I insert the set X, the *adress* of X will determine whether the set will become larger by one element. If one happens to need sets of sets [of sets ...] one could implement them 'manually'. The straightforward way is to build new procedures that convert any set (or table) into a sorted list, and then use LISP like recursive operations in order to check for a possible equality of two sets or tables. This takes up a lot of memory, of course, and, as Michael Glass points out in his contribution, the semantics should be worked out first. I'll go into his questions in another posting, in order to keep this one more general. Sets are so useful as data structures *because* identical elements cannot appear more than once in it. If I did not need that feature, I might as well use lists, and reduce them once in order to remove duplicated strings and numbers. Jan P. A. de Ruiter janpeter@mpi.kun.nl From icon-group-sender Tue Jul 14 13:49:36 1992 Date: Tue, 14 Jul 1992 13:49:36 MST From: icon-group-sender Message-Id: <199207142049.AA03416@cheltenham.cs.arizona.edu> Received: by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 13:49:36 MST Errors-To: icon-group-errors@cs.arizona.edu Apparently-To: icon-group-addresses From icon-group-sender Tue Jul 14 11:24:22 1992 Received: by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 13:49:42 MST Date: Tue, 14 Jul 1992 11:24:22 -0500 (CDT) From: DJBAILEY@SKYLER.MAVD.HONEYWELL.COM Message-Id: <920714112422.2020fdc2@SKYLER.MAVD.HONEYWELL.COM> Subject: Sets of things To: icon-group@cs.arizona.edu X-Vmsmail-To: SMTP%"icon-group@cs.arizona.edu" Status: R Errors-To: icon-group-errors@cs.arizona.edu I did some experimenting with sets based on Jan's concerns and I think he has a good point. Sets of integers or strings behave differently from sets of higher structures. Run the little program below to see the difference. Icon should be more consistant than that. Jan, here is an implementation idea for you. If you have less than 255 unique items, you could equate them to characters with a table and use csets for your set operations. If you could equate your elements to integers, again using a table when you need the actual values, and use set union instead of insertion, the program change might be easier to handle. ============================================================== # This is an Icon program to test the nature of sets in Icon. # It is inspired by a question from Jan Peter de Ruiter. procedure main() super1 := set([15,15]) write("Try set([15,15])") write("The size is ",*super1) super1 := set( [set([15]), set([15])] ) write("Try set( [set([15]), set([15])] )") write("The size is ",*super1) super1 := set([[15],[15]]) write("Try set([[15],[15]])") write("The size is ",*super1) super1 := set(["one","one"]) write("Try set([\"one\",\"one\"])") write("The size is ",*super1) super1 := set([11,12]) ++ set([12]) write("Try set([11,12]) ++ set([12])") write("The size is ",*super1) sub1 := set(["one","two"]) sub2 := set(["two","one"]) write(" ") # blank line write("sub1 and sub2 are Jan's sets.") write("sub1 is ",image(sub1)) write("sub2 is ",image(sub2)) super1 := set() insert(super1,sub1) insert(super1,sub2) write("The size of super1 using inserts is ",*super1) write("super1 looks like ",image(super1)) super1 := set() super1 ++:= sub1 super1 ++:= sub2 write("The size of super1 using set union is ",*super1) write("super1 looks like ",image(super1)) end From idealord@dorsai.com Tue Jul 14 09:37:39 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 10:27:42 MST Received: from uu3.psi.com by optima.cs.arizona.edu (5.65c/15) via SMTP id AA09732; Tue, 14 Jul 1992 10:27:39 MST Received: by uu3.psi.com (5.65b/4.0.071791-PSI/PSINet) id AA22087; Tue, 14 Jul 92 13:27:35 -0400 From: idealord@dorsai.com (Jeff Harrington) Received: by dorsai.com (5.65/3.2.083191-The Dorsai Diplomatic Mission) id AA05518; Tue, 14 Jul 92 09:37:40 -0400 Message-Id: <9207141337.AA05518@dorsai.com> Subject: FTP Address and GA Algorithms in Icon To: icon-group@cs.arizona.edu Date: Tue, 14 Jul 92 9:37:39 EDT X-Mailer: ELM [version 2.3 PL2] Status: R I would appreciate the FTP address for the Icon Project. I am looking for Icon example code, specifically AI type code, and more specifically Genetic Algorithm code in Icon. You may respond by EMail so as not to tie up the list, if you wish. Jeff Harrington idealord@dorsai.com From icon-group-request Tue Jul 14 18:20:50 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 10:35:42 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (5.65c/15) via SMTP id AA11481; Tue, 14 Jul 1992 10:35:39 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA01222; Tue, 14 Jul 92 10:31:20 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 14 Jul 92 18:20:50 GMT From: sun-barr!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!newsaintmail@ames.arc.nasa.gov (Michael Glass at Fermilab) Organization: Fermi National Accelerator Laboratory Subject: Re: Set(Set) Message-Id: <14JUL92122050@adcalc.fnal.gov> References: <9207141007.AA26490@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R An implementation note: my first thought was to compare two sets for equality by checking set differences. Thus: procedure set_equal(A, B) return (*A = *B) & (0 = *(A--B) = *(B--A)) end This works as long as sets A and B contain strings, numbers, csets, etc. Procedure set_equal() may not work if sets A and B contain other structures such as tables, lists, other sets, etc. Depending upon how you define set equality, your routine might have to check for equality of two general structures. Comparing two arbitrary structures is messy. Consider: sort(A) = [ A1, A2 ] # where A1 and A2 are tables sort(B) = [ B1, B2 ] # B1 and B2 likewise It might be that A1 = B2 and B1 = A2; sort() won't necessarily put them in the order you want. You can check for equality by comparing pairs from a subset of the cross product A x B. Now consider that a set may contain a heterogeneous mixture of objects of all data types. Assuming that we have built a function set_equal(A, B) (either the simple version above, or a more complicated version which compares embedded structure types), it seems to me that Mr. de Ruiter is asking for insert2() to make a _copy_ of the set it is inserting. It is my belief that insert2() looks something like this, where Copy() is some suitable extension of the copy() function: procedure insert2(s, x) if type(s) == type(x) == "set" then { if set_equal(!s, x) then return s else return insert(s, Copy(x)) } fail end -- Michael Glass From icon-group-request Tue Jul 14 15:17:47 1992 Received: from optima.cs.arizona.edu by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 11:05:18 MST Received: from ucbvax.Berkeley.EDU by optima.cs.arizona.edu (5.65c/15) via SMTP id AA17799; Tue, 14 Jul 1992 11:05:14 MST Received: by ucbvax.Berkeley.EDU (5.63/1.43) id AA02770; Tue, 14 Jul 92 11:02:22 -0700 Received: from USENET by ucbvax.Berkeley.EDU with netnews for icon-group@cs.arizona.edu (icon-group@cs.arizona.edu) (contact usenet@ucbvax.Berkeley.EDU if you have questions) Date: 14 Jul 92 15:17:47 GMT From: agate!spool.mu.edu!umn.edu!noc.msc.net!uc.msc.edu!shamash!sctc.com!bright@ucbvax.Berkeley.EDU (David A. Bright) Organization: SCTC Subject: Re: Sets Message-Id: <1992Jul14.151747.12603@sctc.com> References: <9207131121.AA23567@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: > Recently I discovered that the set datatype in Icon is not as > sophisticated as I would have liked. For instance, the following > program: >procedure main() > a := set() > b := set() > superset := set() > insert(a,"one") > insert(a,"two") > insert(b,"two") > insert(b,"one") > insert(superset, a) > insert(superset, b) > write(*superset) >end > writes a 2 on the screen. This means that if the elements of sets > are sets, they don't work properly anymore in the mathematical > sense. >I can very well imagine that there are technical problems involved in >implementing a set-type that would write a 1 in the above program, but >alas, I really do neet that kind of set. Well, replacing "insert(superset, a)" with "every insert(superset, !a)" (and similarly for "b") got what I THINK you were trying to do, but it will still print "2" because "a" and "b" both have two identical elements. -- David A. Bright Secure Computing bright@SCTC.COM (work) From icon-group-sender Tue Jul 14 14:45:17 1992 Received: by cheltenham.cs.arizona.edu; Tue, 14 Jul 1992 15:18:00 MST Date: Tue, 14 Jul 1992 14:45:17 MST From: "Clinton Jeffery" Message-Id: <199207142145.AA13408@chuckwalla.cs.arizona.edu> To: icon-group Subject: sets of things Status: R Errors-To: icon-group-errors@cs.arizona.edu Someone said: Icon should be more consistent. Icon is consistent, it is just that the Icon set type is not what Mr. de Ruiter needs. He needs mathematical sets. As several folks have pointed out, Icon sets are not mathematical sets, since they can have structure values such as sets and tables as members. If you insert a 1 into a set, the set doesn't have to worry about the 1 ever changing. If you insert a set S1 into a set S2, you can still insert or delete elements from S1. These Icon sets are not math sets, they are changeable (or mutable) structures, Very similar to tables. Michael Glass's post was correct: in order to implement math sets, one needs a set type with values that are immutable, one needs set operations that produce new sets instead of changing old ones, and one needs a "structural equality" test for sets. Maybe someone has already done this in Icon along the lines Mr. Glass suggested. I know math sets are useful for a broad class of algorithms that are expressed in terms of sets. From icon-group-sender Wed Jul 15 06:24:53 1992 Received: by cheltenham.cs.arizona.edu; Wed, 15 Jul 1992 05:33:59 MST Date: 15 Jul 92 06:24:53 GMT From: world!ksr!tim@decwrl.dec.com (Tim Peters) Organization: Kendall Square Research Corp. Subject: Re: Set(Set) Message-Id: <13807@ksr.com> References: <9207141007.AA26490@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In article <9207141007.AA26490@mpix10.mpi.kun.nl> janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: > ... [notes that Icon sets aren't always mathematical sets] ... >If I try to insert (identical) sets instead of numbers/strings, >the logic has suddenly changed ... The 2nd edition of _The Icon Programming Language_, chapter 10, section "Comparing Values" (pp 125-127) explains what's going on, although it doesn't explicitly mention sets in that section (& it should). The bottom line is that only entities of type cset integer null real string work the way you expect. Note that I was careful to say "the way you expect" instead of "correctly" . Icon *is* consistent in the sense that the same rules apply for table referencing and "===" comparison as apply for determining set membership. It would be horrid to have sets use a method different from those. >Sets are so useful as data structures *because* identical elements cannot >appear more than once in it. If I did not need that feature, I might as >well use lists, and reduce them once in order to remove duplicated strings >and numbers. I'm not saying you don't need what you need, but do claim that Icon's "sets" are useful nevertheless -- even Icon's flavor of sets of sets. Take it for what it is, and you'll find good uses for it; I've written oodles of Icon that uses sets of sets & sets of lists etc, and I'm grateful that the set functions do an use an inexpensive pointer- comparison method (else they'd run way too slowly to be useful in some applications). It's not always true that lists are as convenient in this context, either: "delete" does something clearly for sets that's clumsy to express with list operations. Ditto intersection, and so on. It's also not clear that it's possible to construct a set implementation that does "the right thing" in all cases. Well, actually, it's clearly impossible: consider, e.g., functions (nicely-behaved things of Icon type "procedure"). Mathematically, a function is just a set of pairs, so an implementation of a set (in the mathematical sense) of functions would need to be able to determine, for an arbitrary pair of functions, whether they compute the same thing for all inputs. And that's, in general, unsolvable. Once you resign yourself to accepting that sets of procedures should (must) use pointer semantics, where do you draw the line? Icon draws it at a defensible place, even though it's not always the ideal place for every application. Question: what should this print? a := [] push( a, a ) b := [] push( b, b ) c := set([a,b]) write(*c) I.e., is every instance of "a list that contains only itself" the *same* instance? Or might they be different? This just hints at the complications -- the issues really aren't that clear. One great virtue of Icon's design in this area is that it's easy to understand (although not as well documented, I think, as it should be) ... paradoxically y'rs - tim Tim Peters Kendall Square Research Corp tim@ksr.com, ksr!tim@uunet.uu.net From icon-group-sender Wed Jul 15 10:53:51 1992 Received: by cheltenham.cs.arizona.edu; Wed, 15 Jul 1992 05:34:24 MST Date: Wed, 15 Jul 92 10:53:51 +0200 From: Jan Peter de Ruiter Message-Id: <9207150853.AA28581@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: solution of set problem Cc: maarten@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu # Hi, # # I solved the set-problem yesterday night. It was not as complicated as I # expected, thanks to the blessings of the type() function and the generator # mechanism. It is somewhat slow, of course, but not as slow as I feared (at # least not on a Dec Ultrix workstation). # # If you remove the mail-header, this should run without further ado. # # Greetings, # # Jan P. A. de Ruiter # janpeter@mpi.kun.nl # record rek(x,y) # this record declaration and the procedure main() procedure main() # are given only for testing purposes. Library is below. s := set() a := set() b := set() insert2(b, "noot") insert2(b, "aap") insert2(a, "aap") insert2(a, "noot") insert2(s,b) # set b is inserted, but set a, having the same *value*, is delete2(s,a) # removed from s. write("TEST1 : the size of the set is now ",*s) # should give 0 now # a second, more extensive test: insert2(s,cset("abcde")) # a cset insert2(s,0.5) # a real insert2(s,5) # an integer insert2(s,[ 1, 2, 3, "aap",rek("een","twee")]) # a list, containing integer, string and record ta := table() ta[1] := "aap" ta[2] := "noot" insert2(ta) # a table s2 := copy(s) # make a 'real' copy delete2(s, [1, 2, 3, "aap",rek("een","twee")]) # an element with this value is present, so write("TEST 2:") write("size of s : ",*s) # should give 3 write("size of s2 : ",*s2) # should give 4 end # # ABOVE IS THE MAIN ROUTINE AND A RECORD DECLARATION FOR TESTING PURPOSES. # # # BELOW ARE THE ACTUAL LIB-PROCEDURES # ############################################################################# # MSET LIBRARY # # # # Jan P. de Ruiter, 1992 # # # # # # Implements the "mset" type. # # # # The idea of the mset type is that no two identical data-structures can be # # present in a set, where identity is defined as "containing the same # # elements". # # # # Definitions implicit in the procedure same_value(..,..): # # # # TYPE IDENTITY TEST # # # # all types === and if this test fails... # # # # integer = # # real = # # cset, string == # # record all fields have same value # # list all elements are the same, including ordering # # table same keys, and every key has the same associated value # # set contain the same elements # # # ############################################################################# # # This is the core routine. # It succeeds if two things have the same value(s). # procedure same_value(d1,d2) if d1 === d2 then return # same object else if type(d1) ~== type(d2) then fail # not the same type else if *d1 ~= *d2 then fail # not the same size else case type(d1) of { # the same type and size ("set" | "table" ) : return same_elements(sort(d1,1),sort(d2,1)) ("list") : return same_elements(d1,d2) ("real" | "integer") : return(d1 = d2) ("cset" | "string" ) : return(d1 == d2) default : return same_elements(d1,d2) # user defined type } end # # used in same_value: # procedure same_elements(l1,l2) if l1 === l2 then return # same objects else if *l1 ~= *l2 then fail # not the same size else { if *l1 = 0 then return # both lists empty else { every(i := 1 to *l1) do if not same_value(l1[i],l2[i]) then fail # recursion return } } end # # The new insert operation. Insert2 always succeeds # procedure insert2(S,el) every (if same_value(el,!S) then return) return insert(S,el) end # # The new member operation, that also detects equal-valued elements # procedure member2(S,el) every(if same_value(!S,el) then return) fail end # # The new delete operation, that detects equal-valued elements. # Always succeeds # procedure delete2(S,el) every(t := !S) do if same_value(t,el) then return delete(S,t) return end # # conversion of standard icon set into new mset. # procedure reduce2(iset) temp := set() every(insert2(temp,!iset)) return temp end From icon-group-sender Wed Jul 15 10:53:51 1992 Received: by cheltenham.cs.arizona.edu; Wed, 15 Jul 1992 05:38:27 MST Date: Wed, 15 Jul 92 10:53:51 +0200 From: Jan Peter de Ruiter Message-Id: <9207150853.AA28581@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: solution of set problem Cc: maarten@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu # Hi, # # I solved the set-problem yesterday night. It was not as complicated as I # expected, thanks to the blessings of the type() function and the generator # mechanism. It is somewhat slow, of course, but not as slow as I feared (at # least not on a Dec Ultrix workstation). # # If you remove the mail-header, this should run without further ado. # # Greetings, # # Jan P. A. de Ruiter # janpeter@mpi.kun.nl # record rek(x,y) # this record declaration and the procedure main() procedure main() # are given only for testing purposes. Library is below. s := set() a := set() b := set() insert2(b, "noot") insert2(b, "aap") insert2(a, "aap") insert2(a, "noot") insert2(s,b) # set b is inserted, but set a, having the same *value*, is delete2(s,a) # removed from s. write("TEST1 : the size of the set is now ",*s) # should give 0 now # a second, more extensive test: insert2(s,cset("abcde")) # a cset insert2(s,0.5) # a real insert2(s,5) # an integer insert2(s,[ 1, 2, 3, "aap",rek("een","twee")]) # a list, containing integer, string and record ta := table() ta[1] := "aap" ta[2] := "noot" insert2(ta) # a table s2 := copy(s) # make a 'real' copy delete2(s, [1, 2, 3, "aap",rek("een","twee")]) # an element with this value is present, so write("TEST 2:") write("size of s : ",*s) # should give 3 write("size of s2 : ",*s2) # should give 4 end # # ABOVE IS THE MAIN ROUTINE AND A RECORD DECLARATION FOR TESTING PURPOSES. # # # BELOW ARE THE ACTUAL LIB-PROCEDURES # ############################################################################# # MSET LIBRARY # # # # Jan P. de Ruiter, 1992 # # # # # # Implements the "mset" type. # # # # The idea of the mset type is that no two identical data-structures can be # # present in a set, where identity is defined as "containing the same # # elements". # # # # Definitions implicit in the procedure same_value(..,..): # # # # TYPE IDENTITY TEST # # # # all types === and if this test fails... # # # # integer = # # real = # # cset, string == # # record all fields have same value # # list all elements are the same, including ordering # # table same keys, and every key has the same associated value # # set contain the same elements # # # ############################################################################# # # This is the core routine. # It succeeds if two things have the same value(s). # procedure same_value(d1,d2) if d1 === d2 then return # same object else if type(d1) ~== type(d2) then fail # not the same type else if *d1 ~= *d2 then fail # not the same size else case type(d1) of { # the same type and size ("set" | "table" ) : return same_elements(sort(d1,1),sort(d2,1)) ("list") : return same_elements(d1,d2) ("real" | "integer") : return(d1 = d2) ("cset" | "string" ) : return(d1 == d2) default : return same_elements(d1,d2) # user defined type } end # # used in same_value: # procedure same_elements(l1,l2) if l1 === l2 then return # same objects else if *l1 ~= *l2 then fail # not the same size else { if *l1 = 0 then return # both lists empty else { every(i := 1 to *l1) do if not same_value(l1[i],l2[i]) then fail # recursion return } } end # # The new insert operation. Insert2 always succeeds # procedure insert2(S,el) every (if same_value(el,!S) then return) return insert(S,el) end # # The new member operation, that also detects equal-valued elements # procedure member2(S,el) every(if same_value(!S,el) then return) fail end # # The new delete operation, that detects equal-valued elements. # Always succeeds # procedure delete2(S,el) every(t := !S) do if same_value(t,el) then return delete(S,t) return end # # conversion of standard icon set into new mset. # procedure reduce2(iset) temp := set() every(insert2(temp,!iset)) return temp end From icon-group-sender Wed Jul 15 11:30:34 1992 Received: by cheltenham.cs.arizona.edu; Wed, 15 Jul 1992 05:38:50 MST Date: Wed, 15 Jul 92 11:30:34 +0200 From: Jan Peter de Ruiter Message-Id: <9207150930.AA28651@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: consistency Cc: maarten@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu I understand that the ball game of sets is that if the structure that is part of a set changes, the contents of the set will change with it. Quoting Clinton Jeffery: > Someone said: Icon should be more consistent. Icon is consistent, it is > just that the Icon set type is not what Mr. de Ruiter needs. He needs > mathematical sets. > As several folks have pointed out, Icon sets are not mathematical sets, > since they can have structure values such as sets and tables as members. > If you insert a 1 into a set, the set doesn't have to worry about the 1 > ever changing. If you insert a set S1 into a set S2, you can still insert > or delete elements from S1. These Icon sets are not math sets, they are > changeable (or mutable) structures, Very similar to tables. Of course, Icon sets are what the creator of Icon sets wanted them to be. And I happen to like sets of a more formal kind. No problem, that's why I tried to implement "the other kind of set" myself. I may be very stubborn, perhaps, but I *still* think that Icon sets are not consistent. If I use the statements S := set() a := 1 insert(S, a) a := 2 every(write(!S)) It does *not* write 2, but 1. So if you put a *constant* in a set, then there is no worry about it changing, but if you put a *variable* in a set, a change of that variable is not entirely unlikely. Jan P. A. de Ruiter janpeter@mpi.kun.nl From icon-group-sender Wed Jul 15 10:22:48 1992 Received: by cheltenham.cs.arizona.edu; Wed, 15 Jul 1992 11:57:30 MST Date: Wed, 15 Jul 1992 10:22:48 MST From: "Kenneth Walker" Message-Id: <199207151722.AA04624@ponderosa.cs.arizona.edu> To: icon-group, janpeter@mpi.kun.nl Subject: Re: consistency Status: R Errors-To: icon-group-errors@cs.arizona.edu > Date: Wed, 15 Jul 92 11:30:34 +0200 > From: Jan Peter de Ruiter > > ... if you put a *variable* in a set ... The Icon insert() function dereferences its arguments so you cannot put a variable in a set; you can only put the value of a variable in a set. These semantics are internally consistent. Ken Walker / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721 +1 602 621-4252 kwalker@cs.arizona.edu uunet!arizona!kwalker From icon-group-sender Thu Jul 16 13:56:54 1992 Received: by cheltenham.cs.arizona.edu; Thu, 16 Jul 1992 05:41:43 MST Date: Thu, 16 Jul 92 13:56:54 +0200 From: ms@informatik.uni-hannover.de (Michael Sperber) Message-Id: <9207161156.AA25620@informatik.uni-hannover.de> To: janpeter@mpi.kun.nl.ddn Cc: icon-group@cs.arizona.edu.ddn In-Reply-To: Jan Peter de Ruiter's message of Wed, 15 Jul 92 15:32:04 +0200 <9207150930.AA28651@mpix10.mpi.kun.nl*MAILER@cdc2-gw.rrzn.uni-hannover.de> Subject: consistency Status: R Errors-To: icon-group-errors@cs.arizona.edu Icon sets ARE consistent. Of course, you should say what they should be consistent with. The question is which equality operator is used to determine if an element is already in a set or not. I haven't done any Icon stuff for a long time, but if I remember correctly, it uses the == equality -- consistently! (And yes, you are stubborn!) :-> Cheers, Chipsy From icon-group-sender Tue Jul 28 23:21:20 1992 Received: by cheltenham.cs.arizona.edu; Tue, 28 Jul 1992 20:16:40 MST Date: 28 Jul 92 23:21:20 GMT From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!news.ysu.edu!malgudi.oar.net!caen!uakari.primate.wisc.edu!crdgw1!newsun!mwalker1@ucbvax.Berkeley.EDU (Mel Walker) Organization: Society of Right-Handed Sesquipedalians Subject: Icon language Message-Id: Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I've got a version of Icon that runs under MPW on a mac. It claims to be version 8, with TR 90-7 as a (sub-version?) number. It is public domain. Is this the latest version of Icon? Are there other version of MPW Icon? Other versions of Icon on the Mac, free or not? The one I have tends to crash occasionally under Sys7 on a IIci. I am trying to learn the language (just for fun and possible future use). BTW: Is there a FAQ for this group? ------ Mel Walker mwalker@novell.com "Darth & Luke in '92: Jedis for a Better America" All opinions above the .sig might be mine. You'll never know, will ya? From icon-group-sender Fri Jul 31 11:38:43 1992 Received: by cheltenham.cs.arizona.edu; Sat, 1 Aug 1992 11:26:49 MST Date: 31 Jul 92 11:38:43 GMT From: munnari.oz.au!uniwa!mullet!john@uunet.uu.net (John West) Organization: University Computer Club --- Perth, Western Australia Subject: installing Icon on 386BSD - Help me! Message-Id: <1992Jul31.113843.15202@mullet.gu.uwa.edu.au> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I would like to install Icon on our 486 machine (intel). It is currently running 386BSD version 0.1 I had a look at the config files in the distribution, but couldn't find anything likely. I thought it might be possible to modify one of the other 386-type configs, but when I had a look, they all had inline assembler - not something I want to mess with. Can someone help? Please email to gudjm@uniwa.uwa.edu.au - news and mail on mullet are not what I'd call particularly reliable. TIA John West -- For the humour impaired: Insert a :-) after every third word From icon-group-sender Fri Jul 31 22:14:43 1992 Received: by cheltenham.cs.arizona.edu; Sat, 1 Aug 1992 11:26:55 MST Date: 31 Jul 92 22:14:43 GMT From: uchinews!ellis!goer@handies.ucar.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: installing Icon on 386BSD - Help me! Message-Id: <1992Jul31.221443.13172@midway.uchicago.edu> References: <1992Jul31.113843.15202@mullet.gu.uwa.edu.au> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu john@mullet.gu.uwa.edu.au (John West) writes: >I would like to install Icon on our 486 machine (intel). It is currently >running 386BSD version 0.1 > >I had a look at the config files in the distribution, but couldn't find >anything likely. I thought it might be possible to modify one of the other >386-type configs, but when I had a look, they all had inline assembler - >not something I want to mess with. >Can someone help? This is a good question, and worth a posting. I'll wager that all of the inline code you saw was for coexpressions. Just disable the feature, and you'll be fine. Alternatively, check through the configs for the Sun/386 (or whatever it was). Perhaps the assembler code there will be close enough to what you need. I have no idea how close the 386BSD code is going to be to the System V assembler code, but you could try looking in the various SYSV configuration directories. At one point I "implemented" coexpressions for Xenix by simply borrowing the Microport implementation. I've had to screw around with it a bit subsequently, but you might find it quite easy, as long as your assembler is standard. Good luck, and keep us posted. -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Sun Aug 2 14:00:22 1992 Received: by cheltenham.cs.arizona.edu; Sun, 2 Aug 1992 05:53:17 MST Date: Sun, 2 Aug 92 14:00:22 +0200 From: Jan Peter de Ruiter Message-Id: <9208021200.AA09893@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: 386/protected mode Cc: janpeter@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu Another question concerning running Icon on an Intel 386/486 based machine, but this time not on 386BSD, but on MSDOS: Recently I discovered that the GNU (Free Software Foundation) C compiler is ported to 386/486 DOS based PC's. For those of you who do not know about this compiler: the compiler and the resulting executables run in Protected Mode, with a flat adress space of whatever you have installed, including memory-disk paging in case of memory shortage. While I'm not a crack at deciphering Copyright arrangements, my impression is that the FSF doesn't want to be paid as long as the product one builds with the compiler is free, and the source code is accessible. Since Icon is free and sources are freely available, couldn't it be a good idea to port Icon to 386 - protected mode? It would be great to have more memory, 32 bit integers, more speed, and memory paging when running Icon on a PC under MS-DOS. (By the way, there are other protected mode code builder kits, of course, but many vendors want to have a fee for the distribution of the protected mode *loader*) My questions: 1. Is there already a protected mode Icon for 386/MSDOS? 2. If not, could it be implemented using the GnuCC compiler? 3. If yes, is there anyone with experience in Icon implementation who is willing to give it a try? (I myself would like to put a lot of work into it, but I am not familiar with the technical details of the Icon / PC implementation, which seems to be essential for such a project) Greetings, Jan de Ruiter janpeter@mpi.kun.nl From icon-group-sender Sun Aug 2 06:00:39 1992 Received: by cheltenham.cs.arizona.edu; Sun, 2 Aug 1992 06:00:50 MST Date: Sun, 2 Aug 1992 06:00:39 MST From: "Ralph Griswold" Message-Id: <199208021300.AA06658@cheltenham.cs.arizona.edu> To: icon-group@cs.arizona.edu, janpeter@mpi.kun.nl Subject: Re: 386/protected mode Status: R Errors-To: icon-group-errors@cs.arizona.edu There already is a 32-bit protected mode implementation of Icon for MS-DOS for 386/486 processors. The current version was built using Intel Code Builder. It's about 3 times faster than the "standard" 16-bit MS-DOS Icon and can access up to 4GB of memory. It's available from the Icon Project via FTP, our RBBS, or on diskette is the same way as other personal-computer versions of Icon. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sun Aug 2 23:00:54 1992 Received: by cheltenham.cs.arizona.edu; Mon, 3 Aug 1992 07:36:57 MST Date: Sun, 2 Aug 92 23:00:54 EDT From: Paul_Abrahams@MTS.cc.Wayne.edu To: icon-group@cs.arizona.edu Message-Id: <485332@MTS.cc.Wayne.edu> Subject: Protected-mode Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu A disadvantage of the protected-mode version of Icon under MS-DOS, at least for some people such as me, is that it's incompatible with QEMM. (Correct me if I'm wrong, Ralph.) So if you're considering using that version, be forewarned. From icon-group-sender Mon Aug 3 02:23:50 1992 Received: by cheltenham.cs.arizona.edu; Mon, 3 Aug 1992 07:37:05 MST Via: uk.ac.edinburgh.festival; Mon, 3 Aug 1992 10:23:34 +0100 Date: 03 Aug 92 10:23:29 BST From: R J Hare Subject: FFT To: icon-group@cs.arizona.edu Message-Id: <9208031023.aa11591@uk.ac.ed.festival> Status: R Errors-To: icon-group-errors@cs.arizona.edu Has anyone written any fast Fourier transform routines in Icon? I have had a look at the ipl and couldn't see anything there... Thanks. Roger Hare. From icon-group-sender Mon Aug 3 07:36:44 1992 Received: by cheltenham.cs.arizona.edu; Mon, 3 Aug 1992 07:37:22 MST Date: Mon, 3 Aug 1992 07:36:44 MST From: "Ralph Griswold" Message-Id: <199208031436.AA17164@cheltenham.cs.arizona.edu> To: Paul_Abrahams@MTS.cc.Wayne.edu, icon-group@cs.arizona.edu Subject: Re: Protected-mode Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu The present version of MS-DOS/386 Icon runs with QEMM 386 v6.0 (an earlier version of 386 Icon didn't). The only memory environment I know of that 386 Icon does not run with is DESQView 386. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Fri Aug 7 03:08:58 1992 Received: by cheltenham.cs.arizona.edu; Fri, 7 Aug 1992 05:54:28 MST Date: 7 Aug 92 03:08:58 GMT From: munnari.oz.au!uniwa!mullet!john@uunet.uu.net (John West) Organization: University Computer Club --- Perth, Western Australia Subject: Icon on 386BSD Message-Id: <1992Aug7.030858.28422@mullet.gu.uwa.edu.au> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Well.. I compiled Icon our 486 box, running 386BSD version 0.1 It goes. At least, it doesn't crash when I compile the tests. I'll have to have a close look at the results sometime when I have enough time to do it. But programs compile and run without crashing, and they appear to produce sensible results. Even co-expressions. John West -- For the humour impaired: Insert a :-) after every third word From icon-group-sender Wed Aug 12 15:40:46 1992 Received: by cheltenham.cs.arizona.edu; Thu, 13 Aug 1992 12:18:47 MST Date: 12 Aug 92 15:40:46 GMT From: van-bc!ubc-cs!destroyer!caen!kuhub.cc.ukans.edu!spssig.spss.com!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: another chart parser Message-Id: <1992Aug12.154046.26396@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu This was posted a couple of months ago. I've been using it for some routine stuff, and found it was really not as flexible as I'd like. It also had some bugs, and probably retains those bugs. For anyone who wants it, here is a newer version: ############################################################################ # # Name: ichartp.icn # # Title: Iconish implementation of a simple chart parser # # Author: Richard L. Goerwitz # # Version: 1.6 # ############################################################################ # # General: # # Ichartp implements a simple chart parser - a slow but # easy-to-implement strategy for parsing context free grammars (it # has a cubic worst-case time factor). Chart parsers are flexible # enough to handle a lot of natural language constructs. They also # lack many of the troubles associated with empty and left-recursive # derivations. To obtain a parse, just create a BNF file, obtain a # line of input, and then invoke parse_sentence(sentence, # bnf_filename, start-symbol). Parse_sentence suspends successive # edge structures corresponding to possible parses of the input # sentence. There is a routine called edge_2_tree() that converts # these edges to a more standard form. See the stub main() procedure # for an example of how to make use of all these facilities. # # Implementation details: # # The parser itself operates in bottom-up fashion, but it might # just as well have been coded top-down, or for that matter as a # combination bottom-up/top-down parser (chart parsers don't care). # The parser operates in breadth-first fashion, rather than walking # through each alternative until it is exhausted. As a result, there # tends to be a pregnant pause before any results appear, but when # they appear they come out in rapid succession. To use a depth-first # strategy, just change the "put" in "put(ch.active, new_e)" to read # "push." I haven't tried to do this, but it should be that simple # to implement. # BNFs are specified using the same notation used in Griswold & # Griswold, and as described in the IPL program "pargen.icn," with # the following difference: All metacharacters (space, tab, vertical # slash, right/left parends, brackets and angle brackets) are # converted to literals by prepending a backslash. Comments can be # include along with BNFs using the same notation as for Icon code # (i.e. #-sign). # # Gotchas: # # Pitfalls to be aware of include things like ::= | ha | # () (a weak attempt at a laugh recognizer). This grammar will # accept "ha," "ha ha," etc. but will suspend an infinite number of # possible parses. The right way to do this sort of thing is ::= # ha | ha, or if you really insist on having the empty string as # a possibility, try things like: # # ::= () | # ::= ha | ha # # Of course, the whole problem of infinite parses can be avoided by # simply invoking the parser in a context where it is not going to # be resumed, or else one in which it will be resumed a finite number # of times. # # Motivation: # # I was reading Byte Magazine (vol. 17:2 [February, 1992]), and # ran into an article entitled "A Natural Solution" (pages 237-244) # in which a standard chart parser was described in terms of its C++ # implementation. The author remarked at how his optimizations made # it possible to parse a 14-word sentence in only 32 seconds (versus # 146 for a straight Gazdar-Mellish LISP chart parser). 32 seconds # struck me as hardly anything to write home about, so I coded up a # quick system in Icon to see how it compared. This library is the # result. # I'm quite sure that this code could be very much improved upon. # As it stands, its performance seems as good as the C++ parser in # BYTE, if not better. It's hard to tell, though, seeing as I have # no idea what hardware the guy was using. I'd guess a 386 running # DOS. On a 386 running Xenix the Icon version beats the BYTE times # by a factor of about four. The Icon compiler creates an executable # that (in the above environment) parses 14-15 word sentences in # anywhere from 6 to 8 seconds. Once the BNF file is read, it does # short sentences in a second or two. If I get around to writing it, # I'll probably use the code here as the basic parsing engine for an # adventure game my son wants me to write. # ############################################################################ # # Links: structs, slashbal, rewrap, strip, stripcom (ximage for debugging) # # Requires: an up-to-date IPL, coexpressions # ############################################################################ # # Here's a sample BNF file (taken, modified, from the BYTE # Magazine article mentioned above). Note again the conventions a) # that nonterminals be enclosed in angle brackets & b) that overlong # lines be continued by terminating the preceding line with a # backslash. Although not illustrated below, the metacharacters <, # >, (, ), and | can all be escaped (i.e. can all have their special # meaning neutralized) with a backslash (e.g. \<). Comments can also # be included using the Icon #-notation. Empty symbols are illegal, # so if you want to specify a zero-derivation, use "()." There is an # example of this usage below. # # ::= | # ::= | ( () | ) | \ # ( | | | ) # ::= ( | | | ) | \ # | | | \ # # ::=

( | ) | # ::= # ::= and # ::= the | a | his | her # ::= her | he | they # ::= nurse | nurses | book | books | travel | arrow | arrows | \ # fortune | fortunes | report # ::= outrageous | silly | blue | green | heavy | white | red | \ # black | yellow # ::= travel | travels | report | see | suffer # ::= hear | see | suffer #

::= on | of # ::= that # ############################################################################ # I use ximage for debugging purposes. link structs, slashbal, rewrap, strip, stripcom#, ximage record stats(edge_list, lhs_table, term_set) record chart(inactive, active) # inactive - set; active - list record retval(no, item) record edge(LHS, RHS, LEN, DONE, BEG, END, SEEN) record short_edge(LHS, RHS) # # For debugging only. # procedure main(a) local res, filename # &trace := -1 filename := \a[1] | "bnfs.byte" while line := read(&input) do { res := &null every res := parse_sentence(line, filename, "S") do { if res.no = 0 then write(stree(edge2tree(res.item))) # write(ximage(res.item)) else if res.no = 1 then { write("hmmm") write(stree(edge2tree(res.item))) } } /res & write("can't parse ",line) } end # # parse_sentence: string x string -> edge records # (s, filename) -> Es # where s is a chunk of text presumed to constitute a sentence # where filename is the name of a grammar file containing BNFs # where Es are edge records containing possible parses of s # procedure parse_sentence(s, filename, start_symbol) local file, e, i, elist, ltbl, tset, ch, tokens, st, memb, new_e, token_set, none_found, active_modified static master, old_filename initial master := table() # # Initialize and store stats for filename (if not already stored). # if not (filename == \old_filename) then { file := open(filename, "r") | p_err(filename, 7) # # Read BNFs from file; turn them into edge structs, and # store them all in a list; insert terminal symbols into a set. # elist := list(); ltbl := table(); tset := set() every e := bnf_file_2_edges(file) do { put(elist, e) # main edge list (active) (/ltbl[e.LHS] := set([e])) | insert(ltbl[e.LHS], e) # index LHSs every i := 1 to e.LEN do # LEN holds length of e.RHS if /e.RHS[i].RHS then # RHS for terminals is null insert(tset, e.RHS[i].LHS) } insert(master, filename, stats(elist, ltbl, tset)) old_filename := filename close(file) } elist := fullcopy(master[filename].edge_list) ltbl := fullcopy(master[filename].lhs_table) tset := master[filename].term_set # # Make edge list into the active section of chart; tokenize the # sentence s & check for unrecognized terminals. # ch := chart(set(), elist) tokens := tokenize(s) # # Begin parse by entering all tokens in s into the inactive set # in the chart as edges with no RHS (a NULL RHS is characteristic # of all terminals). # token_set := set(tokens) every i := 1 to *tokens do { # Flag words not in the grammar as errors. if not member(tset, tokens[i]) then suspend retval(1, tokens[i]) # Now, give us an inactive edge corresponding to word i. insert(ch.inactive, e := edge(tokens[i], &null, 1, 1, i, i+1)) # Insert word i into the LHS table. (/ltbl[tokens[i]] := set([e])) | insert(ltbl[tokens[i]], e) # Watch out for those empty RHSs. insert(ch.inactive, e := edge("", &null, 1, 1, i, i)) (/ltbl[""] := set([e])) | insert(ltbl[""], e) } *tokens = 0 & i := 0 insert(ch.inactive, e := edge("", &null, 1, 1, i+1, i+1)) (/ltbl[""] := set([e])) | insert(ltbl[""], e) # # Until no new active edges can be built, keep ploughing through # the active edge list, trying to match unconfirmed members of their # RHSs up with inactive edges. # until \none_found do { # write(ximage(ch)) none_found := 1 every e := !ch.active do { active_modified := &null # keep track of inactive edges we've already tried /e.SEEN := set() # # e.RHS[e.DONE+1] is the first unconfirmed category in the # RHS of e; ltbl[e.RHS[e.DONE+1].LHS] are all edges having # as their LHS the LHS of the first unconfirmed category in # e's RHS; we simply intersect this set with the inactives, # and then subtract out those we've seen before in connec- # tion with this edge - # if *(st := \ltbl[e.RHS[e.DONE+1].LHS] ** ch.inactive -- e.SEEN) > 0 then { # record all the inactive edges being looked at as seen e.SEEN ++:= st every memb := !st do { # make sure this inactive edge starts where the # last confirmed edge in e.RHS ends! if memb.BEG ~= \e.RHS[e.DONE].END then next # set none_found to indicate we've created a new edge else none_found := &null # create a new edge, having the LHS of e, the RHS of e, # the start point of e, the end point of st, and one more # confirmed RHS members than e new_e := edge(e.LHS, fullcopy(e.RHS), e.LEN, e.DONE+1, e.BEG, memb.END) new_e.RHS[new_e.DONE] := memb /new_e.BEG := memb.BEG if new_e.LEN = new_e.DONE then { # it's inactive insert(ch.inactive, new_e) insert(ltbl[e.LHS], new_e) if new_e.BEG = 1 & new_e.END = (*tokens+1) then { if new_e.LHS == start_symbol # complete parse then suspend retval(0, new_e) } } else { put(ch.active, new_e) # it's active active_modified := 1 } } } # restart if the ch.active list has been modified if \active_modified then break next } } end # # tokenize: break up a sentence into constituent words, using spaces, # tabs, and other punctuation as separators (we'll need to # change this a bit later on to cover apostrophed words) # procedure tokenize(s) local l, word l := list() s ? { while tab(upto(&letters)) do put(l, map(tab(many(&letters)))) } return l end # # edge2tree: edge -> tree # e -> t # # where e is an edge structure (active or inactive; both are okay) # where t is a tree like what's described in Ralph Griswold's # structs library (IPL); I don't know about the 2nd ed. of # Griswold & Griswold, but the structure is described in the 1st # ed. in section 16.1 # # fails if, for some reason, the conversion can't be made (e.g. the # edge structure has been screwed around with in some way) # procedure edge2tree(e) local memb, t t := [e.LHS] \e.RHS | (return t) # a terminal type(e) == "edge" | (return put(t, [])) # An incomplete edge every memb := !e.RHS do # has daughters. put(t, edge2tree(memb)) return t end # # bnf_file_2_edges: concatenate backslash-final lines & parse # procedure bnf_file_2_edges(f) local getline getline := create stripcom(!f) while line := @getline do { while line ?:= 1(tab(-2) || tab(slashupto('\\')), pos(-1)) || @getline suspend bnf_2_edges(line) } end # # bnf_2_edges: string -> edge records # s -> Es (a generator) # where s is a CFPSG rule in BNF form # where Es are edges # procedure bnf_2_edges(s) local tmp # # Break BNF-style CFPSG rule into LHS and RHS. If there is more # than one RHS (a la the | alternation op), suspend multiple re- # sults. # s ? { # tab upto the ::= sign tmp := (tab(slashupto(':')) || ="::=") | p_err(s, 1) # strip non-backslashed spaces, and extract LHS symbol stripspaces(tmp) ? { LHS := 1(tab(slashbal(':', '<', '>')), ="::=") | p_err(s, 1) LHS ?:= strip(2(="<", tab(-1), =">"), '\\') | p_err(s, 2) LHS == "" & p_err(s, 6) } every RHS := do_slash(tab(0) \ 1) do { RHS := string_2_list(RHS) suspend edge(LHS, RHS, *RHS, 0, &null, &null) } } end # # string_2_list: string -> list # s -> L # where L is a list of partially constructed (short) edges, having # only LHS and RHS; in the case of nonterminals, the RHS is set # to 1, while for terminals the RHS is null (and remains that way # throughout the parse) # procedure string_2_list(s) local tmp, RHS_list, LHS (s || "\x00") ? { tab(many(' \t')) pos(-1) & (return [short_edge("", &null)]) RHS_list := list() repeat { tab(many(' \t')) pos(-1) & break if match("<") then { tmp := ("" ~== tab(slashbal(&cset, '<', '>'))) | p_err(s, 4) LHS := stripspaces(tmp) LHS ?:= strip(2(="<", tab(-1), =">"), '\\') | p_err(s, 4) LHS == "" & p_err(s, 10) put(RHS_list, short_edge(LHS, 1)) } else { LHS := stripspaces(tab(slashupto(' <') | -1)) slashupto('>', LHS) & p_err(s, 5) put(RHS_list, short_edge(strip(LHS, '\\'), &null)) } } } return RHS_list end # # slashupto: cset x string x integer x integer -> integers # (c, s, i, j) -> Is (a generator) # where Is are the integer positions in s[i:j] before characters # in c that is not preceded by a backslash escape # procedure slashupto(c, s, i, j) if /s := &subject then /i := &pos else /i := 1 /j := *s + 1 /c := &cset c ++:= '\\' s[1:j] ? { tab(i) while tab(upto(c)) do { if (="\\", move(1)) then next suspend .&pos move(1) } } end # # fullcopy: make full recursive copy of object # procedure fullcopy(obj) local retval, i, k case type(obj) of { "co-expression" : return obj "cset" : return obj "file" : return obj "integer" : return obj "list" : { retval := list(*obj) every i := 1 to *obj do retval[i] := fullcopy(obj[i]) return retval } "null" : return &null "procedure" : return obj "real" : return obj "set" : { retval := set() every insert(retval, fullcopy(!obj)) return retval } "string" : return obj "table" : { retval := table(obj[[]]) every k := key(obj) do insert(retval, fullcopy(k), fullcopy(obj[k])) return retval } # probably a record; if not, we're dealing with a new # version of Icon or a nonstandard implementation, and # we're screwed default : { retval := copy(obj) every i := 1 to *obj do retval[i] := fullcopy(obj[i]) return retval } } end # # do_slash: string -> string(s) # Given a|b suspend a then b. Used in conjunction with do_parends(). # procedure do_slash(s) local chunk s ? { while chunk := tab(slashbal('|', '(', ')')) do { suspend do_parends(chunk) move(1) } suspend do_parends(tab(0)) } end # # do_parends: string -> string(s) # Given a(b)c suspend abc; given a(b|c)d suspend abd and acd, etc. # Used in conjuction with do_slash(). # procedure do_parends(s) local chunk, i, j s ? { if not (i := slashupto('(')) then { chunk := tab(0) slashupto(')') & p_err(s, 8) suspend chunk } else { j := i + slashbal(')', '(', ')', s[i+1:0]) | p_err(s, 9) suspend tab(i) || (move(1), do_slash(tab(j))) || (move(1), do_parends(tab(0))) } } end # # p_err: print error message to stderr & abort # procedure p_err(s, n) local i, msg static errlist initial { errlist := [[1, "malformed LHS"], [2, "nonterminal lacks proper <> enclosure"], [3, "missing left angle bracket"], [4, "unmatched left angle bracket"], [5, "unmatched right angle bracket"], [6, "empty symbol in LHS"], [7, "unable to open file"], [8, "unmatched right parenthesis"], [9, "unmatched left parenthesis"], [10, "empty symbol in RHS"] ] } every i := 1 to *errlist do if errlist[i][1] = n then msg := errlist[i][2] writes(&errout, "error ", n, " (", msg, ") in \n") every write("\t", rewrap(s) | rewrap()) exit(n) end # # Remove non-backslashed spaces and tabs. # procedure stripspaces(s) local s2 s2 := "" s ? { while s2 ||:= tab(slashupto(' \t')) do tab(many(' \t')) s2 ||:= tab(0) } return s2 end -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Mon Aug 17 09:30:01 1992 Received: by cheltenham.cs.arizona.edu; Mon, 17 Aug 1992 09:30:18 MST Date: Mon, 17 Aug 1992 09:30:01 MST From: "Ralph Griswold" Message-Id: <199208171630.AA09248@cheltenham.cs.arizona.edu> To: icon-group Subject: Version 8.7 Icon for UNIX and VMS Status: R Errors-To: icon-group-errors@cs.arizona.edu Version 8.7 of Icon is now available for UNIX and VMS. These implementations include X Window System features and both the interpreter and the optimizing compiler. The VMS distribution includes executables. Complete systems, including source code and the Icon program library, are available by anonymous FTP to cs.arizona.edu. cd /icon/packages/unix or /icon/packages/vms and get the READ.ME file there for further information. Executable binaries and related files are available for the following UNIX platforms via FTP: Convex NeXT DECstation (MIPS risc) Sequent Symmetry HP 9000/700 Sun 3 HP 9000/800 Sun 4 (Sparc) Iris 4D cd /icon/binaries/unix and get the READ.ME there for further information. The complete UNIX and VMS systems also are available on magnetic media with printed documentation. Shipping is included to addresses in the United States, Canada, and Mexico. The charge for shipping to other countries is shown in brackets. UNIX tape $30 [$10] UNIX cartridge $45 [$10] UNIX 1.44MB diskettes $25 [$5] VMS tape $32 [$11] Tapes are 1/2", 9-track, 1600 bpi. Cartridges are written in QIC-24 format. Payment to The University of Arizona may be made by check in U.S. dollars drawn on a bank with a branch in the United States. MasterCard and Visa also are acceptable. Direct questions to icon-project@cs.arizona.edu (not icon-group). Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Mon Aug 17 10:09:26 1992 Received: by cheltenham.cs.arizona.edu; Mon, 17 Aug 1992 10:09:32 MST Date: Mon, 17 Aug 1992 10:09:26 MST From: "Ralph Griswold" Message-Id: <199208171709.AA10602@cheltenham.cs.arizona.edu> To: icon-group Subject: 8.7 Icon for UNIX Status: R Errors-To: icon-group-errors@cs.arizona.edu There are very few language differences between Version 8.6 and 8.7. The differences mostly are in the implementation, including bug fixes and adjustments to X-Icon. If you have 8.6 and aren't having any troubles, you probably don't need to get 8.7. If you're using X-Icon, however, you probably should get 8.7. There also are several X-Icon programs in the program library in 8.7 Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Tue Aug 18 10:17:04 1992 Received: by cheltenham.cs.arizona.edu; Tue, 18 Aug 1992 10:17:11 MST Date: Tue, 18 Aug 1992 10:17:04 MST From: "Ralph Griswold" Message-Id: <199208181717.AA29479@cheltenham.cs.arizona.edu> To: icon-group Subject: VMS 8.7 Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu The VMS version of Icon 8.7 was built with X-Window (DecWindows) support enabled. We have found that some sites that do not have DecWindows are unable to run Icon at all. You can check for the presence of the necessary library file by entering $ DIR SYS$SHARE:DECW$XLIBSHR.EXE If this file does not exist, Icon 8.7 will not run. We are investigating this problem. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Tue Aug 18 12:42:02 1992 Received: by cheltenham.cs.arizona.edu; Wed, 19 Aug 1992 05:27:43 MST Date: Tue, 18 Aug 92 12:42:02 EST From: MATH0022@rmc.ca Reply-To: lindsay@rmc.ca To: icon-group@cs.arizona.edu Message-Id: <920818.12420265.040650@RMC.CP6> Subject: (1) ICON & OS/2 ? (2) Strings vs. Lists. Status: R Errors-To: icon-group-errors@cs.arizona.edu (1) Would someone please post some comments, status, considerations or availability information about using ICON with OS/2 (as opposed to DOS or to DOS + WINDOWS or other multitasker) on '386 or '486 type equipment (either the interpreter or a compiler) ? (2) A few months ago, there were a few ruminations on this board about processing strings as lists or rather vv.; I'd like to open up and expand the subject again. Plainly there is a logical parallel between a string and a list, the differences being (a) that strings (in ICON and other languages too) are limited to having characters as components, while lists may have elements of any data type or any one other data type, (b) the obvious implementations on all the machines that I can think of are quite different, and (c) the operations that we tend to impute to lists are quite different from those that are usually associated with strings. But are they still? Both strings and lists are linear. We have been processing at least 2-dimensional images such as photographs of lunar and planetary surfaces to extract hidden detail and display it, and the image processing that I've seen bears no obvious relation to our current SNOBOLish concept of patterns in a string or list. Hence there seem to be 2 questions that are still open after several years of work: First, can we expand our concept of (linear) pattern so that that sort of pattern matching can be extended into 2 or more dimensions, perhaps via nearest-neighbour paths in an array, and Second, what new operators are needed for 'pattern matching' in 2 or more dimensions or for recognizing patterns in lists of numbers e.g., and what do these new operators say about linear pattern matching? The early attempts to try to deal with these 2 questions seem to have gotten almost nowhere, and the subject has almost been dropped in favour of artificial intelligence and computer vision considerations. In the early 1970's, I believe, I heard of a paper entitled 'How to Parse (the picture of) a Dog', but I never located it. In view of our recent advances in image analysis, I suggest that another look is in order. -------------------------------------------------------------------------------- John H. Lindsay, Department of Mathematics and Computer Science, Royal Military College of Canada, Kingston, Ontario, Canada, K7K 5L0. Phones: Office, (613) 541-6419 Messages, 541-6343 or 541-6458 Home, 546-6988 E-Mail: From Bitnet, NetNorth, ONet: LINDSAY_JH@RMC.CA From Canadian Military Colleges: LINDSAY JH@RMC Fax: (613) 542-8129 <*> <*> <*> END <*> <*> <*> From icon-group-sender Thu Aug 20 02:17:37 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 05:02:05 MST Date: 20 Aug 92 02:17:37 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!ux1.cso.uiuc.edu!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: (1) ICON & OS/2 ? (2) Strings vs. Lists. Message-Id: <1992Aug20.021737.27873@midway.uchicago.edu> References: <920818.12420265.040650@RMC.CP6> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In article <920818.12420265.040650@RMC.CP6> lindsay@rmc.ca writes: > A few months ago, there were a few ruminations on this board about > processing strings as lists or rather vv.; I'd like to open up and expand > the subject again. Plainly there is a logical parallel between a string and > a list, Perhaps you could define what you mean by "list." Do you mean a LISPish vec- tor? Even in Icon, the list is a much more general type, since it can con- tain objects of all other types. Instead of unifying lists and strings, may- be it might be better to talk about expanding strings to cover all homogenous linear sequences of certain data types. But then, of course, we lose a lot of our optimizations, and Icon becomes even more polymorphic (is that the right word?), since things like scanning will have to be modified to do many different things, depending on the kind of string it encounters. Maybe what might we worth thinking about is whether it might be possible to develop a list scanning mechanism. I've thought about this a lot, and I don't really see an elegant mechanism. Got any ideas? -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Thu Aug 20 07:13:29 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 07:31:03 MST Date: Thu, 20 Aug 1992 07:13:29 MST From: "Ralph Griswold" Message-Id: <199208201413.AA05459@cheltenham.cs.arizona.edu> To: icon-group Subject: list scanning/pattern matching Status: R Errors-To: icon-group-errors@cs.arizona.edu We've looked at this problem off and on for over 20 years, but have never come up with anything that was really useful. All we've learned are the reasons why it is not as good an idea as it appears on the surface. Richard is right -- the real problem is that list elements are not simple. Think about loops in structures. Looking at it another way, string scanning derives much of its usefulness from the simplicity of sequences of characters. Richard's idea of extending strings to sequences of other atomic values is interesting and deserves consideration despite the problems he noted with it. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Thu Aug 20 16:57:09 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 10:20:35 MST Date: Thu, 20 Aug 92 16:57:09 +0200 From: Jan Peter de Ruiter Message-Id: <9208201457.AA12761@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: list scanning Cc: janpeter@mpi.kun.nl Status: R Errors-To: icon-group-errors@cs.arizona.edu Could someone perhaps elaborate on the problems and/or proposed solutions in the field of list-pattern-matching? I certainly believe that it is a tough nut to crack, but I'm interested in what efforts have been made in this field, and why they are not working (..well enough). One aspect of existing attempts at list scanning that I'd like to hear more about is the question whether the problems mentioned by Richard & Ralph are problems of a conceptual type (elegance-related) or mainly performance related. Jan P. A. de Ruiter janpeter@mpi.kun.nl From icon-group-sender Thu Aug 20 10:58:08 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 14:01:26 MST Date: Thu, 20 Aug 1992 10:58:08 MST From: "Gregg Townsend" Message-Id: <199208201758.AA01079@owl.cs.arizona.edu> To: icon-group Subject: does VMS Icon problem affect you? Status: R Errors-To: icon-group-errors@cs.arizona.edu We're unsure how widespread the VMS Icon installation problems are. If you're having trouble installing VMS Icon 8.7, or are avoiding it because of the problem, please let us know by email to icon-project@cs.arizona.edu or uunet!arizona!icon-project. To recap, the problem is that neither the compiler nor the interpreter will run under VMS if the file SYS$SHARE:DECW$XLIBSHR.EXE is absent. This is the shared library for DecWindows (X Windows). A short note from anyone who's succeeded with the installation would also be appreciated. Gregg Townsend / Computer Science Dept / Univ of Arizona / Tucson, AZ 85721 +1 602 621 4325 gmt@cs.arizona.edu 110 57 16 W / 32 13 45 N / +758m From icon-group-sender Thu Aug 20 15:05:36 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 14:01:47 MST From: idealord@dorsai.com (Jeff Harrington) Message-Id: <9208201905.AA08280@dorsai.com> Subject: Re: List Scanning To: icon-group@cs.arizona.edu Date: Thu, 20 Aug 92 15:05:36 EDT X-Mailer: ELM [version 2.3 PL2] Status: R Errors-To: icon-group-errors@cs.arizona.edu Has anyone used the programs in the program library - lscan.icn? I use Icon primarily for music composition/editing and the use of list scanning procedures would vastly simplify my programs. The procedures in lscan.icn purport to be modelled on all of the string scanning builtins - find(), tab(), etc but I haven't found the opportunity to experiment with them yet. Jeff Harrington idealord@dorsai.com From icon-group-sender Thu Aug 20 19:27:14 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 14:02:13 MST Date: 20 Aug 92 19:27:14 GMT From: timbuk.cray.com!walter.cray.com!ferris!gerardo@uunet.uu.net (Gerardo Cisneros) Organization: Cray Research, Inc. Subject: Re: list scanning Message-Id: <1992Aug20.142714.22838@walter.cray.com> References: <9208201457.AA12761@mpix10.mpi.kun.nl> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In article <9208201457.AA12761@mpix10.mpi.kun.nl> janpeter@mpi.kun.nl (Jan Peter de Ruiter) writes: >Could someone perhaps elaborate on the problems and/or proposed >solutions in the field of list-pattern-matching? I certainly believe that >it is a tough nut to crack, but I'm interested in what efforts have been >made in this field, and why they are not working (..well enough). >[...] List pattern matching was implemented in the language CONVERT by Adolfo Guzman and Harold V. McIntosh more than 25 years ago: A. Guzman and H.V.McIntosh, "CONVERT", Commun. ACM _9_, 604-615 (1966) It ran as an interpreter under LISP on the IBM 709 and the AN-FSQ 32. Cheers, Gerardo Cisneros -- Dr. Gerardo Cisneros |Cray Research de M'exico, S.A. de C.V. gerardo.cisneros@cray.com |Camino a Sta. Teresa 480-A #302 (+52+5)622-8584 |14020 Tlalpan, D.F., MEXICO Anything I said sound like an opinion? Then it's no one's but my own. From icon-group-sender Thu Aug 20 20:11:00 1992 Received: by cheltenham.cs.arizona.edu; Thu, 20 Aug 1992 18:21:12 MST Date: 20 Aug 92 20:11:00 GMT From: destroyer!wsu-cs!usenet.ins.cwru.edu!wariat!ppetto@gumby.wisc.edu (Peter J. Petto) Organization: Akademia Pana Kleksa, Public Access Uni* Site Subject: Icon Question(s) Message-Id: <1992Aug20.201100.25164@wariat.org> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I'm trying to learn Icon, and have run into a little roadblock. I'm hoping that someone here might help me get unstuck. I'm starting by trying to convert an old SNOBOL routine to Icon. The routine I'm working on is as follows: * * CHOP USENET FILE INTO MORE READABLE FORM * &ANCHOR = 1 &TRIM = 1 HONE = 'Article: ' HTWO = 'From: ' HTHREE = 'Subject: ' HFOUR = 'Date: ' HFIVE = 'Organization: ' SONE = 'From ncoast' STWO = 'From usenet' STHREE = 'From wariat' HMATCH = HONE | HTWO | HTHREE | HFOUR | HFIVE SMATCH = SONE | STWO | STHREE * * INPUT('READLINE', 5, 1024) OUTPUT('PRINT', 6, 1024) * * HREAD LINE = READLINE :F(END) EQ(0,SIZE(LINE)) :S(BREAD) LINE HMATCH :F(HREAD) PRINT = LINE :(HREAD) * * BREAD PRINT = LINE BLOOP LINE = READLINE :F(END) LINE SMATCH :S(HREAD) PRINT = LINE :(BLOOP) * END One of my first attempts at an Icon equivelant is as follows: # unet.icn # # filter Usenet news headers # for printing and reading # global Mode procedure main() Mode := "header" while line := read() do if Mode := "header" then head(line) else body(line) end procedure head(line) if match("Article: " | "Date: " | "From: " | "Organization: " | "Subject: ", line) then write(line) if *line = 0 then { write(line); Mode := "body" } end procedure body(line) if match("From ncoast" | "From usenet" | "From wariat", line) then Mode := "header" else write(line) end This Icon program seems to filter the headers properly, but I'm not getting any body text through. I'm stumped and KNOW that I'm missing something obvious. Please help me! I'd also appreciate some advice as to rephrasing the match patterns as co-expressions -- assuming that this would be a better method. (I think if I get this one right, I should be able to translate the rest of my routines.) Thanks in advance for any and all help. --- Peter Petto | ppetto@wariat.org Bay Village, Ohio | 73125.617@compuserve.com From icon-group-sender Fri Aug 21 04:51:43 1992 Received: by cheltenham.cs.arizona.edu; Fri, 21 Aug 1992 05:35:34 MST Date: 21 Aug 92 04:51:43 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: list scanning Message-Id: <1992Aug21.045143.23619@midway.uchicago.edu> References: <9208201457.AA12761@mpix10.mpi.kun.nl>, <1992Aug20.142714.22838@walter.cray.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu gerardo@ferris.cray.com (Gerardo Cisneros) writes: > >List pattern matching was implemented in the language CONVERT by Adolfo >Guzman and Harold V. McIntosh more than 25 years ago: >A. Guzman and H.V.McIntosh, "CONVERT", Commun. ACM _9_, 604-615 (1966) >It ran as an interpreter under LISP on the IBM 709 and the AN-FSQ 32. If it's not too much of an imposition, could you perhaps summarize the salient points, and (if you every actually used this system) how it "looked and felt"? -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Fri Aug 21 05:28:22 1992 Received: by cheltenham.cs.arizona.edu; Fri, 21 Aug 1992 05:35:43 MST Date: 21 Aug 92 05:28:22 GMT From: uchinews!ellis!goer@speedy.wisc.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: List Scanning Message-Id: <1992Aug21.052822.24847@midway.uchicago.edu> References: <9208201905.AA08280@dorsai.com> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu idealord@dorsai.com (Jeff Harrington) writes: >Has anyone used the programs in the program library - lscan.icn? I use >Icon primarily for music composition/editing and the use of list scanning >procedures would vastly simplify my programs. The procedures in lscan.icn >purport to be modelled on all of the string scanning builtins - find(), >tab(), etc but I haven't found the opportunity to experiment with them yet. I wrote the lscan routines, and can say (definitively) that they are of very limited scope, mainly useful only for lists of strings. I really think that scanning lists in Icon is not the way to go. Scanning only makes sense for homogenous linear sequences. Csets are not linear, so they wouldn't be usable (except if converted). Integers don't make sense, either, unless we are talking a) about "large" characters (in which case, we're not talking about integers at all), or b) bit series. I have many times wanted to scan integers as "strings" of 1s and 0s, without having to actually convert them to genuine Icon strings. If Icon's strings were simply altered to permit "characters" of any rea- sonable width (from a single bit on up), this would probably not interact very well with current computer architectures, even if it would be *very* useful to us (and compatible with previous implementations). Right now, strings are implemented as series of characters, as defined by the machine on which the implementation is running. You can write 8 characters on an output stream, and then read them back in. No big deal. What if we are trying to write 32-bit characters? Or 1-bit characters? Reading them back in would require some thought on the part of the user. There would have to be consistency. If the defaults were set up properly, though, I guess the user would not have to think much anyway. My mind boggles at the idea. Imagine: Strings specified as having a character-width. Type conversions? Convert an integer to a string of 1-bit-wide characters, and then scan it. Neat for compressing informa- tion. Conversions, naturally, would not be possible for incompatible strings (e.g. 3-bit wide chars vs 8-bit wide ones). Output streams would also be defined as requiring a specific character-width (e.g. 8- bit), and all writes to those streams would trigger conversions or er- ror messages, in cases of incompatible strings. Imagine: If ISO 10646 is ever combined with Unicode, and accepted as a standard, there'd be no trouble using the system. Just use 32-bit- wide strings. These would automatically be type-converted when neces- sary to 8-bit-wide strings. Would this actually work, or is it just too late at night for me to think straight? -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Fri Aug 21 09:53:02 1992 Received: by cheltenham.cs.arizona.edu; Fri, 21 Aug 1992 10:03:33 MST Date: Fri, 21 Aug 1992 09:53:02 MST From: "Kenneth Walker" Message-Id: <199208211653.AA11058@optima.cs.arizona.edu> To: icon-group Subject: Re: Icon Question(s) Status: R Errors-To: icon-group-errors@cs.arizona.edu > From: destroyer!wsu-cs!usenet.ins.cwru.edu!wariat!ppetto@gumby.wisc.edu (Peter J. Petto) > ... > if Mode := "header" > then head(line) It looks like you have a simple typo, try > if Mode == "header" Ken Walker kwalker@cs.arizona.edu uunet!arizona!kwalker From icon-group-sender Mon Aug 24 12:26:14 1992 Received: by cheltenham.cs.arizona.edu; Mon, 24 Aug 1992 15:49:05 MST Date: Mon, 24 Aug 1992 12:26:14 MST From: "Ralph Griswold" Message-Id: <199208241926.AA26083@cheltenham.cs.arizona.edu> To: icon-group Subject: Version 8.7 Icon Sun 4 binaries Status: R Errors-To: icon-group-errors@cs.arizona.edu Due to a clerical mistake, the 8.7 Icon binaries for the Sun 4 in our FTP area (/icon/binaries/unix/sun4/sun4.tar.Z) were configured without X facilities. That error was corrected this morning. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Wed Aug 26 22:57:55 1992 Received: by cheltenham.cs.arizona.edu; Thu, 27 Aug 1992 05:58:19 MST Date: 26 Aug 92 22:57:55 GMT From: usc!sol.ctr.columbia.edu!eff!news.oc.com!spssig.spss.com!uchinews!iitmax!thssbxv@uunet.uu.net (Super *MAN*) Organization: Illinois Institute of Technology Subject: Icon compiler for DOS or SUN Message-Id: <1992Aug26.225755.22847@iitmax.iit.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: RO Errors-To: icon-group-errors@cs.arizona.edu Hi, I am looking for ICON compiler for DOS or SUN. Does somebody know ftp site where I could get one (if it is public domain of course). Thanks thssbxv@iitmax.iit.edu From icon-group-sender Thu Aug 27 05:58:01 1992 Received: by cheltenham.cs.arizona.edu; Thu, 27 Aug 1992 05:58:28 MST Date: Thu, 27 Aug 1992 05:58:01 MST From: "Ralph Griswold" Message-Id: <199208271258.AA25350@cheltenham.cs.arizona.edu> To: usc!sol.ctr.columbia.edu!eff!news.oc.com!spssig.spss.com!uchinews!iitmax!thssbxv@uunet.uu.net Subject: Re: Icon compiler for DOS or SUN Cc: icon-group Status: R Errors-To: icon-group-errors@cs.arizona.edu There are many public-domain implementations of Icon, including ones for the platforms you want, available from cs.arizona.edu. cd /icon and get READ.ME. If you need further information, let me know. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sat Aug 29 18:13:36 1992 Received: by cheltenham.cs.arizona.edu; Sun, 30 Aug 1992 11:15:17 MST Date: Sat, 29 Aug 92 18:13:36 EDT From: Paul_Abrahams@MTS.cc.Wayne.edu To: icon-group@cs.arizona.edu Message-Id: <493113@MTS.cc.Wayne.edu> Subject: Icon BBS Status: R Errors-To: icon-group-errors@cs.arizona.edu A small suggestion: the information on the Icon BBS included in the Icon Newsletter should include the available baud rates and the required parity and stop bit settings. (For now, perhaps you could post that information as a response to this message.) Thanks. Paul Abrahams From icon-group-sender Sun Aug 30 11:19:01 1992 Received: by cheltenham.cs.arizona.edu; Sun, 30 Aug 1992 11:19:08 MST Date: Sun, 30 Aug 1992 11:19:01 MST From: "Ralph Griswold" Message-Id: <199208301819.AA06603@cheltenham.cs.arizona.edu> To: icon-group Subject: Icon RBBS Status: R Errors-To: icon-group-errors@cs.arizona.edu The information you want is a bit bulky to put in every Icon Newsletter. There was an article covering this in Icon Newsletter 38. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sun Aug 30 11:21:59 1992 Received: by cheltenham.cs.arizona.edu; Sun, 30 Aug 1992 11:22:06 MST Date: Sun, 30 Aug 1992 11:21:59 MST From: "Ralph Griswold" Message-Id: <199208301821.AA06688@cheltenham.cs.arizona.edu> To: icon-group Subject: Icon RBBS Status: R Errors-To: icon-group-errors@cs.arizona.edu I see the article in Newsletter 38 does not contain all the information someone might want to use the Icon RBBS. The settings are standard, but I'll dig additional information out of an ealier Newsetter and post it in a day or so. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Mon Aug 31 09:18:57 1992 Received: by cheltenham.cs.arizona.edu; Mon, 31 Aug 1992 10:48:16 MST Date: Mon, 31 Aug 1992 09:18:57 MST From: "Cliff Hathaway" Message-Id: <199208311618.AA22060@javelina.cs.arizona.edu> To: icon-group Subject: Icon RBBS particulars Status: R Errors-To: icon-group-errors@cs.arizona.edu Some folks have requested the particulars for connecting to the Icon electronic bulletin board. Phone: 602-621-2283 Settings: 8N1 (8 bits, no parity, 1 stop bit) 1200 - 9600 baud Downloads can be done via kermit, Xmodem or Ymodem. We try to log in to the RBBS several times a week to check for messages, but email to icon-project is a more reliable means of getting a prompt reply from us. We try to ensure that the RBBS is available as much as possible. When we do bring it down for maintenance, we do it during normal working hours for us (0800 - 1700 Mountain Standard Time). Cliff Hathaway Dept. of Computer Science (602)621-4291 University of Arizona cliff@cs.arizona.edu (internet) Tucson, Ariz. 85721 {cmcl2,noao,uunet}!arizona!cliff (uucp) From icon-group-sender Tue Sep 1 18:58:28 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 06:37:34 MST Date: 1 Sep 92 18:58:28 GMT From: newross!dynastar!nr@princeton.edu Organization: Princeton University, Dept. of Computer Science Subject: Icon question about sorting Message-Id: <1992Sep1.185828.2803@newross.Princeton.EDU> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I have a set of strings that I want to sort. I would like the case of letters to be ignored during sorting, but I don't want the results to come out all in one case. The only thing I've been able to think of is ugly: make a new set of mapped strings, sort that, and then for each element of the original array find the position in the mapped list. There must be a better way; what is it? -- Norman Ramsey nr@princeton.edu From icon-group-sender Wed Sep 2 08:55:07 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 12:56:37 MST Date: 02 Sep 1992 08:55:07 -0600 (CST) From: Chris Tenaglia - 257-8765 Subject: Sorting strings To: icon-group@cs.arizona.edu Message-Id: <01GOAX3V9SO694DRQW@mis.mcw.edu> Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Status: R Errors-To: icon-group-errors@cs.arizona.edu > From: IN%"newross!dynastar!nr@princeton.edu" 2-SEP-1992 08:42:26.93 > To: IN%"icon-group@cs.arizona.edu" > Subj: Icon question about sorting > I have a set of strings that I want to sort. I would like the case of > letters to be ignored during sorting, but I don't want the results to > come out all in one case. The only thing I've been able to think of > is ugly: make a new set of mapped strings, sort that, and then for > each element of the original array find the position in the mapped > list. There must be a better way; what is it? > -- > Norman Ramsey > nr@princeton.edu I've had this and the problem of wanting to sort on a key that was several non-contiguous fields in the strings. Unfortunately, I had to use a brute force method of forming a sort list with the sort keys prepended to the front of each string in the list. I also wanted to be able to sort in reverse order, so I had to convert those fields as I built the sort key with a map(line,&cset,reverse(&cset)). Then comes the sort, and then you've got to strip the keys off, leaving your sorted data. Well maybe you could define the first n bytes of each line as a general purpose sort key, and ignore it during other processing? That depends on whether the data is your file or someone elses' I suppose. Depending on the OS, sometimes they have a SORT utility. You'd write your data to a temp file, use the OS SORT with all the magical options via a system() command, and then reload the sorted data. Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu From icon-group-sender Wed Sep 2 09:10:00 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 12:57:00 MST Message-Id: <199209021445.AA26968@optima.cs.arizona.edu> From: nowlin@iwtqg.att.com Date: Wed, 2 Sep 92 09:10 CDT To: att!cs.arizona.edu!icon-group Subject: Re: sorting question Status: R Errors-To: icon-group-errors@cs.arizona.edu > I have a set of strings that I want to sort. I would like the case of > letters to be ignored during sorting, but I don't want the results to > come out all in one case. The only thing I've been able to think of > is ugly: make a new set of mapped strings, sort that, and then for > each element of the original array find the position in the mapped > list. There must be a better way; what is it? > > -- > Norman Ramsey > nr@princeton.edu Let Icon do that for you. Tables were born for this kind of thing: procedure main() t := table() while s := read() do t[map(s)] := s every write((!sort(t))[2]) end This program reads strings, one per line from standard input, and prints them back out in sorted order, ignoring case. Just what you asked for as far as I can tell. Jerry Nowlin From icon-group-sender Wed Sep 2 09:56:27 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 12:57:14 MST Resent-Date: 02 Sep 1992 09:56:27 -0500 (CDT) Resent-From: stone@HILBERT.MATH.GRIN.EDU Date: 02 Sep 1992 09:56:27 -0500 (CDT) From: John David Stone Subject: Icon question about sorting Resent-To: icon-group@cs.arizona.edu To: Icon-group@arizona.edu Resent-Message-Id: <01GOAVDKXM5E8ZF60X@Arizona.edu> Message-Id: <9209021456.AA08102@HILBERT.MATH.GRIN.EDU> X-Vms-To: IN%"Icon-group@Arizona.edu" Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Status: R Errors-To: icon-group-errors@cs.arizona.edu The only part of the process that you can speed up, as far as I can see, is the recovery of the original strings. You'd do this by keeping the original and mapped strings together during the sort: procedure case_insensitive_sort(string_set) local string_table, str, string_list string_table := table() every str := !string_set do string_table[map(str, &ucase, &lcase)] := str string_list := list(0) every put(string_list, (!sort(string_table))[2]) return string_list end ------ John David Stone - Lecturer in Computer Science and Philosophy ----- -------------- Manager of the Mathematics Local-Area Network -------------- -------------- Grinnell College - Grinnell, Iowa 50112 - USA -------------- -------- stone@math.grin.edu - (515) 269-3181 - stone@grin1.bitnet -------- From icon-group-sender Wed Sep 2 13:23:03 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 12:57:22 MST Date: 2 Sep 92 13:23:03 GMT From: mcsun!uknet!glasgow!gnik@uunet.uu.net (David King) Organization: Glasgow University Computing Science Dept. Subject: Denotational semantics for Icon? Message-Id: Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Does anyone know if a formal semantics exists for Icon? If so could you tell me where I could get hold of it. Thanks very much -- David J. King --------------------- Department of Computing Science gnik@dcs.glasgow.ac.uk University of Glasgow, G12 8QQ Phone: (041) 339 8855 From icon-group-sender Wed Sep 2 18:48:38 1992 Received: by cheltenham.cs.arizona.edu; Wed, 2 Sep 1992 17:20:52 MST Date: Wed, 2 Sep 92 18:48:38 EDT From: Paul_Abrahams@MTS.cc.Wayne.edu To: icon-group@cs.arizona.edu Message-Id: <494568@MTS.cc.Wayne.edu> Subject: VEMD.386 for MS-DOS Icon Status: R Errors-To: icon-group-errors@cs.arizona.edu Has anyone successfully used VEMD.386, the floating-point emulator that comes with MS-DOS Icon Version 8.5, under Windows 3.1? When I tried it, the program hung and I could only break out by closing the window. I have no way of knowing whether the problem has to do with Windows or with the peculiarities of my machine (a Gateway 386/33 Cache). Paul Abrahams From icon-group-sender Wed Sep 2 23:00:27 1992 Received: by cheltenham.cs.arizona.edu; Thu, 3 Sep 1992 06:30:05 MST Date: 02 Sep 1992 23:00:27 -0600 (CST) From: Chris Tenaglia - 257-8765 Subject: Labor Day Doodle To: icon-group@cs.arizona.edu Message-Id: <01GOBQ1F77DU94DT0X@mis.mcw.edu> Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Status: R Errors-To: icon-group-errors@cs.arizona.edu I have a habit of posting games on holidays. Labor day is almost here and I don't have a game, but I did put together a toy. Reading the Icon Newsletter there was a section about student projects using X-Icon. I'm not a student but I like doing those kinds of projects and so here's mine. It's a simulation of a 4-D cube (tessarect). The code is not too elegant. I had the help of Dewdneys' Armchair Universe and a math expert (Bruce Salzman) to put it together in Quick C on a PC about 4 to 5 years ago. I then ported it to PC BASIC as an exercize about 3 to 4 years ago. Now there's the X-icon version, which you can tell is derived from the BASIC version because it has so many global variables. Well maybe some of you will have some helpful suggestions. I especially hate doing two dimensional arrays using tables keyed off concatenated string indices. The fun part is that you can move closer or further. Up or down. Turn it on the X axis, Y axis, Z axis, and the Other axis ;-). Rotate on all four at once and watch it explode and zoom and twist and mehardula (a 4-d term I made up for some motion incomprehensible to us 3-d creatures). I've compiled and run it under both VAX/VMS 5.5 with Decwindows/Motif and DEC RISC Ultrix Unix, so it should be pretty portable. Enjoy! Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu ------------------------------------------------------------------------------- #TITLE TESSARECT 4-D VIRTUAL REALITY MANIPULATOR #EJECT # # FILE : TESS.ICN # DESC : TUMBLING TESSARECT SIMULTATION WRITTEN FOR X WINDOWS # USAGE: TESS [size] # The size is optional. I believe it's pixels. The window produced is # square shaped. The size defaults to 1024. Of course you need an X # display to run this. It has been successfully run under VMS and # Ultrix unix as is. It's written for monochrome displays. You will # have to prep your environment for X before running it. # # UPDATE BY WHAT # 22-AUG-1992 TENAGLIA INITIAL PORTING FROM DOS BASIC # 23-AUG-1992 TENAGLIA OPTIMIZE AND ELIMINATE UNNECESSARY VARIABLES # 28-AUG-1992 TENAGLIA MADE HANDLE BOUNDARY CONDITIONS BETTER # global vs, vt, ne, pi, twopi, vs2, vs3, # view parameters vx, vy, vz, vw, # view projectors ox, oy, oldx, oldy, # old x,y positions x, h, dh, xi, # axis pointer & increment y, p, dp, yi, # axis pointer & increment z, b, db, # axis pointer & increment w, a, da, # axis pointer & increment dv, dd, d, # distance increments sa, sb, sp, sh, # sine constants ca, cb, cp, ch, # cosine constants ppux,ppuy,scale, # more projection constants projtessarect, # new projection matrices oldproj, # former matrix tessarect, # tessarect matrix edges, # edges matrix xwindow, lines, columns # xwindow variables #SUB MAIN AND SETUP PROCEDURES #EJECT # # this is the main drawing loop # procedure main(stuff) setup(stuff) getview() repeat { genview() testkey(stuff) changeview() } end # # this sets up some main x variables and constants # procedure setup(settings) vs := real(settings[1] | 1024.0) vs2:= vs * 5.0 vs3:= -vs* 4.0 vt := 16 ne := 48 pi := 3.1415927 twopi := pi * 2.0 tessarect := [ [ 1, 1,-1,-1 ], # C [ 1,-1,-1,-1 ], # 8 [-1,-1,-1,-1 ], # 0 [-1, 1,-1,-1 ], # 4 [ 1, 1, 1,-1 ], # E [ 1,-1, 1,-1 ], # A [-1,-1, 1,-1 ], # 2 [-1, 1, 1,-1 ], # 6 [ 1, 1,-1, 1 ], # D [ 1,-1,-1, 1 ], # 9 [-1,-1,-1, 1 ], # 1 [-1, 1,-1, 1 ], # 5 [ 1, 1, 1, 1 ], # F [ 1,-1, 1, 1 ], # B [-1,-1, 1, 1 ], # 3 [-1, 1, 1, 1 ] ] # 7 edges := [ -1, 9, -2, 10, -3, 11, -4, 12, -5, 13, -6, 14, -7, 15, -8, 16, -1, 2, 3, 4, 1, 5, 6, 7, 8, 5, -2, 6, -3, 7, -4, 8, -9, 10, 11, 12, 9, 13, 14, 15, 16, 13,-10, 14,-11, 15,-12, 16 ] projtessarect := table(0) oldproj := table(0) end #SUB BUILD WINDOW & OTHER NEEDED CONSTANTS #EJECT # # set up other important windowing variables and constants # procedure getview() ox := vs / 2.0 oy := vs / 2.0 lines := integer(vs / 14.22 + 0.5) columns := integer(vs / 5.69 + 0.5) scale := 5.0 ppux := scale * 10.0 ; ppuy := scale * 8.0 dv := 2.0 ; dd := 0.0 ; d := 2.0 h := pi / 4.0 ; dh := 0.040 ; xi := 0.0 p := 0.0 ; dp := 0.0 ; yi := 0.0 b := 0.0 ; db := 0.0 a := 0.015 ; da := 0.0 write("\nTessarect Simulation\n") write(" x : move x-axis | r : reset to original settings") write(" y : move y-axis | o : move futher out") write(" z : move z-axis | i : move closer in ") write(" a : move the OTHER axis | q : quit") write(" up/down/left/right arrows move shape on screen") write(" f : freeze rotation | : blank stop movement") # # configure the X-connection # (xwindow := open("TESS","x", "x=" || vs,"y=" || vs, "bg=black","fg=white", "lines=" || lines,"columns=" || columns)) | { write("Can't open window. Press ") stop("ABEND ANOX") } XSync(xwindow) XSetStipple(xwindow,8,0) XAttrib(xwindow,"drawop=xor") XGotoRC(xwindow,1,1) write(xwindow,"Tessarect Simulation\n") write(xwindow," x : move x-axis | r : reset to original settings") write(xwindow," y : move y-axis | o : move futher out") write(xwindow," z : move z-axis | i : move closer in ") write(xwindow," a : move the OTHER axis | q : quit") write(xwindow," up/down/left/right arrows move shape on screen") write(xwindow," f : freeze rotation | : blank stop movement") end #SUB ACTUAL TESSARECT ANIMATOR #EJECT # # calculate points in 4 dimensions # procedure calcview() sh := sin(h) ; ch := cos(h) sp := sin(p) ; cp := cos(p) sb := sin(b) ; cb := cos(b) sa := sin(a) ; ca := cos(a) vx := -dv * ca * cp * sh vy := -dv * ca * cp * ch vz := -dv * ca * sp vw := -dv * sa end # # run a display pass # procedure genview() calcview() project() connect() oldproj := copy(projtessarect) end # # project 4 dimensions to fewer dimensions # procedure project() projtessarect := table(0) every i := 1 to vt do { x := tessarect[i][1] - vx y := tessarect[i][2] - vy z := tessarect[i][3] - vz w := tessarect[i][4] - vw q := w * sa x := (x * ca - q) / w y := (y * ca - q) / w z := (z * ca - q) / w xa:= ch * x - sh * y ya:= sh * x + ch * y za:= cp * z - sp * ya tx:= cb * xa + sb * za ty:= cp * ya + sp * z tz:= cb * za - sb * xa projtessarect[i || "," || 1] := ox + ppux * d * tx / ty projtessarect[i || "," || 2] := oy + ppuy * d * tz / ty } end #EJECT # # perform motion # procedure changeview() if (h +:= dh) > twopi then h -:= twopi if (p -:= dp) < -twopi then p +:= twopi if (a +:= da) > twopi then a -:= twopi if (b -:= db) < -twopi then b +:= twopi if (dv > 0.0) & (dv < 6.0) then { dv +:= dd } else { dv -:= (2.0 * dd) dd := 0.0 } if (ox > 0.0) & (ox < vs) then { ox +:= xi } else { ox -:= (2.0 * xi) xi := 0.0 } if (oy > 0.0) & (oy < vs) then { oy +:= yi } else { oy -:= (2.0 * yi) yi := 0.0 } end #EJECT # # draw it # procedure connect() every i := 1 to ne do { pt := abs(edges[i]) b1 := oldproj[pt || "," || 1] b2 := oldproj[pt || "," || 2] a1 := projtessarect[pt || "," || 1] a2 := projtessarect[pt || "," || 2] if edges[i] < 0 then { oldx := a1 oldy := a2 oldxb:= b1 oldyb:= b2 next } if ((vs2 > oldxb > vs3) & (vs2 > b1 > vs3) & (vs2 > oldyb > vs3) & (vs2 > b2 > vs3)) then XDrawLine(xwindow,oldxb,oldyb,b1,b2) if ((vs2 > oldx > vs3) & (vs2 > a1 > vs3) & (vs2 > oldy > vs3) & (vs2 > a2 > vs3)) then XDrawLine(xwindow,oldx,oldy,a1,a2) oldx := a1 oldy := a2 oldxb:= b1 oldyb:= b2 } XSync(xwindow) end #EJECT # # sense the outside world # procedure testkey(window) static uparrow, downarrow, leftarrow, rightarrow, xrotate, yrotate, zrotate, arotate, closer, further, halt, freeze, quit, restart initial { uparrow := "65362" ; downarrow := "65364" leftarrow := "65361" ; rightarrow := "65363" xrotate := "x" ; yrotate := "y" zrotate := "z" ; arotate := "a" closer := "i" ; further := "o" halt := " " ; freeze := "f" quit := "q" ; restart := "r" } if (things := XPending(xwindow)) & (*things > 0) then { request := map(XEvent(xwindow)) } else { kbhit() | return request := map(getch()) } case request of { xrotate : dh := if dh = 0.0 then 0.070 else 0.00 yrotate : dp := if dp = 0.0 then 0.039 else 0.00 zrotate : db := if db = 0.0 then 0.025 else 0.00 arotate : da := if da = 0.0 then 0.016 else 0.00 closer : dd := if dd = 0.0 then -0.05 else 0.00 further : dd := if dd = 0.0 then 0.05 else 0.00 leftarrow : xi := -5.0 rightarrow : xi := 5.0 uparrow : yi := -5.0 downarrow : yi := 5.0 halt : { xi := 0.00 ; yi := 0.00 ; dd := 0.00 } freeze : { dh := 0.00 ; dp := 0.00 ; db := 0.00 ; da := 0.00 } restart : { close(xwindow) ; setup(window) ; getview() ; connect() } quit : stop("Execution Interrupted") } end # END OF PROGRAM From icon-group-sender Thu Sep 3 13:46:36 1992 Received: by cheltenham.cs.arizona.edu; Thu, 3 Sep 1992 06:30:24 MST Date: Thu, 3 Sep 92 13:46:36 +0200 From: Jan Peter de Ruiter Message-Id: <9209031146.AA13971@mpix10.mpi.kun.nl> To: icon-group@cs.arizona.edu Subject: sorting Status: R Errors-To: icon-group-errors@cs.arizona.edu Wouldn't it be most convenient if Icon allowed the programmer to define his/her own compare-function used in the sort() procedure? If that were possible, the case sensitivity could be avoided by defining a compare-function that simply ignores case, and from then on everything would be the same. I imagine something along the lines of a &compare keyword that points to the (possibly user defined) function that returns either -1, 0 or 1, depending on the outcome of the comparison. In that way the most esoteric sorting functions could be written, without deteriorating the programming style. Jan. P. A. de Ruiter janpeter@mpi.nl From icon-group-sender Thu Sep 3 09:32:19 1992 Received: by cheltenham.cs.arizona.edu; Thu, 3 Sep 1992 07:46:17 MST Date: Thu, 3 Sep 92 09:32:19 CDT From: "Richard L. Goerwitz" Message-Id: <9209031432.AA03653@midway.uchicago.edu> To: icon-group@cs.arizona.edu Subject: sorting Status: R Errors-To: icon-group-errors@cs.arizona.edu Jan says: Wouldn't it be most convenient if Icon allowed the programmer to define his/her own compare-function used in the sort() procedure? In general, one should (IMHO) be able to count on the various built-in functions remaining static. If somebody needs an exotic sort procedure, it should be named something else. It just makes for easier-to-read-and- maintain code. I personally detest working on code where somebody has gone in and redefined built-ins! Sorting is often usefully done in a case-insensitive manner, and I note that you suggest using a keyword to turn on this behavior. The problem here is that you're using a side-effect that will confuse people merci- lessly. If you need a case-insensitive sort for certain things, it is very easy just to create a procedure to do it yourself. Jerry Nowlin's posting a couple of days ago was a fine example of this. By creating a user-defined sort procedure, and naming it something other than "sort," you'll tip anyone who reads your code off that you're not doing a stan- dard system sort. If in fact a case-insensitive sort were added to Icon, I'd say it would be better to do it as a different function (e.g. sorti). Icon is big, and its intrinsic namespace could easily become cluttered, though, so perhaps the best idea would be to implement a new sort as a library procedure. I haven't checked the IPL for a sort routine, but I'd guess that that would be the very sort of thing the Icon Project would have included in its distribution. If one is not there, well, then if somebody writes one that handles arbitrary types and structures the same way as the system sort, I'd certainly think it would be good to post it here, and at the same time send a copy to the Icon Project for possible inclusion in the Icon Program Library distribution. -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Fri Sep 4 14:05:54 1992 Received: by cheltenham.cs.arizona.edu; Fri, 4 Sep 1992 10:08:45 MST Date: 4 Sep 92 14:05:54 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!sctc.com!beede@ucbvax.Berkeley.EDU (Mike Beede) Organization: SCTC Subject: Re: sorting Message-Id: <1992Sep4.140554.5727@sctc.com> References: <9209031432.AA03653@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: RO Errors-To: icon-group-errors@cs.arizona.edu goer@MIDWAY.UCHICAGO.EDU ("Richard L. Goerwitz") writes: >Sorting is often usefully done in a case-insensitive manner, and I note >that you suggest using a keyword to turn on this behavior. It's been several years since I used Icon, so I don't know whether this is workable: can't you pass in the comparison function as an argument? This abstracts the sorting algorithm from the ordering function, which seems to be Mom-and-Apple-Pie. The procedure should be called something other than ``sort'', unless ``sort'' with a single parameter could use the default comparisons, and with two use the user-supplied one. I agree completely that using a side-effect to control sorting behavior would be extremely unfriendly. -- Mike Beede Secure Computing beede@sctc.com 1210 W. County Rd E, Suite 100 ------------------ Arden Hills, MN 55112 (612) 482-7420 From icon-group-sender Sat Sep 5 08:31:47 1992 Received: by cheltenham.cs.arizona.edu; Sat, 5 Sep 1992 07:55:41 MST Date: 05 Sep 1992 08:31:47 -0600 (CST) From: Chris Tenaglia - 257-8765 Subject: Nice Sample VMS Program To: icon-group@cs.arizona.edu Message-Id: <01GOF2UCJESI94DUZV@mis.mcw.edu> Organization: Medical College of Wisconsin (Milwaukee, WI) X-Vms-To: IN%"icon-group@cs.arizona.edu" Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT Status: R Errors-To: icon-group-errors@cs.arizona.edu We'll there probably aren't a not of X-icon users out there yet. There are probably not a lot of VMS-icon users either, but VMS users usually seem to need a little more help (I know I did when I first started). Here's a little program that does DIR/SIZE sorting by size and filterable by boolean on the size rather than regular expression on the file. I call the program SIZES. Here are some samples : ICONX SIZES EQ 0 ! find files with 0 blocks ICONX SIZES GT 1000 ! find files over 1000 blocks in size ICONX SIZES NE 8 ! find files that aren't 8 blocks ICONX SIZES ! display all files Output files are specified using unixlike redirectors: ICONX SIZES LT 100 >S.TMP ! write output to S.TMP ICONX SIZES GT 2000 >>S.TALLY ! append output to S.TALLY The output is sorted by size from highest to lowest. The program uses string scanning and has comments. Maybe someone might want to post a unix or DOS version? Here's the code : # # FILE : SIZES.ICN # DESC : VMS DIR/SIZE SORTED BY SIZE INSTEAD BY FILENAME # USE : ICONX SIZES [compare size] # WHERE compare IS AL, GT, LT, EQ, GE, LE, NE AND # SIZE IS A NUMBER MEANING ALLOCATED BLOCKS SO FOR # EXAMPLE iconx sizes gt 1000 WILL DO A DIR/SIZE # SHOWING ONLY FILES GREATER THAN 1000 BLOCKS SORTED # BY BLOCKS WITH BIGGEST FILES FIRST. # # UPDATE BY WHAT # 5-SEP-1992 TENAGLIA INITIAL CREATION # procedure main(param) cache := [] dir := "" grand := 0 if *param = 2 then # if something is specified { # then method := param[1] # get method of compare limit := param[2] # compare sizes with this } else { # otherwise method := "al" # look at all of them limit := -1 # and this is a place holder } command := "dir/size=alloc/nohead/notrail " pipe := open(command,"pr") while (name := read(pipe)) & (size := read(pipe)) do { if dir == "" then name ? (dir := tab(upto(']') + 1)) name ? { move(upto(']')) file := tab(0) } if compare(size,limit,param[1]) then { put(cache,right(size,7) || " " || trim(file)) grand +:= size } } close(pipe) results := sort(cache) write("\n",dir,"\n") while write(pull(results)) write("\nTotal Allocated Blocks = ",grand) end # # GENERIC BOOLEAN COMPARE EITHER RETURNS OR FAILS # A & B MUST BE NUMERICS, AND CONDITION IS A BOOLEAN ABBREVIATION # procedure compare(a,b,condition) case condition of { "al" : return # always "gt" : if a > b then return # greater than "lt" : if a < b then return # less than "eq" : if a = b then return # equal to "ge" : if a >= b then return # greater than or equal to "le" : if a <= b then return # less than or equal to "ne" : if a ~= b then return # not equal default : fail # never } fail end ################# end of program #################### Chris Tenaglia (System Manager) | Medical College of Wisconsin 8701 W. Watertown Plank Rd. | Milwaukee, WI 53226 (414)257-8765 | tenaglia@mis.mcw.edu, mcwmis!tenaglia From icon-group-sender Sat Sep 5 07:48:57 1992 Received: by cheltenham.cs.arizona.edu; Sat, 5 Sep 1992 07:55:48 MST Date: Sat, 5 Sep 1992 07:48:57 MST From: "Ralph Griswold" Message-Id: <199209051448.AA17632@cheltenham.cs.arizona.edu> To: icon-group Subject: "debugify" Status: R Errors-To: icon-group-errors@cs.arizona.edu Icon Newsletter 39 has an article on an Icon debugger by Charles Shartsis. His method requires modifying the "ucode" produced by the Icon translator and specifically relies on the numerical codes used in ucode for representing keywords. Unfortunately, these numeric codes sometimes change. Specifically, the codes used in his program are for Version 8.0, and these codes have changed in more recent releases. His debugger in the present Icon program library and our FTP area therefore will not work properly on the current version of Icon for most platforms. He is working on fixing the problem. In the meantime, if you want to use "debugify" on recent versions of Icon, you will need to change to keyword codes. We can't tell you excatly what to do, since it varies from version to version, but you might find it an interesting exercise to figure out what to do. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sat Sep 5 07:54:49 1992 Received: by cheltenham.cs.arizona.edu; Sat, 5 Sep 1992 07:55:54 MST Date: Sat, 5 Sep 1992 07:54:49 MST From: "Ralph Griswold" Message-Id: <199209051454.AA17700@cheltenham.cs.arizona.edu> To: icon-group Subject: X-Icon editor Status: R Errors-To: icon-group-errors@cs.arizona.edu The program library in release 8.7 of Icon for UNIX and VMS has an editor written in X-Icon. Unfortunately when we made recent changes in X-Icon, we failed to properly update the code in this editor. We've now corrected the problem, but if you picked up UNIX or VMS Icon by FTP prior to September 1, you may have a defective copy of the editor. We have placed corrected versions of the two files that were in error in our FTP area, in /icon/library. They are xed.icn main program textedit.icn procedure used by xed. Ralph E. Griswold ralph@cs.arizona.edu Department of Computer Science uunet!arizona!ralph The University of Arizona 602-621-6609 (voice) Tucson, AZ 85721 602-621-9618 (fax) From icon-group-sender Sun Sep 6 21:56:57 1992 Received: by cheltenham.cs.arizona.edu; Sun, 6 Sep 1992 19:30:47 MST Date: 6 Sep 92 21:56:57 GMT From: pipex!demon!apusapus.demon.co.uk!tfj@uunet.uu.net (Trevor Jenkins) Organization: Job hunters use Parachute Subject: W3-Icon possible? Message-Id: <715816617snx@apusapus.demon.co.uk> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu In issue 39 of the Icon newsletter there was an item on X-Icon but else where it is stated that most use of Icon is on MS-DOS machines this got me thinking as to the whether a Windows3 Icon is possible? (For me it is desirable as I'm not likely to use Icon on anything other than a PC.) ------------------------------------------------------------- Trevor Jenkins Radio: G6AJG 134 Frankland Rd, Croxley Green, Rickmansworth, WD3 3AU email: tfj@apusapus.demon.co.uk phone: +44 (0)923 776436 From icon-group-sender Mon Sep 7 04:50:12 1992 Received: by cheltenham.cs.arizona.edu; Mon, 7 Sep 1992 05:58:01 MST Date: 7 Sep 92 04:50:12 GMT From: uchinews!ellis!goer@handies.ucar.edu (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: W3-Icon possible? Message-Id: <1992Sep7.045012.9932@midway.uchicago.edu> References: <715816617snx@apusapus.demon.co.uk> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu tfj@apusapus.demon.co.uk (Trevor Jenkins) writes: >In issue 39 of the Icon newsletter there was an item on X-Icon but else >where it is stated that most use of Icon is on MS-DOS machines this got me >thinking as to the whether a Windows3 Icon is possible? (For me it is >desirable as I'm not likely to use Icon on anything other than a PC.) It would be ideal to have Icon implemented under every windowing system in existence, in the sense of providing X-Iconish functionality - espe- cially under popular ones like the OS/2 presentation manager, the Mac, and Windows. Doing so would not be at all impossible. The specs for X-Icon have been written up as part of a U of Arizona technical report. If you were to try your hand at implementing X-Icon functionality under Win- dows, I'm sure you'd be able to count on support from other users here, as also from the Icon Project itself - although one suspects that they are probably busy enough just designing and implementing the base language for their platforms that Windows would not be a high priority for them. -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Mon Sep 7 11:55:33 1992 Received: by cheltenham.cs.arizona.edu; Mon, 7 Sep 1992 12:02:45 MST Date: Mon, 7 Sep 1992 11:55:33 MST From: "Clint Jeffery" Message-Id: <199209071855.AA18803@chuckwalla.cs.arizona.edu> To: icon-group Subject: X-Icon has been ported to OS/2 Presentation Manager API Status: R Errors-To: icon-group-errors@cs.arizona.edu Although it was designed with portability in mind, we downplayed X-Icon's potential on other platforms for at least two reasons: (1) The large amount of X Window code makes porting a major effort, (2) Porting *all* its X-specific features would be near impossible. Nevertheless, a gifted and determined programmer named Darren Merrill of the University of Arizona has done a port of X-Icon to OS/2 2.0. It is a near-complete port, with very few of X-Icon's features altered or missing. Its graphics performance on a 486 processor is competitive with low-end workstations. It is in the testing phase, and we plan to release it when it is ready. So, X-Icon can be ported, but it is not easy. We are not funded to port to other window systems and cannot justify it as research, but we are always interested in hearing from folks who undertake such efforts. Clint Jeffery, Icon Project From icon-group-sender Tue Sep 8 07:12:32 1992 Received: by cheltenham.cs.arizona.edu; Tue, 8 Sep 1992 09:58:05 MST Via: uk.ac.edinburgh.festival; Tue, 8 Sep 1992 15:10:18 +0100 Date: 08 Sep 92 15:10:01 BST From: R J Hare Subject: fail/break To: icon-group@cs.arizona.edu Message-Id: <9209081510.aa04013@uk.ac.ed.festival> Status: R Errors-To: icon-group-errors@cs.arizona.edu I have a situation where I am doing something like: procedure main() . . repeat action() stop() end procedure action() . . if test then break . . end in other words, I am repeating the procedure action which takes one or another action depending on a value. Some values just bale out of the action and try again by repeating the procedure. My problem is this - if I replace the break in the above with fail, I seem to get the same effect. Which is correct please, break or fail? Thanks. Roger Hare. From icon-group-sender Tue Sep 8 13:03:00 1992 Received: by cheltenham.cs.arizona.edu; Tue, 8 Sep 1992 14:30:11 MST Message-Id: <199209081811.AA14861@optima.cs.arizona.edu> From: nowlin@iwtqg.att.com Date: Tue, 8 Sep 92 13:03 CDT To: att!cs.arizona.edu!icon-group Subject: Re: fail/break Status: R Errors-To: icon-group-errors@cs.arizona.edu > I have a situation where I am doing something like: > > procedure main() > . > . > repeat action() > stop() > end > > procedure action() > . > . > if test then break > . > . > end > > My problem is this - if I replace the break in the above with fail, I > seem to get the same effect. Which is correct please, break or fail? > > Roger Hare. There's not enough context in your example. The break control structure only makes sense in the context of a loop. Your example piece of code contains no evidence of a loop surrounding the break. If there is a loop around the break, and inside the action() procedure, that loop would be the one the break is in effect for - not the repeat loop in the main() procedure. In the case of this example, it looks like ONLY fail makes sense. You should get a translation error with an orphaned break. Jerry Nowlin From icon-group-sender Tue Sep 8 20:20:24 1992 Received: by cheltenham.cs.arizona.edu; Wed, 9 Sep 1992 03:50:15 MST Date: Tue, 8 Sep 92 20:20:24 -0400 From: isidev!nowlin@uunet.uu.net Message-Id: <9209090020.AA28885@relay2.UU.NET> To: uunet!cs.arizona.edu!icon-group@uunet.UU.NET Subject: Re: fail/break Status: R Errors-To: icon-group-errors@cs.arizona.edu > procedure main() > repeat action() > stop() > end By the way. Did I forget to mention that unless the action() procedure terminates the program with a call to exit() or stop(), you have an infinite loop here? The failure of action() will not terminate the repeat loop. Jerry Nowlin From icon-group-sender Tue Sep 8 18:38:39 1992 Received: by cheltenham.cs.arizona.edu; Wed, 9 Sep 1992 03:50:21 MST Date: 8 Sep 92 18:38:39 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: Re: fail/break Message-Id: <1992Sep8.183839.22407@midway.uchicago.edu> References: <9209081510.aa04013@uk.ac.ed.festival> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu ercn72@FESTIVAL.ED.AC.UK (R J Hare) asks a good question that really ought to be answered properly. I'll give it my best shot. He says: >I have a situation where I am doing something like: > >procedure main() > repeat action() >end > >procedure action() > if test then break >end As far as break is concerned, the only loops it knows about are the ones within the procedure it is invoked from. The whole idea behind a lexically scoped language, with procedural isolation, is that the programmer should break his or task down into smaller units that communicate with the rest of the program via a limited and easily controllable interface (namely arg- ment passing). Put more simply, when you create an action(arg) pro- cedure, you are saying that you want to isolate a specific task having to do with arg. If break could break out of loops in the procedure you called action() from, it would defeat the whole reason for isolating the procedure in the first place. The correct way to do what you want is to turn repeat { action() } procedure action() if something then break end into something like this: repeat { if something then break } Think what would happen if Icon control structures could be "broken" out of from any procedure invoked from within them: Very ugly side-effects would certainly cause mysterious bugs, and tracebacks would not be able to locate them! -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Thu Sep 10 13:56:09 1992 Received: by cheltenham.cs.arizona.edu; Sun, 13 Sep 1992 17:14:15 MST Date: Thu, 10 Sep 92 13:56:09 CDT From: "Richard L. Goerwitz" Message-Id: <9209101856.AA25441@midway.uchicago.edu> To: icon-group@cs.arizona.edu Subject: bug; 8.6 + UNIX + keyboard functions + compiler Status: R Errors-To: icon-group-errors@cs.arizona.edu When I compile in keyboard functions with 8.6, the linking phase with my C compiler turns up a missing _keyboard_error function in one of the rt.a object files. This does not occur when the pro- gram in question is interpreted. -Richard From icon-group-sender Fri Sep 11 12:56:11 1992 Received: by cheltenham.cs.arizona.edu; Sun, 13 Sep 1992 17:14:26 MST Date: 11 Sep 92 12:56:11 GMT From: dog.ee.lbl.gov!hellgate.utah.edu!caen!uwm.edu!zazen!mis.mcw.edu!tenaglia@ucbvax.Berkeley.EDU Organization: Medical College of Wisconsin Subject: X-Icon Sample Program Message-Id: <1992Sep11.075611.311@mis.mcw.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu I imagine X-Icon hasn't caught on real big yet, however, I'd like to post a sample. It's a doodler of recursive Sierpinski triangles. The mouse is polled as is the keyboard. The code could probably be better, but I thought we could get a few more X-Icon posts going by getting out some samples. Chris Tenaglia (System Manager) | "The past explained, Medical College of Wisconsin | the future fortold, 8701 W. Watertown Plank Rd. | the present largely appologized for." Milwaukee, WI 53226 | Organon to The Doctor (414)257-8765 | tenaglia@mis.mcw.edu # # FILE : SIER.ICN # DESC : DRAWS SIERPINSKI TRIANGLES IN X-WINDOWS # USAGE: ICONX SIER WIDTH HEIGHT # WIDTH AND HEIGHT ARE USED TO SIZE THE XWINDOW. THREE RANDOM POINTS # ARE AUTOMATICALLY CHOOSEN. 2000 DOTS PER TRIANGLE IS THE DEFAULT. # THE MOUSE IS USED TO ADJUST THINGS. # MOUSE BUTTON 1 -- SET A TRIANGLE CORNER # MOUSE BUTTON 2 -- SET THE NUMBER OF DOTS TO PLOT (ALSO "D") # MOUSE BUTTON 3 -- START DRAWING TRIANGLE (ALSO "C") # ALSO "S" SAVES THE PICTURE TO SIERPINSKI.IMG # ALSO "E" ERASES THE PICTURE SO YOU CAN START OVER # ALSO "Q" QUITS THE PROGRAM # # UPDATE BY WHAT # 11-SEP-1992 TENAGLIA INITIAL PORT FROM ADEX CHROMAGRAPH & C # global VW,VH,yes,x,ox,y,oy,xw,yw, wl,wr,wt,wb,CW,CR,mode,answer, xwindow,px,py,lines,columns,pass procedure main(param) setup(param) until (answer ~== yes) & (trim(answer) ~== "") do { # # LOAD THE SEED MATRIX TO DETERMINE THE INITIAL DIMENSIONS # every i := 1 to 3 do { px[i] := ?VW px[i+3] := px[i] py[i] := ?VH py[i+3] := py[i] } # # ALLOW MOUSE TO CHANGE THE TRIANGLE CORNER POINTS # XDrawPoint(xwindow,px[1],py[1],px[2],py[2],px[3],py[3]) adjust() # # DRAW THE INITIAL OUTLINE OF THE TRIANGLE AND SET SEED NUMBERS # XDrawLine(xwindow,px[1],py[1],px[2],py[2],px[3],py[3],px[1],py[1]) h := ?VW v := ?VH # # THIS IS THE MAIN DRAWING LOOP FOR THE RECURSIVE TRIANGLE # writes(at(24,1),blink("Drawing....")) every times := 1 to mode do { p := ?6 # PICK SOME INTERESTING PLACE h1 := px[p] v1 := py[p] h := integer(real((h1 - h) / 2.0 + h)) v := integer(real((v1 - v) / 2.0 + v)) XDrawPoint(xwindow,h,v) } } close(xwindow) end # # SETUP INITIAL GLOBAL PARAMETERS AND CONSTANTS # procedure setup(items) VW := integer(items[1]) | 500 VH := integer(items[2]) | 400 mode := 2000 yes := "y" OX := 0 OY := 0 xw := VW - 2 * OX yw := VH - 2 * OY pass := 0 wl := -xw/2 wr := - wl wb := -yw/2 wt := - wb px := [0,0,0,0,0,0] py := [0,0,0,0,0,0] lines := integer(VH / 14.22 + 0.5) columns := integer(VW / 5.69 + 0.5) &random := map(&clock,":","0") answer := yes (xwindow := open("SIERPINSKI","x", "x=" || VW,"y=" || VH, "bg=black","fg=white", "lines=" || lines,"columns=" || columns)) | { write("Can't open window. Press ") stop("ABEND ANOX") } XSync(xwindow) XSetStipple(xwindow,8,0) end # # PROMPT FOR AN INPUT STRING # procedure input(prompt) writes(prompt) return read() end # # ALLOW MOUSE TO ADJUST THE TRIANGLE CORNER POINTS # procedure adjust() i := 1 writes(cls()) write("+---------------------------------------------+") write("| |") write("| Press M1 to plant a corner |") write("| Press M2 to set the dot count |") write("| Press M3 or enter 'C' to start plotting |") write("| Enter E to Erase window |") write("| Enter S to Save window |") write("| Enter Q to Quit program |") write("+---------------------------------------------+") write(at(2,20),"Sierpinski Triangle # ",pass) byte := "" while byte := map(XEvent(xwindow)) do { xy := [] every put(xy,XQueryPointer(w)) x := xy[1] - 10 ; y := xy[2] - 40 case byte of { string(&lpress) : { XDrawPoint(xwindow,px[i],py[i]) px[i] := x px[i+3] := x py[i] := y py[i+3] := y XDrawPoint(xwindow,x,y) if (i +:= 1) > 3 then i := 1 } string(&mpress) | "D" | "d" : { tmp := open("DOT QUANTITY","x","font=-*-Terminal-*-*-*-*-*-*-*-*-*-160-*-*") write(tmp,"How many dots to plot") itera := read(tmp) if not(numeric(itera)) then { write(tmp,"\7Numeric input needed. Press ") read(tmp) close(tmp) byte := "" XFlush(xwindow) next } close(tmp) mode := itera } string(&rpress) | "C" | "c" : { write(at(2,20),"Sierpinski Triangle # ",(pass+:=1)) return } "S" | "s" : { writes(at(24,1),blink("Writing Image to sierpinski.img")) XWriteImage(xwindow,"sierpinski.img") writes(at(24,1),"\e[K\7") } "E" | "e" : { XEraseArea(xwindow,0,0,0,0) ; pass := 0 } "Q" | "q" : stop(at(23,1),"X SIERPINSKI cancelled") default : &null } byte := "" XFlush(xwindow) } end # # PROCEDURE USES ANSI SEQUENCE TO SET CURSOR TO SCREEN LOCATION # procedure at(row,column) return "\e[" || row || ";" || column || "f" end # # PROCEDURE RETURNS AN ANSI BLINKING STRING # procedure blink(str) return "\e[5m" || str || "\e[m" end # # PROCEDURE RETURNS AN ANSI STRING TO CLEAR THE TERM WINDOW # procedure cls() return "\e[2J\e[H" end From icon-group-sender Sun Sep 13 01:32:00 1992 Received: by cheltenham.cs.arizona.edu; Sun, 13 Sep 1992 17:14:33 MST Date: 13 Sep 92 01:32:00 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: profiler, part3 Message-Id: <1992Sep13.013200.26598@midway.uchicago.edu> References: <1992Sep13.012856.26377@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is profile.03 (part 3 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file iolib.icn continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 3; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping iolib.icn' else echo 'x - continuing file iolib.icn' sed 's/^X//' << 'SHAR_EOF' >> 'iolib.icn' && X } X else isFILE := 1 X } X } X X # The logic here probably isn't clear. The idea is to try to use X # the termcap environment variable successively as 1) a termcap en- X # try and then 2) as a termcap file. If neither works, 3) go to X # the /etc/termcap file. The else clause here does 2 and, if ne- X # cessary, 3. The "\termcap_string ? (not match..." expression X # handles 1. X X if \isFILE # if find(slash, \termcap_string) X then f := open(\termcap_string) X /f := open(!termcap_names) | X er("getentry","I can't access your termcap file. Read iolib.icn.",1) X X getline := create read_file(f) X X while line := @getline do { X if line ? (pos(1) | tab(find("|")+1), =name, any(':|')) then { X entry := "" X while (\line | @getline) ? { X if entry ||:= 1(tab(find(":")+1), pos(0)) X then { X close(f) X # if entry ends in tc= then add in the named tc entry X entry ?:= tab(find("tc=")) || X # recursively fetch the new termcap entry X (move(3), getentry(tab(find(":"))) ? X # remove the name field from the new entry X (tab(find(":")+1), tab(0))) X return entry X } X else { X \line := &null # must precede the next line X entry ||:= trim(trim(tab(0),'\\'),':') X } X } X } X } X X close(f) X er("getentry","can't find and/or process your termcap entry",3) X Xend X X X Xprocedure read_file(f) X X # Suspends all non #-initial lines in the file f. X # Removes leading tabs and spaces from lines before suspending X # them. X X local line X X \f | er("read_tcap_file","no valid termcap file found",3) X while line := read(f) do { X match("#",line) & next X line ?:= (tab(many('\t ')) | &null, tab(0)) X suspend line X } X X fail X Xend X X X Xprocedure maketc_table(entry) X X # Maketc_table(s) (where s is a valid termcap entry for some X # terminal-type): Returns a table in which the keys are termcap X # capability designators, and the values are the entries in X # "entry" for those designators. X X local k, v, str, decoded_value X X /entry & er("maketc_table","no entry given",8) X if entry[-1] ~== ":" then entry ||:= ":" X X /tc_table := table() X X entry ? { X X tab(find(":")+1) # tab past initial (name) field X X while tab((find(":")+1) \ 1) ? { X &subject == "" & next X if k := 1(move(2), ="=") then { X # Get rid of null padding information. Iolib can't X # handle it (unlike itlib.icn). Leave star in. It X # indicates a real dinosaur terminal, and will later X # prompt an abort. X str := ="*" | ""; tab(many(&digits)) X decoded_value := Decode(str || tab(find(":"))) X } X else if k := 1(move(2), ="#") X then decoded_value := integer(tab(find(":"))) X else if k := 1(tab(find(":")), pos(-1)) X then decoded_value := true() X else er("maketc_table", "your termcap file has a bad entry",3) X /tc_table[k] := decoded_value X &null X } X } X X return tc_table X Xend X X X Xprocedure getval(id) X X /tc_table := maketc_table(getentry(getname())) | X er("getval","can't make a table for your terminal",4) X X return \tc_table[id] | fail X # er("getval","the current terminal doesn't support "||id,7) X Xend X X X Xprocedure Decode(s) X X # Does things like turn ^ plus a letter into a genuine control X # character. X X local new_s, chr, chr2 X X new_s := "" X X s ? { X X while new_s ||:= tab(upto('\\^')) do { X chr := move(1) X if chr == "\\" then { X new_s ||:= { X case chr2 := move(1) of { X "\\" : "\\" X "^" : "^" X "E" : "\e" X "b" : "\b" X "f" : "\f" X "n" : "\n" X "r" : "\r" X "t" : "\t" X default : { X if any(&digits,chr2) then { X char(integer("8r"||chr2||move(2 to 0 by -1))) | X er("Decode","bad termcap entry",3) X } X else chr2 X } X } X } X } X else new_s ||:= char(ord(map(move(1),&lcase,&ucase)) - 64) X } X new_s ||:= tab(0) X } X X return new_s X Xend X X X Xprocedure igoto(cm,col,line) X X local colline, range, increment, padding, str, outstr, chr, x, y X X if \col > (tc_table["co"]) | \line > (tc_table["li"]) then { X colline := string(\col) || "," || string(\line) | string(\col|line) X range := "(" || tc_table["co"]-1 || "," || tc_table["li"]-1 || ")" X er("igoto",colline || " out of range " || (\range|""),9) X } X X # Use the Iconish 1;1 upper left corner & not the C-ish 0 offsets X increment := -1 X outstr := "" X X cm ? { X while outstr ||:= tab(find("%")) do { X tab(match("%")) X if padding := integer(tab(any('23'))) X then chr := (="d" | "d") X else chr := move(1) X if case \chr of { X "." : outstr ||:= char(line + increment) X "+" : outstr ||:= char(line + ord(move(1)) + increment) X "d" : { X str := string(line + increment) X outstr ||:= right(str, \padding, "0") | str X } X } X then line :=: col X else { X case chr of { X "n" : line := ixor(line,96) & col := ixor(col,96) X "i" : increment := 0 X "r" : line :=: col X "%" : outstr ||:= "%" X "B" : line := ior(ishift(line / 10, 4), line % 10) X ">" : { X x := move(1); y := move(1) X line > ord(x) & line +:= ord(y) X &null X } X } | er("goto","bad termcap entry",5) X } X } X return outstr || tab(0) X } X Xend X X X Xprocedure iputs(cp, affcnt) X X # Writes cp to the screen. Use this instead of writes() for X # compatibility with itlib (a UNIX-only version which can handle X # albeit inelegantly) terminals that need padding. X X static num_chars X initial num_chars := &digits ++ '.' X X type(cp) == "string" | X er("iputs","you can't iputs() a non-string value!",10) X X cp ? { X if tab(many(num_chars)) & ="*" then X stop("iputs: iolib can't use terminals that require padding.") X writes(tab(0)) X } X X return X Xend SHAR_EOF echo 'File iolib.icn is complete' && true || echo 'restore of iolib.icn failed' rm -f _shar_wnt_.tmp fi # ============= iscreen.icn ============== if test -f 'iscreen.icn' -a X"$1" != X"-c"; then echo 'x - skipping iscreen.icn (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting iscreen.icn (Text)' sed 's/^X//' << 'SHAR_EOF' > 'iscreen.icn' && X############################################################################ X# X# Name: iscreen.icn X# X# Title: Icon screen functions X# X# Author: Richard L. Goerwitz X# X# Version: 1.28 X# X############################################################################ X# X# This and future version of iscreen are placed in the public domain - RLG X# X############################################################################ X# X# This file contains some rudimentary screen functions for use with X# itlib.icn (termlib-like routines for Icon). X# X# clear() - clears the screen (tries several methods) X# emphasize() - initiates emphasized (usu. = reverse) mode X# boldface() - initiates bold mode X# blink() - initiates blinking mode X# normal() - resets to normal mode X# message(s) - displays message s on 2nd-to-last line X# underline() - initiates underline mode X# status_line(s,s2,p) - draws status line s on the 3rd-to-last X# screen line; if s is too short for the terminal, s2 is used; X# if p is nonnull then it either centers, left-, or right-justi- X# fies, depending on the value, "c," "l," or "r." X# clear_emphasize() - horrible way of clearing the screen to all- X# emphasize mode; necessary for many terminals X# X############################################################################ X# X# Requires: UNIX X# X# Links: itlib.icn (or your OS-specific port of itlib) X# X# See also: boldface.icn X# X############################################################################ X X Xprocedure clear() X X # Clears the screen. Tries several methods. X local i X X normal() X if not iputs(getval("cl")) X then iputs(igoto(getval("cm"),1,1) | getval("ho")) X if not iputs(getval("cd")) X then { X every i := 1 to getval("li") do { X iputs(igoto(getval("cm"),1,i)) X iputs(getval("ce")) X } X iputs(igoto(getval("cm"),1,1)) X } X return X Xend X X X Xprocedure boldface() X X static bold_str, cookie_str X initial { X if bold_str := getval("md") X then cookie_str := repl(getval("le"|"bc") | "\b", getval("mg")) X else { X # One global procedure value substituted for another. X boldface := emphasize X return emphasize() X } X } X X normal() X iputs(\bold_str) X iputs(\cookie_str) X return X Xend X X X Xprocedure blink() X X static blink_str, cookie_str X initial { X if blink_str := getval("mb") X then cookie_str := X repl(getval("le"|"bc") | "\b", getval("mg")) X else { X # One global procedure value substituted for another. X blink := emphasize X return emphasize() X } X } X X normal() X iputs(\blink_str) X iputs(\cookie_str) X return X Xend X X X Xprocedure emphasize() X X static emph_str, cookie_str X initial { X if emph_str := getval("so") X then cookie_str := repl(getval("le"|"bc") | "\b", getval("sg")) X else { X if emph_str := getval("mr") X then cookie_str := repl(getval("le"|"bc") | "\b", getval("mg")) X else if emph_str := getval("us") X then cookie_str := repl(getval("le"|"bc") | "\b", getval("ug")) X } X } X X normal() X iputs(\emph_str) X iputs(\cookie_str) X return X Xend X X X Xprocedure underline() X X static underline_str, cookie_str X initial { X if underline_str := getval("us") X then cookie_str := repl(getval("le"|"bc") | "\b", getval("ug")) X } X X normal() X iputs(\underline_str) X iputs(\cookie_str) X return X Xend X X X Xprocedure normal(mode) X X static UN_emph_str, emph_cookie_str, X UN_underline_str, underline_cookie_str, X UN_bold_str, bold_cookie_str X X initial { X X # Find out code to turn off emphasize (reverse video) mode. X if UN_emph_str := getval("se") then X # Figure out how many backspaces we need to erase cookies. X emph_cookie_str := repl(getval("le"|"bc") | "\b", getval("sg")) X else UN_emph_str := "" X X # Finally, figure out how to turn off underline mode. X if UN_underline_str := (UN_emph_str ~== getval("ue")) then X underline_cookie_str := repl(getval("le"|"bc")|"\b", getval("ug")) X else UN_underline_str := "" X X # Figure out how to turn off boldface mode. X if UN_bold_str := X (UN_underline_str ~== (UN_emph_str ~== getval("me"))) then X # Figure out how many backspaces we need to erase cookies. X bold_cookie_str := repl(getval("le"|"bc") | "\b", getval("mg")) X else UN_bold_str := "" X X } X X iputs("" ~== UN_emph_str) & X iputs(\emph_cookie_str) X X iputs("" ~== UN_underline_str) & X iputs(\underline_cookie_str) X X iputs("" ~== UN_bold_str) & X iputs(\bold_cookie_str) X X return X Xend X X X Xprocedure status_line(s,s2,p) X X # Writes a status line on the terminal's third-to-last line X # The only necessary argument is s. S2 (optional) is used X # for extra narrow screens. In other words, by specifying X # s2 you give status_line an alternate, shorter status string X # to display, in case the terminal isn't wide enough to sup- X # port s. If p is nonnull, then the status line is either X # centered (if equal to "c"), left justified ("l"), or right X # justified ("r"). X X local width X X /s := ""; /s2 := ""; /p := "c" X width := getval("co") X if *s > width then { X (*s2 < width, s := s2) | X er("status_line","Your terminal is too narrow.",4) X } X X case p of { X "c" : s := center(s,width) X "l" : s := left(s,width) X "r" : s := right(s,width) X default: stop("status_line: Unknown option "||string(p),4) X } X X iputs(igoto(getval("cm"), 1, getval("li")-2)) X emphasize(); writes(s) X normal() X return X Xend X X X Xprocedure message(s) X X # Display prompt s on the second-to-last line of the screen. X # I hate to use the last line, due to all the problems with X # automatic scrolling. X X /s := "" X normal() X iputs(igoto(getval("cm"), 1, getval("li"))) X iputs(getval("ce")) X normal() X iputs(igoto(getval("cm"), 1, getval("li")-1)) X iputs(getval("ce")) X writes(s[1:getval("co")] | s) X return X Xend X X X Xprocedure clear_underline() X X # Horrible way of clearing the screen to all underline mode, but X # the only apparent way we can do it "portably" using the termcap X # capability database. X X local i X X underline() X iputs(igoto(getval("cm"),1,1)) X if getval("am") then { X underline() X every 1 to (getval("li")-1) * getval("co") do X writes(" ") X } X else { X every i := 1 to getval("li")-1 do { X iputs(igoto(getval("cm"), 1, i)) X underline() X writes(repl(" ",getval("co"))) X } X } X iputs(igoto(getval("cm"),1,1)) X Xend X X X Xprocedure clear_emphasize() X X # Horrible way of clearing the screen to all reverse-video, but X # the only apparent way we can do it "portably" using the termcap X # capability database. X X local i X X emphasize() X iputs(igoto(getval("cm"),1,1)) X if getval("am") then { X emphasize() X every 1 to (getval("li")-1) * getval("co") do X writes(" ") X } X else { X every i := 1 to getval("li")-1 do { X iputs(igoto(getval("cm"), 1, i)) X emphasize() X writes(repl(" ",getval("co"))) X } X } X iputs(igoto(getval("cm"),1,1)) X Xend SHAR_EOF true || echo 'restore of iscreen.icn failed' rm -f _shar_wnt_.tmp fi # ============= Makefile.dist ============== if test -f 'Makefile.dist' -a X"$1" != X"-c"; then echo 'x - skipping Makefile.dist (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting Makefile.dist (Text)' sed 's/^X//' << 'SHAR_EOF' > 'Makefile.dist' && X# Don't change this unless you're sure of what you're doing. XPROGNAME = profile X X# You may need to change this (new users, use icont). XICONC = /usr/icon/v8/bin/icont X# ICONC = /usr/icon/v8/bin/iconc X X# If your system has old-style terminals attached (ones that require X# padding), use itlib instead of iolib. Otherwise, delete itlib.icn. X# ITLIB = itlib XITLIB = iolib X X# Please edit these to reflect your local file structure & conventions. XDESTDIR = /usr/local/bin XOWNER = bin XGROUP = bin X XSHELL = /bin/sh XMAKE = /bin/make X X# Please don't change these. XSRC = $(PROGNAME).icn $(ITLIB).icn iscreen.icn X X# I hope you won't have to use this. X# DEBUGFLAG = -t X X$(PROGNAME): $(SRC) X $(ICONC) $(DEBUGFLAG) -o $(PROGNAME) $(SRC) X X# Pessimistic assumptions regarding the environment (in particular, X# I don't assume you have the BSD "install" shell script). Xinstall: $(PROGNAME) X test -d $(DESTDIR) || (mkdir $(DESTDIR) && chmod 755 $(DESTDIR)) X cp $(PROGNAME) $(DESTDIR)/ X chgrp $(GROUP) $(DESTDIR)/$(PROGNAME) X chown $(OWNER) $(DESTDIR)/$(PROGNAME) X @echo "Installation done." X @echo "" X Xclean: X -rm -f *~ *.u? X -rm -f $(PROGNAME) SHAR_EOF true || echo 'restore of Makefile.dist failed' rm -f _shar_wnt_.tmp fi rm -f _shar_seq_.tmp echo You have unpacked the last part exit 0 -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Sun Sep 13 01:30:05 1992 Received: by cheltenham.cs.arizona.edu; Sun, 13 Sep 1992 17:14:40 MST Date: 13 Sep 92 01:30:05 GMT From: agate!spool.mu.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: profiler, part2 Message-Id: <1992Sep13.013005.26494@midway.uchicago.edu> References: <1992Sep13.012856.26377@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu ---- Cut Here and feed the following to sh ---- #!/bin/sh # this is profile.02 (part 2 of a multipart archive) # do not concatenate these parts, unpack them in order with /bin/sh # file itlib.icn continued # if test ! -r _shar_seq_.tmp; then echo 'Please unpack part 1 first!' exit 1 fi (read Scheck if test "$Scheck" != 2; then echo Please unpack part "$Scheck" next! exit 1 else exit 0 fi ) < _shar_seq_.tmp || exit 1 if test ! -f _shar_wnt_.tmp; then echo 'x - still skipping itlib.icn' else echo 'x - continuing file itlib.icn' sed 's/^X//' << 'SHAR_EOF' >> 'itlib.icn' && X if line ? (pos(1) | tab(find("|")+1), =name, any(':|')) then { X entry := "" X while (\line | @getline) ? { X if entry ||:= 1(tab(find(":")+1), pos(0)) X then { X close(f) X # if entry ends in tc= then add in the named tc entry X entry ?:= tab(find("tc=")) || X # recursively fetch the new termcap entry X (move(3), getentry(tab(find(":"))) ? X # remove the name field from the new entry X (tab(find(":")+1), tab(0))) X return entry X } X else { X \line := &null # must precede the next line X entry ||:= trim(trim(tab(0),'\\'),':') X } X } X } X } X } X X close(f) X er("getentry","can't find and/or process your termcap entry",3) X Xend X X X Xprocedure read_file(f) X X # Suspends all non #-initial lines in the file f. X # Removes leading tabs and spaces from lines before suspending X # them. X X local line X X \f | er("read_tcap_file","no valid termcap file found",3) X while line := read(f) do { X match("#",line) & next X line ?:= (tab(many('\t ')) | &null, tab(0)) X suspend line X } X X fail X Xend X X X Xprocedure maketc_table(entry) X X # Maketc_table(s) (where s is a valid termcap entry for some X # terminal-type): Returns a table in which the keys are termcap X # capability designators, and the values are the entries in X # "entry" for those designators. X X local k, v, decoded_value X X /entry & er("maketc_table","no entry given",8) X if entry[-1] ~== ":" then entry ||:= ":" X X /tc_table := table() X X entry ? { X X tab(find(":")+1) # tab past initial (name) field X X while tab((find(":")+1) \ 1) ? { X &subject == "" & next X if k := 1(move(2), ="=") X then decoded_value := Decode(tab(find(":"))) X else if k := 1(move(2), ="#") X then decoded_value := integer(tab(find(":"))) X else if k := 1(tab(find(":")), pos(-1)) X then decoded_value := true() X else er("maketc_table", "your termcap file has a bad entry",3) X /tc_table[k] := decoded_value X &null X } X } X X return tc_table X Xend X X X Xprocedure getval(id) X X /tc_table := maketc_table(getentry(getname())) | X er("getval","can't make a table for your terminal",4) X X return \tc_table[id] | fail X # er("getval","the current terminal doesn't support "||id,7) X Xend X X X Xprocedure Decode(s) X X # Does things like turn ^ plus a letter into a genuine control X # character. X X new_s := "" X X s ? { X X while new_s ||:= tab(upto('\\^')) do { X chr := move(1) X if chr == "\\" then { X new_s ||:= { X case chr2 := move(1) of { X "\\" : "\\" X "^" : "^" X "E" : "\e" X "b" : "\b" X "f" : "\f" X "n" : "\n" X "r" : "\r" X "t" : "\t" X default : { X if any(&digits,chr2) then { X char(integer("8r"||chr2||move(2 to 0 by -1))) | X er("Decode","bad termcap entry",3) X } X else chr2 X } X } X } X } X else new_s ||:= char(ord(map(move(1),&lcase,&ucase)) - 64) X } X new_s ||:= tab(0) X } X X return new_s X Xend X X X Xprocedure igoto(cm,col,line) X X local colline, range, increment, padding, str, outstr, chr, x, y X X if \col > (tc_table["co"]) | \line > (tc_table["li"]) then { X colline := string(\col) || "," || string(\line) | string(\col|line) X range := "(" || tc_table["co"]-1 || "," || tc_table["li"]-1 || ")" X er("igoto",colline || " out of range " || (\range|""),9) X } X X # Use the Iconish 1;1 upper left corner & not the C-ish 0 offsets X increment := -1 X outstr := "" X X cm ? { X while outstr ||:= tab(find("%")) do { X tab(match("%")) X if padding := integer(tab(any('23'))) X then chr := (="d" | "d") X else chr := move(1) X if case \chr of { X "." : outstr ||:= char(line + increment) X "+" : outstr ||:= char(line + ord(move(1)) + increment) X "d" : { X str := string(line + increment) X outstr ||:= right(str, \padding, "0") | str X } X } X then line :=: col X else { X case chr of { X "n" : line := ixor(line,96) & col := ixor(col,96) X "i" : increment := 0 X "r" : line :=: col X "%" : outstr ||:= "%" X "B" : line := ior(ishift(line / 10, 4), line % 10) X ">" : { X x := move(1); y := move(1) X line > ord(x) & line +:= ord(y) X &null X } X } | er("goto","bad termcap entry",5) X } X } X return outstr || tab(0) X } X Xend X X X Xprocedure iputs(cp, affcnt) X X local baud_rates, char_rates, i, delay, PC, minimum_padding_speed X static num_chars, char_times X # global tty_speed X X initial { X num_chars := &digits ++ '.' X char_times := table() X # Baud rates in decimal, not octal (as in termio.h) X baud_rates := [0,7,8,9,10,11,12,13,14,15,16] X char_rates := [0,333,166,83,55,41,20,10,10,10,10] X every i := 1 to *baud_rates do { X char_times[baud_rates[i]] := char_rates[i] X } X } X X type(cp) == "string" | X er("iputs","you can't iputs() a non-string value!",10) X X cp ? { X delay := tab(many(num_chars)) X if ="*" then { X delay *:= \affcnt | X er("iputs","affected line count missing",6) X } X writes(tab(0)) X } X X if (\delay, tty_speed ~= 0) then { X minimum_padding_speed := getval("pb") X if /minimum_padding_speed | tty_speed >= minimum_padding_speed then { X PC := tc_table["pc"] | "\000" X char_time := char_times[tty_speed] | (return "speed error") X delay := (delay * char_time) + (char_time / 2) X every 1 to delay by 10 X do writes(PC) X } X } X X return X Xend X X X Xprocedure getspeed() X X local stty_g, stty_output, c_cflag, o_speed X X stty_g := open("/bin/stty -g 2>&1","pr") | X er("getspeed","Can't access your stty command.",4) X stty_output := !stty_g X close(stty_g) X X \stty_output ? { X # tab to the third field of the output of the stty -g cmd X tab(find(":")+1) & tab(find(":")+1) & X c_cflag := integer("16r"||tab(find(":"))) X } | er("getspeed","Unable to unwind your stty -g output.",4) X X o_speed := iand(15,c_cflag) X return o_speed X Xend SHAR_EOF echo 'File itlib.icn is complete' && true || echo 'restore of itlib.icn failed' rm -f _shar_wnt_.tmp fi # ============= iolib.icn ============== if test -f 'iolib.icn' -a X"$1" != X"-c"; then echo 'x - skipping iolib.icn (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting iolib.icn (Text)' sed 's/^X//' << 'SHAR_EOF' > 'iolib.icn' && X######################################################################## X# X# Name: iolib.icn X# X# Title: Icon termlib-type tools for MS-DOS and UNIX X# X# Author: Richard L. Goerwitz (with help from Norman Azadian) X# X# Version: 1.13 X# X######################################################################### X# X# The authors place this and future versions of iolib in the public X# domain. X# X######################################################################### X# X# The following library represents a series of rough functional X# equivalents to the standard Unix low-level termcap routines. It is X# not meant as an exact termlib clone. Nor is it enhanced to take X# care of magic cookie terminals, terminals that use \D in their X# termcap entries, or archaic terminals that require padding. This X# library is geared mainly for use with ANSI and VT-100 devices. X# Note that this file may, in most instances, be used in place of the X# older UNIX-only itlib.icn file. It essentially replaces the DOS- X# only itlibdos routines. For DOS users not familiar with the whole X# notion of generalized screen I/O, I've included extra documentation X# below. Please read it. X# X# The sole disadvantage of this over the old itlib routines is that X# iolib.icn cannot deal with archaic or arcane UNIX terminals and/or X# odd system file arrangements. Note that because these routines X# ignore padding, they can (unlike itlib.icn) be run on the NeXT and X# other systems which fail to implement the -g option of the stty X# command. Iolib.icn is also simpler and faster than itlib.icn. X# X# I want to thank Norman Azadian for suggesting the whole idea of X# combining itlib.icn and itlibdos.icn into one distribution, for X# suggesting things like letting drive specifications appear in DOS X# TERMCAP environment variables, and for finding several bugs (e.g. X# the lack of support for %2 and %3 in cm). Although he is loathe X# to accept this credit, I think he deserves it. X# X######################################################################### X# X# Contents: X# X# setname(term) X# Use only if you wish to initialize itermlib for a terminal X# other than what your current environment specifies. "Term" is the X# name of the termcap entry to use. Normally this initialization is X# done automatically, and need not concern the user. X# X# getval(id) X# Works something like tgetnum, tgetflag, and tgetstr. In the X# spirit of Icon, all three have been collapsed into one routine. X# Integer valued caps are returned as integers, strings as strings, X# and flags as records (if a flag is set, then type(flag) will return X# "true"). Absence of a given capability is signalled by procedure X# failure. X# X# igoto(cm,destcol,destline) - NB: default 1 offset (*not* zero)! X# Analogous to tgoto. "Cm" is the cursor movement command for X# the current terminal, as obtained via getval("cm"). Igoto() X# returns a string which, when output via iputs, will cause the X# cursor to move to column "destcol" and line "destline." Column and X# line are always calculated using a *one* offset. This is far more X# Iconish than the normal zero offset used by tgoto. If you want to X# go to the first square on your screen, then include in your program X# "iputs(igoto(getval("cm"),1,1))." X# X# iputs(cp,affcnt) X# Equivalent to tputs. "Cp" is a string obtained via getval(), X# or, in the case of "cm," via igoto(getval("cm"),x,y). Affcnt is a X# count of affected lines. It is completely irrelevant for most X# modern terminals, and is supplied here merely for the sake of X# backward compatibility with itlib, a UNIX-only version of these X# routines (one which handles padding on archaic terminals). X# X########################################################################## X# X# Notes for MS-DOS users: X# X# There are two basic reasons for using the I/O routines X# contained in this package. First, by using a set of generalized X# routines, your code will become much more readable. Secondly, by X# using a high level interface, you can avoid the cardinal X# programming error of hard coding things like screen length and X# escape codes into your programs. X# X# To use this collection of programs, you must do two things. X# First, you must add the line "device=ansi.sys" (or the name of some X# other driver, like zansi.sys, nansi.sys, or nnansi.sys [=new X# nansi.sys]) to your config.sys file. Secondly, you must add two X# lines to your autoexec.bat file: 1) "set TERM=ansi-mono" and 2) X# "set TERMCAP=\location\termcap." The purpose of setting the TERM X# variable is to tell this program what driver you are using. If you X# have a color system, you could use "ansi-color" instead of X# "ansi-mono," although for compatibility with a broader range of X# users, it would perhaps be better to stick with mono. The purpose X# of setting TERMCAP is to make it possible to determine where the X# termcap database file is located. The termcap file (which should X# have been packed with this library as termcap.dos) is a short X# database of all the escape sequences used by the various terminal X# drivers. Set TERMCAP so that it reflects the location of this file X# (which should be renamed as termcap, for the sake of consistency X# across UNIX and MS-DOS spectra). If desired, you can also try X# using termcap2.dos. Certain games work a lot better using this X# alternate file. To try it out, rename it to termcap, and set X# the environment variable TERMCAP to its location. X# X# Although the authors make no pretense of providing here a X# complete introduction to the format of the termcap database file, X# it will be useful, we believe, to explain a few basic facts about X# how to use this program in conjunction with it. If, say, you want X# to clear the screen, add the line, X# X# iputs(getval("cl")) X# X# to your program. The function iputs() outputs screen control X# sequences. Getval retrieves a specific sequence from the termcap X# file. The string "cl" is the symbol used in the termcap file to X# mark the code used to clear the screen. By executing the X# expression "iputs(getval("cl"))," you are 1) looking up the "cl" X# (clear) code in the termcap database entry for your terminal, and X# the 2) outputting that sequence to the screen. X# X# Some other useful termcap symbols are "ce" (clear to end of X# line), "ho" (go to the top left square on the screen), "so" (begin X# standout mode), and "se" (end standout mode). To output a X# boldfaced string, str, to the screen, you would write - X# X# iputs(getval("so")) X# writes(str) X# iputs(getval("se")) X# X# You can also write "writes(getval("so") || str || getval("se")), X# but this would make reimplementation for UNIX terminals that X# require padding rather difficult. X# X# It is also heartily to be recommended that MS-DOS programmers X# try not to assume that everyone will be using a 25-line screen. X# Most terminals are 24-line. Some 43. Some have variable window X# sizes. If you want to put a status line on, say, the 2nd-to-last X# line of the screen, then determine what that line is by executing X# "getval("li")." The termcap database holds not only string-valued X# sequences, but numeric ones as well. The value of "li" tells you X# how many lines the terminal has (compare "co," which will tell you X# how many columns). To go to the beginning of the second-to-last X# line on the screen, type in: X# X# iputs(igoto(getval("cm"), 1, getval("li")-1)) X# X# The "cm" capability is a special capability, and needs to be output X# via igoto(cm,x,y), where cm is the sequence telling your computer X# to move the cursor to a specified spot, x is the column, and y is X# the row. The expression "getval("li")-1" will return the number of X# the second-to-last line on your screen. X# X########################################################################## X# X# Requires: UNIX or MS-DOS, co-expressions X# X# See also: itlib.icn, iscreen.icn X# X########################################################################## X X Xglobal tc_table, isDOS Xrecord true() X X Xprocedure check_features() X X initial { X X if find("UNIX",&features) then X isDOS := &null X else if find("MS-DOS", &features) then X isDOS := 1 X else stop("check_features: OS not (yet?) supported.") X X find("expressi",&features) | X er("check_features","co-expressions not implemented - &$#!",1) X } X X return X Xend X X X Xprocedure setname(name) X X # Sets current terminal type to "name" and builds a new termcap X # capability database (residing in tc_table). Fails if unable to X # find a termcap entry for terminal type "name." If you want it X # to terminate with an error message under these circumstances, X # comment out "| fail" below, and uncomment the er() line. X X #tc_table is global X X check_features() X X tc_table := table() X tc_table := maketc_table(getentry(name)) | fail X # er("setname","no termcap entry found for "||name,3) X return "successfully reset for terminal " || name X Xend X X X Xprocedure getname() X X # Getname() first checks to be sure we're running under DOS or X # UNIX, and, if so, tries to figure out what the current terminal X # type is, checking successively the value of the environment X # variable TERM, and then (under UNIX) the output of "tset -". X # Terminates with an error message if the terminal type cannot be X # ascertained. DOS defaults to "mono." X X local term, tset_output X X check_features() X X if \isDOS then { X term := getenv("TERM") | "mono" X } X else { X if not (term := getenv("TERM")) then { X tset_output := open("/bin/tset -","pr") | X er("getname","can't find tset command",1) X term := !tset_output X close(tset_output) X } X } X X return \term | X er("getname","can't seem to determine your terminal type",1) X Xend X X X Xprocedure er(func,msg,errnum) X X # short error processing utility X write(&errout,func,": ",msg) X exit(errnum) X Xend X X X Xprocedure getentry(name, termcap_string) X X # "Name" designates the current terminal type. Getentry() scans X # the current environment for the variable TERMCAP. If the X # TERMCAP string represents a termcap entry for a terminal of type X # "name," then getentry() returns the TERMCAP string. Otherwise, X # getentry() will check to see if TERMCAP is a file name. If so, X # getentry() will scan that file for an entry corresponding to X # "name." If the TERMCAP string does not designate a filename, X # getentry() will scan the termcap file for the correct entry. X # Whatever the input file, if an entry for terminal "name" is X # found, getentry() returns that entry. Otherwise, getentry() X # fails. X X local isFILE, f, getline, line, nm, ent1, ent2, entry X static slash, termcap_names X initial { X if \isDOS then { X slash := "\\" X termcap_names := ["termcap","termcap.dos","termcap2.dos"] X } X else { X slash := "/" X termcap_names := ["/etc/termcap"] X } X } X X X # You can force getentry() to use a specific termcap file by cal- X # ling it with a second argument - the name of the termcap file X # to use instead of the regular one, or the one specified in the X # termcap environment variable. X /termcap_string := getenv("TERMCAP") X X if \isDOS then { X if \termcap_string then { X if termcap_string ? ( X not ((tab(any(&letters)), match(":")) | match(slash)), X pos(1) | tab(find("|")+1), =name) X then { X # if entry ends in tc= then add in the named tc entry X termcap_string ?:= tab(find("tc=")) || X # Recursively fetch the new termcap entry w/ name trimmed. X # Note that on the next time through name won't match the X # termcap environment variable, so getentry() will look for X # a termcap file. X (move(3), getentry(tab(find(":"))) ? X (tab(find(":")+1), tab(0))) X return termcap_string X } X else isFILE := 1 X } X } X else { X if \termcap_string then { X if termcap_string ? ( X not match(slash), pos(1) | tab(find("|")+1), =name) X then { X # if entry ends in tc= then add in the named tc entry X termcap_string ?:= tab(find("tc=")) || X # Recursively fetch the new termcap entry w/ name trimmed. X (move(3), getentry(tab(find(":")), "/etc/termcap") ? X (tab(find(":")+1), tab(0))) X return termcap_string SHAR_EOF true || echo 'restore of iolib.icn failed' fi echo 'End of part 2' echo 'File iolib.icn is continued in part 3' echo 3 > _shar_seq_.tmp exit 0 -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer From icon-group-sender Sun Sep 13 01:28:56 1992 Received: by cheltenham.cs.arizona.edu; Sun, 13 Sep 1992 17:14:46 MST Date: 13 Sep 92 01:28:56 GMT From: cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU (Richard L. Goerwitz) Organization: University of Chicago Computing Organizations Subject: simple profiler Message-Id: <1992Sep13.012856.26377@midway.uchicago.edu> Sender: icon-group-request@cs.arizona.edu To: icon-group@cs.arizona.edu Status: R Errors-To: icon-group-errors@cs.arizona.edu Appended to this posting is part 1 of a three-part shell archive containing a simple Icon profiler for UNIX. I needed it to determine why a program I wrote was running so slowly. It's not extensively tested, but I thought I'd post it, since I'd guess it would be the sort of thing a lot of people would want. -Richard ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove # everything above the "!/bin/sh" line above, and type "sh file_name". # # made 09/13/1992 01:04 UTC by goer@midway.uchicago.edu # Source directory /u/richard/Profile # # existing files will NOT be overwritten unless -c is specified # This format requires very little intelligence at unshar time. # "if test", "cat", "rm", "echo", "true", and "sed" may be needed. # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # This shar contains: # length mode name # ------ ---------- ------------------------------------------ # 9756 -r--r--r-- profile.icn # 13556 -r--r--r-- itlib.icn # 18055 -r--r--r-- iolib.icn # 7164 -r--r--r-- iscreen.icn # 1126 -rw-r--r-- Makefile.dist # if test -r _shar_seq_.tmp; then echo 'Must unpack archives in sequence!' echo Please unpack part `cat _shar_seq_.tmp` next exit 1 fi # ============= profile.icn ============== if test -f 'profile.icn' -a X"$1" != X"-c"; then echo 'x - skipping profile.icn (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting profile.icn (Text)' sed 's/^X//' << 'SHAR_EOF' > 'profile.icn' && X############################################################################ X# X# Name: profile.icn X# X# Title: simple Icon profiler for UNIX X# X# Author: Richard L. Goerwitz X# X# Version: 1.3 X# X############################################################################ X# X# This very simple profiler takes a single argument - an Icon program X# compiled with the -t option. Displays stats on which procedures X# were called the most often, and from what lines in what files they X# were called. Use this program to figure out what procedures are X# getting worked the hardest and why. Counts only invocations and X# resumptions; not suspensions, returns, failures. X# X# If you are running a program that reads from a file, be sure to X# protect the redirection symbol from the shell (i.e. "profile X# 'myprog < input'" instead of "profile myprog < input"). If a given X# program normally reads &input, please redirect stdin to read from X# another tty than the one you are running profile from. If you X# forget to do this, the results might be very interesting.... Also, X# don't redirect stderr, as this contains the trace that profile will X# be reading and using to obtain run-time statistics. Profile X# automatically redirects stdout to /dev/null. X# X# Currently runs only under UNIX, but with some tweaking could be X# made to run elsewhere as well. X# X# The display should be pretty much self-explanatory. Filenames and X# procedures get truncated at nineteen characters (if the display X# gets too wide, it can become hard to read). A star is prepended to X# procedures whose statistics have changed since the last screen X# update. X# X############################################################################ X# X# Requires: coexpressions, keyboard functions, pipes, UNIX X# X# Links: iolib or itlib, iscreen X# X############################################################################ X X# link iscreen Xglobal CM, LI, CO, CE X Xprocedure main(a) X X local whitespace, firstidchars, idchars, usage, in_data, X cmd, line, filename, linenum, procname, t, threshhold X X whitespace := '\t ' X firstidchars := &letters ++ '_' X idchars := &digits ++ &letters ++ '_' X usage := "usage: profile filename _ X (filename = Icon program compiled with -t option)" X X # X # If called with a program name as the first argument, open it, X # and pipe the trace output back to this program. Assume the X # user knew enough to compile it with the "-t" option. X # X if *a > 0 then { X if find("UNIX", &features) then { X cmd := ""; every cmd ||:= !a || " " X if find("2>"|"2>&1", cmd) then X stop("profile: Please don't redirect stderr!") X in_data := open(cmd || " 2>&1 1> /dev/null", "pr") | X stop("profile: Can't find or execute ", cmd, ".") X } else stop("profile: Your OS is not (yet) supported.") X } X else stop(usage) X X # clear screen, set up global variables; initialize table X setup_screen() X t := table() X X threshhold := 0 X while line := read(in_data) do { X threshhold +:= 1 X # X # Break each line down into a file name, line number, and X # procedure name. X # X line ? { X tab(many(whitespace)) X match(":") & next X { X filename := trim(tab(find(":"))) & X tab(many(whitespace ++ ':')) & X linenum := tab(many(&digits)) & X tab(many(whitespace ++ '|')) & X procname := tab(any(firstidchars)) || tab(many(idchars)) X } | next X tab(many(whitespace)) X # Count only invocations and resumptions. X match("suspended"|"failed"|"returned") & next X } X X # X # Enter statistics into table. X # X /t[procname] := table() X /t[procname][filename] := table(0) X t[procname][filename][linenum] +:= 1 X X # X # Display stats interactively. X # X if threshhold > 50 then { X threshhold := 0 X display_stats(t) X } X } X X display_stats(t) X # Write a nice exit message. X goodbye() X Xend X X X# X# display_stats: display the information in t interactively X# Xprocedure display_stats(t) X X local l, input, c X static top, len, firstline X # sets global variables CM, LI, CO, and CE X initial { X top := 1 X # The first line we can write data to on the screen. X firstline := 3 X len := LI - 4 - firstline X } X X # X # Structure the information in t into a list. Note that to obtain X # the number of procedures, one must divide l in half. X # X l := sort_table(t) X X # X # Check for user input. X # X while kbhit() do { X iputs(igoto(CM, 1, LI-1)) X writes("Press j/k/^/$/p/q: ") X iputs(CE) X writes(input := map(getch())) X case input of { X # Increase or decrease top by 4; don't go beyond 0 or X # *l; no even numbers for top (the 4 also must be even). X "j" : top := (*l > (top+2) | *l-1) X "\r" : top := (*l > (top+2) | *l-1) X "\n" : top := (*l > (top+2) | *l-1) X "k" : top := (0 < (top-2) | 1) X "\x02" : top := (0 < (top-4) | 1) X "\x15": top := (0 < (top-4) | 1) X " " : top := (*l > (top+4) | *l-1) X "\x06" : top := (*l > (top+4) | *l-1) X "\x04" : top := (*l > (top+4) | *l-1) X "^" : top := 1 X "$" : top := *l-1 X "p" : { X iputs(igoto(CM, 1, LI-1)) X writes("Press any key to continue: "); iputs(CE) X until kbhit() & getch() do delay(500) X } X "q" : goodbye() X "\x0C" : setup_screen() X "\x012": setup_screen() X default: { X if any(&digits, input) then { X while c := getche() do { X if c == ("\n"|"\r") then { X if not (input <:= 1) then X input +:= input % 2 - 1 X top := (0 < input | 1) X top := (*l > input | *l-1) X break X } else { X if any(&digits, c) X then input ||:= c & next X else break X } X } X } X } X } X iputs(igoto(CM, 1, LI-1)) X writes("Press j/k/^/$/p/q: ") X iputs(CE) X } X X # X # Display the information contained in table t via list l2. X # X write_list(l, top, len, firstline) X return X Xend X X X# X# sort_table: structure the info in t into a list X# X# What a mess. T is a table, keys = procedure names, values = X# another table. These other tables are tables where keys = file X# names and values = yet another table. These yet other tables X# are structured as follows: keys = line numbers, values = number X# of invocations. The idea is to collapse all of these tables X# into sorted lists, and at the same time count up the total X# number of invocations for a given procedure name (going through X# all its invocations at every line in every file). A new table X# is then created where keys = procedure names and values = total X# number of invocations. Yet another sort is done on the basis of X# total number of invocations. X# Xprocedure sort_table(t) X X local t2, total_t, k, total, i, l, l2 X static old_totals X initial old_totals := table() X X t2 := copy(t) X total_t := table() X every k := key(t2) do { X t2[k] := sort(t2[k], 3) X total := 0 X every i := 2 to *t2[k] by 2 do { X every total +:= !t2[k][i] X t2[k][i] := sort(t2[k][i], 3) X } X insert(total_t, k, total) X } X l2 := list(); l := sort(total_t, 4) X every i := 1 to *l-1 by 2 do { X push(l2, t2[l[i]]) X if not (total_t[l[i]] <= \old_totals[l[i]]) then X l[i] := "*" || l[i] X push(l2, l[i]) X } X X old_totals := total_t X return l2 X Xend X X X# X# write_list: write statistics in the upper part of the screen X# Xprocedure write_list(l, top, len, firstline) X X local i, j, k, z, w X static last_i X #global CM, CE X initial last_i := 2 X X # Arg1, l, is a sorted table of sorted tables of sorted tables! X # Firstline is the first line on the screen we can write data to. X # X i := firstline X iputs(igoto(CM, 1, i)); iputs(CE) X every j := top to *l by 2 do { X writes(left(l[j], 19, " ")) X every k := 1 to *l[j+1]-1 by 2 do { X iputs(igoto(CM, 20, i)) X writes(left(l[j+1][k], 19, " ")) X every z := 1 to *l[j+1][k+1]-1 by 2 do { X iputs(igoto(CM, 40, i)) X writes(left(l[j+1][k+1][z], 7, " ")) X iputs(igoto(CM, 48, i)) X writes(l[j+1][k+1][z+1]) X if (i +:= 1) > (firstline + len) then X break break break X else iputs(igoto(CM, 1, i)) & iputs(CE) X } X } X } X X # Clear the remaining lines down to the status line. X # X every w := i to last_i do { X iputs(igoto(CM, 1, w)) X iputs(CE) X } X last_i := i X X return X Xend X X X# X# setup_screen: clear screen, set up status line. X# Xprocedure setup_screen() X X # global CM, LI, CO, CE X initial { X CM := getval("cm") | X stop("setup_screen: No cm capability!") X LI := getval("li") X CO := getval("co") X CE := getval("ce") X # UNIX-specific command to disable character echo. X system("stty -echo") X } X X clear() X iputs(igoto(CM, 1, 1)) X emphasize() X writes(left(left("procedure name", 19, " ") || X left("source file", 20, " ") || X left("line", 8, " ") || X "number of invocations/resumptions", X CO, " ")) X normal() X status_line("- \"Profile,\" by Richard Goerwitz -") X iputs(igoto(CM, 1, LI-1)) X writes("J or CR=down; k=up; ^=begin; $=end; p=pause; q=quit: ") X iputs(CE) X X return X Xend X X# X# goodbye: exit, say something nice X# Xprocedure goodbye() X X # UNIX-specific command. X system("stty echo") X X status_line("- \"Profile,\" by Richard Goerwitz -") X every boldface() | emphasize() | normal() | X boldface() | emphasize() | normal() X do { X delay(50) X iputs(igoto(CM, 1, LI-1)) X writes("Hope you enjoyed using profile! ") X normal(); iputs(CE) X } X exit() X Xend X X X# X# stop_profile: graceful exit after error X# Xprocedure stop_profile(s) X X # UNIX-specific command. X system("stty echo") X X status_line("- \"Profile,\" by Richard Goerwitz -") X iputs(igoto(CM, 1, LI-1)) X writes(s); iputs(CE) X iputs(igoto(CM, 1, LI)) X stop() X Xend SHAR_EOF true || echo 'restore of profile.icn failed' rm -f _shar_wnt_.tmp fi # ============= itlib.icn ============== if test -f 'itlib.icn' -a X"$1" != X"-c"; then echo 'x - skipping itlib.icn (File already exists)' rm -f _shar_wnt_.tmp else > _shar_wnt_.tmp echo 'x - extracting itlib.icn (Text)' sed 's/^X//' << 'SHAR_EOF' > 'itlib.icn' && X######################################################################## X# X# Name: itlib.icn X# X# Title: Icon termlib-type tools X# X# Author: Richard L. Goerwitz X# X# Version: 1.33 X# X######################################################################### X# X# I place this and future versions of itlib in the public domain - RLG X# X######################################################################### X# X# The following library represents a series of rough functional X# equivalents to the standard Unix low-level termcap routines. They X# are not meant as exact termlib clones. Nor are they enhanced to X# take care of magic cookie terminals, terminals that use \D in their X# termcap entries, or, in short, anything I felt would not affect my X# normal, day-to-day work with ANSI and vt100 terminals. There are X# some machines with incomplete or skewed implementations of stty for X# which itlib will not work. See the BUGS section below for work- X# arounds. X# X# Requires: A unix platform & co-expressions. There is an MS-DOS X# version, itlibdos.icn. X# X# setname(term) X# Use only if you wish to initialize itermlib for a terminal X# other than what your current environment specifies. "Term" is the X# name of the termcap entry to use. Normally this initialization is X# done automatically, and need not concern the user. X# X# getval(id) X# Works something like tgetnum, tgetflag, and tgetstr. In the X# spirit of Icon, all three have been collapsed into one routine. X# Integer valued caps are returned as integers, strings as strings, X# and flags as records (if a flag is set, then type(flag) will return X# "true"). Absence of a given capability is signalled by procedure X# failure. X# X# igoto(cm,destcol,destline) - NB: default 1 offset (*not* zero)! X# Analogous to tgoto. "Cm" is the cursor movement command for X# the current terminal, as obtained via getval("cm"). Igoto() X# returns a string which, when output via iputs, will cause the X# cursor to move to column "destcol" and line "destline." Column and X# line are always calculated using a *one* offset. This is far more X# Iconish than the normal zero offset used by tgoto. If you want to X# go to the first square on your screen, then include in your program X# "iputs(igoto(getval("cm"),1,1))." X# X# iputs(cp,affcnt) X# Equivalent to tputs. "Cp" is a string obtained via getval(), X# or, in the case of "cm," via igoto(getval("cm"),x,y). Affcnt is a X# count of affected lines. It is only relevant for terminals which X# specify proportional (starred) delays in their termcap entries. X# X# BUGS: I have not tested these routines much on terminals that X# require padding. These routines WILL NOT WORK if your machine's X# stty command has no -g option (tisk, tisk). This includes 1.0 NeXT X# workstations, and some others that I haven't had time to pinpoint. X# If you are on a BSD box, try typing "sh -c 'stty -g | more'" it may X# be that your stty command is too clever (read stupid) to write its X# output to a pipe. The current workaround is to replace every in- X# stance of /bin/stty with /usr/5bin/stty (or whatever your system X# calls the System V stty command) in this file. If you have no SysV X# stty command online, try replaceing "stty -g 2>&1" below with, say, X# "stty -g 2>&1 1> /dev/tty." If you are using mainly modern ter- X# minals that don't need padding, consider using iolib.icn instead of X# itlib.icn. X# X########################################################################## X# X# Requires: UNIX, co-expressions X# X# See also: iscreen.icn (a set of companion utilities), iolib.icn X# X########################################################################## X X Xglobal tc_table, tty_speed Xrecord true() X X Xprocedure check_features() X X local in_params, line X # global tty_speed X X initial { X find("unix",map(&features)) | X er("check_features","unix system required",1) X find("o-expres",&features) | X er("check_features","co-expressions not implemented - &$#!",1) X system("/bin/stty tabs") | X er("check_features","can't set tabs option",1) X } X X # clumsy, clumsy, clumsy, and probably won't work on all systems X tty_speed := getspeed() X return "term characteristics reset; features check out" X Xend X X X Xprocedure setname(name) X X # Sets current terminal type to "name" and builds a new termcap X # capability database (residing in tc_table). Fails if unable to X # find a termcap entry for terminal type "name." If you want it X # to terminate with an error message under these circumstances, X # comment out "| fail" below, and uncomment the er() line. X X #tc_table is global X X check_features() X X tc_table := table() X tc_table := maketc_table(getentry(name)) | fail X # er("setname","no termcap entry found for "||name,3) X return "successfully reset for terminal " || name X Xend X X X Xprocedure getname() X X # Getname() first checks to be sure we're running under Unix, and, X # if so, tries to figure out what the current terminal type is, X # checking successively the value of the environment variable X # TERM, and then the output of "tset -". Terminates with an error X # message if the terminal type cannot be ascertained. X X local term, tset_output X X check_features() X X if not (term := getenv("TERM")) then { X tset_output := open("/bin/tset -","pr") | X er("getname","can't find tset command",1) X term := !tset_output X close(tset_output) X } X return \term | X er("getname","can't seem to determine your terminal type",1) X Xend X X X Xprocedure er(func,msg,errnum) X X # short error processing utility X write(&errout,func,": ",msg) X exit(errnum) X Xend X X X Xprocedure getentry(name, termcap_string) X X # "Name" designates the current terminal type. Getentry() scans X # the current environment for the variable TERMCAP. If the X # TERMCAP string represents a termcap entry for a terminal of type X # "name," then getentry() returns the TERMCAP string. Otherwise, X # getentry() will check to see if TERMCAP is a file name. If so, X # getentry() will scan that file for an entry corresponding to X # "name." If the TERMCAP string does not designate a filename, X # getentry() will scan /etc/termcap for the correct entry. X # Whatever the input file, if an entry for terminal "name" is X # found, getentry() returns that entry. Otherwise, getentry() X # fails. X X local f, getline, line, nm, ent1, ent2 X X # You can force getentry() to use a specific termcap file by cal- X # ling it with a second argument - the name of the termcap file X # to use instead of the regular one, or the one specified in the X # termcap environment variable. X /termcap_string := getenv("TERMCAP") X X if \termcap_string ? (not match("/"), pos(1) | tab(find("|")+1), =name) X then { X # if entry ends in tc= then add in the named tc entry X termcap_string ?:= tab(find("tc=")) || X # Recursively fetch the new termcap entry w/ name trimmed. X (move(3), getentry(tab(find(":")), "/etc/termcap") ? X (tab(find(":")+1), tab(0))) X return termcap_string X } X else { X X # The logic here probably isn't clear. The idea is to try to use X # the termcap environment variable successively as 1) a termcap en- X # try and then 2) as a termcap file. If neither works, 3) go to X # the /etc/termcap file. The else clause here does 2 and, if ne- X # cessary, 3. The "\termcap_string ? (not match..." expression X # handles 1. X X if find("/",\termcap_string) X then f := open(termcap_string) X /f := open("/etc/termcap") | X er("getentry","I can't access your /etc/termcap file",1) X X getline := create read_file(f) X X while line := @getline do { SHAR_EOF true || echo 'restore of itlib.icn failed' fi echo 'End of part 1' echo 'File itlib.icn is continued in part 2' echo 2 > _shar_seq_.tmp exit 0 -- -Richard L. Goerwitz goer%midway@uchicago.bitnet goer@midway.uchicago.edu rutgers!oddjob!ellis!goer