mstade / funkis

Functional JavaScript
MIT License
6 stars 0 forks source link

Removed `nil` #5

Closed mstade closed 10 years ago

mstade commented 10 years ago

Having three kinds of objects to denote the absence of a value is a bit retarded, so I removed the one I added. For denoting the end of a sequence, I added the done property on the seq function instead. Feels safer anyhow.

Also renamed isNil to isnt and added a converse is function. Makes it nicer to read code than seeing bangs everywhere.

Removed lim as well, since it was an odd ball and when nil disappeared it was tricky to make it work with seq. I took a cue from Clojure's repeatedly instead, with the important difference that in this version of repeatedly each function call will have its index passed.

Added a naive implementation of nth, which probably should be optimized at some point.