RE: [Haskell] is $ a no-op?

2004-10-13 Thread Kevin Millikin
On Wednesday, October 13, 2004 11:25 AM, Jacques Carette [SMTP:[EMAIL PROTECTED] wrote:
   --  It's kind of like an converse map.
  
  I have attempted, unsuccessfully, to write flist above in a point-free 
  manner.  Is it possible?
 
  Of course it is, but why?
  flist = flip (map . flip ($))
 
 Some functions are simpler point-free, others are simpler with points.  I
 was curious about this one (I like the pointwise version better).
 
 Also, the statement It's kind of like a converse map becomes quite clear
 from the point-free way to write it, while still not so obvious in the
 pointwise version.

I haven't proven it, but I think that this is the same function on lists:

 flist = (. return) . ap

-- Kevin
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell


RE: [OT] Teaching Haskell in High School

2003-02-07 Thread Kevin Millikin
On Friday, February 07, 2003 7:41 AM, Arjan van IJzendoorn 
[SMTP:[EMAIL PROTECTED]] 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?
___
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell