Why do the results of the vector Clojure function exclude the stop value?

Forgive me for a new question and potentially incorrect terminology.

Clojure vector functions produce values ​​that do not include stop value. For example:

=> (subvec [:peanut :butter :and :jelly] 1 3)
[:butter :and]
=> (range 1 5)
(1 2 3 4)

The document for the range explicitly states this, but does not give a rational one: "... Returns the lazy number nums from the beginning (inclusive) to the end (exclusive) ...".

In Ruby, these operations are included:

(1..5) .to_a => [1, 2, 3, 4, 5] [: peanuts ,: butter ,: and ,: jelly] [1,3] => [: butter ,: and ,: jelly ]

Obviously, these are very different languages, but I wonder if there was any underlying reason besides the personal preferences of the language developers?

+4
source share
2

, (count collection) , NPE. .

+5

, Java. java.lang.String.substring java.util.List.subList .

+4

Source: https://habr.com/ru/post/1527570/


All Articles