Common Lisp Tutorial 10c: OOP Basic Methods

preview_player
Показать описание
In this third video in the series we look at methods, and how, unlike other languages, they are not connected to classes, and how they work. There's a lot more to methods in Common Lisp, so we look at the fundamentals in anticipation of exploring further in later lessons.
Рекомендации по теме
Комментарии
Автор

@~26:49 call-next-method doesn't need any args here.

From CLHS:

"When call-next-method is called with no arguments, it passes the current method's original arguments to the next method. [...]

When call-next-method is called with arguments, the next method is called with those arguments.

If call-next-method is called with arguments but omits optional arguments, the next method called defaults those arguments."

Btw, since the specialization for kilometer does nothing except call call-next-method, you are basically wrapping regular method resolution. So not compiling the method for kilometer will have the same effect since kilometer /is a/ meter. It can be very insightful to tinker with this stuff, thanks for the great content! :D

insanecbrotha
Автор

American here. 12 inches is a foot :) Which is handy for even subdivisions of measures in construction of physical things, because it has multiple factors (1, 2, 3, 4, 6, 12) where metric with base 10 can only be factored to (1, 5, 10).

Yard is 3 feet, or 36 inches, which is still handy in measures (again, lots of factors).

I've never seen fathoms (which is 2 yards) used for anything in the US, instead measures of yards are use (e.g. an American football field is 100 yards) until you get to fractions of mile (1 mile = 5280 feet), which is used for automobile-oriented distances like "1/4 mile to the next highway off-ramp".

5280 seems weird and arbitrary and while the number is mostly historical, it also has a lot of factors (48 in total) which is not insignificant, seeing as that the largest number of factors for any number from 1 to 10000 is 64

vinapocalypse
Автор

nice videos please continue, the audio is a bit low

guillermorojas
welcome to shbcf.ru