Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] "in" question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yang Shouxun <yangsx@f...>
Subject: Re: [Caml-list] "in" question
On Friday 22 November 2002 07:35, mzukowski@yci.com wrote:
> I've been working through Jason Hickey's introduction to Objective Caml and
> don't quite get why the "in" is necessary in this construct:
>
> # let sum i = let sum2 j = i + j in sum2 ;;
> val sum : int -> int -> int = <fun>
>
> If I leave out the "in" I get a generic "Syntax error":
>
> # let sum i = let sum2 j = i + j ;;
> Characters 31-33:
>   let sum i = let sum2 j = i + j ;;

In OCaml "let" can be used in two ways:
1. toplevel declaration "let"
2. local declaration "let...in"

Since "let sum2" is not toplevel, it must be the local form "let...in". 

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners