----- Original Message -----
From: "Kevin Glynn" <[EMAIL PROTECTED]>
To: "Anthony Borla" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, December 03, 2005 7:13 AM
Subject: Oz Newbie: Pattern Matching and Type Conversion
Kevin,
>
> Anthony Borla writes:
>
> > >
> > > but have you tried the Regex module?
> > >
> >
> > Funny you should ask that. I'd *started* to look at this
> > module, but ran into problems [not related to the current
> > program] using things like 'Regex.replace' and 'Regex.forAll',
> > and unable to solve them, shelved the attempt for a later time
> > [besides, plenty of other Oz aspects to explore].
> >
> > I don't suppose you've got a couple of simple examples of
> > these routines laying around ;) ! There're definitely no examples
> > in either the documentation or mailing list archive [I just searched
> > using the link you gave below].
> >
>
> You are right, I haven't used it before either but maybe this is a
> start:
>
> declare
> [Regex] = {Module.link ['x-oz://contrib/regex']}
> DigitsRE = {Regex.make '[[:digit:]]+'}
> Str = " regex 58 99"
>
> {Browse {Map {Regex.allMatches DigitsRE Str}
> fun {$ match(0:S#E)}
> {Int.toFloat {String.toInt
> {ByteString.toString {ByteString.slice
{ByteString.make Str} S E}}}}
> end
> }}
>
Very much appreciated :) !
>
> You will have to get over your fear of multiple type
> translations though ;-)
>
I *do* miss implict type conversion behaviour [e.g. C 'type promotions'],
and have been bitten [numerous times] by simple code such as:
<float> / <int>
What can I say ? Some lax habits are very difficult to break, but I am
working on it :) !
Cheers,
Anthony Borla
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users