News for hackers. Stuff that matters.
Re:Is Haskell the right language for teaching functional pro... by TuringTest on Monday October 16, 2017 @10:53AM (#15483589)
I studied Haskell in college (with the Gofer variant), and it was GREAT for learning practical functional programming.

We didn't use monads though (they weren't in widespread use back then), so we had to learn the accumulator-parameter pattern and tail recursion the hard way.

Learning my foldr's and foldl's and zipwith's gave me confidence that almost any imperative programming can be equally represented as a recursive function, which is an important lesson for someone who had only learned about traditional imperative programming and OOP up to that point.

Of course, a proper course should center around algorithms and recursive data structures where functional programming shines; it should not begin with building business application logic, for which a classic language may have a gentler ramp-up.

Re:Is Haskell the right language for teaching functional pro... by HelloNurse on Monday October 16, 2017 @12:10PM (#15484275)
If your course didn't cover monads, it was a very introductory one which would have probably benefited from choosing a nicer and simpler language, like antiquated LISP or maybe Scheme.
Re:Is Haskell the right language for teaching functional pro... by DonaldFisk on Monday October 16, 2017 @05:33PM (#15486792)
> antiquated LISP

By that do you mean "Lisp, which is antiquated", or "a LISP which is antiquated"?

Lisp certainly isn't antiquated, but as the second oldest high level language after FORTRAN, there are antiquated versions of it (e.g. LISP 1.5).

Re:Is Haskell the right language for teaching functional pro... by Chattered on Tuesday October 17, 2017 @02:46AM (#15489123)
Wadler's introductory Haskell course at Edinburgh doesn't cover monads, but it's great. I don't want to use scheme because I want students exposed to a decent static type system. There's an argument to be made for using standard ml, maybe.

I think the fact that strings are linked lists is great for beginners. One of their assignments is on web scraping, where they can reuse all their list based functions to solve the problem.

I am not too keen on Haskell's polymorphism for teaching beginners, and error messages are mostly useless for them. If I were teaching again, I would be recommending custom preludes with simpler types.

Re:Is Haskell the right language for teaching functional pro... by TuringTest on Monday October 16, 2017 @12:40PM (#15484546)
It was introductory, yes, although it also covered relational programming in PROLOG.

I benefited from the type inference/type declarations, and learning about generics explained in a non-duck-typing way, though, which I wouldn't have had in LISP.

Re:Is Haskell the right language for teaching functional pro... by wwweston on Monday October 16, 2017 @01:16PM (#15484895)
Hey, can you point to or do you have any of the relational/Prolog programming materials? I dabbled in this years ago, mostly experimenting on my own, would love to see some materials designed for guided exploration.
Re:Is Haskell the right language for teaching functional pro... by TuringTest on Tuesday October 17, 2017 @04:06AM (#15489351)
I'm afraid the material is some handwritten notes in Spanish, interleaved with some code examples in PROLOG. They were quite systematic IIRC, covering basic logic, data structures, proper use of the !bang for performance, etc.

I no longer have the exercises in code, just paper. I've yet to scan my handwritten notes and bring them to the digital era :-) This may prompt me to finally do it.

If you still want them, I can send you the scanned pdf to your mail. However, I think you'd better off with some free online course. On a cursory examination, this one seems similar to the content in my notes:

[1] http://www.learnprolognow.org/lpnpage.php?pageid=online

Re:Is Haskell the right language for teaching functional pro... by krfsm on Monday October 16, 2017 @07:35PM (#15487521)
There were courses using haskell before monads were the smash hit they are now. In particular haskell didn't have monadic IO then. On the other hand, variants such as gofer were pretty simple.
Re:Is Haskell the right language for teaching functional pro... by reddit_clone on Monday October 16, 2017 @05:13PM (#15486692)
> antiquated LISP

That's debatable. True, Lisp is Old. Hardly antiquated.

Re:Is Haskell the right language for teaching functional pro... by HelloNurse on Tuesday October 17, 2017 @11:07AM (#15491523)
I agree, but over the decades LISP developed significant complications, such as object oriented features; I think the most appropriate LISP for an introductory FP course would be a very antiquated and very simple and pure one, without advanced features (and the accompanying syntactic pollution) that might be of interest as advanced theory, useful in advanced practice, but a source of confusion and a major waste of time for beginners.

Fancy LISP variants would still be vastly easier to learn than Haskell, but a straightforward computer adaptation of lambda calculus would minimize the distance between theory and running programs.

I'm not familiar enough with Scheme or Clojure to tell whether they are too complex for an introductory course.

Re:Is Haskell the right language for teaching functional pro... by flavio81 on Tuesday October 17, 2017 @12:09PM (#15492104)
>I agree, but over the decades LISP developed significant complications, such as object oriented features

How can this be a complication? On Common Lisp, you can just choose not to use object oriented features (the CLOS system).

There are many CL libraries that do not use OOP code at all.

And if you want to use them, in CLOS a method is called exactly the same as a function; they are called "generic functions", so the syntax is just the same.

>without advanced features (and the accompanying syntactic pollution)

I don't think there is any syntactic pollution. Again, in Common Lisp the syntax is totally uniform for all the features, in fact for a beginners' Functional Programming course, he/she would only need to learn:

    () parentheses for opening and closing an s-expression
    ; for comments
    ' for quoting an s-expression so it is not evaluated
    #' for indicating that the following symbol 
       is a function name
       (not needed on Lisp-1 languages like Scheme)
    "" for delimiting a string
... and that's it!!

"Advanced" features don't introduce too much syntax either:

    `  for quoting an s-expression in a "template" way
       (i.e. for use in macros)
    ,  for escaping the ` operator
    ,@ for escaping the ` operator, "splicing" the
       contents of a list; for example when passing a code
       block to a macro.
For a language that is really extensive in features, the amount of syntax introduced is minimal, really.

Compare with Haskell.

Re:Is Haskell the right language for teaching functional pro... by HelloNurse on Wednesday October 18, 2017 @04:50PM (#15502919)
Of eight special delimiter character you list, three are used for macros. While the syntax of the highly evolved Common Lisp you have in mind remains extremely frugal, macros are only one of many relatively large unnecessary luxury feature.

Teaching fancy language features in an introductory course steals time and attention from fundamental functional programming principles. CLOS, unless thoroughly dissected as an advanced example of how far can you go with LISP, would be an even worse gratuitous distraction than macros.

Of course, "complex" LISP isn't going to be comparable with Haskell, and in a sufficiently long introductory course advanced language features might be worth teaching to increase student productivity.

Re:Is Haskell the right language for teaching functional pro... by lispm on Tuesday October 17, 2017 @03:26PM (#15494057)
> I'm not familiar enough with Scheme or Clojure to tell whether they are too complex for an introductory course.

Simple Scheme has been used for decades for introductory courses, both in schools and university.

An even simpler Lisp called Logo has been used with early programming education for kids.

Lots of educational material based on Scheme or Logo exists.