[clean-list] Hidden_conventions?

Arjen van Weelden arjenw@zonnet.nl
Mon, 26 Jul 2004 16:55:23 +0200


It is (a): "The alternatives are tried in textual order."

See the Clean Language Report 2.0 section 3.1 
http://www.cs.kun.nl/~clean/CleanExtra/report20/chapter3/s31.html

The options mentioned in (b), (c), and (d) are not used by Clean.

regards,
	Arjen

clean-list.mail.zooloo@xoxy.net wrote:
> I am quite new to FP, so my question concerns a rather basic issue.
> 
> In the CleanBook, chapter 3.3, there is something I don't
> understand:
> 
> splitAt :: Int [a] -> ([a],[a])
> splitAt 0 xs = ([],xs)
> splitAt n [] = ([],[])
> splitAt n [x:xs] = ([x:ys],zs)
> where
>     (ys,zs) = splitAt (n-1) xs.
> 
> Now I am wondering why that works. As far as I can see, there are two
> contradicting definitions for the outcome of splitAt 0 [1..]:
> 
> 1. ([],[1..])
> 2. ([1..],[]) (similarly to the example given at the beginning of
> chapter 3.2.1.).
> 
> 
> Which is the reason for the latter possibility being discarded?
> I have some ideas about that, the most supposable ones of which are:
> 
> (a) perhaps because of the textual order
> (b) because perhaps special cases (here: argument 0) overrule
> overlapping general definitions (argument n)
> (c) because perhaps finite structures (in 1. the first list becomes [])
> take precedence over infinite ones (in 2. the first list becomes [1..])
> (d) because there may be a convention that valid definitions overrule
> competing invalid ones, and perhaps Clean can't compute the limit of
> the second list series.
> 
> Is any of those true? If yes, are all other assumptions wrong?
> 
> 
> Regards,
> zooloo
> 
> 
> _______________________________________________
> clean-list mailing list
> clean-list@cs.kun.nl
> http://www.cs.kun.nl/mailman/listinfo/clean-list
>