3 Oct 2007 05:22
assorted beginner questions
Mark Smithfield <m_smithfield <at> yahoo.com>
2007-10-03 03:22:01 GMT
2007-10-03 03:22:01 GMT
This is a mixed bag. These are the questions that I
would ask an
informed friend. They might be obvious, but they are
not obvious
to me (yet, I hope).
-----------------------------
As I read code in Squeak, I discover method names that
I do not
know. How do you find these methods if you don't know
the type of
the receiver? For example,
self subclassResponsibility.
-----------------------------
In the floor method from Number,
truncation _ self truncated.
What does the underscore mean?
-----------------------------
I want to apply smalltalk to fibonacci numbers. I add
this method
to Integer,
fib:
(self = 0) ifTrue: (^0)
(self = 1) ifTrue: (^1)
^ (self - 1 fib) + (self - 2 fib).
Next, I would like to memoize this method, (because of
(Continue reading)
Your solution is >20x faster, thanks!
RSS Feed