Hacker News new | past | comments | ask | show | jobs | submit login

Well, one of the usual examples would be:

    let ones = 1 : ones in ones
Here ':' is the cons operator, prepending something to a list, so here you defines 'ones' to be '1' followed by 'ones', which in (GHC) Haskell, compiles down to a datatype that has a pointer to the list element ('1') and the tail ('ones', i.e. itself).

EDIT: I realised I forgot to say what it actually does, in case that's not obvious. It's an infinite list of, well, ones...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: