Skip to content

Commit

Permalink
make sure find returns entry with original key
Browse files Browse the repository at this point in the history
  • Loading branch information
richhickey committed Dec 18, 2008
1 parent a2c5b5b commit 437ff9b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
30 changes: 0 additions & 30 deletions clojure.iml
Expand Up @@ -11,35 +11,6 @@
<setting name="buildJar" value="true" />
<setting name="mainClass" value="clojure.lang.Compiler" />
</component>
<component name="FacetManager">
<facet type="web" name="Web" implicit="true">
<configuration>
<descriptors>
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/servlet/WEB-INF/web.xml" optional="false" version="2.5" />
</descriptors>
<webroots>
<root url="file://$MODULE_DIR$/servlet" relative="/" />
</webroots>
<building>
<setting name="EXPLODED_URL" value="file://" />
<setting name="EXPLODED_ENABLED" value="false" />
<setting name="JAR_URL" value="file://" />
<setting name="JAR_ENABLED" value="false" />
<setting name="BUILD_MODULE_ON_FRAME_DEACTIVATION" value="false" />
<setting name="BUILD_EXTERNAL_DEPENDENCIES" value="false" />
<setting name="EXCLUDE_EXPLODED_DIRECTORY" value="true" />
<setting name="RUN_JASPER_VALIDATION" value="true" />
<setting name="BUILD_ONLY_WEB_RESOURCES" value="false" />
</building>
<packaging>
<containerElement type="module" name="clojure">
<attribute name="method" value="1" />
<attribute name="URI" value="/WEB-INF/classes" />
</containerElement>
</packaging>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
Expand All @@ -59,7 +30,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
<option name="ACTIVE_VCS_NAME" value="svn" />
Expand Down
2 changes: 1 addition & 1 deletion src/jvm/clojure/lang/PersistentArrayMap.java
Expand Up @@ -83,7 +83,7 @@ public boolean containsKey(Object key){
public IMapEntry entryAt(Object key){
int i = indexOf(key);
if(i >= 0)
return new MapEntry(key,array[i+1]);
return new MapEntry(array[i],array[i+1]);
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/jvm/clojure/lang/PersistentStructMap.java
Expand Up @@ -123,7 +123,7 @@ public IMapEntry entryAt(Object key){
Map.Entry e = def.keyslots.entryAt(key);
if(e != null)
{
return new MapEntry(key, vals[(Integer) e.getValue()]);
return new MapEntry(e.getKey(), vals[(Integer) e.getValue()]);
}
return ext.entryAt(key);
}
Expand Down
5 changes: 3 additions & 2 deletions src/jvm/clojure/lang/RT.java
Expand Up @@ -663,14 +663,15 @@ else if(key instanceof Number && (coll instanceof String || coll.getClass().isAr
static public Object find(Object coll, Object key){
if(coll == null)
return null;
else if(coll instanceof Map)
else if(coll instanceof Associative)
return ((Associative) coll).entryAt(key);
else
{
Map m = (Map) coll;
if(m.containsKey(key))
return new MapEntry(key, m.get(key));
return null;
}
return ((Associative) coll).entryAt(key);
}

//takes a seq of key,val,key,val
Expand Down

0 comments on commit 437ff9b

Please sign in to comment.