Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It works in OCaml too, where lists certainly are not functions!

    let rec ones = 1 :: ones;;


I don't know OCaml, but logically it cannot be an actual realized list as the would take up an infinite amount of memory. Whether or not it acts like a function in the language wasn't really the point - internally it must still be an iterator unless you have a computer with an infinite amount of memory.


It's not a function, an infinite list or an iterator. It's a cyclic linked list.




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

Search: