Created
November 11, 2010 22:13
-
-
Save leobessa/673304 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
True = lambda { |a,b| a } | |
False = lambda { |a,b| b } | |
display = lambda { |boolean| boolean['true','false']} | |
display[True] # => "true" | |
display[False] # => "false" | |
And = lambda{ |b1,b2| b1[b2,b1] } | |
Or = lambda{ |b1,b2| b1[b1,b2] } | |
Not = lambda{ |b| b[False,True] } | |
display[And[True ,True]] # => "true" | |
display[And[True ,False]] # => "false" | |
display[And[False,True]] # => "false" | |
display[And[False,False]] # => "false" | |
display[Or[True ,True]] # => "true" | |
display[Or[True ,False]] # => "true" | |
display[Or[False,True]] # => "true" | |
display[Or[False,False]] # => "false" | |
display[Not[True]] # => "false" | |
display[Not[False]] # => "true" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
boa!
olha que legal da mais pra fazer. em vez de
if cond
isso
else
aquilo
cond(isso, aquilo)
bacana nao? a la smalltalk.