Exercises for Essence of Dispatch
Damien Cassou, Stéphane Ducasse and Luc Fabresse
http://stephane.ducasse.free.fr
Three Questions
- Implement
not
- Implement
|
(or) and ifTrue:ifFalse:
- What is the goal of these exercises?
Exercise 1: Implement not
Propose an implementation of not
in a world where:
- You have:
true
, false
- You only have objects and messages
- How would you implement:
not
?
false not
-> true
true not
-> false
Exercise 2: Implement | (or)
Propose an implementation of or
in a world where:
- You have:
true
, false
- You only have objects and messages
- How would you implement:
not
?
true | true -> true
true | false -> true
true | anything -> true
false | true -> true
false | false -> false
false | anything -> anything
Exercise 3: Why These Exercises?
- You are never going to implement Booleans in your life
- So why do we think these exercises are so important?
/