Version française
Home     About     Download     Resources     Contact us    
Browse thread
arrays and type variables...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: arrays and type variables...
Don Syme wrote:
> 
> Shouldn't "[| [] |]" count as a value??
> 
> # let x = [| [] |];;
> val x : '_a list array = [|[]|]
> # let x = [];;
> val x : 'a list = []
> # let x = [| |];;
> val x : 'a array = [||]

No, because you can assign to arrays:

# let x = [| [] |];;
val x : '_a list array = [|[]|]
# x.(0) <- [1];;
- : unit = ()
# x;;
- : int list array = [|[1]|]

You cannot assign anything to the empty array [| |], however.

Regards,

	- Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

:: be declarative. be functional. just be. ::