Hacker News new | ask | show | jobs
by saityi 2331 days ago
You are correct, and I will fix it. The goal here was to encourage recursion and assuage fears of recursion coming from other languages: if I remember correctly, Standard ML does define semantics around 'expansive expressions' which make them /safer/ than I think most imperative programmers (my targeted audience) would expect, but this particular example would throw an exception.

To fix it, I will rewrite this section to say that the standard requires optimising /tail-recursive/ calls away, and modify the example to be iteratively recursive, but I'd still like to assuage fears of recursion in the tour. The 'while' loop in SML is actually just a derived form, and is rewritten to recursion; there is no looping in the language. Do you have any suggestions for rewording?

This is a work in progress that I was looking for feedback on :) Thank you! If you see anything else fishy, please let me know.

1 comments

Thanks for your answer! I don't have any specific wording suggestions. If you're willing to add a specific section on tail recursion, I think you might leave this example in place (with the first paragraph of the current text) and then show a tail-recursive version in the next step (with a slightly modified version of the second paragraph of the current text).