-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Problem
The Clojure function related to the error is the following:
(defn valid-cards-ids
"Returns a list of all the valid cards ids."
[deck-id & [uuid]]
(->> (full-deck deck-id true uuid)
(map :id)
set))The error is actually due to the :id as a function in (map :id)
Calling the function from Unity:
Clojure.GetVar("clojure.core", "map")
.invoke(RT.keyword(null, "id"), fullDeck)
// => {ChunkedCons}[nil nil nil nil nil nil ...]In fact, looking at the valAt C# code:
public object valAt(object _param1, object _param2)
{
object o = _param1;
switch (Util.hash(o) & 3)
{
case 0:
if (o == (object) Keyword.intern((string) null, "id"))
return this.id;
break;
case 1:
if (o == (object) Keyword.intern((string) null, "num"))
return this.num;
break;
case 2:
if (o == (object) Keyword.intern((string) null, "suit"))
return this.suit;
break;
case 3:
if (o == (object) Keyword.intern((string) null, "deck-id"))
return this.deck\u002Did;
break;
}
return RT.get(this.__extmap, _param1, _param2);
}When :id is called, the hash is 1 not 0 as shown above.
So the hash of the keyword :id is different between compiling the valAt of PokerCard and the rumtime calculation.
I directly copied Clojure.dll and Magic.Runtime from my Nostrand to unity assets and got the same results.
So the difference is caused by the different dotnet runtimes.
Metadata
Metadata
Assignees
Labels
No labels