Greetings,

Playing around with Oz again [as well as finally reading through CTM - what
a mind blower !], and have a really quick query on regex use, specifically,
the correct use of 'Regex.replace'.

The documentation states that the 'Regex.replace' signature is as follows:

    {Regex.replace +TXT +RE +FUN ?RES}

'+TXT' and '+RE' are fairly obvious, but what is the signature of '+FUN'
supposed to be ? All my attempts [guesses, actually] have failed miserably,
and the most 'successful' of these failed attempts simply blocks [presumably
waiting for a dataflow variable to bind ?]. A code excerpt follows:

    Seq = {NewCell nil} Cre = {NewCell nil}
    ...
    Seq := "abcde\n12345\nABCDE\n"
    Cre := {Regex.make "\n"}
    ...
    Seq := {Regex.replace @Seq @Cre fun {$ X Y} X end}

I presume that X is bound to "\n" [don't know about Y - is *it* waiting to
bind ?], and at present it is simply being returned [I actually want to
remove it, so this would mean replacing it with "" (?), but this does not
work].

I'm probably making a pretty fundamantal error, but this is truly driving me
nuts. If anyone has an explanation, or perhaps a short *working* example,
I'd very much appreciate it.

Cheers,

Anthony Borla

P.S.

I know there are more efficient ways of performing string [list]
manipulations, but I specifically want to try out regex functionality in Oz.




_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to