3 ms·
Racket can actually return multiple values rather than a product type, which is what Python does. However people don't usually use it because it's easier to jus
by anaphor 13y ago
Racket can actually return multiple values rather than a product type, which is what Python does. However people don't usually use it because it's easier to just return a pair or whatever and then pattern match on it.
http://docs.racket-lang.org/reference/eval-model.html#%28part._values-model%29 http://docs.racket-lang.org/reference/eval-model.html#%28par...
- derleth 13y agoCommon Lisp can do the same thing, and people typically prefer returning a product type because capturing multiple return values invariably introduces some extra syntax. Forth functions (or words, if you insist) can return multiple values as easily as they can return a single value, but the stack metaphor makes this a lot more natural. This is also true of Joy and RPL and other languages which are conceptually organized around mutating a (notional) stack. Multiple return values only become unnatural when you choose an abstraction other than the stack.
- anaphor 13y agoI have used RPL (I have an HP 50G) and yeah, you can do some fun stuff with the stack. Although I wish they would just port Factor to it already :P