wow! nice job AtKaaZ...so if I understood correctly there is no issue with my code yes? translate-position sits at the bottom of my API (cannot live without it)...

Jim


On 21/01/13 00:33, AtKaaZ wrote:
Caused by:
RuntimeException Can't embed object in code, maybe print-dup not defined: clojure.core$reify__6186@4e5db277
    clojure.lang.Util.runtimeException (Util.java:223)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4571)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4496)
clojure.lang.Compiler$ObjExpr.emitListAsObjectArray (Compiler.java:4392)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4529)
    clojure.lang.Compiler$ObjExpr.emitConstants (Compiler.java:4610)
    clojure.lang.Compiler$ObjExpr.compile (Compiler.java:4072)
    clojure.lang.Compiler$FnExpr.parse (Compiler.java:3808)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6558)
    clojure.lang.Compiler.analyze (Compiler.java:6361)
Caused by:
IllegalArgumentException *No method in multimethod 'print-dup' for dispatch value: class clojure.core$reify__6186*
    clojure.lang.MultiFn.getFn (MultiFn.java:160)
    clojure.lang.MultiFn.invoke (MultiFn.java:231)
    clojure.core/pr-on (core.clj:3321)
    clojure.lang.Var.invoke (Var.java:419)
    clojure.lang.RT.print (RT.java:1739)
    clojure.lang.RT.printString (RT.java:1718)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4566)

to see this I had to edit clojure code /clojure/src/jvm/clojure/lang/Compiler.java line 4571
by adding the cause to the throw (that ",e"):
throw Util.runtimeException(
"Can't embed object in code, maybe print-dup not defined: " +
                        value,e);

any reason why that isn't there already?(I guess this was added later: the ability to pass the cause)




On Mon, Jan 21, 2013 at 1:20 AM, AtKaaZ <atk...@gmail.com <mailto:atk...@gmail.com>> wrote:

    Actually, it's even simpler:

    (def ^:const
    mappings-8x8
      (mapv #(apply vector-of :int %)
            [[0 0] [1 0] [2 0]])
      )

    (class mappings-8x8) ;throws
    CompilerException java.lang.RuntimeException: Can't embed object
    in code, maybe print-dup not defined:
    clojure.core$reify__6186@77771028, compiling:


    On Mon, Jan 21, 2013 at 1:17 AM, AtKaaZ <atk...@gmail.com
    <mailto:atk...@gmail.com>> wrote:

        I've managed to reduce this to:
        (ns Clondie24.games.xx1)

        (def ^:const
        mappings-8x8

          (mapv #(apply vector-of :int %)
                [[0 0] [1 0] [2 0]])
          )


        (defn translate [mappings]
          (let [list-loc
                (.indexOf mappings [0 1])]
            ))


        (translate mappings-8x8);throws



        ----
        => (pst *e 121312)
        CompilerException java.lang.RuntimeException: Can't embed
        object in code, maybe print-dup not defined:
        clojure.core$reify__6186@77771028,
        compiling:(Clondie24\games\xx1.clj:16:1)

            clojure.lang.Compiler.analyzeSeq (Compiler.java:6566)
            clojure.lang.Compiler.analyze (Compiler.java:6360)
            clojure.lang.Compiler.eval (Compiler.java:6615)
            clojure.lang.Compiler.load (Compiler.java:7062)
            Clondie24.games.chess/eval19634 (NO_SOURCE_FILE:1)
            clojure.lang.Compiler.eval (Compiler.java:6618)
            clojure.lang.Compiler.eval (Compiler.java:6581)
            clojure.core/eval (core.clj:2852)
        clojure.main/repl/read-eval-print--6625 (main.clj:251)
        clojure.main/repl/fn--6630/fn--6631 (main.clj:269)
            clojure.main/repl/fn--6630 (main.clj:269)
            clojure.main/repl (main.clj:267)
        clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn--988
        (interruptible_eval.clj:58)
            clojure.core/apply (core.clj:617)
            clojure.core/with-bindings* (core.clj:1788)
        clojure.tools.nrepl.middleware.interruptible-eval/evaluate
        (interruptible_eval.clj:43)
        
clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn--1029/fn--1032
        (interruptible_eval.clj:173)
            clojure.core/comp/fn--4173 (core.clj:2330)
        clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn--1022
        (interruptible_eval.clj:140)
        java.util.concurrent.ThreadPoolExecutor.runWorker
        (ThreadPoolExecutor.java:1110)
        java.util.concurrent.ThreadPoolExecutor$Worker.run
        (ThreadPoolExecutor.java:603)
            java.lang.Thread.run (Thread.java:722)
        Caused by:
        RuntimeException Can't embed object in code, maybe print-dup
        not defined: clojure.core$reify__6186@77771028

        clojure.lang.Util.runtimeException (Util.java:219)
        clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4570)
        clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4496)
        clojure.lang.Compiler$ObjExpr.emitListAsObjectArray
        (Compiler.java:4392)
        clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4529)
        clojure.lang.Compiler$ObjExpr.emitConstants (Compiler.java:4609)
        clojure.lang.Compiler$ObjExpr.compile (Compiler.java:4072)
        clojure.lang.Compiler$FnExpr.parse (Compiler.java:3808)
            clojure.lang.Compiler.analyzeSeq (Compiler.java:6557)
            clojure.lang.Compiler.analyze (Compiler.java:6360)

        to fix this, just comment out the "^:const" part, like so:
        (def ;^:const
        now, doesn't throw.


        ---------

        ///some extra stuff(ignore this):
        (def xam0 (translate mappings-8x8));works
        (println xam0)

        (let [ xam (translate 1 2 mappings-8x8) ]);this one throws:
        can't embed even before Wrong number of args (3)

        ///end ignore

        Maybe someone can explain...

        This was enjoyable ;)



        On Mon, Jan 21, 2013 at 12:03 AM, Jim - FooBar();
        <jimpil1...@gmail.com <mailto:jimpil1...@gmail.com>> wrote:

            yes exactly! In the commit that github shows last line 238
            is line 244 in my current branch...Since you're looking
            into it i can commit everything now so we're all on the
            same page...

            Jim


            On 20/01/13 21:10, AtKaaZ wrote:
            is this line 244?
            
https://github.com/jimpil/Clondie24/blob/master/src/Clondie24/games/chess.clj#L238


            On Sun, Jan 20, 2013 at 7:58 PM, Jim - FooBar();
            <jimpil1...@gmail.com <mailto:jimpil1...@gmail.com>> wrote:

                Hi everyone,

                I came back to a project of mine after a couple of
                months only to be surprised by some cryptic
                exception! Imagine a 2d vector:

                (def coords [[0 0] [0 1] [1 0]  [1 1]]) ;;vector of
                vectors of longs

                ;;but let's try ints which are cached:

                (def coords
                  (mapv #(apply vector-of :int %)  [[0 0] [0 1] [1 0]
                 [1 1]])) ;;vector of vectors of ints


                everything seems great right? well, now my namespaces
                don't even compile! This is my representation of the
                'board' in a game which means that I'm only reading
                from this vector nothing else! I am getting
                CompilerException java.lang.RuntimeException: Can't
                embed object in code, maybe print-dup not defined:
                clojure.core$reify__6184@1eb42164,
                compiling:(Clondie24/games/chess.clj:244:1) where
                line 244 is just a 'defn' with its argument
                vector...as soon as I comment out the conversion to
                unboxed int primitives everything works again! doing
                (pst) does not help at all! Look at this:

                user=> (pst)
                CompilerException java.lang.RuntimeException: Can't
                embed object in code, maybe print-dup not defined:
                clojure.core$reify__6186@61c28cfb,
                compiling:(Clondie24/games/chess.clj:244:1)
                clojure.lang.Compiler.analyzeSeq (Compiler.java:6566)
                clojure.lang.Compiler.analyze (Compiler.java:6360)
                clojure.lang.Compiler.analyzeSeq (Compiler.java:6547)
                clojure.lang.Compiler.analyze (Compiler.java:6360)
                clojure.lang.Compiler.access$100 (Compiler.java:37)
                clojure.lang.Compiler$DefExpr$Parser.parse
                (Compiler.java:528)
                clojure.lang.Compiler.analyzeSeq (Compiler.java:6559)
                clojure.lang.Compiler.analyze (Compiler.java:6360)
                clojure.lang.Compiler.analyze (Compiler.java:6321)
                clojure.lang.Compiler.eval (Compiler.java:6622)
                clojure.lang.Compiler.load (Compiler.java:7062)
                clojure.lang.RT.loadResourceScript (RT.java:361)
                Caused by:
                RuntimeException Can't embed object in code, maybe
                print-dup not defined: clojure.core$reify__6186@61c28cfb
                clojure.lang.Util.runtimeException (Util.java:219)
                clojure.lang.Compiler$ObjExpr.emitValue
                (Compiler.java:4570)
                clojure.lang.Compiler$ObjExpr.emitValue
                (Compiler.java:4496)
                clojure.lang.Compiler$ObjExpr.emitListAsObjectArray
                (Compiler.java:4392)
                clojure.lang.Compiler$ObjExpr.emitValue
                (Compiler.java:4529)
                clojure.lang.Compiler$ObjExpr.emitConstants
                (Compiler.java:4609)
                clojure.lang.Compiler$ObjExpr.compile
                (Compiler.java:4072)
                clojure.lang.Compiler$FnExpr.parse (Compiler.java:3808)
                clojure.lang.Compiler.analyzeSeq (Compiler.java:6557)
                clojure.lang.Compiler.analyze (Compiler.java:6360)
                nil

                this is clearly not my code! everything is
                clojure.lang.Compiler related!
                what is happening exactly? can anyone explain? I'm
                not doing anything 'weird' in the function reported
                in the exception just reading  the vector.

                Jim





-- You received this message because you are subscribed
                to the Google
                Groups "Clojure" group.
                To post to this group, send email to
                clojure@googlegroups.com
                <mailto:clojure@googlegroups.com>
                Note that posts from new members are moderated -
                please be patient with your first post.
                To unsubscribe from this group, send email to
                clojure+unsubscr...@googlegroups.com
                <mailto:clojure%2bunsubscr...@googlegroups.com>
                For more options, visit this group at
                http://groups.google.com/group/clojure?hl=en




-- I may be wrong or incomplete.
            Please express any corrections / additions,
            they are encouraged and appreciated.
            At least one entity is bound to be transformed if you do ;)
-- You received this message because you are subscribed to
            the Google
            Groups "Clojure" group.
            To post to this group, send email to
            clojure@googlegroups.com <mailto:clojure@googlegroups.com>
            Note that posts from new members are moderated - please
            be patient with your first post.
            To unsubscribe from this group, send email to
            clojure+unsubscr...@googlegroups.com
            <mailto:clojure+unsubscr...@googlegroups.com>
            For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

-- You received this message because you are subscribed to
            the Google
            Groups "Clojure" group.
            To post to this group, send email to
            clojure@googlegroups.com <mailto:clojure@googlegroups.com>
            Note that posts from new members are moderated - please be
            patient with your first post.
            To unsubscribe from this group, send email to
            clojure+unsubscr...@googlegroups.com
            <mailto:clojure%2bunsubscr...@googlegroups.com>
            For more options, visit this group at
            http://groups.google.com/group/clojure?hl=en




-- I may be wrong or incomplete.
        Please express any corrections / additions,
        they are encouraged and appreciated.
        At least one entity is bound to be transformed if you do ;)




-- I may be wrong or incomplete.
    Please express any corrections / additions,
    they are encouraged and appreciated.
    At least one entity is bound to be transformed if you do ;)




--
I may be wrong or incomplete.
Please express any corrections / additions,
they are encouraged and appreciated.
At least one entity is bound to be transformed if you do ;)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to