[OT] Teaching Haskell in High School
Kevin Millikin
kmillikin@atcorp.com
Fri, 7 Feb 2003 10:10:40 -0600
On Friday, February 07, 2003 7:41 AM, Arjan van IJzendoorn
[SMTP:afie@cs.uu.nl] wrote:
> The quality of the messages, however, is not as good as I would have
> expected. I am a beginning Scheme programmer ...
Then you should have set the language to "Beginning Student" or
"Beginning Student with List Abbreviations".
Seriously.
A nice thing about the DrScheme environment is that it allows
languages to be layered. Instructors don't have to wave their arms
ands say "pay no attention to 'public static void' and 'String[] args'
and 'class TestExp {'" just to begin writing simple programs.
The DrScheme languages are restricted subsets of Scheme. The same
could certainly be done in a learning environment for Haskell, but is
more difficult in Java or C++. Even if the student is told to "ignore"
some things for now, many of the problems they have are often caused by
not understanding the things they're supposed to be ignoring--which can
be incredibly frustrating.
If you had set the DrScheme language to one of the two "Beginning
Student" levels, you would have seen:
function call: expected a defined name or a primitive operation
name after an open parenthesis, but found a number
And "+1" would have been highlighted. This would have been reported
when you entered the *definition* for length2, not when you applied it.
Switch to "Intermediate Student", and you get:
function call: expected a name after an open parenthesis, but
found a number
With "+1" highlighted, at definition of length2.
Switch to "Intermediate Student with lambda" or "Advanced Student",
and the definition is accepted, but the application (to a non-empty
list) reports:
procedure application: expected procedure, given: 1; arguments
were: 0
> I think it is important that error messages show exactly what was
> entered by the user (+1 and not 1) and that's why in Helium we
> remember each little detail in the abstract syntax tree.
Excellent idea.
> I still don't know what "arguments were: 1" means. Does it refer to
> the number of arguments?
Are you sure you it said that? Mine doesn't ;). I expect "arguments
were: 0". It was complaining about trying to apply "1" to the
argument that is the value of (length2 empty), which should be zero,
no?