3 ms·
The article uses a simplified version of Scheme as a toy Lisp, for an exercise, which is an excellent choice, but a downside is that it could be misinterpreted
by neilv 7y ago
The article uses a simplified version of Scheme as a toy Lisp, for an exercise, which is an excellent choice, but a downside is that it could be misinterpreted as characterizing Scheme well.
First, there's what I think is an important distinction of idiomatic programming in Scheme, for which the first example in the article gives the wrong idea, with a noble lie: that Java code implies an immediate return, but the Scheme code does not.
Were that Scheme expression not in a tail position of a procedure (which it probably wouldn't be), it wouldn't have effect analogous to that of the Java code. And a one-armed `if` makes little sense in a tail position in modern Scheme, and looks erroneous.
Scheme is a full imperative algorithmic language, and doesn't have to be used in a pure-functional way, but idiomatic programming in Scheme tends to lean towards functional when practical. You almost never do premature returns quite like that in Scheme, for example. (One can do most any memory-safe thing one wants, including the less-idiomatic and even the outrageously insane, but hopefully over time one learns the idiomatic ways, rather than overuses/misuses less-idiomatic features, like leaning on a crutch they don't need and that's actually harmful to them.)
Separate from that, another thing possibly misleading about this article is that their Scheme implementation doesn't do what's sometimes called "proper implementation of tail calls" (which would be required to be a real Scheme). Idiomatic Scheme will tend to use tail calls heavily, with impunity, which would not be the case if a Scheme implementation let such calls exhaust resources.
- sansnomme 7y agoYou realize the person whose code you are criticizing wrote one of the classic books on Lisp right?
- nudq 7y agoYou realize that the OP's concerns actually intesify if the author in question is perceived as an authority on the topic, right?
- iamnotacrook 7y agoYou realise it's problematic to emphasise typos, right?
- nudq 7y agoYou realize it's problematic to emphasize typos, right? (Thanks, would edit if I could.)
- deleted 7y ago[deleted]
- neilv 7y agoI suspect he'd agree that this piece can be misinterpreted to give people the wrong idea about Scheme, despite the kind words he has for Scheme. Scheme already has undeserved image problems, from various CS101 drive-by exposures that students get to it, never properly learning it.
- deleted 7y ago[deleted]
- kerkeslager 7y agohttps://en.wikipedia.org/wiki/Argument_from_authority https://en.wikipedia.org/wiki/Argument_from_authority
- ragnese 7y agoThe other things that "beginner" tutorials such as this do is they say "lisp" when they really mean "something resembling Scheme". I started a project some time ago to write an elisp interpreter, mostly for fun. But since elisp is much more like Common Lisp than Scheme, it has a surprising amount more syntax than a Scheme does. The parser was much more complex than I initially thought it would be.