Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Obsoluted?: stream matching
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi VANICAT <vanicat@l...>
Subject: Re: [Caml-list] Obsoluted?: stream matching
"SooHyoung Oh" <shoh@duonix.com> writes:

> It seems that stream matching has been obsoluted, at least in Ocaml 3.02.
> Right?

No

> 
> # let next = function
>   [< 'x >] -> x
>   | [<>] -> raise (Failure "end of stream")
>   ;;

# let next = parser
  [< 'x >] -> x
  | [<>] -> raise (Failure "end of stream")
  ;;
val next : 'a Stream.t -> 'a = <fun>


> Syntax error
> 
> Instead of the stream pattern matchng,
> do they have to use "peek" & "junk"?
> 
> # let next s =
>   match Stream.peek s with
>   Some x -> Stream.junk s; x
>   | None -> raise (Failure "end of stream")
>   ;;
> 
> p.s.: Where can I find the LATEST document of Ocaml 3.02?
> It's VERY VERY DIFFICULT to follow it by trial and error.

http://pauillac.inria.fr/ocaml/htmlman/


-- 
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr