News for hackers. Stuff that matters.
[dead]
Re:How the right syntax can help teach recursion by sctb on Thursday September 15, 2016 @04:09PM (#12509414)
You cannot post like this here. Please comment civilly and substantively on Hacker News—we ban accounts that don't do this.

https://news.ycombinator.com/newsguidelines.html

Re:How the right syntax can help teach recursion by exDM69 on Thursday September 15, 2016 @05:35AM (#12504594)
It's not hard, but I the issue is a stupid way of teaching procedural programming in the first place, not a student with mental difficulties.

When you've been taught that computers process a sequence of operations (ie. statements, not actual instructions), from the top to the bottom, it's difficult to imagine "start from the beginning, but rename all variables and substitute some values". Recursion is a bit hard when you do it in assembler (need to explicitly work with the stack), but that's not the mental model we typically use in programming. Yet, it's often the model that the students encounter first.

I really liked the SICP lectures from 1980s where the lecturer goes ahead and demonstrates recursion with evaluating expressions by writing them on a blackboard with chalk. It also demonstrates the space and time complexity of the evaluation.

This is why I think that beginner programming lectures should be more focused on expressions than statements. More functional, less procedural.

Re:How the right syntax can help teach recursion by JadeNB on Thursday September 15, 2016 @09:48AM (#12506054)
> I really liked the SICP lectures from 1980s where the lecturer goes ahead and demonstrates recursion with evaluating expressions by writing them on a blackboard with chalk. It also demonstrates the space and time complexity of the evaluation.

I agree! The author does just this when demonstrating the difference between the naïve recursive implementation of `length`, and the tail-recursive one using an accumulator. I don't know if he or she did so with the student, but I thought it was a nice pedagogical touch in the post.

Re:How the right syntax can help teach recursion by rosstex on Thursday September 15, 2016 @05:20AM (#12504541)
You'd be an excellent teacher!
Re:How the right syntax can help teach recursion by myst on Thursday September 15, 2016 @05:32AM (#12504584)
Thanks!
Re:How the right syntax can help teach recursion by duncanawoods on Thursday September 15, 2016 @05:54AM (#12504655)
The problems I see are mostly with the word. When you face a word you don't understand it can be a huge obstacle unrelated to the concept it represents.

Its especially bad when the definition is given to you as code you barely understand performing either a trivial task in a weird way that would seem to be a simple for-loop or a more sophisticated task involving say trees that you struggle to grasp even without the $5 word hanging over it telling you that you don't understand something.

Terms like self-reference are more intuitive.

Re:How the right syntax can help teach recursion by posterboy on Thursday September 15, 2016 @06:30AM (#12504768)
With mutual recursion, two functions calling each other, the self-reference is indirect and this word therefore not explicit. Would that be mutual reference, cross dependence? Does it really matter? In the functionals spirit, it would be enough to treat recursion as an unnamed lambda of the type "clever trick" :)
Re:How the right syntax can help teach recursion by duncanawoods on Thursday September 15, 2016 @08:33AM (#12505524)
I think you said it yourself "indirect self-reference" - its self-describing and doesn't require much explanation. It lets you concentrate on showing why its useful rather than what it is. It leads naturally to discussions of scope of references in languages that don't make self-reference easy.

One reason I think the word becomes confusing is that recursive functions typically also require introducing a recursive data-structures. It makes the teacher feel powerful introducing a special concept but the learner struggles with what feels like a category error - they were trying to understand a processing concept and now its also a property that can apply to static structures too.

Re:How the right syntax can help teach recursion by JadeNB on Thursday September 15, 2016 @06:14AM (#12504717)
> Why would any non-retarded person need any help getting recursion? Recursion is not hard.

As I think was implicit in rosstex (https://news.ycombinator.com/item?id=12504541 )'s comment, this attitude is worthless. Evidently recursion is not hard for you, but there are people who find it hard. If someone else has found an educational approach that works for at least one such person, then what is the use of sneering at it, without even offering anything constructive in return?

A teacher who said such a thing would not only not help his or her students this time, but ensure that they'd never look for help in the future.

Re:How the right syntax can help teach recursion by posterboy on Thursday September 15, 2016 @06:55AM (#12504898)
That is a complicated case for teachers. Dumbed down content slows the progress of the more talented students and vice versa. The system is not perfect so the GP is entitled to his opinion, IMHO. Of course, "dumb" is a debatable characterization, but since the GP didn't start to debate it with actually concrete arguments, the point is moot and just a slur.
Re:How the right syntax can help teach recursion by JadeNB on Thursday September 15, 2016 @09:44AM (#12506030)
> That is a complicated case for teachers. Dumbed down content slows the progress of the more talented students and vice versa.

Your points are excellent and constructive. It is well stated that a classroom cannot always be serving the needs of each of its members, since they will sometimes be in conflict, and that part of the job of a teacher is to figure out how best to address these disparate needs.

My objection was not to this constructive point, but rather to the dismissive ideas (not yours, of course) that (1) having difficulty with a concept (whatever that concept is!) is the mark of a mental disability rather than part of the learning process, and (2) it is worthless even to attempt to address and resolve this difficulty.

Re:How the right syntax can help teach recursion by ChoHag on Thursday September 15, 2016 @07:06AM (#12504960)
They might be 12.