Message-ID: <3B348A1D.A2817BED@csi.com>
Date: Sat, 23 Jun 2001 08:22:53 -0400
From: John Colagioia <JColagioia@csi.com>
X-Mailer: Mozilla 4.61 [en] (Win98; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: rec.arts.int-fiction
Subject: Re: OT: String Manipulation Hell
References: <3B370795@MailAndNews.com> <ant151922566fNdQ@oakseed.demon.co.uk>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 128.238.10.127
X-Original-NNTP-Posting-Host: 128.238.10.127
X-Trace: excalibur.gbmtech.net 993298901 128.238.10.127 (23 Jun 2001 08:21:41 EST)
Organization: GBM Technologies Ltd
Lines: 39
X-Authenticated-User: jnc
X-Original-NNTP-Posting-Host: 127.0.0.1
Path: news.duke.edu!newsgate.duke.edu!nntp-out.monmouth.com!newspeer.monmouth.com!howland.erols.net!newsfeed.fast.net!uunet!dca.uu.net!ash.uu.net!excalibur.gbmtech.net
Xref: news.duke.edu rec.arts.int-fiction:89089

James Taylor wrote:
[...]

> Can you give examples of the kind of string operations Icon
> will do and how you invoke them please.
> I am a Perl man myself, and I find it hard to imagine any language
> that has string handling as more of a core strength than Perl does.
> I would therefore be very interested in some Icon examples.

Ah, the joys of keeping a foot in academia...From "The ICON Programming
Language," by Ralph and Madge Griswold, page 173:
    while exp ?:= {
        2(="(", tab(bal(')')), pos(-1))
        }
where "exp" is a string containing an arithmetic expression, if it
starts with an open-parenthesis, it removes the opening and closing
parentheses.  The bal() function is the one doing the work, looking for
the locations of "balance characters."  It finds the location pairs of
all potential matches of the second and third parameters (unlisted
above, which default to parentheses) before the occurrance of the first
parameter.  The pos() function makes sure that bal() was successful.

Converting arithmetic expressions to "prefix" (operator first, followed
by operands--like LISP), meanwhile, is done like:
    procedure lassoc (exp, op)
        local j
        return exp ? {
            every j := bal(op)
            form (tab(\j), move(1), tab(0))
            }
    end
Nope.  Even after reading the description, I can't figure out what the
heck they're talking about.

Hm.  I guess I'll have to read the book.  ICON looks like fun...

[...]


