I agree with the majority of posters that the breaking changes in the
service of optimal names is the right way to go.
I found the explanation & recipe for porting at clojure.org/lazier
clear & easy to follow. I didn't do full ports of any projects, but I
did some selective porting & found it to be straightforward.
That said, the only problem I see is with the names. Like Mibu, I
think "next" isn't ideal -- it connotes an item in an iteration to me.
If you think "next *seq*" when you see "next" (how Rich explains it
at /lazier), it helps, but it's still not exactly right; or it
requires a different mental model from the non-lazy-branch "rest": the
cursor moving to the "next" item rather than the abstracted "rest of
the coll" (where you think about a cursor).
I think the issue is that "rest" is the right name for both rest &
next. The only difference between them, from the perspective of users,
is how empty rests are represented ('() or nil), & that's a hard
distinction to make manifest in a short name.
If it's the case that rest will almost exclusively appear in the
context of constructing lazy-seqs
(lazy-seq
(cons [something] (rest [something]))
& next will appear all over, it makes sense to me to sacrifice brevity
in the case of rest, & give next the right name: "rest" (that's
tortuous, I know).
rest* isn't quite right, but you get the idea: make the fully-lazy
rest the special-kind-of-rest, & the consumer-code rest the
transparent one. This way, people's concepts about recursing through
seqs of colls & testing for the end won't have to change; they'll only
have to change their understanding of how to make lazy sequences. I
know in my code I do a lot more of the former.
Anyone who's on board with this line of thought have ideas for the
right name of fully-lazy rest?
Best,
Perry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---