diff options
author | Rich Hickey <richhickey@gmail.com> | 2008-09-13 18:46:00 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2008-09-13 18:46:00 +0000 |
commit | 49c9f8960ff07bf53a3a7eedbc52f7754b9cab3e (patch) | |
tree | 1fe41cc084a8f6a4ae9edbe84799ae9ad8eb90e3 /src | |
parent | bba00b2841531a6900c47d1332e09beaa52f3218 (diff) |
fixed nth with not-found arg - when negative index returns not-found
Diffstat (limited to 'src')
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index b8efac2a..2ce55e4f 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -713,6 +713,8 @@ static public Object nth(Object coll, int n){ static public Object nth(Object coll, int n, Object notFound){ if(coll == null) return notFound; + else if(n < 0) + return notFound; else if(coll instanceof IPersistentVector) { IPersistentVector v = (IPersistentVector) coll; |