Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2003-04-29 (07:57)
From: Siegfried Gonzi <siegfried.gonzi@s...>
Subject: Re: [Caml-list] Easy solution in OCaml? 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 
<> 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 Archives:
Bug reports: FAQ:
Beginner's list: