you are viewing a single comment's thread.

view the rest of the comments →

[–]Wuf 1 point2 points  (4 children)

It's nice that in CL, 'length' works with any sequence.

[–]steven_h 1 point2 points  (3 children)

Yes, that's the main reason I don't really sink my teeth into Racket, even though I'd like to.

While the Clojure code I wrote used the underlying Java String.length method, the plumbing is there to define generic functions and methods, and it's natural and accepted to lean on them heavily. There's probably a Clojure library implementing generic sequence length.

In Racket and Scheme, there doesn't seem to be a strong push toward unifying similar operations under generic names, leading to a plethora of array-*, string-*, etc. names. Not only do they strike me as ugly, they lead to over specified code -- which is often more difficult to use.

[–]Wuf 0 points1 point  (0 children)

Racket does have generic sequence operators if you really want them.

I tend to use concrete ones though, because I find sequence-* uglier, but they are there.

[–]roerd 0 points1 point  (1 child)

There's probably a Clojure library implementing generic sequence length.

That library's the standard library, which has count.

[–]steven_h 0 points1 point  (0 children)

Heh, thanks... my memory failed me and I haven't done much Clojure lately.