caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Obsoluted?: stream matching
@ 2001-09-13  5:26 SooHyoung Oh
  2001-09-13  6:21 ` Remi VANICAT
  0 siblings, 1 reply; 2+ messages in thread
From: SooHyoung Oh @ 2001-09-13  5:26 UTC (permalink / raw)
  To: caml-list


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

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

---
SooHyoung Oh

-------------------
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Obsoluted?: stream matching
  2001-09-13  5:26 [Caml-list] Obsoluted?: stream matching SooHyoung Oh
@ 2001-09-13  6:21 ` Remi VANICAT
  0 siblings, 0 replies; 2+ messages in thread
From: Remi VANICAT @ 2001-09-13  6:21 UTC (permalink / raw)
  To: caml-list

"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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-09-13  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-13  5:26 [Caml-list] Obsoluted?: stream matching SooHyoung Oh
2001-09-13  6:21 ` Remi VANICAT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).