News for hackers. Stuff that matters.
Re:The Nature of Lisp (2006) by Xurinos on Tuesday May 04, 2010 @09:28PM (#1320026)
I meant Haskell. :) Turns out CL is pretty light on the funny syntax, and the few places it is used are optional -- but nice.
Re:The Nature of Lisp (2006) by eru on Wednesday May 05, 2010 @01:56PM (#1321925)
OK, I guess then I just have different preferences. I find Haskell much more bearable than CL in terms of beauty.

Scheme is nice, too.

Re:The Nature of Lisp (2006) by Xurinos on Wednesday May 05, 2010 @02:57PM (#1322148)
I have heard similar opinions on Haskell. I am definitely attracted to the convenient function currying and composition, but I realized I could do similar in CL and make it look like whatever made sense to me. I find the ability to create my own look and feel to supercede accepting someone else's look and feel.

I have no issues with Scheme, except that I have chosen to use CL over Scheme because it does feel like something of a batteries-included system.

On the other hand, I was annoyed by what I felt was inconsistent syntax with Haskell revealed in Real World Haskell chapter 13 (unfortunately my only experience with it) when they showed this function definition:

  mkFuncRec :: String -> (Int -> Int) -> FuncRec
vs this function definition:

  simplify :: (Num a) => SymbolicManip a -> SymbolicManip a

The =>, previously used to instance types, confused me here (they never explained how this definition differed), and I was having a hard time keeping up with all the various times I needed to use each special symbol. Of course, I tolerated it through C++ and perl, so if I ever decided to try a project, I could probably get used to it.
Re:The Nature of Lisp (2006) by eru on Wednesday May 05, 2010 @04:14PM (#1322418)
I see that the namespaces for values and types are somewhat separate in Haskell. Could you please describe your confusion again in different words?

Perhaps I am too used to Haskell, but I do not see anything confusing in those two definitions. What do you mean with "previously used to instance types"? As far as I can remember => is only ever used in the context shown above.

Re:The Nature of Lisp (2006) by Xurinos on Wednesday May 05, 2010 @04:19PM (#1322440)
The book introduced the second pattern out of the blue. What is the difference between those two function definitions? What does "=>" mean in this context? a :: b -> (c d) -> e makes sense to me, but f :: (g h) => i -> j -> k does not.

Here is the page that suddenly introduced that second form: http://book.realworldhaskell.org/read/data-structures.html

It is entirely possible I missed some context somewhere in there; "namespaces for values vs types" might be my clue. :)

Re:The Nature of Lisp (2006) by eru on Wednesday May 05, 2010 @05:49PM (#1322711)
In the example

  my_fun :: (TypeClass1 a, Typeclass2 b) => a -> b
the stuff preceeding the => declares what typeclasses the types you mention later should fall into.

A good example is the module Data.Map; this module deals with finite mappings of keys to values. Since those Maps are based on balanced trees, the keys have to be orderable/comparable. So for inserting a key into a map (http://hackage.haskell.org/packages/archive/containers/0.2.0...) we get the following type

  insert :: Ord k => k -> a -> Map k a -> Map k a
This just says that the type of keys has to be an instance of the class Ord (http://haskell.org/ghc/docs/6.12.1/html/libraries/base-4.2.0...). I.e. there has to be an instance declaration with the function

  (<=) :: a -> a -> Bool
Does that help?

By the way, if you want to find documentation about a function and you know its name or type, you can use Hoogle (http://www.haskell.org/hoogle/).

Re:The Nature of Lisp (2006) by Xurinos on Wednesday May 05, 2010 @08:13PM (#1323095)
the stuff preceeding the => declares what typeclasses the types you mention later should fall into.

That makes it clear. Thank you!