Re: Rolling back transactions with clojure.java.jdbc

2013-10-25 Thread Mark Tomko
Looks like that was a success. Thanks for the help! On Fri, Oct 25, 2013 at 11:26 AM, Mark Tomko wrote: > Thanks Sean. I'll give it a try! > > > > > On Fri, Oct 25, 2013 at 11:21 AM, Sean Corfield wrote: > >> Second bug in your code: (delete-scores-for-column

Re: Rolling back transactions with clojure.java.jdbc

2013-10-25 Thread Mark Tomko
Thanks Sean. I'll give it a try! On Fri, Oct 25, 2013 at 11:21 AM, Sean Corfield wrote: > Second bug in your code: (delete-scores-for-column db cid) > > Should be: (delete-scores-for-column t cid) > > Sorry I didn't see that (additional) bug first time around when I > suggested removing :trans

Re: Why is using (not (empty? coll)) not idiomatic?

2013-05-13 Thread Mark Tomko
Even so, what do you do when you're using someone else's code as a library? On Mon, May 13, 2013 at 10:42 AM, Meikel Brandmeyer (kotarak) wrote: > Hi, > > Am Montag, 13. Mai 2013 16:16:36 UTC+2 schrieb Mark: >> >> That's a fair point, but do you always know that what you've gotten back >> is a s

Re: Names and clojure.core

2013-03-28 Thread Mark Tomko
I definitely agree that nomenclature is often one of the hardest things to handle well. I'm actually a professional software engineer in real life, but I don't get to use Clojure at work. I suppose the names I suggested were uninspired partially because I only get a few minutes at a time to work on

Re: Are there any plans for more allowed symbol characters?

2010-03-02 Thread Mark Tomko
I agree with you in principle, but I suspect that the answer is deliberately delegated to Java's definition of letter or number. Mark On Mar 2, 3:17 am, Michael Wood wrote: > On 2 March 2010 00:24, Joost wrote: > > > On 1 mrt, 23:02, Michael Wood wrote: > >> I don't know if the following's "al

Re: Dubious performance characteristics of hash-maps

2010-02-23 Thread Mark Tomko
I'd suggest allocating more heap than the default JVM settings, or running the JVM in server mode. I'm not sure what Haskell's underlying implementation is, but I'd assume that it can grow its heap (somewhat) arbitrarily, which the JVM cannot, beyond a fixed bound. On Feb 23, 12:51 am, "Edward Z.

Re: Dubious performance characteristics of hash-maps

2010-02-23 Thread Mark Tomko
I'd suggest checking your JVM memory settings. The Haskell implementation may allow the heap to grow arbitrarily, but the default JVM heap size is very limited, which may result in poor memory performance. On Feb 23, 12:51 am, "Edward Z. Yang" wrote: > I'd first like to state that I went into th

Re: Seattle Clojure meeting

2010-02-12 Thread Mark Tomko
Oh, man. I just moved from Seattle to Boston in December, and I miss Zoka's coffee. Have fun, everyone!Maybe we can get some of the Boston-area Clojure folks to meet up sometime. On Feb 11, 7:30 pm, Phil Hagelberg wrote: > On Fri, Feb 5, 2010 at 12:50 PM, Phil Hagelberg wrote: > > Wow, I c

Re: Access to nested static classes

2009-12-29 Thread Mark Tomko
y into conflict with other imports!). In Clojure, however, it appears that any class that I want to reference needs to be fully qualified or explicitly imported into my own namespace. On Dec 28, 11:09 pm, David Brown wrote: > On Mon, Dec 28, 2009 at 02:50:59PM -0800, Mark Tomko wrote: > >

Re: Access to nested static classes

2009-12-28 Thread Mark Tomko
tion: No such namespace: NestedStatics$LevelOne $LevelTwo (analysis.clj:5) On Dec 28, 5:48 pm, Mark Tomko wrote: > This appears to work: > > user=> (str org.tomko.konkordans.NestedStatics$LevelOne) > "class org.tomko.konkordans.NestedStatics$LevelOne" > > Is this depend

Re: Access to nested static classes

2009-12-28 Thread Mark Tomko
n wrote: > On Mon, Dec 28, 2009 at 02:32:48PM -0800, Mark Tomko wrote: > >user=> (str.org.tomko.konkordans.NestedStatics/LevelOne) > > Does > >     str.org.tomko.konkordans.NestedStatics$LevelOne/ONE > > Work? > > You can always look in the class output directory tha

Access to nested static classes

2009-12-28 Thread Mark Tomko
Is there a way to reference nested static members of Java classes using Clojure? I tried a few things and couldn't get it to work. To simplify the question a bit, I wrote the following Java class: package org.tomko.konkordans; public class NestedStatics { public static String FOO = "foo";

Heap implementation in Clojure

2009-12-14 Thread Mark Tomko
I wrote this implementation of a heap (or priority queue) in pure Clojure: http://pastebin.com/m2ab1ad5a It's probably not of any quality sufficient to be make it to the contrib package, but it seems to work. Any thoughts on how it might be improved? Thanks, Mark -- You received this message

Re: Where is the Clojure 1.0 API documentation?

2009-12-09 Thread Mark Tomko
ure itself. Python does this and I've always liked it. > > Tom > > On Dec 9, 5:43 am, Mark Tomko wrote: > > > > > I second this - since many of the IDE plugins bundle the clojure-1.0 > > jar, new users trying out Clojure (and IDEs) can't use all the >

Re: Where is the Clojure 1.0 API documentation?

2009-12-09 Thread Mark Tomko
I second this - since many of the IDE plugins bundle the clojure-1.0 jar, new users trying out Clojure (and IDEs) can't use all the features listed in the docs, and it's hard to tell which is which. Maybe we could at least add a 'added in version' to the new method metadata? On Dec 9, 4:48 am, Jar

Re: Trouble implementing Dijkstra algorithm in Clojure

2009-12-08 Thread Mark Tomko
A priority queue implemented over a heap would be more efficient than a sorted set, in general. With a heap, you have constant time access to the smallest (WLOG) element in the heap at all times. Removing it costs a fixed O(lg n). A sorted set (especially one that's being modified) isn't necessa

Re: swap two elements in an arbitrary collection

2009-11-13 Thread Mark Tomko
ant... and > efficient. > > hth > > Christophe > > > > > > On Fri, Nov 13, 2009 at 7:07 AM, Mark Tomko wrote: > > Let's try this again: > > > (defn swap [coll i j] > >  (if (= i j) coll > >      (let [li (min i j) ui (max i j)] > &

Re: swap two elements in an arbitrary collection

2009-11-12 Thread Mark Tomko
re-li (list (nth coll ui)) post-li-pre-ui (list (nth coll li)) (rest post-li-post-ui))) The code is actually even more complicated. I'm sure with a little more time I could clean it up. On Nov 12, 9:59 pm, Mark Tomko wrote: > Oh, I po

Re: swap two elements in an arbitrary collection

2009-11-12 Thread Mark Tomko
Oh, I posted too soon. My implementation has a bug. On Nov 12, 9:56 pm, Mark Tomko wrote: > I came up with a way to do it, but I'm sure there's a simpler way. > Here's what I have: > > (defn swap [coll i j] >   (let [li (min i j) ui (max i j)] >     (let [[

swap two elements in an arbitrary collection

2009-11-12 Thread Mark Tomko
I came up with a way to do it, but I'm sure there's a simpler way. Here's what I have: (defn swap [coll i j] (let [li (min i j) ui (max i j)] (let [[pre-li post-li] (split-at li coll)] (let [[post-li-pre-ui post-li-post-ui] (split-at (- ui 1) (rest post-li))] (concat p

Re: Finding elements in 2 sequences that match (indexwise)

2009-10-14 Thread Mark Tomko
(count (matching-elements coll1 coll2))) This was partially for my own debugging purposes, so I could see what things were being counted. On Oct 14, 12:23 am, John Harrop wrote: > On Wed, Oct 14, 2009 at 2:06 AM, Mark Tomko wrote: > > > This is basically a problem of parallel iterati

Finding elements in 2 sequences that match (indexwise)

2009-10-13 Thread Mark Tomko
This is basically a problem of parallel iteration. I've devised 2 solutions, one is recursive (alas, not tail-recursive) and the other appears to be a more idiomatic Clojure solution. Can someone suggest a more efficient or cleaner solution? Here's the "literal" solution: (defn matching-elemen

Re: Help with closures

2009-10-09 Thread Mark Tomko
Of course. I'm not sure what I was thinking. Thank you. On Oct 9, 7:47 pm, Shawn Hoover wrote: > On Fri, Oct 9, 2009 at 10:37 PM, Mark Tomko wrote: > > ; a returns a new similarity function that applies the provided > > transform function > > ; before compa

Help with closures

2009-10-09 Thread Mark Tomko
Okay, I'm flummoxed. Given the following definition: (defn make-n-gram-fn [n] (fn [coll] (map vec (partition n 1 coll I can do this: (def bi-gram (make-n-gram-fn 2)) (bi-gram "abc") ([\a \b] [\b \c]) But, if I add the following: ; counts the number of indexes in a pair of collections

Re: What does this error mean?

2009-10-08 Thread Mark Tomko
Can you give some more context? On Oct 8, 6:38 am, kunjaan wrote: > java.lang.ClassFormatError: Unknown constant tag 52 in class file > queries__init (Trial.clj:0) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clo

Re: immutable defs?

2009-10-06 Thread Mark Tomko
This is pretty much what I'd had in mind. I don't see how the text of the Exception is set by the macro, but it'd be really spectacular if the message were more clear. Is that message coming from the defvar form? On Oct 6, 6:14 pm, "Stephen C. Gilardi" wrote: > On Oct 2, 2009, at 10:29 AM, Mar

Re: Memory Characteristics of Persistent Datastructures

2009-10-05 Thread Mark Tomko
To be explicit, the doall needs to be before the call to recur (that is, it affects the map). Is that right? On Oct 5, 1:31 am, Meikel Brandmeyer wrote: > Hi, > > On Oct 5, 9:50 am, Volkan YAZICI wrote: > > > > (defn leak [] > > >   (loop [v [0 0]] > > >     (recur (map + v [1 1] > > > >

Re: immutable defs?

2009-10-02 Thread Mark Tomko
That's what I meant when I mentioned the 'binding' form above. The reason that's okay (to me) is that it explicitly calls out that bindings may be about to change. On Oct 2, 11:47 am, John Newman wrote: > Also, I'm not sure if your understanding of "binding" is correct. > > because within any l

Re: immutable defs?

2009-10-02 Thread Mark Tomko
When I write code in Java, I declare everything final that's possible to be declared final, and I deliberately look for solutions that avoid reassignment to variables, so all my variables are final). I'm new to Clojure, so I might be wrong, but it seems that within a function, mutable bindings mu