Re: Compiling ClojureScript to JavaScript inside an app

2013-05-29 Thread Dave Ray
Hi David. Himera by Fogus is a "ClojureScript compiler as a service" which seems like it may be an example of what you're looking for. https://github.com/fogus/himera Cheers, Dave On Wed, May 29, 2013 at 1:49 PM, David Pollak wrote: > Howdy, > > I'm looking to embed the ClojureScript compil

Re: Clojure in production

2013-06-18 Thread Dave Ray
My team at Netflix is using Clojure for all new development these days. Dave On Tue, Jun 18, 2013 at 7:12 AM, Hussein B. wrote: > According to their "Jobs" page, Doo is using Clojure to implement their > backend and web application: > https://doo.net/en/ > > > On Monday, June 10, 2013 11:47:25 P

Re: [ANN] Nightcode, an IDE for Clojure and Java

2013-08-02 Thread Dave Ray
In Seesaw [1] you can specify your shortcuts as "menu S" instead of "ctrl S" and it will pick the right one for the platform. Cheers, Dave [1] my memory's a little fuzzy here :) On Fri, Aug 2, 2013 at 12:00 PM, Zach Oakes wrote: > That's a good point, I should be using command instead of co

Re: Why (eval (list (quote (println "Clojure")))) is throwing a Null Pointer Exception?

2013-08-24 Thread Dave Ray
You have an extra list in there which causes the evaluated code to look like this: ((println "Clojure")) The println is executed, it returns nil, and then because of the extra parens, Clojure tries to execute nil as a function, giving a NPE. This works: user=> (eval (quote (println "Clojure"))

Rxjava + Clojure Users

2013-08-27 Thread Dave Ray
Hi. I'm writing to see if there's anyone out there using RxJava [1] from Clojure and to get their opinion on it's current, built-in support for non-Java languages. Just to recap, the current implementation knows about clojure.lang.IFn allowing functions to be passed directly to RxJava methods:

Re: Rxjava + Clojure Users

2013-08-29 Thread Dave Ray
Hi, Thanks for your feedback on your RxJava usage. I'm glad to hear that neither of you feel too strongly about direct IFn support because... In an effort to simplify the implementation and improve the RxJava experience for all JVM-based languages, we'll be dropping direct IFn support (and Groovy

Re: Rxjava + Clojure Users

2013-08-29 Thread Dave Ray
> On Thu, Aug 29, 2013 at 2:00 PM, Dave Ray wrote: > >> In the Clojure case, this will consist of a namespace, probably >> rx.lang.clojure, with the following helpers: >> >> (defn fn* [f]) Takes a function f, and wraps it in an object that >> implements

Re: Handling name collisions with clojure.core

2013-09-04 Thread Dave Ray
Maybe this is a dumb idea, but could you have a macro that rewrites code to use your ops? (require '[clojure.core.matrix :as m]) (m/with-ops (+ ... (* ...) ...)) and then all the "special" symbols get rewritten/qualified with clojure.core.matrix? Dave On Wed, Sep 4, 2013 at 10:26 PM, Sean

Re: how does one unquote a list of records that implement IFn without treating the first item as a function?

2013-09-05 Thread Dave Ray
~(vec attrs), perhaps? On Thu, Sep 5, 2013 at 12:20 PM, Jim - FooBar(); wrote: > HI all, > > I've gotten myself into a weird situation... > > I'm defining a def-like macro and I want to use 'name-with-attributes'. > Consider the following skeleton: > > > (defmacro defX [name & args] > (let [[na

Re: Reflection warning on setCaretPosition

2015-02-27 Thread Dave Ray
(let [^JEditorPane html-table (editor-pane ...)] ...) should fix it. Or just set the caret position in the create function: (editor-pane :caret-position 0) or use config: (config! editor-pane :caret-position 0) Dave On Fri, Feb 27, 2015 at 4:07 AM, Cecil Westerhof wrote: > 2015-02-27 11:34

Re: Clojure & Vim & Ctags (oh my!)

2014-09-05 Thread Dave Ray
ctrl-o will take you back to your previous position after gf. At least it does for me. Dave On Fri, Sep 5, 2014 at 11:47 AM, Alan Thompson wrote: > Thanks for the 'gf' reference. I can't seem to find a way to go back, > though (like popping the tag stack with crtl-T). > Alan > > > On Thu, Sep

Re: leiningen resources folder

2014-09-11 Thread Dave Ray
clojure.java.io/resource isn't specific to the resources folder. It just scans the classpath. Your classpath probably looks like "test:src:resources" or something so "test" wins. If there was a test/readme.txt file you'd also get that rather than resources/readme.txt. Cheers, Dave On Thu, Sep 11,

Re: CCW bug [SEVERE]

2014-10-28 Thread Dave Ray
Do the names Ken Wesson or Cedric Greevey mean anything to you? Just checking. On Tue, Oct 28, 2014 at 1:28 PM, Fluid Dynamics wrote: > On Tuesday, October 28, 2014 12:19:29 PM UTC-4, Marcus Blankenship wrote: >> >> Agreed. I've been amazed at how kind this group has been, despite your >> attit

Re: a nicer way to write 1 - 2 + 3 - 4 ... +/- n

2014-11-13 Thread Dave Ray
How about: (->> (map * (cycle [1 -1]) (range 1 n)) (reduce +)) ? Dave On Thu, Nov 13, 2014 at 5:31 PM, Andy L wrote: > Hi, > > All I was able to come up with was this > > (defn altsum[n] (reduce + (map * (range 1 (inc n)) (interpose -1 (repeat > 1) > > ... works quite well, however

Re: Open html file in Clojure

2014-12-08 Thread Dave Ray
Nope. It barely renders HTML3. JavaFX, I think, has a real embedded browser component. And, of course, it's always easy to just launch a browser: http://docs.oracle.com/javase/6/docs/api/java/awt/Desktop.html#browse%28java.net.URI%29 Dave On Mon, Dec 8, 2014 at 4:23 AM, Gary Verhaegen wrote: >

Re: Which GUI toolkit would you like to see wrapped in an idiomatic Clojure library?

2016-03-19 Thread Dave Ray
Inline below.. Dave On Thu, Mar 17, 2016 at 9:37 AM, Jason Zwolak wrote: > Paul, yeap, Seesaw is definitely something worth considering. Dave Ray > hasn't abandoned the project, but I sent a personal email to him asking > about the state of the project and it does seem the Seesaw

Re: anyone in Santa Cruz?

2014-03-27 Thread Dave Ray
I'd be interested. Dave On Thu, Mar 27, 2014 at 1:04 PM, Tim wrote: > Yes, please! > > > On Thursday, March 27, 2014 10:21:32 AM UTC-7, Brian Craft wrote: > >> Looking for clojure users in the Santa Cruz, Ca area who are interested >> in a meetup, study group, etc. >> > -- > You received this

Re: Kwargs vs explicit parameter map for APIs?

2014-04-25 Thread Dave Ray
Seesaw looks nice, but in retrospect I would use explicit maps if I had it to do all over again for exactly the reasons you mention. These days, I always use explicit maps for options. Dave On Fri, Apr 25, 2014 at 3:56 PM, Andrey Antukh wrote: > Hi! > > I have the same doubt! > > However, At t

Re: seesaw >> canvas >> paint

2014-05-02 Thread Dave Ray
Someone asked something similar on reddit and my response had a couple examples of rendering app state: http://www.reddit.com/r/Clojure/comments/23uweq/watchers_and_paint_and_repaint_oh_my/ch7iw4s Hope this helps, Dave On Fri, May 2, 2014 at 1:27 PM, Christopher Howard wrote: > Suppose one i

Re: Headless server, no GUI, no idea

2014-05-09 Thread Dave Ray
I'm not exactly clear what you're trying to do, but I had similar problems with running Seesaw tests on Travis CI. Here's the settings I used to work around it: https://github.com/daveray/seesaw/blob/develop/.travis.yml Hope this helps, Dave On Fri, May 9, 2014 at 10:52 AM, Stuart Sierra wr

Re: Gradle: how to deal with it

2014-05-10 Thread Dave Ray
You should use Clojuresque [1]. The latest version (1.7.0) can start an nrepl server for you. Since I'm a bad user (and because of various dependency-related hurdles at work), I still haven't actually started using it though. Luckily, with earlier versions it's pretty easy to define a new task that

Re: seesaw: drawing text

2014-06-03 Thread Dave Ray
The canvas example shows two ways of doing this: https://github.com/daveray/seesaw/blob/develop/test/seesaw/test/examples/canvas.clj paint1 uses the .drawString method directly. paint2 uses string-shape for the same effect. Hope this helps, Dave On Tue, Jun 3, 2014 at 11:56 AM, Christopher

Re: Defs with %

2014-06-17 Thread Dave Ray
I believe this is a problem with the Leiningen REPL. It works fine from the built-in REPL: $ java -jar ~/.m2/repository/org/clojure/clojure/1.5.1/clojure-1.5.1.jar Clojure 1.5.1 user=> (def top% 4) #'user/top% user=> top% 4 Dave On Tue, Jun 17, 2014 at 1:32 AM, Mike Thompson wrote: > At the

Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
Hey, You have too many colons: user=> (read-string ":l/test") :l/test Dave On Tue, Sep 17, 2013 at 4:03 PM, Casper Clausen wrote: > I am reading a bunch of clojure files using the build-in reader (or > tools.reader, it has the same problem) and I am running into a problem > regarding names

Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
A namespace-qualified keyword has a single colon: :my-namespace/something The double-colon is only shorthand for the current namespace: (in-ns 'my-namespace) ::something -> :my-namespace/something Dave On Tue, Sep 17, 2013 at 4:58 PM, Casper Clausen wrote: > The double colon keyword create

Re: Reading namespaced keywords

2013-09-17 Thread Dave Ray
Cool. You learn something new every day :) On Tuesday, September 17, 2013, Brandon Bloom wrote: > > The double-colon is only shorthand for the current namespace: > > Or other namespaces via an alias: > > (alias 'clj 'clojure.core) > ::clj/foo => :clojure.core/foo > > Inside ns forms, the :as keyw

Re: Are there any GUI based Clojure apps out there?

2013-10-17 Thread Dave Ray
Nightcode is also client-side and all Clojure: https://nightcode.info/ Dave On Thu, Oct 17, 2013 at 7:02 AM, Andy Fingerhut wrote: > The Clojure namespace browser was developed using the Seesaw library: > > https://github.com/franks42/clj-ns-browser > > > > > On Thu, Oct 17, 2013 at 6:33 AM

Re: get fn and not-found

2013-10-28 Thread Dave Ray
... or the no-sentinel find-based approach: (if-let [[_ v] (find a-map :b)] v (my-foo)) Cheers, Dave On Mon, Oct 28, 2013 at 9:08 AM, Alex Baranosky < alexander.barano...@gmail.com> wrote: > Or a shorter variant of the sentinel approach: > > (let [r (get a-map :b ::unfound)] > (if (= r

Re: a possibly vague question

2013-11-14 Thread Dave Ray
As noted over on the Seesaw list, your pdf loading code is blocking the UI thread. When you call it from the REPL, it's a separate thread so the button has a chance to update itself. You'll need to put the pdf loading on a separate thread if you want to the UI to update and stay responsive. Cheers

Re: [ANN] overload-middleware 0.1.1

2013-11-16 Thread Dave Ray
FWIW, Netflix uses a sorta similar approach but the overload detection lives on the client-side since different clients may have varying definitions of "slow", may want finer grained control of fallback behavior, etc: http://techblog.netflix.com/2012/02/fault-tolerance-in-high-volume.html There

Re: How would I do this in Clojure?

2013-12-05 Thread Dave Ray
It's also doable with just swap!, fwiw: (defn make-blah [xs] (let [a (atom [nil xs])] (fn [] (first (swap! a (fn [[_ tail]] [(first tail) (next tail)])) Dave On Thu, Dec 5, 2013 at 12:43 PM, Mark Engelberg wrote: > Although I think tha

Re: get rid of reflection in proxy-super?

2013-12-22 Thread Dave Ray
Seesaw has the same problem with paintComponent. IIRC, it's because it's protected. I never found a workaround. Dave On Sunday, December 22, 2013, Colin Fleming wrote: > I actually just wrote a long reply detailing how to type hint 'this', and > then noticed that you've already done that! This e

Re: get rid of reflection in proxy-super?

2013-12-22 Thread Dave Ray
roxy should be in a finally block. > Currently if the superclass method throws an exception, the proxy will be > left with the superclass call in its proxy mappings. > > > > On 23 December 2013 16:41, Colin Fleming wrote: > >> But surely proxy-super should be designed t

Re: Wrong clojure version depending on lein dependencies (was: ANN: Clojure 1.5)

2013-03-02 Thread Dave Ray
I'll push a new release of seesaw this weekend to isolate the issue. It seems like a clj-ns-browser release with the new seesaw version would then be appropriate. Nelson pointed this issue out to me a while ago, but 1.5 seemed so far off at the time. Sorry about the pain. Dave On Sat, Mar 2, 201

Re: Wrong clojure version depending on lein dependencies (was: ANN: Clojure 1.5)

2013-03-02 Thread Dave Ray
>> As i'm responsible for the clj-ns-browser release... >> And although the dependency issue seems another 2 levels down, can i specify >> anything differently in my project file to prevent this? > > You could add the a similar exclusion for org.clojure/clojure in the > seesaw dependency declarati

ANN: Seesaw 1.4.3 release

2013-03-02 Thread Dave Ray
Hi, Since it's been a while, thought I'd mention that Seesaw 1.4.3 was just released. You can find release notes here: https://github.com/daveray/seesaw/wiki/Release-Notes Mostly just small maintenance issues. The one good reason to upgrade is if you're planning on using Clojure 1.5 and don't

Re: ANN: Seesaw 1.4.3 release

2013-03-03 Thread Dave Ray
: http://darevay.com/talks/clojurewest2012/#/title-slide > > > On Sun, Mar 3, 2013 at 12:34 PM, Dave Ray wrote: >> >> Hi, >> >> Since it's been a while, thought I'd mention that Seesaw 1.4.3 was >> just released. You can find release notes here: &g

Re: Getting the right Clojure version with dependencies

2013-04-04 Thread Dave Ray
The latest Seesaw version on Clojars is 1.4.3. It addresses the Clojure dependency issue. Cheers, Dave On Thu, Apr 4, 2013 at 4:40 PM, Jim - FooBar(); wrote: > [ghostandthemachine/seesaw "1.4.3-SNAPSHOT" :exclusions [ > org.clojure/clojure]] > > Jim > > ps: maybe the actual coordinate for cloj

Re: Struggling with encapsulation

2013-05-09 Thread Dave Ray
I agree that you probably don't need to go overboard with hiding stuff. For option 2 though there's no need for deftype. Just implement the protocol with reifiy within the create function and use the closure for state. (defn create-woobly [...] (let [... put your queues and stuff here ...]

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Dave Ray
On Mon, May 13, 2013 at 1:42 AM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Am Montag, 13. Mai 2013 10:35:14 UTC+2 schrieb Stuart Sierra: >> >> >> >> I believe "lightweight dependency loading system" is an oxymoron. Either >> you A) design a new module format and try to get everyone to follow it

Re: who's not using leiningen?

2013-05-16 Thread Dave Ray
On Wednesday, May 15, 2013, Dave Sann wrote: > If you are not using Leiningen, what do you use? At home I use leiningen because its easy and well supported. At work I use gradle and sometimes ant because it's the quickest path to getting clojure in the build. > > why do you prefer it? > > D > >

Feedback Request

2011-04-18 Thread Dave Ray
Hi, For the last few weeks, I've been working on a Clojure Swing wrapper called Seesaw. I've learned a lot about Clojure so far, but I think it's time to ask for some feedback. If I wait 'til it's perfect or complete, ... well, then no one would ever hear from me. The code can be found on github

Re: Feedback Request

2011-04-19 Thread Dave Ray
ects support toSwing? With the aid of metadata, I'm > sure it could work. > > On Apr 19, 12:57 am, Dave Ray wrote: >> Hi, >> >> For the last few weeks, I've been working on a Clojure Swing wrapper >> called Seesaw. I've learned a lot about Clojure so f

Re: Feedback Request

2011-04-25 Thread Dave Ray
e > source and try some stuff myself. > > On Apr 19, 6:20 pm, Dave Ray wrote: >> Thanks. At the moment Seesaw has a ToWidget protocol which it uses to >> implicitly convert things to Swing components (String -> JLabel, >> Action -> JButton, etc). So it should be pret

Re: Odd Java interop behavior

2011-04-26 Thread Dave Ray
If the "blah blah blah..." is meant to represent a very long file name or path, my guess would be that you've bumped up against the Windows path limit (260 chars) which can manifest itself in weird ways. See cause 4 here: http://support.microsoft.com/kb/320081 Since you're also having issues i

Re: Odd Java interop behavior

2011-04-26 Thread Dave Ray
es when it tries to read it. 37 is the point at which the path length spills over from 260 to 261 which is the documented limit for *some* Windows file system APIs. Dave On Tue, Apr 26, 2011 at 2:36 PM, Ken Wesson wrote: > On Tue, Apr 26, 2011 at 2:26 PM, Dave Ray wrote: >> If the &qu

Re: 2D graphics options with Clojure?

2011-04-30 Thread Dave Ray
I've also had success with Batik for server-side image generation. As long as you don't mind SVG. Dave On Saturday, April 30, 2011, Nathan Sorenson wrote: > Batik can serialize to both PNG and PDF. http://xmlgraphics.apache.org/batik/ > > I currently use Batik in a clojure project doing a lot of

ANN: Seesaw 1.0.0 (Clojure + Swing)

2011-05-09 Thread Dave Ray
Just a quick announcement that I've pushed an initial version of Seesaw, my Clojure + Swing experiment, to Clojars. If anyone gives it a try, I'd love to hear feedback. On GitHub here: https://github.com/daveray/seesaw Cheers, Dave -- You received this message because you are subscribed to

Re: ANN: Hafni

2011-06-23 Thread Dave Ray
Hi, This looks pretty cool. I'd love to see a larger example of how you'd apply arrows to managing UI state. From my limited understanding, functions are arrows, but arrows are not functions. The examples you give fall pretty much in the "functions are arrows" camp, meaning that the code could be

Workers

2011-06-23 Thread Dave Ray
Hi there, I'm playing with a little problem (calculating pi) that is "trivially parallelizable" in that I can easily break the calculation up into a bunch of chunks, send them off to workers and gather the results back together. The one additional requirement I have is that I'd like the process to

Re: Idiomatic way to reference a bundled data file from Clojure source?

2011-06-28 Thread Dave Ray
Hey, I don't have a good example, but the right way to do is with resources which are basically just files that live on the classpath: * Put the files in a folder on your classpath. If your using leiningen, the resources/ directory does this by default. * Get a URL to the file with clojure.java.i

Continuations or monads or something

2011-06-29 Thread Dave Ray
Hi, Yesterday I read this article [1] on asynchronous UI workflows in F#. Basically, taking a sequential set of steps in a UI that would normally be spread across a bunch of event handlers, and making it look like sequential code in one place. So tonight I took a stab at implementing something lik

Re: Continuations or monads or something

2011-06-30 Thread Dave Ray
Thanks! In theory, this should only ever happen on the UI thread so it's not an issue, but better safe than sorry. Any thoughts on the overall premise or approach? Dave On Thu, Jun 30, 2011 at 8:22 AM, Meikel Brandmeyer wrote: > Hi again, > > await-event is not thread-safe. > > (defn await-even

Re: Continuations or monads or something

2011-07-01 Thread Dave Ray
I read about it and didn't see how to map my idea onto it so I stormed ahead. I'll take another look thought. This is probably one of those cases where you don't see the perfectly good wheel right in front of you until you invent one of your own. :) Dave On Fri, Jul 1, 2011 at 2:16 AM, Meikel Br

Re: Anyone on Google+ yet?

2011-07-14 Thread Dave Ray
http://profiles.google.com/daveray maybe this is a dumb question, but am I supposed to manually add everyone on this thread in G+? Seems a little unwieldy. dave On Thu, Jul 14, 2011 at 8:56 PM, Charlie Griefer wrote: > On Thu, Jul 14, 2011 at 4:55 PM, Sean Corfield wrote: >> Is it just a case

Reflection warning on protected methods

2011-07-18 Thread Dave Ray
Hi, I work on a project that's heavy on the Java interop. I've been working through it trying to eliminate reflection (I'd like to build unsigned applets). Anyway, I haven't been able to eliminate the reflection warning on paintComponent in this example: (set! *warn-on-reflection* true) (proxy [j

Re: clooj, a lightweight IDE for clojure

2011-07-19 Thread Dave Ray
Cool project, especially if it manages to *stay* lightweight :) It is indeed difficult to build a console with Swing's text components. Actually, I think it's difficult with the out-of-the-box text components in just about any toolkit. They're not designed for it and there are a ton of edge cases

Re: Anyone on Google+ yet?

2011-07-24 Thread Dave Ray
Invite sent in case someone else didn't send one already. Cheers, Dave On Sun, Jul 24, 2011 at 12:26 PM, MHOOO wrote: > I've never been fond of facebook, mainly because there is this > tendency to have a lot of people in your friends list whom you barely > know. G+ seems to do better with circl

Re: Forcing evaluation of returned anonymous javascript function in ClojureScript

2011-07-24 Thread Dave Ray
See the "Host Interop" section here [1]. With ClojureScript there's a distinction between method lookup and method invocation. I think what you want is: (-> % .target (.getResponseText)) Dave [1] https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure On Sun, Jul 24, 2011 at 1:51

Re: Stream closed...

2011-08-12 Thread Dave Ray
Even shorter: (defn duplicate-file-data [file-path] (spit file-path (slurp file-path) :append true)) Dave On Fri, Aug 12, 2011 at 11:16 PM, Sean Corfield wrote: > I think you also want to reorganize the code so you get the line-seq and > then the line-count outside the for loop. And bear in min

Re: reload file in lein

2011-08-14 Thread Dave Ray
This works for me: repl> (use 'foo.core :reload) or :reload-all if deps of the foo.core ns have changed. Also, (load-file) shouldn't be necessary. Cheers, Dave On Sun, Aug 14, 2011 at 8:20 PM, Jay Vyas wrote: > hi guys, Im doing the following development "workflow" > > -> edit a script in vi

Re: `extends?`, `class` and `type` on ClojureScript

2012-02-19 Thread Dave Ray
Is satisfies? sufficient for your needs? It seems to be implemented in ClojureScript and is, I think, the official way to check whether and object implements a protocol. Dave On Sun, Feb 19, 2012 at 9:26 AM, Shantanu Kumar wrote: >> > I noticed that `extends?`, `class` and `type` are not impleme

Re: PersistentHashMap vs PersistentArrayMap in Postal Question

2012-03-04 Thread Dave Ray
Brad, As Kevin points out, because the values in the property file go through read-string, they're read as Clojure literals, symbols in this case. One solution is to make the string values look like string literals to the reader: host="foo.com" port=2525 user="me" pass="pwd" Try that and never b

ANN: Seesaw 1.4.0

2012-03-05 Thread Dave Ray
Hi, Seesaw 1.4.0 is out now. The release notes [1] have highlights of all the changes since 1.3.0. Note there are two breaking changes in the API. I believe the impact of these changes should be minimal since they were in areas of the API even I was never able to use effectively. I'd also like to

Re: Returning Success

2012-03-19 Thread Dave Ray
On Mon, Mar 19, 2012 at 7:14 PM, jk wrote: > I read this and wondered why you care? Isn't it sufficient to return > the new world state? You could use identical? as someone suggested but > why bother? It sounds like the player should be able to keep bumping > into the wall if they keep making the

Re: New release of Paredit mode for Vim with support for VimClojure repls and Map literals

2012-04-22 Thread Dave Ray
Note that Tomas recently extracted paredit from slimv, so it has its own home now: https://bitbucket.org/kovisoft/paredit Also, there have been several important bug fixes applied to paredit in the last few months. It would be great if any improvements you've made could make it back into the offici

Re: ClassCastException clojure.lang.Var$Unbound Help

2012-04-30 Thread Dave Ray
I think what you actually want is: (defn get-id [] (session/get :uid)) in your code, you're trying to call #'session/get directly and bind it to get-id. Of course, the problem with this is that #'session/get expects to be called in the context of a request which is where your Unbound var except

Re: Network Visual Layout Algorithm

2012-05-31 Thread Dave Ray
Lacij (https://github.com/pallix/lacij) and Vijual (https://github.com/drcode/vijual) both implement graph layout algorithms in Clojure. Dave On Thu, May 31, 2012 at 6:42 AM, Ulises wrote: >> I have a contest going with a colleague, where we each have to render a >> network layout in SVG.  My gu

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Dave Ray
Keywords implement IFn meaning they can act as functions that look themselves up in a map. Strings are just strings. Replace "b" with (get "b") and you'll get the behavior you're looking for. Dave On Thu, May 31, 2012 at 7:55 AM, Boris V. Schmid wrote: > Can someone tell me what I'm overlooking

Re: using -> on a nested hash-map with string keywords.

2012-05-31 Thread Dave Ray
Too true. On Thu, May 31, 2012 at 10:22 AM, Alan Malloy wrote: > Yes, but really to GET a value nested IN a series of maps, he should > just be using get-in, rather than threading anything at all. > > On May 31, 7:59 am, Dave Ray wrote: >> Keywords implement IFn meani

Re: scanLeft

2012-06-11 Thread Dave Ray
Try reductions: user=> (reductions + 0 [1 2 3]) (0 1 3 6) Dave On Mon, Jun 11, 2012 at 5:51 PM, Andy Coolware wrote: > Hi, > > I am looking for a way to express following function in Clojure: > scala> scanLeft(List(1,2,3))(0)(_ + _) > res1: List[Int] = List(0, 1, 3, 6) > > Any insight? > An

Re: Access denied with clojure.java.io/copy

2012-07-09 Thread Dave Ray
On Sun, Jul 8, 2012 at 1:47 AM, Pierre-Henry Perret wrote: > > Using clojure.java.io/copy I get the following output: > > ___ > Exception in thread "main" java.io.FileNotFoundException: > .lein-git-deps\project\cljs-src (Access denied) (NO_SOURCE_FILE:0 > > > The sourc

Re: seesaw's beautiful docstrings

2012-07-25 Thread Dave Ray
For what it's worth, the docstrings are indeed hand-formatted, but that's pretty easy with vim or any decent editor. The size of the docstrings is a bit of a problem. At one point on Twitter Fogus suggested that Trammel could help off-load documentation elsewhere, but I never was motivated enough t

Re: having trouble setting the cursor with seesaw

2012-08-26 Thread Dave Ray
Hi, It's probably better to ask on the seesaw mailing list [1] rather than this more general list. With the info you've given it's hard to tell, but I'd guess you're setting the cursor and then doing a long-running operation in the UI thread. When you do that, the cursor (and ui) is never updated

Isolated Clojure Environments

2012-08-30 Thread Dave Ray
Hi, I'm looking for the best way to execute some Clojure code in a more or less completely isolated environment. That is, say we load one piece of code: A: --- (ns my-ns) (def foo [] (println "hi")) (foo) --- if a second piece of code was loaded: B: --- (ns my-ns) (foo) ; <-- This should fai

Re: Isolated Clojure Environments

2012-08-31 Thread Dave Ray
PM, Laurent PETIT wrote: > Hi, > > Currently, counterclockwise is using classlojure to maintain separate > Leiningen environments for separate open projects. > > HTH, > > Laurent > > Sent from a smartphone, please excuse the brevity/typos. > > Le 31 août 2012 à

Re: clojure library code fails to load resource file when called from java

2012-09-07 Thread Dave Ray
slurp is happy to slurp from a URL, no need for the (.getFile) call on the resource. In other words, the file returned for a resource that's been compiled into a jar isn't very useful. Stick with the URL returned bye clojure.java.io/resource. Dave On Fri, Sep 7, 2012 at 10:58 AM, fenton wrote: >

Re: How do I get the total memory used by the app?

2012-09-12 Thread Dave Ray
You can connect jconsole or visualvm to your running app to monitor memory usage, GC, threads, etc, etc. On my machine, jconsole lives in $JAVA_HOME/bin/jconsole. Cheers, Dave On Wed, Sep 12, 2012 at 10:12 AM, larry google groups < lawrencecloj...@gmail.com> wrote: > I need to know how much mem

Question about Seesaw breaking change

2012-09-13 Thread Dave Ray
Hi, Over on the Seesaw list, there's a little question about a possible breaking change to the way selection works: https://groups.google.com/forum/?fromgroups=#!topic/seesaw-clj/qJe7RElZmYw Thought I'd mention it here in case anyone wants to object. Cheers, Dave -- You received this messa

Bug in printing futures

2012-10-11 Thread Dave Ray
In Clojure 1.4, I came across the following this week: user=> (def f (future (Thread/sleep 2))) #'user/f user=> f # user=> (future-cancel f) true user=> f CancellationException java.util.concurrent.FutureTask$Sync.innerGet (FutureTask.java:220) That is, when printing a futur

Re: Simple way to get image from url

2012-10-15 Thread Dave Ray
Something like this perhaps: (with-open [in (clojure.java.io/input-stream "http://google.com/favicon.ico";)] (clojure.java.io/copy in (clojure.java.io/file "favicon.ico"))) Dave On Mon, Oct 15, 2012 at 6:23 AM, AtKaaZ wrote: > => (use 'clj-http.client) > nil > => (= (:body (clj-http.client/ge

Re: Calling name on a keyword gives nil??

2012-10-22 Thread Dave Ray
The name parameter of your function is shadowing clojure.core/name. On Mon, Oct 22, 2012 at 7:58 AM, JvJ wrote: > I'm getting a REALLY weird error. I'm trying to check if a set of keywords > are all uppercase. > When binding a value to 'res' in the let statement, I traverse a list of > keywords.

Re: Could not locate clojure/data/json__init.class or clojure/data/json.clj on classpath

2012-10-25 Thread Dave Ray
Why don't you have clojure.data.json in your dependencies in project.clj? That seems like a problem to me. Dave On Thu, Oct 25, 2012 at 10:01 AM, larry google groups wrote: > I asked this previously but I thought I would start a new thread to go into > more detail. This is driving me crazy. I wa

with-open and line-seq

2012-10-26 Thread Dave Ray
Hi, At work I've had a few conversations about treating files, especially large ones, as seqs of lines. In particular, the apparent conflict between using clojure.core/with-open to ensure a file is closed appropriately, and clojure.core/line-seq as a generic sequence of lines which may be consumed

Re: with-open and line-seq

2012-10-26 Thread Dave Ray
om old contrib. Could you be more >> clear about what isn't satisfying about that? For me it usually boils down >> to: it's unsatisfying that core line-seq doesn't do that by default. >> >> '(Devin Walters) >> >> On Oct 26, 2012, at 6:45 PM,

Re: with-open and line-seq

2012-10-28 Thread Dave Ray
Stuart, Thanks for the link. It confirms the suspicions I had about a general solution for this issue. For the particular code I'm working with, I'll try pushing with-open further up and see if that gives me some of the flexibility I'm looking for. Cheers, Dave On Sun, Oct 28, 2012 at 2:21 PM,

Re: with-open and line-seq

2012-11-07 Thread Dave Ray
ou mean by "close the > file"? Do you mean "close the clojure.java.io/reader"? which happens > implicitly when a with-open exits? I've also not understood what the > original problem is...Has anyone had problems with large files? > > sorry for the inconvenienc

Re: code waiting on something - cannot debug - driving me insane!!!

2012-11-13 Thread Dave Ray
Just a wild guess, but if something's shown on the screen, #'draw-tiles will probably get invoked to paint the canvas and it might end up blocking on the #'curr-game promise. Dave On Tue, Nov 13, 2012 at 12:19 PM, Jim - FooBar(); wrote: > Hi all, > > I've had this unbelievable problem for some t

Re: code waiting on something - cannot debug - driving me insane!!!

2012-11-13 Thread Dave Ray
Dump the JVM's threads [1] and see what it's stuck on? Dave [1] http://www.crazysquirrel.com/computing/java/basics/java-thread-dump.jspx On Tue, Nov 13, 2012 at 1:42 PM, Jim - FooBar(); wrote: > On 13/11/12 20:36, Dave Ray wrote: >> >> Just a wild guess, but if someth

Re: Run Counterclockwise nREPL on specific port

2012-11-20 Thread Dave Ray
> Run: Actually, maybe this makes sense, isn't this a bit like the "remote > connection java launcher" ? Several remotes could be saved in different > launch configurations. Some other configuration options could come up > quickly, like "things to prepend on each launch - via a potential additional

Re: Change the CCW compile output catalog

2012-12-02 Thread Dave Ray
Hey Laurent, For what it's worth, I was a little surprised that CCW used it's own output folder rather than Eclipse's, but I understand why you'd do it that way. One thing that was a little problematic was that CCW automatically created the folder and added it to the Eclipse classpath when all I

Re: A bearded person, Clojure and JavaFX

2012-12-05 Thread Dave Ray
Although it's not obvious from the JavaFX docs since they're written for a Java audience, it is very possible to create apps in an interactive style without inheritance. Two caveats: * Ignore the Application class. Just create your scene, etc directly. * Most execution has to run on the JavaFX thr

Re: Change the CCW compile output catalog

2012-12-13 Thread Dave Ray
On Thu, Dec 13, 2012 at 12:08 AM, Laurent PETIT wrote: Laurent, > Hey Dave, > > 2012/12/3 Dave Ray >> >> Hey Laurent, >> >> For what it's worth, I was a little surprised that CCW used it's own >> output folder rather than Eclipse's, but I u

Re: Running a clojure script

2012-12-15 Thread Dave Ray
Yep. java -jar clojure.jar hello.clj Should do the trick. Alternatively, java -cp clojure.jar clojure.main hello.clj Will also work if you need to control the classpath more. Dave On Saturday, December 15, 2012, Mark Engelberg wrote: > Let's say I have a file "hello.clj" that simply con

Re: Little namespace question

2012-12-19 Thread Dave Ray
A function seems to work fine unless I don't understand your requirement: ; normal version that takes code forms and symbols (defn eval-in [code ns] (let [old (-> *ns* str symbol)] (try (in-ns ns) (eval code) (finally (in-ns old) ; sugary

Re: Little namespace question

2012-12-19 Thread Dave Ray
It does, right? On Wednesday, December 19, 2012, Alan Shaw wrote: > But returning the evaluation was a requirement... > > > On Wed, Dec 19, 2012 at 2:58 PM, Alan Shaw wrote: > > No, there was no requirement that it be a macro. Thanks! > > -A > > > > On We

Re: Maps, keywords, and functions

2012-12-20 Thread Dave Ray
You can avoid superfluous anonymous functions. For example, this: (map #(get % :id) my-sequence) vs this: (map :id my-sequence) Cheers, Dave On Thu, Dec 20, 2012 at 3:13 PM, Jonathon McKitrick wrote: > I thought it was pretty interesting to treat maps as functions, and even > more intri

Re: if-let/when-let

2013-01-04 Thread Dave Ray
I don't know if it will answer your history question, but there was a fairly long discussion about this last year: https://groups.google.com/forum/?fromgroups=#!searchin/clojure/let-else/clojure/1g5dEvIvGYY/EWjwFGnS-rYJ Cheers, Dave On Fri, Jan 4, 2013 at 7:23 AM, Edward Tsech wrote: > Sorr

Re: Prisoner's Dilemma in Clojure

2011-08-22 Thread Dave Ray
I'm not sure why this code was written this way, but Marginalia has no problem using docstrings. Compare it's own docs: http://fogus.me/fun/marginalia/ and the code they were generated from: https://github.com/fogus/marginalia/blob/master/src/marginalia/core.clj Cheers, Dave On Mon, Aug 2

Re: why is it necessary to use identity to check for nils in an if statement

2011-08-23 Thread Dave Ray
You have an extra set of parens around a, treating it as a function call. Try: (defn if-a [a b] (if a (str a) (str b))) Hope that helps, Dave On Tue, Aug 23, 2011 at 4:37 PM, Andrew Xue wrote: > this doesn't work: > > user=> (defn if-a [a b] (if (a) (str a) (str b))) > #'user/if-a > user=> (

  1   2   >