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 <jzwo...@gmail.com> 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 a

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 cldwester...@gmail.com

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

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 core.as...@gmail.com 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

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 a2093...@trbvm.com 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

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: 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 clooj...@gmail.com 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

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

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: 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

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

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

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 n...@niwi.be wrote: Hi! I have the same doubt!

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 timothy.parthem...@gmail.com 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. --

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

Re: get rid of reflection in proxy-super?

2013-12-22 Thread Dave Ray
with the superclass call in its proxy mappings. On 23 December 2013 16:41, Colin Fleming colin.mailingl...@gmail.comwrote: But surely proxy-super should be designed to call protected methods? I'd have to check but I suspect I call other protected methods using it. On 23 December 2013 14:13, Dave Ray dave

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

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

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.

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: 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 andy.finger...@gmail.comwrote: The Clojure namespace browser was developed using the Seesaw library: https://github.com/franks42/clj-ns-browser On Thu, Oct

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 casp...@gmail.com 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

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 casp...@gmail.com wrote: The double

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 keyword

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(); jimpil1...@gmail.comwrote: 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]

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: 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

Re: Rxjava + Clojure Users

2013-08-29 Thread Dave Ray
wrote: On Thu, Aug 29, 2013 at 2:00 PM, Dave Ray dave...@gmail.com 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 all the various Rx FuncX

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: 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)))

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 zsoa...@gmail.com wrote: That's a good point, I should be using command

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. hubaghd...@gmail.com 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,

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 feeder.of.the.be...@gmail.com wrote: Howdy, I'm looking to embed

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 --

Re: Utility libraries and dependency hygiene

2013-05-13 Thread Dave Ray
On Mon, May 13, 2013 at 1:42 AM, Meikel Brandmeyer (kotarak) m...@kotka.de 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: 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: 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(); jimpil1...@gmail.comwrote: [ghostandthemachine/seesaw 1.4.3-SNAPSHOT :exclusions [ org.clojure/clojure]] Jim ps: maybe the actual

Re: ANN: Seesaw 1.4.3 release

2013-03-03 Thread Dave Ray
://darevay.com/talks/clojurewest2012/#/title-slide On Sun, Mar 3, 2013 at 12:34 PM, Dave Ray dave...@gmail.com 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: https://github.com/daveray/seesaw/wiki/Release-Notes

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,

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 declaration, but

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

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

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 jmckitr...@gmail.com wrote: I thought it was pretty interesting to treat maps as functions,

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 noden...@gmail.com wrote: No, there was no requirement that it be a macro. Thanks! -A On Wed, Dec 19, 2012 at 7:40 AM, Dave

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

Re: Change the CCW compile output catalog

2012-12-13 Thread Dave Ray
On Thu, Dec 13, 2012 at 12:08 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Laurent, Hey Dave, 2012/12/3 Dave Ray dave...@gmail.com 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

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

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: 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 op

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(); jimpil1...@gmail.com wrote: Hi all, I've had this unbelievable

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(); jimpil1...@gmail.com wrote: On 13/11/12 20:36, Dave Ray wrote: Just a wild guess, but if something's shown

Re: with-open and line-seq

2012-11-07 Thread Dave Ray
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 inconvenience...I read the entire thread and I'm still not understanding! Jim On 29/10/12 03:21, Dave Ray wrote: Stuart, Thanks for the link

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,

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

Re: with-open and line-seq

2012-10-26 Thread Dave Ray
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, Dave Ray dave...@gmail.com wrote: Hi, At work I've had a few conversations about treating files, especially large ones, as seqs of lines

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 lawrencecloj...@gmail.com wrote: I asked this previously but I thought I would start a new thread to go into more detail. This

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 kfjwhee...@gmail.com 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

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 atk...@gmail.com wrote: = (use 'clj-http.client) nil = (= (:body

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 #core$future_call$reify__6110@27adc5f7: :pending user= (future-cancel f) true user= f CancellationException java.util.concurrent.FutureTask$Sync.innerGet

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

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

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

Re: Isolated Clojure Environments

2012-08-31 Thread Dave Ray
...@gmail.com 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 à 03:38, Dave Ray dave...@gmail.com a écrit : Hi

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 fail

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

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

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 andy.coolw...@gmail.com 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)

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 ulises.cerv...@gmail.com wrote: I have a contest going with a colleague, where we each have to render a network

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 boris.sch...@gmail.com wrote: Can someone tell me

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 a...@malloys.org 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 dave...@gmail.com wrote: Keywords implement IFn

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

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

Re: Returning Success

2012-03-19 Thread Dave Ray
On Mon, Mar 19, 2012 at 7:14 PM, jk john.r.kru...@gmail.com 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

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

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

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 kumar.shant...@gmail.com wrote: I noticed that `extends?`, `class` and

Re: Change components of JPanel autonomously and simultaneously

2012-01-31 Thread Dave Ray
;; This is how I repaint the frame, after changing the list (doto *frame*       (.setContentPane (make-panel))       .repaint       (.setVisible true)) This is probably the reason it's slow (you don't say how many rects you're drawing). It's only necessary to set the content pane of the

Re: Change components of JPanel autonomously and simultaneously

2012-01-31 Thread Dave Ray
Calling repaint directly on the panel (not the frame) should be all that's necessary to update the display. updateComponentTreeUI() is only used when the look and feel of an app changes. Dave On Tue, Jan 31, 2012 at 8:44 AM, Jonathan Cardoso jonathancar...@gmail.com wrote: I used   

Re: seesaw texteditor.clj classpath error

2012-01-23 Thread Dave Ray
Jay, That's enough. You've asked this question and many related questions over the last several months [1][2][3][4][5][6]. Usually the simplest answer is download Leiningen [7] and learn to use it. The advice is the same here. Since this is the point in a thread when you usually disappear only

Re: On using atoms together with side effect functions

2012-01-06 Thread Dave Ray
On Fri, Jan 6, 2012 at 3:02 PM, Jozef Wagner jozef.wag...@gmail.com wrote: Consider this contrived piece of code: (def aval (atom {:dumped false :contents hello world})) (defn update!   [item]   (when-not (:dumped item)     (spit a.out (:contents item) :append true)     (assoc item

Re: Bug in extend-protocol macro? (Clojure 1.3.0)

2011-12-30 Thread Dave Ray
On Fri, Dec 30, 2011 at 4:13 PM, Alan Malloy a...@malloys.org wrote: On Dec 30, 11:34 am, Marshall T. Vandegrift llas...@gmail.com wrote: Peter Taoussanis ptaoussa...@gmail.com writes: Thanks- that explains it: dropping to extend works as expected. Another option I've been making use of for

Re: ANN: Seesaw 1.3.0

2011-12-21 Thread Dave Ray
driven development emphasises and I hope we see more people working in this area. Sam --- http://sam.aaron.name On 21 Dec 2011, at 03:24, Dave Ray wrote: Hi, I've just release Seesaw 1.3.0. Details of this release can be found in the release notes [1]. There are a few features I'm

Re: ANN: Seesaw 1.3.0

2011-12-21 Thread Dave Ray
--- http://sam.aaron.name On 21 Dec 2011, at 03:24, Dave Ray wrote: Hi, I've just release Seesaw 1.3.0. Details of this release can be found in the release notes [1]. There are a few features I'm pretty happy about, so I'll mention them briefly here. Interactive development: So far

Re: ANN: Seesaw 1.3.0

2011-12-21 Thread Dave Ray
Hi Laurent! ... On Wed, Dec 21, 2011 at 7:42 AM, Laurent PETIT laurent.pe...@gmail.com wrote: Hello Dave ! 2011/12/21 Dave Ray dave...@gmail.com: Hi, I've just release Seesaw 1.3.0. Details of this release can be found in the release notes [1]. There are a few features I'm pretty happy

Re: Question about accessing java methods?

2011-12-21 Thread Dave Ray
On Wed, Dec 21, 2011 at 3:10 PM, Alan Malloy a...@malloys.org wrote: On Dec 21, 12:03 pm, Jonas jonas.enl...@gmail.com wrote: You can also do (.. boxWidget GetProp3D (SetUserTransform t)) or (- boxWidget .GetProp3D (.SetUserTransform t)) Well, neither of these are strictly equivalent to his

ANN: Seesaw 1.3.0

2011-12-20 Thread Dave Ray
Hi, I've just release Seesaw 1.3.0. Details of this release can be found in the release notes [1]. There are a few features I'm pretty happy about, so I'll mention them briefly here. Interactive development: So far, learning Seesaw has meant getting familiar with Java and Swing. I think that

Re: UnsatisfiedLinkError using clojure.lang.RT/loadLibrary

2011-12-18 Thread Dave Ray
java.library.path is only good for the first layer of libraries you load. Any dependent libs (like libvtkCommon.so) are loaded with the normal dynamic loading provided by the OS. So, i think there's two options: * Just use LD_LIBRARY_PATH env variable (or OS equivalent) and don't bother with

Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-06 Thread Dave Ray
Stathis, I use the Lazytest watcher partly out of convenience. I happen to use Lazytest for testing so it's usually already running anyway. However, some work has already been done to extract the watch functionality [1]. It might be fun to combine your viewer with it. Maybe have a naming

ANN: Seesaw 1.2.2

2011-12-04 Thread Dave Ray
Hi, Seesaw 1.2.2 has been released. It includes several enhancements, most notably SwingX support and some tools to make debugging exceptions in the UI thread easier. The full release notes can be found here: https://github.com/daveray/seesaw/wiki/Release-Notes. Cheers, Dave -- You received

Re: ANN: Clarity 0.5.1 - New GUI library

2011-12-03 Thread Dave Ray
to differentiate with seesaw. It's very interesting to see that both me and Dave Ray came up with similar solutions/features. It seems that Seesaw is more concise in comparison to Clarity, and from the project page it does look like a more mature project. On the other hand, it seems to me (and I might

Re: classpath on seesaw????

2011-11-15 Thread Dave Ray
I have tried to run lein deps and the  lein run -m seesaw.test.examples.kitchensink from the first seesaw, then the nest seesaw and ffinally examples. I can't get to run. - Original Message - C:\Users\jim.jim-PC\Downloads\daveray-seesaw-1.0.7-281-g12248d4.zip From: Dave Ray

Re: classpath on seesaw????

2011-11-12 Thread Dave Ray
Good Morning, The easiest way to run the Seesaw examples is as describe in the wiki (https://github.com/daveray/seesaw/wiki): * Install leiningen * Clone or download the repo from github * then... $ cd seesaw $ lein deps $ lein run -m seesaw.test.examples.kitchensink Replace kitchensink with

Re: where to find clojure swing definitons

2011-11-07 Thread Dave Ray
Hi. In Swing, components are positioned with a layout manager. Here's a guide to the ones that Swing provides out of the box: http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html. If you're building a Swing app, you might find Seesaw (https://github.com/daveray/seesaw), or

Re: Sum on a list of maps

2011-10-16 Thread Dave Ray
Yes, just change the grouping function passed to group-by: (group-by #(vector (% Type) (% Subtype)) coll) The keys in the resulting map will be two-element vectors (e.g. [TypeA SubTypeA]) so you'll need to adjust the body of the for a bit in BG's example. Cheers, Dave On Sun, Oct 16, 2011

Re: Sum on a list of maps

2011-10-14 Thread Dave Ray
Someone cleverer than me to post the built-in function that already does exactly what you want, but here's one way: (defn sum-by-type [in] (- in (group-by #(get % Type)) (map (fn [[k vs]] {Type k Value (reduce (fn [acc v] (+ acc

Re: Does macros evaluates its arguments before?

2011-09-26 Thread Dave Ray
The argument isn't being evaluated during macro expansion, it's being evaluated when the expanded form is evaluated by the repl: user= (macroexpand '(infix (5 + 4))) (let* [vec__590 (5 + 4) x__574__auto__ (clojure.core/nth vec__590 0 nil) f__575__auto__ (clojure.core/nth vec__590 1 nil)

Re: including sound or image files with Leiningen uberjar command

2011-09-17 Thread Dave Ray
Did you forget to set the name of the main class/namespace in project.clj? that would cause the behavior you're seeing. Dave On Saturday, September 17, 2011, loonster tbur...@acm.org wrote: On Sep 16, 1:24 am, Joost jo...@zeekat.nl wrote: On Sep 16, 7:20 am, loonster tbur...@acm.org wrote:

Re: including sound or image files with Leiningen uberjar command

2011-09-17 Thread Dave Ray
at 10:57 AM, loonster tbur...@acm.org wrote: Nope.  The project.clj is: (defproject depExp 1.0.0-SNAPSHOT  :description FIXME: write  :dependencies [[org.clojure/clojure 1.2.1]                 [org.clojure/clojure-contrib 1.2.0]]  :main depExp) Tim On Sep 17, 5:05 am, Dave Ray dave

Re: including sound or image files with Leiningen uberjar command

2011-09-16 Thread Dave Ray
Note that this implementation is the same as (clojure.java.io/resource) [1]. Dave [1] https://github.com/clojure/clojure/blob/3a3374f714e5a755b7de2a761f37696f07a74e80/src/clj/clojure/java/io.clj#L422 On Fri, Sep 16, 2011 at 8:58 AM, willyh wheine...@gmail.com wrote: I use the following

  1   2   >