Browse thread
How can I have a string matched my custom type?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Mehdi <mehdid@g...> |
| Subject: | Re: [Caml-list] How can I have a string matched my custom type? |
> > There a little problem when you try to compute > > > > > let e = parse "1*3-2";; > > > > > > I get : > > > > > val e : expr = Times (Value "1", Value "3") > > This is a Genlex limitation. "-2" is recognized as an integer > constant. Thus you need to add extra space: > > ====================================================================== > # parse "1*3 - 2";; > - : expr = Minus (Times (Value "1", Value "3"), Value "2") > ====================================================================== ok > I also didn't understand why there is this in "term" : > > > > > | _ -> f > > > | _ -> failwith "syntax error" > > Simply because I wrote this code in a rush :-) Forget about the last > line. I thought it was something obscur behind these two lines :) thanks for the quick answer -- Mehdi Dogguy مهدي الدڤي