[erlang-questions] Erlang 3000?

Richard O'Keefe ok@REDACTED
Wed Nov 19 04:33:54 CET 2008


On 17 Nov 2008, at 1:44 pm, Håkan Stenholm wrote:
> Conditionals that have more than 2 branches where none of them  
> branch on
> patterns - e.g. something like the to_upper code below:
>
> to_upper_char(C) when is_integer(C) ->
>  if
>     $a =< C, C =< $z       -> C - 32;
>     16#E0 =< C, C =< 16#F6 -> C - 32;
>     16#F8 =< C, C =< 16#FE -> C - 32;
>     true -> C
>  end.

If this is supposed to convert ISO Latin 1 characters
to upper case, it's wrong.  (In at least two different
ways, both of which are left as an exercise for the
reader.)  Code for such purposes simply shouldn't be
written by hand these days, but should be generated by
some sort of script from the (relevant portion of the)
Unicode data base.  As such, whether it's written using
'case', 'if', or embedded Intercal should be of no interest.

> case .... of
>  _ when ... -> ...
>  _ when ... -> ...
>  _ when ... -> ...
>  ...
> end

Did I write up a proposal for
	case ...
	  of ... when ... -> ...
	       ; when ... -> ...
	       ;             ...
	   ; ... when ... -> ...
	       ; when ... -> ...
	       ;             ...
	   ; .......
	end
or did I just stick it into my radically incomplete micro-Erlang?




More information about the erlang-questions mailing list