summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cli/runtime/RT.cs15
-rw-r--r--src/jvm/clojure/lang/RT.java15
2 files changed, 30 insertions, 0 deletions
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs
index 1f97c081..5cf4187f 100644
--- a/src/cli/runtime/RT.cs
+++ b/src/cli/runtime/RT.cs
@@ -196,6 +196,21 @@ static public Object find(Object key, Object coll)
return ((Associative)coll).find(key);
}
+ //takes a seq of key,val,key,val
+//returns tail starting at val of matching key if found, else null
+static public ISeq findKey(Keyword key,ISeq keyvals) {
+ while(keyvals != null)
+ {
+ ISeq r = keyvals.rest();
+ if (r == null)
+ throw new Exception("Malformed keyword argslist");
+ if (keyvals.first() == key)
+ return r;
+ keyvals = r.rest();
+ }
+ return null;
+}
+
static public Object without(Object key, Object coll)
{
if (coll == null)
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java
index 7fc7b4ab..f00101c0 100644
--- a/src/jvm/clojure/lang/RT.java
+++ b/src/jvm/clojure/lang/RT.java
@@ -180,6 +180,21 @@ static public Object find(Object key, Object coll) {
return ((Associative)coll).find(key);
}
+//takes a seq of key,val,key,val
+//returns tail starting at val of matching key if found, else null
+static public ISeq findKey(Keyword key,ISeq keyvals) throws Exception {
+ while(keyvals != null)
+ {
+ ISeq r = keyvals.rest();
+ if (r == null)
+ throw new Exception("Malformed keyword argslist");
+ if (keyvals.first() == key)
+ return r;
+ keyvals = r.rest();
+ }
+ return null;
+}
+
static public Object without(Object key, Object coll) {
if(coll == null)
return null;