Re: Socket servers, threads, and redirecting error output.
Thank you, Sean. That is an excellent example. -austin On Sunday, January 3, 2021 at 12:48:55 PM UTC-8 Sean Corfield wrote: > Austin, > > You might find a macro like this helpful -- just use it directly instead > of future. You can replace println with whatever sort of logging you want. > > (defmacro logged-future > "Given a body, execute it in a try/catch and log any errors." > [& body] > (let [line (:line (meta )) > file *file*] > `(future > (try > ~@body > (catch Throwable t# > (println t# "Unhandled exception at:" > ~file "line:" ~line > "on thread:" > (.getName (Thread/currentThread > > > On Sat, Jan 2, 2021 at 5:59 PM Austin Haas wrote: > >> Ah, thanks for pointing that out. I must've overlooked your example, >> because I'd already written off futures. >> >> It seems like what you are suggesting, catch and print, might be about as >> good as I could hope for. If I don't want to block the main thread, then I >> don't see what else I could possibly do but print the exception. I guess I >> could store it somewhere, but in any case, I'd use this same pattern. >> >> Thanks, Justin. >> On Saturday, January 2, 2021 at 1:44:55 PM UTC-8 noise...@gmail.com >> wrote: >> >>> to be clear, in my second example you see the error from the future >>> without using deref >>> >>> good luck finding your solution >>> >>> On Sat, Jan 2, 2021 at 12:50 PM Austin Haas >>> wrote: >>> >>>> Thank you very much for the explanation, Justin. >>>> >>>> I don't see how I can use futures, though, without blocking on the main >>>> thread (to get the exception when it occurs). I'm spawning a long-running >>>> process that never returns a value. >>>> On Saturday, January 2, 2021 at 12:43:14 AM UTC-8 noise...@gmail.com >>>> wrote: >>>> >>>>> By the time the exception is caught, you are already outside the >>>>> context of the Thread which the repl client is interacting with. The >>>>> default exception handler has no information tying the executing thread >>>>> to >>>>> the repl process (not to mention the dynamic variables clojure is using >>>>> to >>>>> associate output from code your client runs with that socket connection). >>>>> >>>>> You probably don't want to rebind the root exception handler to show >>>>> *all* exceptions to your client socket. Which means that you need to set >>>>> up >>>>> some soft of infrastructure connecting the information about the failed >>>>> function to the socket you are listening to. >>>>> >>>>> I find "future" very convenient for this, it uses a pool which will >>>>> perform better than creating Threads ad-hoc, and will capture Exceptions >>>>> and re-throw when you deref (of course, it's up to you to ensure you >>>>> deref, >>>>> or use try/catch and otherwise forward the failure information via the >>>>> catch block). Also, it conveys dynamic bindings for things like >>>>> clojure.core/*out* and clojure.core/*err* that java classes don't know >>>>> about. >>>>> >>>>> (ins)user=> (def fut (future (throw (Exception. "oops" >>>>> #'user/fut >>>>> (ins)user=> @fut ; waits until deref to raise the error >>>>> Execution error at user/fn (REPL:11). >>>>> oops >>>>> (ins)user=> (def fut2 (future (try (throw (Exception. "oops")) (catch >>>>> Exception e (println "wat\n" e) ; prints instead of raising >>>>> #'user/fut2 >>>>> user=> wat >>>>> #error { >>>>> :cause oops >>>>> :via >>>>> [{:type java.lang.Exception >>>>>:message oops >>>>>:at [user$fn__165 invokeStatic NO_SOURCE_FILE 13]}] >>>>> :trace >>>>> [[user$fn__165 invokeStatic NO_SOURCE_FILE 13] >>>>> [user$fn__165 invoke NO_SOURCE_FILE 13] >>>>> [clojure.core$binding_conveyor_fn$fn__5754 invoke core.clj 2030] >>>>> [clojure.lang.AFn call AFn.java 18] >>>>> [java.util.concurrent.FutureTask run FutureTask.java 264] >>>>> [java.util.concurrent.ThreadPoolExecutor runWorker >>>>> ThreadPoolExecutor.java
Re: Socket servers, threads, and redirecting error output.
Ah, thanks for pointing that out. I must've overlooked your example, because I'd already written off futures. It seems like what you are suggesting, catch and print, might be about as good as I could hope for. If I don't want to block the main thread, then I don't see what else I could possibly do but print the exception. I guess I could store it somewhere, but in any case, I'd use this same pattern. Thanks, Justin. On Saturday, January 2, 2021 at 1:44:55 PM UTC-8 noise...@gmail.com wrote: > to be clear, in my second example you see the error from the future > without using deref > > good luck finding your solution > > On Sat, Jan 2, 2021 at 12:50 PM Austin Haas wrote: > >> Thank you very much for the explanation, Justin. >> >> I don't see how I can use futures, though, without blocking on the main >> thread (to get the exception when it occurs). I'm spawning a long-running >> process that never returns a value. >> On Saturday, January 2, 2021 at 12:43:14 AM UTC-8 noise...@gmail.com >> wrote: >> >>> By the time the exception is caught, you are already outside the context >>> of the Thread which the repl client is interacting with. The default >>> exception handler has no information tying the executing thread to the repl >>> process (not to mention the dynamic variables clojure is using to associate >>> output from code your client runs with that socket connection). >>> >>> You probably don't want to rebind the root exception handler to show >>> *all* exceptions to your client socket. Which means that you need to set up >>> some soft of infrastructure connecting the information about the failed >>> function to the socket you are listening to. >>> >>> I find "future" very convenient for this, it uses a pool which will >>> perform better than creating Threads ad-hoc, and will capture Exceptions >>> and re-throw when you deref (of course, it's up to you to ensure you deref, >>> or use try/catch and otherwise forward the failure information via the >>> catch block). Also, it conveys dynamic bindings for things like >>> clojure.core/*out* and clojure.core/*err* that java classes don't know >>> about. >>> >>> (ins)user=> (def fut (future (throw (Exception. "oops" >>> #'user/fut >>> (ins)user=> @fut ; waits until deref to raise the error >>> Execution error at user/fn (REPL:11). >>> oops >>> (ins)user=> (def fut2 (future (try (throw (Exception. "oops")) (catch >>> Exception e (println "wat\n" e) ; prints instead of raising >>> #'user/fut2 >>> user=> wat >>> #error { >>> :cause oops >>> :via >>> [{:type java.lang.Exception >>>:message oops >>>:at [user$fn__165 invokeStatic NO_SOURCE_FILE 13]}] >>> :trace >>> [[user$fn__165 invokeStatic NO_SOURCE_FILE 13] >>> [user$fn__165 invoke NO_SOURCE_FILE 13] >>> [clojure.core$binding_conveyor_fn$fn__5754 invoke core.clj 2030] >>> [clojure.lang.AFn call AFn.java 18] >>> [java.util.concurrent.FutureTask run FutureTask.java 264] >>> [java.util.concurrent.ThreadPoolExecutor runWorker >>> ThreadPoolExecutor.java 1128] >>> [java.util.concurrent.ThreadPoolExecutor$Worker run >>> ThreadPoolExecutor.java 628] >>> [java.lang.Thread run Thread.java 834]]} >>> >>> >>> >>> On Thu, Dec 31, 2020 at 1:48 PM Austin Haas >>> wrote: >>> >>>> >>>> Problem: When I connect to a socket server and create a thread, >>>> exceptions in the thread are printed in the server's process, not the >>>> client's. I'd like them to appear in the client's process, where the >>>> thread >>>> was created. >>>> >>>> (I'm using the term "process" very generally here, because I don't >>>> understand what is going on.) >>>> >>>> From searching, I understand that there are some other things at play, >>>> like System/err, but I don't understand what is happening or how I can >>>> work >>>> around it. Why does an exception thrown in the client process show in the >>>> client process, but an exception thrown in a thread created by the client >>>> process shows in the server process? Why doesn't binding *err* in a thread >>>> seem to have any effect? Any suggestions or workarounds? >>>> >>>> I'm not using futures, because this is a long-r
Re: Socket servers, threads, and redirecting error output.
Thank you very much for the explanation, Justin. I don't see how I can use futures, though, without blocking on the main thread (to get the exception when it occurs). I'm spawning a long-running process that never returns a value. On Saturday, January 2, 2021 at 12:43:14 AM UTC-8 noise...@gmail.com wrote: > By the time the exception is caught, you are already outside the context > of the Thread which the repl client is interacting with. The default > exception handler has no information tying the executing thread to the repl > process (not to mention the dynamic variables clojure is using to associate > output from code your client runs with that socket connection). > > You probably don't want to rebind the root exception handler to show *all* > exceptions to your client socket. Which means that you need to set up some > soft of infrastructure connecting the information about the failed function > to the socket you are listening to. > > I find "future" very convenient for this, it uses a pool which will > perform better than creating Threads ad-hoc, and will capture Exceptions > and re-throw when you deref (of course, it's up to you to ensure you deref, > or use try/catch and otherwise forward the failure information via the > catch block). Also, it conveys dynamic bindings for things like > clojure.core/*out* and clojure.core/*err* that java classes don't know > about. > > (ins)user=> (def fut (future (throw (Exception. "oops" > #'user/fut > (ins)user=> @fut ; waits until deref to raise the error > Execution error at user/fn (REPL:11). > oops > (ins)user=> (def fut2 (future (try (throw (Exception. "oops")) (catch > Exception e (println "wat\n" e) ; prints instead of raising > #'user/fut2 > user=> wat > #error { > :cause oops > :via > [{:type java.lang.Exception >:message oops >:at [user$fn__165 invokeStatic NO_SOURCE_FILE 13]}] > :trace > [[user$fn__165 invokeStatic NO_SOURCE_FILE 13] > [user$fn__165 invoke NO_SOURCE_FILE 13] > [clojure.core$binding_conveyor_fn$fn__5754 invoke core.clj 2030] > [clojure.lang.AFn call AFn.java 18] > [java.util.concurrent.FutureTask run FutureTask.java 264] > [java.util.concurrent.ThreadPoolExecutor runWorker > ThreadPoolExecutor.java 1128] > [java.util.concurrent.ThreadPoolExecutor$Worker run > ThreadPoolExecutor.java 628] > [java.lang.Thread run Thread.java 834]]} > > > > On Thu, Dec 31, 2020 at 1:48 PM Austin Haas wrote: > >> >> Problem: When I connect to a socket server and create a thread, >> exceptions in the thread are printed in the server's process, not the >> client's. I'd like them to appear in the client's process, where the thread >> was created. >> >> (I'm using the term "process" very generally here, because I don't >> understand what is going on.) >> >> From searching, I understand that there are some other things at play, >> like System/err, but I don't understand what is happening or how I can work >> around it. Why does an exception thrown in the client process show in the >> client process, but an exception thrown in a thread created by the client >> process shows in the server process? Why doesn't binding *err* in a thread >> seem to have any effect? Any suggestions or workarounds? >> >> I'm not using futures, because this is a long-running process that never >> returns a value. >> >> Example transcript: >> >> # Socker server >> >> (The only command entered is the first one, which begins with clj. >> Everything after "user=>" is due to the client below.) >> >> $ clj -J-Dclojure.server.myrepl='{:port >> ,:accept,clojure.core.server/repl}' >> Clojure 1.10.1 >> user=> My second message. >> Exception in thread "Thread-0" clojure.lang.ExceptionInfo: My second >> exception {} >> at user$eval5$fn__141.invoke(NO_SOURCE_FILE:7) >> at clojure.lang.AFn.run(AFn.java:22) >> at java.lang.Thread.run(Thread.java:745) >> Exception in thread "Thread-1" clojure.lang.ExceptionInfo: My third >> exception {} >> at user$eval144$fn__145.invoke(NO_SOURCE_FILE:16) >> at clojure.lang.AFn.run(AFn.java:22) >> at java.lang.Thread.run(Thread.java:745) >> >> # Client >> >> $ nc localhost >> user=> (println "My first message.") >> My first message. >> nil >> user=> (throw (ex-info "My first exception." {})) >> Execution error (ExceptionInfo) at user/eval3 (REPL:2). >> My first exception. >> user=> (.start >
Socket servers, threads, and redirecting error output.
Problem: When I connect to a socket server and create a thread, exceptions in the thread are printed in the server's process, not the client's. I'd like them to appear in the client's process, where the thread was created. (I'm using the term "process" very generally here, because I don't understand what is going on.) >From searching, I understand that there are some other things at play, like System/err, but I don't understand what is happening or how I can work around it. Why does an exception thrown in the client process show in the client process, but an exception thrown in a thread created by the client process shows in the server process? Why doesn't binding *err* in a thread seem to have any effect? Any suggestions or workarounds? I'm not using futures, because this is a long-running process that never returns a value. Example transcript: # Socker server (The only command entered is the first one, which begins with clj. Everything after "user=>" is due to the client below.) $ clj -J-Dclojure.server.myrepl='{:port ,:accept,clojure.core.server/repl}' Clojure 1.10.1 user=> My second message. Exception in thread "Thread-0" clojure.lang.ExceptionInfo: My second exception {} at user$eval5$fn__141.invoke(NO_SOURCE_FILE:7) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Thread.java:745) Exception in thread "Thread-1" clojure.lang.ExceptionInfo: My third exception {} at user$eval144$fn__145.invoke(NO_SOURCE_FILE:16) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Thread.java:745) # Client $ nc localhost user=> (println "My first message.") My first message. nil user=> (throw (ex-info "My first exception." {})) Execution error (ExceptionInfo) at user/eval3 (REPL:2). My first exception. user=> (.start (Thread. (fn [] (println "My second message.") (throw (ex-info "My second exception" {}) nil user=> (.start (Thread. (let [out *out* err *err*] (fn [] (binding [*out* out *err* err] (println "My third message.") (throw (ex-info "My third exception" {}))) nil My third message. Any clues would be appreciated. Thanks! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/d084b0c0-0a1b-4db2-95a1-f38ff894bfa6n%40googlegroups.com.
Re: How to safely print structures that may contain infinite lazy seqs?
Thanks, Justin! Yeah, I noticed that range doesn't return an instance of clojure.lang.LazySeq, so I added a print-method for clojure.lang.Iterate. And that one seems to work as expected, but apparently you can't override the print-method for clojure.lang.LazySeq. But this doesn't seem like a good approach, anyway, because I don't want to change the printing behavior globally. I think I'm just going to have to forego logging arbitrary things, and maybe implement some optional santization if necessary. On Monday, November 2, 2020 at 12:40:48 PM UTC-8 noise...@gmail.com wrote: > hit send too soon -- > > also, that print-method doesn't catch all lazy values > > user=> (instance? clojure.lang.LazySeq (range)) > false > > user=> (supers (class (range))) > #{java.lang.Iterable java.util.List clojure.lang.Obj > clojure.lang.IPending java.io.Serializable clojure.lang.IHashEq > java.util.Collection clojure.lang.IObj clojure.lang.Sequential > clojure.lang.Seqable clojure.lang.IPersistentCollection > clojure.lang.ASeq clojure.lang.IReduce java.lang.Object > clojure.lang.ISeq clojure.lang.IMeta clojure.lang.IReduceInit} > > On Mon, Nov 2, 2020 at 12:36 PM Justin Smith wrote: > > > > > The next step might be to investigate why infinite lazy seqs don't > print as clojure.lang.LazySeq, like the finite ones. > > > > that printing of "clojure.lang.LazySeq@c5d38b66" relies on completely > > realizing the input, as it relies on the hash, which relies on the > > fully realized value > > > > On Mon, Nov 2, 2020 at 12:32 PM Austin Haas > wrote: > > > > > > Thanks, Juan. > > > > > > I don't need to know the length of the seq, though, only that it is > lazy. I don't want to realize any lazy seqs. Ideally, I'd like to be able > to print any data structure and have all lazy seqs print just like it does > in the example I gave above (i.e., "clojure.lang.LazySeq@c5d38b66"), > whether it is finite or infinite. > > > > > > I also don't want to walk through every data structure to check if it > contains a lazy seq, but maybe that is the only option. > > > > > > I've also tried: > > > > > > (defmethod print-method clojure.lang.LazySeq [q, w] > > > (.write w "#clojure.lang.LazySeq")) > > > > > > The next step might be to investigate why infinite lazy seqs don't > print as clojure.lang.LazySeq, like the finite ones. > > > On Monday, November 2, 2020 at 9:22:58 AM UTC-8 jpmon...@gmail.com > wrote: > > >> > > >> Hi Austin, > > >> > > >> Since there is no way to know the length of a lazy-seq without > realizing it, I think your only choice is to set a limit on it by binding > *print-length* if you are not sure about the sequence. > > >> > > >> Other thing you can try is bounded-count like this : > > >> > > >> (defn looks-finite? [xs] > > >> (let [limit 1000] > > >> (< (bounded-count limit xs) limit))) > > >> > > >> (looks-finite? (map inc (range))) ;; => false > > >> (looks-finite? (map inc (range 100))) ;; => true > > >> > > >> I hope that helps. > > >> > > >> Juan > > >> El domingo, 1 de noviembre de 2020 a las 20:06:39 UTC-3, Austin Haas > escribió: > > >>> > > >>> > > >>> How can I make sure that a logging function won't try to realize an > infinite lazy seq that could be anywhere in the arguments passed to the > logging function? > > >>> > > >>> Is there some way to guarantee that lazy seqs won't be realized when > converting to a string? > > >>> > > >>> I know I can bind *print-length*, but I don't want to constrain > every collection. > > >>> > > >>> And I know that lazy seqs aren't always realized, but that doesn't > seem to help if they are infinite: > > >>> > > >>> user=> (str (map inc (range 10))) > > >>> "clojure.lang.LazySeq@c5d38b66" > > >>> > > >>> user=> (str (map inc (range))) > > >>> > > >>> > > >>> Thanks. > > >>> > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Clojure" group. > > > To post to this group, send email to clo...@googlegroups.com > > > Note that posts from new members are moderated - please be patient > with your first post. > > > To unsubscribe from this grou
Re: How to safely print structures that may contain infinite lazy seqs?
Thanks, Juan. I don't need to know the length of the seq, though, only that it is lazy. I don't want to realize *any* lazy seqs. Ideally, I'd like to be able to print any data structure and have all lazy seqs print just like it does in the example I gave above (i.e., "clojure.lang.LazySeq@c5d38b66"), whether it is finite or infinite. I also don't want to walk through every data structure to check if it contains a lazy seq, but maybe that is the only option. I've also tried: (defmethod print-method clojure.lang.LazySeq [q, w] (.write w "#clojure.lang.LazySeq")) The next step might be to investigate why infinite lazy seqs don't print as clojure.lang.LazySeq, like the finite ones. On Monday, November 2, 2020 at 9:22:58 AM UTC-8 jpmon...@gmail.com wrote: > Hi Austin, > > Since there is no way to know the length of a lazy-seq without realizing > it, I think your only choice is to set a limit on it by binding > *print-length* if you are not sure about the sequence. > > Other thing you can try is bounded-count like this : > > (defn looks-finite? [xs] > (let [limit 1000] > (< (bounded-count limit xs) limit))) > > (looks-finite? (map inc (range))) ;; => false > (looks-finite? (map inc (range 100))) ;; => true > > I hope that helps. > > Juan > El domingo, 1 de noviembre de 2020 a las 20:06:39 UTC-3, Austin Haas > escribió: > >> >> How can I make sure that a logging function won't try to realize an >> infinite lazy seq that could be anywhere in the arguments passed to the >> logging function? >> >> Is there some way to guarantee that lazy seqs won't be realized when >> converting to a string? >> >> I know I can bind *print-length*, but I don't want to constrain every >> collection. >> >> And I know that lazy seqs aren't always realized, but that doesn't seem >> to help if they are infinite: >> >> user=> (str (map inc (range 10))) >> "clojure.lang.LazySeq@c5d38b66" >> >> user=> (str (map inc (range))) >> >> >> Thanks. >> >> -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/ab820e20-75ad-4852-aa01-9321cb7487b4n%40googlegroups.com.
How to safely print structures that may contain infinite lazy seqs?
How can I make sure that a logging function won't try to realize an infinite lazy seq that could be anywhere in the arguments passed to the logging function? Is there some way to guarantee that lazy seqs won't be realized when converting to a string? I know I can bind *print-length*, but I don't want to constrain every collection. And I know that lazy seqs aren't always realized, but that doesn't seem to help if they are infinite: user=> (str (map inc (range 10))) "clojure.lang.LazySeq@c5d38b66" user=> (str (map inc (range))) Thanks. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/baafafb8-7038-4d70-ac64-f885ef466dben%40googlegroups.com.
Re: Inconsistent AOT classnotfoundexception
We ended up sticking with AOT (for now, anyway), because it seems easier to manage in the codebase. The alternative is to use data structures that can be eval'd, like you would use in the body of a macro. I like how that clearly separates the code that runs on the local machine from that which runs on the server, but our pipeline is dynamic and there is a lot of function composition, and it seems unwieldy to work with code-as-data on such a large scale. It is like having several 500 line macros that each depend on a bunch of "code fragment" emitting functions. Regarding our compilation issue, we've narrowed the problem to the timestamps inside our library jars. Our build server is using GMT/UTC and our local workstations are using PT (currently, 7 hrs behind GMT). If I understand correctly, Lein checks timestamps to determine which files need to be recompiled, and our library jars will have later timestamps than anything new for 7 hours. I don't understand what is happening, but the result is that we get unbound function or class not found exceptions. It may have something to due with how timestamps are represented in jars. We have confirmed that the clock and timezone is set correctly on the server. Any clues? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/5e9e8773-040b-4246-8481-48f004270523%40googlegroups.com.
Re: Inconsistent AOT classnotfoundexception
Thanks for your replies. I've looked at clj-headlights a bunch, and datasplash, too. I was mistaken to think that AOT was necessary. Earlier in the project, AOT simplified a few things, like affording the use of anonymous functions (in ParDo implementations), and I don't think I realized until now that we had a made a severe tradeoff. I still don't know what is going on with the AOT and the loading, but I'm optimistic that I can bypass the issue entirely by avoiding AOT. -austin > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/43cf0c68-48d7-47ea-9776-14fb7f009e08%40googlegroups.com.
Inconsistent AOT classnotfoundexception
I have to use AOT for a project, because it uses Apache Beam/Google Dataflow. There are two libraries: A and B. A depends on B. Both require AOT. B uses :aot :all in the project.clj :dev profile, so that it will AOT for tests, but not for the jar. A uses :aot :all at the top level of its project.clj. Sometimes, when the program runs, I will get a ClassNotFoundException. The file name for the missing class has a number appended to it (same number every time). The corresponding class file is in the target directory, but the appended number is much higher. What is going on here? Are my classes being compiled multiple times? Are they being compiled in a nondeterministic order? Any clues would be appreciated. So far, this code always works when I build and install locally. It seemed to fail every time after I built it on our build server and served it though a jar repository, but it started working a few hours later when I got on VPN. And then it started throwing the exception again when I brought it in as a dependency of a new project. Thanks. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/8d640e44-013b-4e98-8249-d230270097de%40googlegroups.com.
Re: What's the end goal for tools.deps?
"Several tools already exist to AOT compile deps.edn projects." Alex, can you please identify some of those projects? I haven't been able to find any. -austin -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Inconsistent stack traces from the same expression.
Thanks, Alex. I didn't know about *e or Throwable->map. -austin On Wednesday, October 24, 2018 at 9:07:44 PM UTC-7, Alex Miller wrote: > > Re clj / the built-in repl: > > user=> (doc pst) > - > clojure.repl/pst > ([] [e-or-depth] [e depth]) > Prints a stack trace of the exception, to the depth requested. If none > supplied, *uses the root cause* of the > most recent repl exception (*e), and a depth of 12. > > That is, it only prints the root cause (bottom level) exception in the > stack. > > Leiningen uses its own exception printer and overrides what's in core. I'm > not sure where exactly that's done. > > Perhaps useful for debugging, you can just do *e at the repl - that will > evaluate and print the last exception in the *e var. Exceptions have a > built-in printer that prints the exception as data and will include the > full stack. You can access the same functionality with the core function > Throwable->map: > > (Throwable->map *e) > > Sometimes useful for investigating the truth of the matter in a consumable > way and taking the (possibly customized) repl machinery out of the picture. > > > > > > > On Wednesday, October 24, 2018 at 8:52:58 PM UTC-5, Austin Haas wrote: >> >> I don't understand what is going on here. I'm trying to throw an >> exception with a cause and sometimes the cause is included in the >> stacktrace and sometimes it isn't. >> >> ~$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version >> "1.10.0-beta4"}}}' >> Clojure 1.10.0-beta4 >> user=> (try (/ 1 0) (catch Exception e "caught")) >> "caught" >> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and >> rethrown" e >> Evaluation error (ArithmeticException) at clojure.lang.Numbers.divide ( >> Numbers.java:188). >> Divide by zero >> user=> (clojure.repl/pst) >> ArithmeticException Divide by zero >> clojure.lang.Numbers.divide (Numbers.java:188) >> clojure.lang.Numbers.divide (Numbers.java:3901) >> user$eval3.invokeStatic (:2) >> user$eval3.invoke (:2) >> clojure.lang.Compiler.eval (Compiler.java:7172) >> clojure.lang.Compiler.eval (Compiler.java:7135) >> clojure.core/eval (core.clj:3206) >> clojure.core/eval (core.clj:3202) >> clojure.main/repl/read-eval-print--8898/fn--8901 (main.clj:309) >> clojure.main/repl/read-eval-print--8898 (main.clj:307) >> clojure.main/repl/fn--8907 (main.clj:332) >> clojure.main/repl (main.clj:332) >> nil >> >> Same behavior with Clojure 1.8 and 1.9. >> >> If I start a REPL via lein, the cause appears: >> >> $ lein repl >> nREPL server started on port 46767 on host 127.0.0.1 - nrepl:// >> 127.0.0.1:46767 >> REPL-y 0.3.7, nREPL 0.2.12 >> Clojure 1.8.0 >> Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14 >> Docs: (doc function-name-here) >> (find-doc "part-of-name-here") >> Source: (source function-name-here) >> Javadoc: (javadoc java-object-or-class-here) >> Exit: Control+D or (exit) or (quit) >> Results: Stored in vars *1, *2, *3, an exception in *e >> >> >> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and >> rethrown" e >> >> >> ArithmeticException Divide by zero clojure.lang.Numbers.divide >> (Numbers.java:158) >> user=> (clojure.repl/pst) >> java.lang.Exception: caught and rethrown >> (Unknown Source) user/eval1736 >> (Unknown Source) user/eval1736 >> Compiler.java:6927 clojure.lang.Compiler. >> eval >> Compiler.java:6890 clojure.lang.Compiler. >> eval >> core.clj:3105 clojure.core/eval >> core.clj:3101 clojure.core/eval >> main.clj:240 clojure.main/repl[fn] >> main.clj:240 clojure.main/repl[fn] >> main.clj:258 clojure.main/repl[fn] >> main.clj:258 clojure.main/repl >> main.clj:174 clojure.main/repl >> RestFn.java:1523 clojure.lang.RestFn. >> invoke >> interruptible_eval.clj:87 clojure.tools.nrepl. >> middleware.interruptible-eval/evaluate[fn] >> AFn.java:152
Re: Inconsistent stack traces from the same expression.
Thanks. I would not have thought to check that. These are the processes running after launching each REPL. $ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-beta4"}}}' Does not include cause. rlwrap -r -q \" -b (){}[],^%3@";:' clojure -Sdeps {:deps {org.clojure/clojure {:mvn/version "1.10.0-beta4"}}} /usr/bin/java -Dclojure.libfile=/home/austin/.clojure/.cpcache/638968264.libs -classpath src:/home/austin/.m2/repository/org/clojure/clojure/1.10.0-beta4/clojure-1.10.0-beta4.jar:/home/austin/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar:/home/austin/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar clojure.main $ lein repl Includes cause. java -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false -Dmaven.wagon.rto=1 -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dleiningen.original.pwd=/home/austin -Dleiningen.script=/home/austin/bin/lein -classpath /home/austin/.lein/self-installs/leiningen-2.8.1-standalone.jar clojure.main -m leiningen.core.main repl $ lein repl (inside project) Does not include cause. java -Dfile.encoding=UTF-8 -Dmaven.wagon.http.ssl.easy=false -Dmaven.wagon.rto=1 -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dleiningen.original.pwd=/home/austin/test-project -Dleiningen.script=/home/austin/bin/lein -classpath /home/austin/.lein/self-installs/leiningen-2.8.1-standalone.jar clojure.main -m leiningen.core.main repl java -classpath /home/austin/test-project/test:/home/austin/test-project/src:/home/austin/test-project/dev-resources:/home/austin/test-project/resources:/home/austin/test-project/target/classes:/home/austin/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar:/home/austin/.m2/repository/org/clojure/tools.nrepl/0.2.12/tools.nrepl-0.2.12.jar:/home/austin/.m2/repository/clojure-complete/clojure-complete/0.2.4/clojure-complete-0.2.4.jar -Dfile.encoding=UTF-8 -XX:-OmitStackTraceInFastThrow -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dclojure.compile.path=/home/austin/test-project/target/classes -Dtest-project.version=0.1.0-SNAPSHOT -Dclojure.debug=false clojure.main -i /tmp/form-init3009346480080427936.clj I'm not sure what to make of this. I don't see anything unusual, but I have limited experience with Java. Why does running `lein repl` in a project directory start two processes? -austin On Wednesday, October 24, 2018 at 7:40:28 PM UTC-7, Andy Fingerhut wrote: > > I am not sure if this is the reason, but I would recommend checking the > command line options used when starting the java process in these cases. > Leiningen uses some command line options by default, for faster startup > times I think, that might affect how much detail is captured in stack > traces when exceptions are created. > > Andy > > On Wed, Oct 24, 2018 at 6:53 PM Austin Haas > wrote: > >> I don't understand what is going on here. I'm trying to throw an >> exception with a cause and sometimes the cause is included in the >> stacktrace and sometimes it isn't. >> >> ~$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version >> "1.10.0-beta4"}}}' >> Clojure 1.10.0-beta4 >> user=> (try (/ 1 0) (catch Exception e "caught")) >> "caught" >> user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and >> rethrown" e >> Evaluation error (ArithmeticException) at clojure.lang.Numbers.divide ( >> Numbers.java:188). >> Divide by zero >> user=> (clojure.repl/pst) >> ArithmeticException Divide by zero >> clojure.lang.Numbers.divide (Numbers.java:188) >> clojure.lang.Numbers.divide (Numbers.java:3901) >> user$eval3.invokeStatic (:2) >> user$eval3.invoke (:2) >> clojure.lang.Compiler.eval (Compiler.java:7172) >> clojure.lang.Compiler.eval (Compiler.java:7135) >> clojure.core/eval (core.clj:3206) >> clojure.core/eval (core.clj:3202) >> clojure.main/repl/read-eval-print--8898/fn--8901 (main.clj:309) >> clojure.main/repl/read-eval-print--8898 (main.clj:307) >> clojure.main/repl/fn--8907 (main.clj:332) >> clojure.main/repl (main.clj:332) >> nil >> >> Same behavior with Clojure 1.8 and 1.9. >> >> If I start a REPL via lein, the cause appears: >> >> $ lein repl >> nREPL server started on port 46767 on host 127.0.0.1 - nrepl:// >> 127.0.0.1:46767 >> REPL-y 0.3.7, nREPL 0.2.12 >> Clojure 1.8.0 >> Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14 >> Docs: (doc function-name-here) >> (find-doc "part-of-name-here") >> Source: (source function-name-here) >> Javadoc: (javadoc java-object-or-class-here) >> Exit: Control+D or (exit) or (quit)
Inconsistent stack traces from the same expression.
I don't understand what is going on here. I'm trying to throw an exception with a cause and sometimes the cause is included in the stacktrace and sometimes it isn't. ~$ clj -Sdeps '{:deps {org.clojure/clojure {:mvn/version "1.10.0-beta4"}}}' Clojure 1.10.0-beta4 user=> (try (/ 1 0) (catch Exception e "caught")) "caught" user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and rethrown" e Evaluation error (ArithmeticException) at clojure.lang.Numbers.divide ( Numbers.java:188). Divide by zero user=> (clojure.repl/pst) ArithmeticException Divide by zero clojure.lang.Numbers.divide (Numbers.java:188) clojure.lang.Numbers.divide (Numbers.java:3901) user$eval3.invokeStatic (:2) user$eval3.invoke (:2) clojure.lang.Compiler.eval (Compiler.java:7172) clojure.lang.Compiler.eval (Compiler.java:7135) clojure.core/eval (core.clj:3206) clojure.core/eval (core.clj:3202) clojure.main/repl/read-eval-print--8898/fn--8901 (main.clj:309) clojure.main/repl/read-eval-print--8898 (main.clj:307) clojure.main/repl/fn--8907 (main.clj:332) clojure.main/repl (main.clj:332) nil Same behavior with Clojure 1.8 and 1.9. If I start a REPL via lein, the cause appears: $ lein repl nREPL server started on port 46767 on host 127.0.0.1 - nrepl: //127.0.0.1:46767 REPL-y 0.3.7, nREPL 0.2.12 Clojure 1.8.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here) Javadoc: (javadoc java-object-or-class-here) Exit: Control+D or (exit) or (quit) Results: Stored in vars *1, *2, *3, an exception in *e user=> (try (/ 1 0) (catch Exception e (throw (Exception. "caught and rethrown" e ArithmeticException Divide by zero clojure.lang.Numbers.divide (Numbers.java:158) user=> (clojure.repl/pst) java.lang.Exception: caught and rethrown (Unknown Source) user/eval1736 (Unknown Source) user/eval1736 Compiler.java:6927 clojure.lang.Compiler. eval Compiler.java:6890 clojure.lang.Compiler. eval core.clj:3105 clojure.core/eval core.clj:3101 clojure.core/eval main.clj:240 clojure.main/repl[fn] main.clj:240 clojure.main/repl[fn] main.clj:258 clojure.main/repl[fn] main.clj:258 clojure.main/repl main.clj:174 clojure.main/repl RestFn.java:1523 clojure.lang.RestFn. invoke interruptible_eval.clj:87 clojure.tools.nrepl. middleware.interruptible-eval/evaluate[fn] AFn.java:152 clojure.lang.AFn. applyToHelper AFn.java:144 clojure.lang.AFn.applyTo core.clj:646 clojure.core/apply core.clj:1881 clojure.core/with- bindings* core.clj:1881 clojure.core/with- bindings* RestFn.java:425 clojure.lang.RestFn. invoke interruptible_eval.clj:85 clojure.tools.nrepl. middleware.interruptible-eval/evaluate interruptible_eval.clj:55 clojure.tools.nrepl. middleware.interruptible-eval/evaluate interruptible_eval.clj:224 clojure.tools.nrepl. middleware.interruptible-eval/interruptible-eval[fn] interruptible_eval.clj:192 clojure.tools.nrepl. middleware.interruptible-eval/run-next[fn] AFn.java:22 clojure.lang.AFn.run ThreadPoolExecutor.java:1142 java.util.concurrent. ThreadPoolExecutor.runWorker ThreadPoolExecutor.java:617 java.util.concurrent. ThreadPoolExecutor$Worker.run Thread.java:745 java.lang.Thread.run Caused by: java.lang.ArithmeticException: Divide by zero Numbers.java:158 clojure.lang.Numbers. divide Numbers.java:3808 clojure.lang.Numbers. divide nil But if I run lein repl from inside a project directory, the cause is not included: $ lein new test-project Generating a project called test-project based on the 'default' template. The default template is intended for library projects, not applications. To see other templates (app, plugin, etc), try `lein help new`. ~$ cd test-project/ ~/test-project$ lein repl nREPL server started on port 36739 on host 127.0.0.1 - nrepl://127.0.0.1: 36739 REPL-y 0.3.7, nREPL 0.2.12 Clojure 1.8.0 Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source function-name-here)
Re: What is the minimal Emacs config for practical Clojure development?
Quick update. After a reboot, my REPL starts up much faster (~3-4 seconds) than I reported above. Sorry for the noise. I started adding CLJS support to inf-clojure: https://github.com/austinhaas/inf-clojure/tree/cljs Some of the problems that I reported above were due to inf-clojure only partially working for Clojurescript. Some things, like eldoc, were broken because they were written with nonportable Clojure code. I also discovered that occasionally inf-clojure will detect the wrong REPL type, which results in some of the other problems I reported above. I filed a bug here: https://github.com/clojure-emacs/inf-clojure/issues/151 -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I've determined that the previously mentioned errors are related to incompatibilities with inf-clojure and clojurescript. I filed a bug, and a workaround, with inf-clojure here: https://github.com/clojure-emacs/inf-clojure/issues/150 -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I shouldn't have said that two of those errors were the same. They're different, but they both mention unquoted symbols. Monroe clojure.lang.ExceptionInfo: Arguments to require must be quoted. Offending spec: (symbol (namespace (quote clojure.repl/pst))) at line 1 {:file "", :line 1, :column 5, :root-source-info {:source-type :fragment, :source-form (do (require (symbol (namespace (quote clojure.repl/pst (clojure.repl/pst *e))}, :tag :cljs/analysis-error} inf-clojure WARNING: Use of undeclared Var cljs.user/Throwable at line 6 clojure.lang.ExceptionInfo: Assert failed: Argument to resolve must be a quoted symbol (core/and (seq? quoted-sym) (= (quote quote) (first quoted-sym))) at line 4 {:file "", :line 4, :column 2, :root-source-info {:source-type :fragment, :source-form (try (:arglists (clojure.core/meta (clojure.core/resolve (clojure.core/read-string "ClojureScript" (catch Throwable t nil))}, :tag :cljs/analysis-error} -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I tried this, changing node to browser, like so: clojure -J-Dclojure.server.repl="{:port ${1:-} :accept cljs.server.browser/repl}" -cljs-canary -m cljs.main -re browser -r That starts a REPL in my terminal, but when I try to connect to it from Emacs, using C-c M-c RET localhost RET , I get the following in my Emacs *inf-clojure* buffer: Process inf-clojure connection broken by remote peer and the following the terminal REPL: Exception in thread "Clojure Connection repl 1" java.lang.RuntimeException: Unable to resolve symbol: PrintWriter-on in this context, compiling:(cljs/core/server.clj:81:29) On Friday, July 6, 2018 at 4:50:57 PM UTC-7, Andrea Richiardi wrote: > > Ok this command will open a socket REPL directly in cljs.user: > > clojure -J-Dclojure.server.repl="{:port ${1:-} :accept > cljs.server.node/repl}" -R:cljs-canary -m cljs.main -re node -r > > You need the right deps.edn aliases - then you will be able to nc > localhost or inf-clojure-connect to it. > > On Friday, July 6, 2018 at 11:18:56 AM UTC-7, Austin Haas wrote: >> >> I spent a couple more hours working with Monroe and Figwheel. I still >> can't figure out how to use the REPL. After trying to evaluate a few >> expressions, Emacs gets completely locked up spewing the following error >> message 1000s of times: >> >> clojure.lang.ExceptionInfo: Arguments to require must be quoted. >> Offending spec: (symbol (namespace (quote clojure.repl/pst))) at line 1 >> {:file "", :line 1, :column 5, :root-source-info >> {:source-type :fragment, :source-form (do (require (symbol (namespace >> (quote clojure.repl/pst (clojure.repl/pst *e))}, :tag >> :cljs/analysis-error} >> >> I've switched back to inf-clojure and Figwheel with the following config: >> >> (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/inf-clojure/") >> (require 'inf-clojure) >> (setf inf-clojure-lein-cmd "lein run -m clojure.main") >> (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode) >> (add-hook 'inf-clojure-mode-hook #'eldoc-mode) >> >> That seems to work, but I see something like this in the minibuffer every >> time I move the cursor, with or without eldoc mode enabled: >> >> def: (:arglists^[[0m >> ^[[36m3^[[0m ^[[36m(clojure.core/meta^[[0m >> ^[[36m4^[[0m ^[[36m(clojure.core/resolve^[[0m >> ^[[36m5^[[0m ^[[36m(clojure.core/read-string "def") >> >> Does "lein run -m clojure.main" create a socket REPL? >> >> I followed the instructions for inf-clojure for a "Clojure Command Line >> Socket REPL" ( >> https://github.com/clojure-emacs/inf-clojure#clojure-command-line-socket-repl), >> >> but then (fig-start) is not found. >> >> I followed the instructions for inf-clojure for a "Leiningen Socket REPL" >> (https://github.com/clojure-emacs/inf-clojure#leiningen-socket-repl), >> and that produces results like with "lein run -m clojure.main"; it works, >> but I get the "eldoc" garbage in the minibuffer. AFAICT, the eldoc problem >> doesn't occur until I run (cljs-repl). >> >> Any insight greatly appreciated. >> >> >> >> >> -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
Yesterday, I followed the excellent "Clojurescript Quick Start Guide" (https://clojurescript.org/guides/quick-start). Everything worked as expected. They did a great job of making it as minimal as possible. After that, I followed the "Emacs and Inferior Clojure Interaction Mode" guide (https://clojurescript.org/tools/emacs-inf). That's a nice guide, too. I had one issue: the instructions are out of date because inf-clojure removed the run-clojure alias for the inf-clojure function. I submitted a patch: https://github.com/clojure/clojurescript-site/pull/246 Currently, I'm running with Emacs, inf-clojure, and lein-cljsbuild. It seems to be working well. I don't have live code reloading, like Figwheel. This is the function I'm using in my .emacs to launch the repl: (defun cljs-browser-repl () (interactive) (inf-clojure "lein trampoline run -m clojure.main repl.clj")) And the contents of repl.clj: (require '[cljs.repl :as repl]) (require '[cljs.repl.browser :as browser]) ;; require the browser implementation of IJavaScriptEnv (def env (browser/repl-env :static-dir ["." "out/" "resources/public/"])) ;; create a new environment (repl/repl env) ;; start the REPL Today, for unknown reasons, I'm no longer getting the "def: (:arglists^[[0m..." messages in my minibuffer, but instead I'm seeing two different errors when I put the cursor in an expression: WARNING: Use of undeclared Var cljs.user/Throwable at line 6 clojure.lang.ExceptionInfo: Assert failed: Argument to resolve must be a quoted symbol (core/and (seq? quoted-sym) (= (quote quote) (first quoted-sym))) at line 4 {:file "", :line 4, :column 2, :root-source-info {:source-type :fragment, :source-form (try (:arglists (clojure.core/meta (clojure.core/resolve (clojure.core/read-string "ClojureScript" (catch Throwable t nil))}, :tag :cljs/analysis-error} This usually pops up in the minibuffer as: defn: (core/and (seq? quoted-sym)), but fortunately the full message went to the REPL once. Note that this is the same error I was when using Monroe instead of inf-clojure. The other message I see is: ReferenceError: planck is not defined () which pops up in the minibuffer as: defn: () I also got this error once when trying to get the docstring for a var: WARNING: No such namespace: lumo.repl, could not locate lumo/repl.cljs, lumo/repl.cljc, or JavaScript source providing "lumo.repl" at line 1 WARNING: Use of undeclared Var lumo.repl/doc at line 1 WARNING: Can't take value of macro cljs.core/declare at line 1 ReferenceError: lumo is not defined () To my knowledge, I'm not using lumo or planck. Andrea, do you still think these are issues with inf-clojure? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
I spent a couple more hours working with Monroe and Figwheel. I still can't figure out how to use the REPL. After trying to evaluate a few expressions, Emacs gets completely locked up spewing the following error message 1000s of times: clojure.lang.ExceptionInfo: Arguments to require must be quoted. Offending spec: (symbol (namespace (quote clojure.repl/pst))) at line 1 {:file "", :line 1, :column 5, :root-source-info {:source-type :fragment, :source-form (do (require (symbol (namespace (quote clojure.repl/pst (clojure.repl/pst *e))}, :tag :cljs/analysis-error} I've switched back to inf-clojure and Figwheel with the following config: (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/inf-clojure/") (require 'inf-clojure) (setf inf-clojure-lein-cmd "lein run -m clojure.main") (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode) (add-hook 'inf-clojure-mode-hook #'eldoc-mode) That seems to work, but I see something like this in the minibuffer every time I move the cursor, with or without eldoc mode enabled: def: (:arglists^[[0m ^[[36m3^[[0m ^[[36m(clojure.core/meta^[[0m ^[[36m4^[[0m ^[[36m(clojure.core/resolve^[[0m ^[[36m5^[[0m ^[[36m(clojure.core/read-string "def") Does "lein run -m clojure.main" create a socket REPL? I followed the instructions for inf-clojure for a "Clojure Command Line Socket REPL" (https://github.com/clojure-emacs/inf-clojure#clojure-command-line-socket-repl), but then (fig-start) is not found. I followed the instructions for inf-clojure for a "Leiningen Socket REPL" (https://github.com/clojure-emacs/inf-clojure#leiningen-socket-repl), and that produces results like with "lein run -m clojure.main"; it works, but I get the "eldoc" garbage in the minibuffer. AFAICT, the eldoc problem doesn't occur until I run (cljs-repl). Any insight greatly appreciated. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
This is good, relevant information. Thank you, Andrea. On Thursday, July 5, 2018 at 4:32:58 PM UTC-7, Andrea Richiardi wrote: > > > > On Thursday, July 5, 2018 at 1:01:14 PM UTC-7, Austin Haas wrote: >> >> Gary, I had tried Figwheel a couple years ago and I had a positive >> experience, so that was the next thing I reached for. >> >> I just want a practical dev environment, for both Clojure and >> Clojurescript. To me, that means simple and stable. I definitely want fewer >> things that can go wrong, but if I can install a package by cloning a repo >> and adding a few lines of elisp, and it works, I'm happy. I don't care how >> complex it is. If it causes my REPL to hang, prints out control characters, >> regularly breaks after updates, etc., then I'd rather drop down to >> something simpler, with fewer features. >> >> > There is one more trick though. > > The new cljs.main allows you to have a socket repl for ClojureScript. This > can then be used with `inf-clojure`. It will not be fancy and probably > things will be broken though...the code path has not been seen much love. I > did some experimentation and it definitely works - quite smoothly in fact - > but I have never have time to make it "production" ready :) > > So this does not actually answers the question, just wanted to put it out > there - sorry! > -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
Gary, I had tried Figwheel a couple years ago and I had a positive experience, so that was the next thing I reached for. I just want a practical dev environment, for both Clojure and Clojurescript. To me, that means simple and stable. I definitely want fewer things that can go wrong, but if I can install a package by cloning a repo and adding a few lines of elisp, and it works, I'm happy. I don't care how complex it is. If it causes my REPL to hang, prints out control characters, regularly breaks after updates, etc., then I'd rather drop down to something simpler, with fewer features. For Clojurescript, I've used lein-cljsbuild in the past. That seemed to work well. I know I've connected to a REPL running in the browser before, but I don't remember it being useful enough to bother with. I don't think I knew how to write "reloadable code", then, though. I would love to hear how people do Clojurescript development today, especially if they aren't using Figwheel. On Thursday, July 5, 2018 at 12:07:13 PM UTC-7, Gary Trakhman wrote: > > I'm not sure the desires for lightweight clojure-emacs integration and any > CLJS integration are yet sympathetic. Figwheel is a pretty complex piece > of software. For example, see my issue that has been languishing for almost > a year and hints at greater problems with the compiler integration: > https://github.com/bhauman/lein-figwheel/issues/593 . From my > perspective, this is more due to coupling of the REPL to the compiler > itself than a problem with figwheel. > > But I was surprised when the thread went in this direction just from > reasons I think someone might want to not use cider, fast startup time, > less stuff to go wrong. CLJS adds that back unless it's gotten > significantly better since the last time I tried. > > On Thu, Jul 5, 2018 at 2:19 PM rob > > wrote: > >> If ClojureScript repl integration works smoothly out of the box then >> that's already one reason to use it over Cider... (This is not a jab at >> Cider, just a statement of fact that Cider's support for ClojureScript >> development has so far been lacking, IME) >> >> >> On Thursday, July 5, 2018 at 10:51:02 AM UTC-7, Austin Haas wrote: >>> >>> >>> I tried Monroe, yesterday. It seems to work as advertised. I didn't have >>> any issues. It's nice that "jump to definition" works out of the box. It >>> does not appear to support Eldoc, so no help with function signatures. >>> >>> This is the Emacs config I'm currently using: >>> >>> ;;; clojure-mode >>> >>> (add-to-list 'load-path >>> "~/.emacs.d/site-lisp/third-party/clojure-mode/") >>> (require 'clojure-mode) >>> (add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) >>> (add-hook 'clojure-mode-hook 'paredit-mode) >>> (add-hook 'clojure-mode-hook 'hs-minor-mode) >>> (add-hook 'clojure-mode-hook #'eldoc-mode) >>> >>> ;;; REPL >>> >>> ;; Monroe >>> >>> (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/monroe/") >>> (require 'monroe) >>> (add-hook 'clojure-mode-hook 'clojure-enable-monroe) >>> (setf monroe-detail-stacktraces 'true) >>> >>> I went on to include Figwheel. >>> >>> I created a new project using `lein new figwheel my-project` (which >>> provides the fig-start and cljs-repl functions), and then entered the >>> following commands to set up a Clojurescript dev environment: >>> >>> M-x monroe-nrepl-server-start >>> M-x monroe >>> (fig-start) >>> (cljs-repl) >>> >>> On my machine, those 4 steps take about 30 seconds to run. The first >>> takes 18 seconds, and the rest only take about a second each, but the whole >>> process ends up taking close to 30. >>> >>> Figwheel seems to work great, but I couldn't figure out how to evaluate >>> code in a library dependency and have it updated in the running system. I >>> can evaluate functions, but the new definitions don't appear to be called >>> by the main code. I might be misunderstanding how this is supposed to work; >>> I don't know if it's a Figwheel issue or a Monroe issue or my mistake. But >>> to work around that, and to fix other issues preventing a clean initial >>> compilation, I had to restart the REPL a few dozen times, which was tedious. >>> >>> I'm posting this information in case it is useful to someone else who is >>> trying to discover the current state-of-the-art with running Clojure in >>> Emacs in a straightforward, minimal w
Re: What is the minimal Emacs config for practical Clojure development?
I tried Monroe, yesterday. It seems to work as advertised. I didn't have any issues. It's nice that "jump to definition" works out of the box. It does not appear to support Eldoc, so no help with function signatures. This is the Emacs config I'm currently using: ;;; clojure-mode (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/clojure-mode/") (require 'clojure-mode) (add-hook 'clojure-mode-hook 'rainbow-delimiters-mode) (add-hook 'clojure-mode-hook 'paredit-mode) (add-hook 'clojure-mode-hook 'hs-minor-mode) (add-hook 'clojure-mode-hook #'eldoc-mode) ;;; REPL ;; Monroe (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/monroe/") (require 'monroe) (add-hook 'clojure-mode-hook 'clojure-enable-monroe) (setf monroe-detail-stacktraces 'true) I went on to include Figwheel. I created a new project using `lein new figwheel my-project` (which provides the fig-start and cljs-repl functions), and then entered the following commands to set up a Clojurescript dev environment: M-x monroe-nrepl-server-start M-x monroe (fig-start) (cljs-repl) On my machine, those 4 steps take about 30 seconds to run. The first takes 18 seconds, and the rest only take about a second each, but the whole process ends up taking close to 30. Figwheel seems to work great, but I couldn't figure out how to evaluate code in a library dependency and have it updated in the running system. I can evaluate functions, but the new definitions don't appear to be called by the main code. I might be misunderstanding how this is supposed to work; I don't know if it's a Figwheel issue or a Monroe issue or my mistake. But to work around that, and to fix other issues preventing a clean initial compilation, I had to restart the REPL a few dozen times, which was tedious. I'm posting this information in case it is useful to someone else who is trying to discover the current state-of-the-art with running Clojure in Emacs in a straightforward, minimal way. I'm also hoping that people will reply with comments and suggested improvements. (FWIW, I've been using Emacs full-time for about 20 years, Clojure full-time for about 7 years, and Common Lisp for 5+ years before that, so I'm not new to REPL-driven development in Emacs.) -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: What is the minimal Emacs config for practical Clojure development?
Thanks for the replies. I only want a stable REPL, integrated with Emacs, and nothing else. Łukasz, why did you switch to Monroe? What do you prefer about it? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
What is the minimal Emacs config for practical Clojure development?
I don't want to use a package manager with Emacs. Should I launch a REPL outside of Emacs, then connect to it? Using the CLI tools (i.e., from the command line: clojure -J-Dclojure.server.repl="{:port :accept clojure.core.server/repl}")? Can I launch a REPL from within Emacs? I've been using inf-clojure and clojure-mode with the following elisp in my .emacs: (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/clojure-mode/") (require 'clojure-mode) (add-to-list 'load-path "~/.emacs.d/site-lisp/third-party/inf-clojure/") (load-file "~/.emacs.d/site-lisp/third-party/inf-clojure/inf-clojure.el") (add-hook 'clojure-mode-hook #'inf-clojure-minor-mode) (setf inf-clojure-lein-cmd "lein run -m clojure.main") and C-c C-z to start a REPL, but I get noise in the REPL, including repeated prompts, and (seemingly) random linebreaks in large output. What's the state of the art for a simple, practical Emacs setup for Clojure? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: "Soft" failures with spec?
I have the same problem: I need to log warnings based on some criteria and reject records completely based on other criteria. I'm currently using two separate specs, but I haven't convinced myself that is the best solution. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: ANN: ClojureScript 0.0-3058, Enhanced REPLs, faster compile times
This is great, David! Is it difficult to include dependencies (e.g., core.async) for a project built this way? -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Clojurescript set count returning erroneous values.
I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Clojurescript set count returning erroneous values.
Unfortunately, no, but not from lack of trying. The best lead I've got thus far is that there is a disj call that returns a defective set, which returns a positive value for count, but does not seem to contain any elements. I've tried to capture the offending values, but I can't reproduce the bug with them. I can't arrange the elements of the set to be in the same order, and I can't get the same hash values for the maps (which contain js objects). I suspect the issue may have something to do with hash collisions. The app state is being shuffled with some randomness, and the problem arises consistently after a minute or two of churn. If I add an extra artificial hash field to each element stored in the set, then the problem disappears (or perhaps it is postponed). I noticed that the defective sets always contain many elements with the same hash. (I know very little about how sets and hashing are implemented.) I'll keep debugging. - austin On Tuesday, May 20, 2014 8:36:37 AM UTC-7, David Nolen wrote: Can you demonstrate a complete minimal example? Thanks, David On Tue, May 20, 2014 at 4:06 AM, Austin Haas aus...@pettomato.comjavascript: wrote: I'm having trouble isolating a small test case. I call the following code in an update tick: (let [prev' @prev state' @state] (let [rems (clojure.set/difference prev' state') adds (clojure.set/difference state' prev')] (reset! prev state') (assert (= (count rems) (count (set rems)) (prev and state hold sets of maps.) After running for a few minutes, the assert will fail. The 'rems' and 'adds' will report that their count is 1, but when I try to access the elements there are either none or only one. What would cause a set to return an incorrect value for count? FWIW, the elements of the sets are maps, and one of the fields holds a mutable javascript array. That was my first suspicion, but the array isn't mutated in my code, and I use a memoized function to generate it (to preserve identity). I'm using [org.clojure/clojurescript 0.0-2202]. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com javascript:. For more options, visit https://groups.google.com/d/optout. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: The Reasoned Schemer chpt 4: Please pass the aspirin
Hi Brian, You should post your question to the miniKanren Google group. minikan...@googlegroups.com -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Sat May 25 10:21 , Brian Craft wrote: Wondering if anyone can give me some pointers with this, as I dive into logic programming. Or point me to a more appropriate forum, if this is the wrong one. I know a lot of you have been trying out core.logic. It was all going well until chapter four. The story so far: introduce some simple function, like cdr, then develop a logic programming equivalent, repeat. Then in chapter four we get the second commandment, and the equivalent functions stop being equivalent. Instead, they generate meaningless results, like 4.18, where the value of z is irrelevant to whether the equivalent function (mem) would succeed, since the target pattern appears earlier in the list, but memo outputs an infinite number of the target pattern. Or they generate incorrect results, like 4.31, where some of the patterns do not satisfy the equivalent function (rember), like (a b _.0 d e): z can't be removed unless it unifies with y, in which case y would have been removed, not z. The chapter concludes by highlighting this issue with surprise, a simple example which generates solutions that don't satisfy the constraints. I was hoping, at that point, for insights into accurately translating functions into their logic programming equivalents, however the chapter ends with Please pass the aspirin, and the book continues with more second commandment examples that also produce unhelpful results. So, I'm a bit baffled about the point of this exercise. Why is it useful to have a second commandment that converts functions into logic programming functions that are superficially similar, but fundamentally different, producing solutions that are irrelevant or incorrect for the original function? Is there some different technique that would allow one to generate correct solutions with logic programming? -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Clojure/West (Portland, Mar 18-20) - Mission Kontrol, unsessions, lightning talks
The arcade is called Ground Kontrol (not Mission Kontrol). http://groundkontrol.com/ Last summer, I attended another conference that rented Ground Kontrol for a few hours of free play. Most games are multi-player, and you know everyone is there for the conference, so it can be a really fun way to meet people. (And they also have a full bar.) -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Wed Feb 06 20:27 , Alex Miller wrote: Clojure/West has a great schedule lined up. If you haven't yet, check out the schedule at http://clojurewest.org/schedule. You can register at http://regonline.com/clojurewest2013. If you've seen the odd couple (Dan Friedman and Will Byrd) talking about miniKanren and logic programming, you know they have a lot of interesting stuff to show. We've got a whole miniKanren Confo lined up colocated with Clojure/West, with not just Dan and Will, but David Nolen, and some other great talks (http://clojurewest.org/sessions#confo). Register as an optional item when you register for Clojure/West. If you're coming in the night before the conference, we've got Mission Kontrol, the arcade wonderland reserved with FREE PLAY on all games from 7-9 pm. It's just a couple blocks from the hotel. Unsessions (https://github.com/strangeloop/clojurewest2013/wiki/Unsessions) and lightning talks (http://bit.ly/WBqELu) are now open for submissions. Unsessions will be scheduled based on interest and lightning talks will be opened up to a poll of attendees prior to the conference. Gonna be great! Alex -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- -- 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 unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: core.logic: datomic unification
Ok, thanks, I'll try to get it to work with PersistentVector. I just started looking at core.logic's internals, and I'm still fairly new to Clojure, so everything is a little fuzzy. I took Sequential for granted, since that is referenced in the existing code. Thanks for the help. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Tue Jan 08 07:28 , David Nolen wrote: The dispatching mechanism was more trouble than it was worth but we did lose some flexibility. Do you really need to unify Sequential or is unifying with a concrete type like PersistentVector work well enough for your use case? David On Tue, Jan 8, 2013 at 2:01 AM, Austin Haas aus...@pettomato.com wrote: The datomic unification code in core.logic has bit-rotted. It depends on IUnifyWithSequential, which was removed in this commit: https://github.com/clojure/core.logic/commit/bbc4e820128d5a0745ce3d79cd3bbd9401a1bf55 I'm trying to understand how to update the code, but I don't get how dispatching works following the above commit. It appears that each implementation of IUnifyTerms must dispatch on the second argument, and I don't see how to get clojure.lang.Sequential to dispatch on a datom unless I override the implementation of clojure.lang.Sequential unify-terms here: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1581 I must be missing something. Any pointers would be appreciated. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com -- 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 -- 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
Re: core.logic: datomic unification
Thanks! I had just finished making similar changes. It was a good exercise and I'm glad to be able to compare code. A couple of questions: 1. Why is there no case for unifying a Datom with another Datom? 2. Why aren't multimethods used for dispatching to the appropriate unification implementation? -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Tue Jan 08 14:30 , David Nolen wrote: I've updated the experimental core.logic Datomic support so that you can unify PersistentVector and Datoms again. In a real system I'd probably recommend providing your own tuple type that does not implement Sequential for doing unification with Datoms. David On Tue, Jan 8, 2013 at 11:55 AM, Austin Haas aus...@pettomato.com wrote: Ok, thanks, I'll try to get it to work with PersistentVector. I just started looking at core.logic's internals, and I'm still fairly new to Clojure, so everything is a little fuzzy. I took Sequential for granted, since that is referenced in the existing code. Thanks for the help. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com On Tue Jan 08 07:28 , David Nolen wrote: The dispatching mechanism was more trouble than it was worth but we did lose some flexibility. Do you really need to unify Sequential or is unifying with a concrete type like PersistentVector work well enough for your use case? David On Tue, Jan 8, 2013 at 2:01 AM, Austin Haas aus...@pettomato.com wrote: The datomic unification code in core.logic has bit-rotted. It depends on IUnifyWithSequential, which was removed in this commit: https://github.com/clojure/core.logic/commit/bbc4e820128d5a0745ce3d79cd3bbd9401a1bf55 I'm trying to understand how to update the code, but I don't get how dispatching works following the above commit. It appears that each implementation of IUnifyTerms must dispatch on the second argument, and I don't see how to get clojure.lang.Sequential to dispatch on a datom unless I override the implementation of clojure.lang.Sequential unify-terms here: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1581 I must be missing something. Any pointers would be appreciated. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com -- 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 -- 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 -- 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
core.logic: datomic unification
The datomic unification code in core.logic has bit-rotted. It depends on IUnifyWithSequential, which was removed in this commit: https://github.com/clojure/core.logic/commit/bbc4e820128d5a0745ce3d79cd3bbd9401a1bf55 I'm trying to understand how to update the code, but I don't get how dispatching works following the above commit. It appears that each implementation of IUnifyTerms must dispatch on the second argument, and I don't see how to get clojure.lang.Sequential to dispatch on a datom unless I override the implementation of clojure.lang.Sequential unify-terms here: https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic.clj#L1581 I must be missing something. Any pointers would be appreciated. -austin -- Austin Haas Pet Tomato, Inc. http://pettomato.com -- 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