[erlang-questions] Re assigning variables

Zvi <>
Thu Mar 19 11:18:15 CET 2009




Tony Arcieri wrote:
> 
> On Tue, Mar 17, 2009 at 3:42 PM, Vance Shipley <> wrote:
> 
>>        try begin
>>                case requested_ad_size(Size) of
>>                        bad ->
>>                                throw(bad_size);
>>                        _ ->
>>                                ok
>>                end,
>>                case has_ads() of
>>                        true ->
>>                                throw(disabled);
>>                        false ->
>>                                ok
>>                end,
>>                case is_filtering() of
>>                        true ->
>>                                throw(domain_filtered);
>>                        false ->
>>                                ok
>>                end
>>        end of
>>                ok ->
>>                        yahoo
>>        catch
>>                Problem ->
>>                        Problem
>>        end
>>
> 
> Very cool.  Thanks for this suggestion.
> 
> -- 
> Tony Arcieri
> medioh.com
> 


Tony, you kidding right? :)
As I said before: "Hard thing are easy to implement in Erlang, but some
simple things are hard!".
Programmers are not compilers - compilers are compilers. Suggesting to code
manually such basic operator, like  if-then-else-elsif using exceptions,
higher-order-functions and macros is #$%^& (I have no words) . The LISP's
cond function was invented 50 years ago. The cond even reserved word in
Erlang. 

BTW: I think RoK's ?when macros will not work, b/c if only works with guards
(also aren't when reserved word too?)
 

-- 
View this message in context: http://www.nabble.com/Reassigning-variables-tp22564802p22597115.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list