Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "more" of ISeq not named "rest"?

Tags:

clojure

public interface ISeq extends IPersistentCollection {
  Object first();
  ISeq next();
  ISeq more();
  ISeq cons(Object o);
}

more method of ISeq interface seems to be functioning just rest. Why is it named more not rest?

like image 990
alice Avatar asked Apr 04 '13 15:04

alice


1 Answers

This information is my interpretation of doing some archeology on the Clojure git repository.

Originally there was only rest, which returned nil instead of the emtpy list as it does today. When Rich introduced lazyness, it was then renamed next, and ISeq gained the more method. ASeq implements the more method to return an empty seq instead of nil, and leaves the next methond abstract. At some point after this the rest function was brought back to life as the non-seq, empty list-returning version we know today, but the Java code wasn't refactored.

like image 118
Jeremy Avatar answered Nov 03 '22 01:11

Jeremy