Re: Attempting to import class from a non-standard location [interop]
Ah perfect! Thanks Steven. That works great. Simple mistake on my part. On Sunday, November 30, 2014 8:24:18 PM UTC-5, Steven Yi wrote: Hi John, Could this maybe just be a dependencies problem? It seems you're trying to use classes from two different libraries: com.googlecode.libphonenumber/libphonenumber com.googlecode.libphonenumber/carrier If checking the dependencies for your build doesn't solve it, could you explain a little further what build system you are using? steven On Sunday, November 30, 2014 2:49:40 PM UTC-5, John Bohn wrote: Hi all, I'm trying to import a class from a non-standard location.. Specifically, I'm trying to import PhoneNumberToCarrierMapper from libphonenumber and am receiving the following error: Exception in thread main java.lang.ClassNotFoundException: com.google. i18n.phonenumbers.PhoneNumberToCarrierMapper, compiling:(phonelib/shared. clj:1:1) https://github.com/jjbohn/libphonenumber/blob/master/java/carrier/src/com/google/i18n/phonenumbers/PhoneNumberToCarrierMapper.java (ns phonelib.shared (:require [clojure.string :refer [lower-case]]) (:import [com.google.i18n.phonenumbers PhoneNumberUtil PhoneNumberUtil$PhoneNumberFormat PhoneNumberToCarrierMapper])) My assumption is the problem has to do with how the directories are structured in this library ( https://github.com/jjbohn/libphonenumber/tree/master/java https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fjjbohn%2Flibphonenumber%2Ftree%2Fmaster%2Fjavasa=Dsntz=1usg=AFQjCNEwMt2Z5HShgvx-xVqSdCC3EwjrmQ ). Anyone run into this before and know of a workaround? -- 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] freactive - high performance, pure Clojurescript, declarative DOM library
Hi, I am currently trying to make drag and drop work with freactive, but fail so far. This is my code: [:thead [:tr (for [col (first (:content struct))] [:td [:div {:draggable true :on-drag-start (fn [e] (println dragged)) :on-drag-over (fn [e] (.preventDefault e)) :on-drag-enter (fn [e] (.preventDefault e)) :on-drop (fn [e] (.preventDefault e)(println dropped)) :on-drag-end (fn [_] (println drag end))} col] ])]] But nothing happens, no matter what I try. Are there any restrictions? Should this be done in a different way? Best Regards, Sven Am Montag, 17. November 2014 03:20:29 UTC+1 schrieb Aaron Craelius: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: Provide a simple, intuitive API that should be almost obvious to those familiar with Clojure (inspiration from reagent)Allow for high-performance rendering good enough for animated graphics based on a purely declarative syntaxAllow for reactive binding of any attribute, style property or child node Allow for coordinated management of state via cursors (inspiration from om)Provide deeply-integrated animation supportAllow for cursors based on paths as well as lenses Provide a generic items view component for efficient viewing of large data sets Minimize unnecessary triggering of update eventsCoordinate all updates via requestAnimationFrame wherever possibleBe easy to debug Be written in pure Clojurescript Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- 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.
Cursive Reloaded Workflow
I've been playing around with Cursive lately (it seems awesome if I can ever get comfortable with the keybindings!). I emacs/cider, I have a custom keybinding that injects user/reset to trigger something like https://github.com/stuartsierra/reloaded/blob/master/src/leiningen/new/reloaded/templates/user.clj#L48. Is there a way to do this in cursive? -- 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.
New Functional Programming Job Opportunities
Here are some functional programming job opportunities that were posted recently: Software Engineer - Server Applications at Curbside http://functionaljobs.com/jobs/8765-software-engineer-server-applications-at-curbside Cheers, Sean Murphy FunctionalJobs.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 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.
is any work done to draw sequence diagrams with drcode/vijual ?
Hi guys, I'm trying to guess in which state is drcode/vijual https://github.com/drcode/vijual or which would be the better fork to start working on this drawing sequence diagrams feature... It's a really shame that this so cool tool seems to not be maintained any more :( Any advises or any references to start with? thanks in advance Juan -- 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] Re: [ANN] freactive - high performance, pure Clojurescript, declarative DOM library
There are no restrictions on events and attributes (although some attributes may need a special handler if they don't work properly with setAttribute - please submit an issue on github). Looking at your code, maybe the issue is the event handler names - I believe the DOM events are called dragstart, dragend, etc. without a hyphen. On Mon, Dec 1, 2014 at 10:39 AM, Sven Richter sver...@googlemail.com wrote: Hi, I am currently trying to make drag and drop work with freactive, but fail so far. This is my code: [:thead [:tr (for [col (first (:content struct))] [:td [:div {:draggable true :on-drag-start (fn [e] (println dragged)) :on-drag-over (fn [e] (.preventDefault e)) :on-drag-enter (fn [e] (.preventDefault e)) :on-drop (fn [e] (.preventDefault e)(println dropped)) :on-drag-end (fn [_] (println drag end))} col] ])]] But nothing happens, no matter what I try. Are there any restrictions? Should this be done in a different way? Best Regards, Sven Am Montag, 17. November 2014 03:20:29 UTC+1 schrieb Aaron Craelius: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: Provide a simple, intuitive API that should be almost obvious to those familiar with Clojure (inspiration from reagent)Allow for high-performance rendering good enough for animated graphics based on a purely declarative syntaxAllow for reactive binding of any attribute, style property or child node Allow for coordinated management of state via cursors (inspiration from om)Provide deeply-integrated animation supportAllow for cursors based on paths as well as lenses Provide a generic items view component for efficient viewing of large data sets Minimize unnecessary triggering of update eventsCoordinate all updates via requestAnimationFrame wherever possibleBe easy to debug Be written in pure Clojurescript Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to a topic in the Google Groups ClojureScript group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/99myJ9vLeKQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescr...@googlegroups.com. Visit this group at http://groups.google.com/group/clojurescript. -- 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.
Richelieu: a library for advising functions
Hello, Richelieu, a library for advising functions, is in something resembling announcement-worthy shape. It's available at the following URL: http://github.com/thunknyc/richelieu During my experience writing thunknyc/profile and the associated CIDER support, I realized that advising or decorating functions is something that's been getting reinvented over and over. I wanted to put an end to that. Richelieu supports advising functions as well as vars and namespaces. Multiple advise functions can be associated with a function, and advise functions have access to the underlying var or function this is being decorated. Below is an edited sample from the README that shows how to implement tracing advice using the library. I hope this may be useful to one or more people out there. I plan on modifying thunknyc/profile to use Richelieu as part of a push to implement additional profiling modalities. Regards, Edwin (require '[richelieu.core :refer [advice advise-ns *current-advised* defadvice]]) ;;; Here are some simple functions. (defn add [ xs] (apply + xs)) (defn mult [ xs] (apply * xs)) (defn sum-squares [ xs] (apply add (map #(mult % %) xs))) ;;; This tracing advice shows how to get the current advised object, ;;; which can either be a var or a function value, depending on the ;;; context in which the advice was added. (def ^:dynamic *trace-depth* 0) (defn- ^:unadvisable trace-indent [] (apply str (repeat *trace-depth* \space))) (defadvice trace Writes passed arguments and passes them to underlying function. Writes resulting value before returning it as result. [f args] (printf %s %s %s\n (trace-indent) *current-advised* args) (let [res (binding [*trace-depth* (inc *trace-depth*)] (apply f args))] (printf %s %s %s\n (trace-indent) *current-advised* res) res)) (advise-ns 'user trace) (sum-squares 1 2 3 4) ;;; The above invocation produces the following output: ;; #'user/sum-squares (1 2 3 4) ;; #'user/mult (1 1) ;; #'user/mult 1 ;; #'user/mult (2 2) ;; #'user/mult 4 ;; #'user/mult (3 3) ;; #'user/mult 9 ;; #'user/mult (4 4) ;; #'user/mult 16 ;; #'user/add (1 4 9 16) ;; #'user/add 30 ;; #'user/sum-squares 30 -- 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: Linux Bash script to start clojure
2014-12-01 2:08 GMT+01:00 James Reeves ja...@booleanknot.com: Do you know about Leiningen and lein-exec? Yes, I know about them. But not much more. I should look into them. ;-) -- Cecil Westerhof -- 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] Re: [ANN] freactive - high performance, pure Clojurescript, declarative DOM library
Thank you, I have done so here: https://github.com/aaronc/freactive/issues/25 Best Regards, Sven Am Montag, 1. Dezember 2014 18:56:27 UTC+1 schrieb Aaron: There are no restrictions on events and attributes (although some attributes may need a special handler if they don't work properly with setAttribute - please submit an issue on github). Looking at your code, maybe the issue is the event handler names - I believe the DOM events are called dragstart, dragend, etc. without a hyphen. On Mon, Dec 1, 2014 at 10:39 AM, Sven Richter sve...@googlemail.com javascript: wrote: Hi, I am currently trying to make drag and drop work with freactive, but fail so far. This is my code: [:thead [:tr (for [col (first (:content struct))] [:td [:div {:draggable true :on-drag-start (fn [e] (println dragged)) :on-drag-over (fn [e] (.preventDefault e)) :on-drag-enter (fn [e] (.preventDefault e)) :on-drop (fn [e] (.preventDefault e)(println dropped)) :on-drag-end (fn [_] (println drag end))} col] ])]] But nothing happens, no matter what I try. Are there any restrictions? Should this be done in a different way? Best Regards, Sven Am Montag, 17. November 2014 03:20:29 UTC+1 schrieb Aaron Craelius: freactive (pronounced f reactive for functional reactive) is a new high performance, pure Clojurescript, declarative DOM library: https://github.com/aaronc/freactive It has a syntax very similar to that of Reagent and was in fact inspired by Reagent, Om, and others. I came up with it when I was doing some DOM programming after having spending a fair amount of time working with JavaFX (see my soon to be announced library fx-clj: https://github.com/aaronc/fx-clj). I thought Om and Reagent were very nice to work with (and actually inspired some what I did with fx-clj), but I felt from my desktop GUI experience, that I could take things a few steps further. freactive's main advantages over existing solutions are probably built-in animations support and slightly higher performance. Here are it's goals from the README: Provide a simple, intuitive API that should be almost obvious to those familiar with Clojure (inspiration from reagent)Allow for high-performance rendering good enough for animated graphics based on a purely declarative syntaxAllow for reactive binding of any attribute, style property or child node Allow for coordinated management of state via cursors (inspiration from om)Provide deeply-integrated animation supportAllow for cursors based on paths as well as lenses Provide a generic items view component for efficient viewing of large data sets Minimize unnecessary triggering of update eventsCoordinate all updates via requestAnimationFrame wherever possibleBe easy to debug Be written in pure Clojurescript Provide support for older browsers via polyfills (not yet implemented) Any feedback is welcome!! I'm not sure I like the name freactive - but it was the best I could think of at the time. Suggestions for alternative names are welcome. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to a topic in the Google Groups ClojureScript group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/clojurescript/99myJ9vLeKQ/unsubscribe. To unsubscribe from this group and all its topics, send an email to clojurescrip...@googlegroups.com javascript:. To post to this group, send email to clojur...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/clojurescript. -- 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.
perform action after events stop for some period
I have need to perform an action when a series of events is quiet for some period. That is, if one event arrives an action is queued to execute after some timeout. If a second event arrives the timeout is reset, and so-forth. The following code seems to work, however I'm wondering if calling 'future' from 'swap!' is a bad idea (side effecting), and if there's a better way. (defn queue-with-delay [period func] (let [f (atom nil)] (fn [] (when @f (future-cancel @f)) (swap! f (fn [_] (future (Thread/sleep period) (func))) Use like (def event (queue-with-delay 2000 #(println running))) (event) (event) (event) ; pause 2 sec running -- 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: Cursive Reloaded Workflow
FWIW, please note that it's now possible to script Counterclockwise in such a way. The following link shows how to add a new keybinding for calling (user/reset) on the active REPL : https://github.com/laurentpetit/ccw-plugin-repl#repl-keybindingsclj (Requires a Counterclockwise built from the master branch, e.g. http://updatesite.ccw-ide.org/branch/master/CI0176-master-gitf1930d7/ ) Was just working on it this week-end, thus the high-jack of the thread ;-) -- Laurent 2014-12-01 17:14 GMT+01:00 Dylan Butman dbut...@gmail.com: I've been playing around with Cursive lately (it seems awesome if I can ever get comfortable with the keybindings!). I emacs/cider, I have a custom keybinding that injects user/reset to trigger something like https://github.com/stuartsierra/reloaded/blob/master/src/leiningen/new/reloaded/templates/user.clj#L48. Is there a way to do this in cursive? -- 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. -- Laurent Petit -- 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: Cursive Reloaded Workflow
Looks like Laurent is one ahead of me :-). Cursive can't do this right now, although it's a much-requested feature with an issue in the tracker. I'll try to add this soon. In the meantime, you can use the Search REPL History action which narrows down on typing - not ideal, but it should work for now. You can invoke that from any context, you don't have to be in the REPL editor, and you can use Shift-Enter to execute immediately rather than copying to the REPL editor and focusing it. Cheers, Colin On 2 December 2014 at 11:47, Laurent PETIT laurent.pe...@gmail.com wrote: FWIW, please note that it's now possible to script Counterclockwise in such a way. The following link shows how to add a new keybinding for calling (user/reset) on the active REPL : https://github.com/laurentpetit/ccw-plugin-repl#repl-keybindingsclj (Requires a Counterclockwise built from the master branch, e.g. http://updatesite.ccw-ide.org/branch/master/CI0176-master-gitf1930d7/ ) Was just working on it this week-end, thus the high-jack of the thread ;-) -- Laurent 2014-12-01 17:14 GMT+01:00 Dylan Butman dbut...@gmail.com: I've been playing around with Cursive lately (it seems awesome if I can ever get comfortable with the keybindings!). I emacs/cider, I have a custom keybinding that injects user/reset to trigger something like https://github.com/stuartsierra/reloaded/blob/master/src/leiningen/new/reloaded/templates/user.clj#L48. Is there a way to do this in cursive? -- 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. -- Laurent Petit -- 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. -- 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: perform action after events stop for some period
That version has the unfortunate behavior that (func) can be interrupted if (event) is called while it is running. Here's another version using an agent: (defn queue-with-delay2 [period func] (let [q (agent nil)] (fn [] (send-off q (fn [t] (when t (future-cancel t)) (future (Thread/sleep period) (send-off q (fn [_] (func) nil Running with a sleep to see that (func) is not canceled by subsequence (event) calls: (def event (queue-with-delay2 2000 #(do (println running) (Thread/sleep 2000) (println ending Oddly, if calling (event) between running and ending messages, the repl will stack-overflow on the return value. No idea what that's about. But, running like this is fine: (do (event) nil) On Monday, December 1, 2014 1:37:56 PM UTC-8, Brian Craft wrote: I have need to perform an action when a series of events is quiet for some period. That is, if one event arrives an action is queued to execute after some timeout. If a second event arrives the timeout is reset, and so-forth. The following code seems to work, however I'm wondering if calling 'future' from 'swap!' is a bad idea (side effecting), and if there's a better way. (defn queue-with-delay [period func] (let [f (atom nil)] (fn [] (when @f (future-cancel @f)) (swap! f (fn [_] (future (Thread/sleep period) (func))) Use like (def event (queue-with-delay 2000 #(println running))) (event) (event) (event) ; pause 2 sec running -- 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: Cursive Reloaded Workflow
So IntelliJ works in different way to Eclipse, as I understand it. The terminology is a little confusing - in IntelliJ a project is what I normally think of as a project, so in the case of a multi-module project like CCW or Leiningen, the project is the whole thing (CCW or lein) and the sub-projects (leiningen.core, or ccw.branding, .core, .feature etc) are called modules. A project is opened in a dedicated window, so there's no concept like the Eclipse workspace, where you could have both lein and CCW open at once in the same window (I think, I'm a little fuzzy on Eclipse, and what little knowledge I do have is years out of date). So in Cursive, the REPLs are specific to a project but you can have multiple REPLs for a particular project (so a CLJ one and a CLJS one, or I tend to have one open on my current IDE instance, one on my external instance I'm debugging, and perhaps a test REPL). The REPLs are shown in a toolwindow on one side of the screen, and the different REPLs are tabs within that. So when the user performs an operation which requires a REPL, it uses the currently selected REPL (active tab) of the current project. This generally works pretty well, since the REPL is always related to the correct project, and the user generally knows which REPL they're working in. It can get confusing in my case though when I have three very similar REPLs open, but I just have to be careful or restart them from time to time :-) On 2 December 2014 at 12:14, Laurent PETIT laurent.pe...@gmail.com wrote: 2014-12-02 0:02 GMT+01:00 Colin Fleming colin.mailingl...@gmail.com: Looks like Laurent is one ahead of me :-). Cursive can't do this right now, although it's a much-requested feature with an issue in the tracker. I'll try to add this soon. In the meantime, you can use the Search REPL History action which narrows down on typing - not ideal, but it should work for now. You can invoke that from any context, you don't have to be in the REPL editor, and you can use Shift-Enter to execute immediately rather than copying to the REPL editor and focusing it. Wow, being able to use the Search REPL History action from any context is great! BTW, how do you solve the which repl for which editor? issue in Cursive? In CCW, sometimes ago the REPL to use was derived from the project the files were located. These days, it's just the last active REPL that is used (more freedom for the user, but arguably less intelligence in the IDE). What will be used tomorrow remains an open subject, currently users seem happy ... Cheers, Colin On 2 December 2014 at 11:47, Laurent PETIT laurent.pe...@gmail.com wrote: FWIW, please note that it's now possible to script Counterclockwise in such a way. The following link shows how to add a new keybinding for calling (user/reset) on the active REPL : https://github.com/laurentpetit/ccw-plugin-repl#repl-keybindingsclj (Requires a Counterclockwise built from the master branch, e.g. http://updatesite.ccw-ide.org/branch/master/CI0176-master-gitf1930d7/ ) Was just working on it this week-end, thus the high-jack of the thread ;-) -- Laurent 2014-12-01 17:14 GMT+01:00 Dylan Butman dbut...@gmail.com: I've been playing around with Cursive lately (it seems awesome if I can ever get comfortable with the keybindings!). I emacs/cider, I have a custom keybinding that injects user/reset to trigger something like https://github.com/stuartsierra/reloaded/blob/master/src/leiningen/new/reloaded/templates/user.clj#L48. Is there a way to do this in cursive? -- 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. -- Laurent Petit -- 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. -- You
Re: perform action after events stop for some period
Coincidentally, we recently wrote code to do something very similar. The following function will invoke f after period milliseconds, unless a value is sent on events-ch, in which case the timeout is reset (and starts counting down again): (defn invoke-after-uninterrupted-delay ([period events-ch f] (invoke-after-uninterrupted-delay period events-ch f [])) ([period events-ch f args] (async/go-loop [] (let [[_ p] (async/alts! [(async/timeout period) events-ch])] (if (= p events-ch) (recur) (apply f args)) e On Mon, Dec 1, 2014 at 6:50 PM, Brian Craft craft.br...@gmail.com wrote: That version has the unfortunate behavior that (func) can be interrupted if (event) is called while it is running. Here's another version using an agent: (defn queue-with-delay2 [period func] (let [q (agent nil)] (fn [] (send-off q (fn [t] (when t (future-cancel t)) (future (Thread/sleep period) (send-off q (fn [_] (func) nil Running with a sleep to see that (func) is not canceled by subsequence (event) calls: (def event (queue-with-delay2 2000 #(do (println running) (Thread/sleep 2000) (println ending Oddly, if calling (event) between running and ending messages, the repl will stack-overflow on the return value. No idea what that's about. But, running like this is fine: (do (event) nil) On Monday, December 1, 2014 1:37:56 PM UTC-8, Brian Craft wrote: I have need to perform an action when a series of events is quiet for some period. That is, if one event arrives an action is queued to execute after some timeout. If a second event arrives the timeout is reset, and so-forth. The following code seems to work, however I'm wondering if calling 'future' from 'swap!' is a bad idea (side effecting), and if there's a better way. (defn queue-with-delay [period func] (let [f (atom nil)] (fn [] (when @f (future-cancel @f)) (swap! f (fn [_] (future (Thread/sleep period) (func))) Use like (def event (queue-with-delay 2000 #(println running))) (event) (event) (event) ; pause 2 sec running -- 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. -- 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: Cursive Reloaded Workflow
Thanks guys, Colin, the history search sounds like a great substitute. Just tried it out and it works great! Will definitely get a lot of mileage for other things as well. On Monday, December 1, 2014 7:49:17 PM UTC-5, Colin Fleming wrote: So IntelliJ works in different way to Eclipse, as I understand it. The terminology is a little confusing - in IntelliJ a project is what I normally think of as a project, so in the case of a multi-module project like CCW or Leiningen, the project is the whole thing (CCW or lein) and the sub-projects (leiningen.core, or ccw.branding, .core, .feature etc) are called modules. A project is opened in a dedicated window, so there's no concept like the Eclipse workspace, where you could have both lein and CCW open at once in the same window (I think, I'm a little fuzzy on Eclipse, and what little knowledge I do have is years out of date). So in Cursive, the REPLs are specific to a project but you can have multiple REPLs for a particular project (so a CLJ one and a CLJS one, or I tend to have one open on my current IDE instance, one on my external instance I'm debugging, and perhaps a test REPL). The REPLs are shown in a toolwindow on one side of the screen, and the different REPLs are tabs within that. So when the user performs an operation which requires a REPL, it uses the currently selected REPL (active tab) of the current project. This generally works pretty well, since the REPL is always related to the correct project, and the user generally knows which REPL they're working in. It can get confusing in my case though when I have three very similar REPLs open, but I just have to be careful or restart them from time to time :-) On 2 December 2014 at 12:14, Laurent PETIT lauren...@gmail.com javascript: wrote: 2014-12-02 0:02 GMT+01:00 Colin Fleming colin.ma...@gmail.com javascript:: Looks like Laurent is one ahead of me :-). Cursive can't do this right now, although it's a much-requested feature with an issue in the tracker. I'll try to add this soon. In the meantime, you can use the Search REPL History action which narrows down on typing - not ideal, but it should work for now. You can invoke that from any context, you don't have to be in the REPL editor, and you can use Shift-Enter to execute immediately rather than copying to the REPL editor and focusing it. Wow, being able to use the Search REPL History action from any context is great! BTW, how do you solve the which repl for which editor? issue in Cursive? In CCW, sometimes ago the REPL to use was derived from the project the files were located. These days, it's just the last active REPL that is used (more freedom for the user, but arguably less intelligence in the IDE). What will be used tomorrow remains an open subject, currently users seem happy ... Cheers, Colin On 2 December 2014 at 11:47, Laurent PETIT lauren...@gmail.com javascript: wrote: FWIW, please note that it's now possible to script Counterclockwise in such a way. The following link shows how to add a new keybinding for calling (user/reset) on the active REPL : https://github.com/laurentpetit/ccw-plugin-repl#repl-keybindingsclj (Requires a Counterclockwise built from the master branch, e.g. http://updatesite.ccw-ide.org/branch/master/CI0176-master-gitf1930d7/ ) Was just working on it this week-end, thus the high-jack of the thread ;-) -- Laurent 2014-12-01 17:14 GMT+01:00 Dylan Butman dbu...@gmail.com javascript: : I've been playing around with Cursive lately (it seems awesome if I can ever get comfortable with the keybindings!). I emacs/cider, I have a custom keybinding that injects user/reset to trigger something like https://github.com/stuartsierra/reloaded/blob/master/src/leiningen/new/reloaded/templates/user.clj#L48. Is there a way to do this in cursive? -- 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 javascript: 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. -- Laurent Petit -- 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 javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to