Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Easy solution in OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Siegfried Gonzi <siegfried.gonzi@s...>
Subject: Re: [Caml-list] Easy solution in OCaml?
brogoff@speakeasy.net wrote:

>
>
>Perhaps the question could go back to the Clean designers too. Why are they 
>worried about two measly keywords? My evil twin suggests that it's the 
>well known Dutch frugality at work. I suspect that since Clean is lazy 
>and was originally a lower level language, they just didn't include it. 
>
>I agree with Markus that if-then-else is nicer to read. Haskell get's this one 
>right over Clean. 
>

I know different strokes for different people but I do not see why 
if-then should be easier to read. An excertp from a Haskell manual:

==
When many choices have to made guards 
<http://www.cs.uu.nl/%7Eafie/haskell/tourofsyntax.html#Guards> can come 
in handy. Instead of:

	kindOfChar :: /Char -> String/
	kindOfChar c = 
	  if isLower c 
	  then "lower" 
	  else if isUpper c 
	       then "upper" 
	       else if isDigit c 
	            then "digit" 
	            else "other"

you can write:

	kindOfChar :: /Char -> String/
	kindOfChar c
	  | isLower c = "lower"
	  | isUpper c = "upper"
	  | isDigit c = "digit"
	  | otherwise = "other"
==

S. Gonzi



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