Re: ATTN contrib authors: Automatic documentation for clojure.contib

2009-04-15 Thread Sean Devlin
Check out the thread below in the Compojure group. Specifically, look for the comment by Brain Carper http://groups.google.com/group/compojure/browse_thread/thread/67d92ceb4128a375?hl=en Brian's code: http://briancarper.net/clojure/compojure-doc.clj This might be an alternate approach to the

Re: Possible contrib contribution: clojure.contrib.timing

2009-04-15 Thread Sean Devlin
Start by putting your code on github or something similar :) On Apr 14, 8:01 pm, Chris wrote: > While playing around with clojure I've found the (time ...) macro > isn't as powerful as I'd like.  To fix this I made a timing library to > help me figure out where all my runtime is going.  If other

Oracle and Clojure

2009-04-20 Thread Sean Devlin
Okay, I'm willing to bet this crowd has already seen this: http://www.sun.com/third-party/global/oracle/index.jsp Any thoughts on how this affects Clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" g

Re: Oracle and Clojure

2009-04-20 Thread Sean Devlin
n years. *Will Java continue to be open source? *What the hell is going to happen to JDBC? Of course, I won't even begin to get into MySQL issues. Time to install Postgres... Has anyone here been able to install Clojure on IcedTea? On Apr 20, 9:22 am, hank williams wrote: > On Mon, Ap

Re: Oracle and Clojure

2009-04-21 Thread Sean Devlin
Thanks to *everyone* for responding! I can see that I was over reacting yesterday. Time for me to stop worrying and get back to coding. Sean On Apr 21, 2:05 am, Adrian Cuthbertson wrote: > There are some precedents - the acquisition of SleepyCat (berkeley db, > et al) - still readily availabl

Google announcement, version 1.0 & SCM Holy War (not really)

2009-04-24 Thread Sean Devlin
There recently was a ton of traffic about SCM in the "Path to 1.0" thread. Google made the following announcement: http://google-code-updates.blogspot.com/2009/04/mercurial-support-for-project-hosting.html Does this make changing the SCM tool to Hg a real possibility? While this might not be s

Re: Clojure 1.0

2009-05-04 Thread Sean Devlin
Thank you and congrats! On May 4, 9:46 am, AlamedaMike wrote: |> Congratulations, Rich! And thanks for all your hard work. Having a 1.0 |> release out to help adoption in the workplace environments that we |> need to get into. Indeed, this is the case where I work. Having a stable version to t

Clojure, SAP and JCo

2009-05-04 Thread Sean Devlin
Hi, Has anyone else here been using Clojure to interact with SAP? Or, are there any JCo experts in the house? Sean --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t

Help: Java code works, Clojure code doesn't

2009-05-05 Thread Sean Devlin
Okay, I've got code that works in Java but I can't get working in Clojure. Here's the code in Java public class TutorialConnect1 extends Object { JCO.Client mConnection; public TutorialConnect1() { try { // Change the logon information to your own system/user mConnection = JC

Re: Help: Java code works, Clojure code doesn't

2009-05-05 Thread Sean Devlin
ng in REPL, then you need to include everything you > need in the classpath the the invoked JVM, for example: > > java -classpath my-jar-file-containing-DsrlPassport.jar;clojure.jar > clojure.main > > On 5 May, 15:54, Sean Devlin wrote: > > > Okay, I've got code that

Re: Help: Java code works, Clojure code doesn't

2009-05-05 Thread Sean Devlin
epl... > > (TutorialConnect1.) > > That might highlight the problem - your java stack strace might give > some clues. It does sound like a classpath problem of some sort. > > Rgds, Adrian. > > On Tue, May 5, 2009 at 6:04 PM, Sean Devlin wrote: > > > That's a really good

RESOLVED: Java code works, Clojure code doesn't

2009-05-05 Thread Sean Devlin
Yeah, it was a classpath error. I had to create the following dummy object: com.sap.jdsr.writer.DsrIPassport Once I did that and added it to the classpath, I was golden. Turns out this is a known error with SAP JCo Thanks everyone! On May 5, 1:49 pm, Sean Devlin wrote: > Another gr

Re: Add JNDI lookup support for contrib/sql

2009-05-09 Thread Sean Devlin
+1 On May 9, 2:33 am, Mark Derricutt wrote: > Hi, > > Can we add the following to contrib's sql namespace, it simply adds "jndi" > as a db-spec scheme ( I also raised this > ashttp://code.google.com/p/clojure-contrib/issues/detail?id=39, which google > decided to set as a defect and I can't cha

Re: Designing an SQL-based application

2009-05-11 Thread Sean Devlin
Here are my thoughts on the three approaches: Approach #1: This seems the most straightforward. I'd write a function that takes a map of conditions, and returns a list of tuples. You can then do what you want with the list of tuples. Approach #2: Remember the first rule of macro club: Don't

Re: Designing an SQL-based application

2009-05-11 Thread Sean Devlin
function-vs-macro debate, and I we can save those for another day :) On May 11, 12:04 pm, Victor Rodriguez wrote: > On Mon, May 11, 2009 at 11:32 AM, Sean Devlin > wrote: > > > Here are my thoughts on the three approaches: > > > Approach #1:  This seems the most str

Re: Macros applied to entire programs

2009-05-11 Thread Sean Devlin
Macros are definitely the tool to do this. Take a look here at Paul Graham's "The Roots of Lisp". In it you'll get an idea of why eval is so powerful, and why macros are exactly the tool for the job you're thinking of. http://lib.store.yahoo.net/lib/paulgraham/jmc.ps I'll let someone else answ

Re: Macros applied to entire programs

2009-05-12 Thread Sean Devlin
One thing hit me as I went to bed last night about this problem: Writing a macro to optimize an s-exp *is* writing a compiler. The good news is that you *don't* have to write a parser. There is some low hanging fruit here (like the + macro described above), but I imagine there will be a lot of

str-utils change proposal, round 2

2009-05-13 Thread Sean Devlin
Hello again everyone, I've added a few new routines to a string library I've been working on. I mentioned it about a month ago, as a proposed change to str- utils. Original Thread: http://groups.google.com/group/clojure/browse_thread/thread/42152add46b851a0# Github: http://github.com/francoisde

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
seems to occur > common enough that it's not a bad idea. > > > > On Thu, May 14, 2009 at 1:12 AM, Sean Devlin wrote: > > > Hello again everyone, > > I've added a few new routines to a string library I've been working > > on.  I mentioned it ab

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
to occur > > common enough that it's not a bad idea. > > > On Thu, May 14, 2009 at 1:12 AM, Sean Devlin   > > wrote: > > >> Hello again everyone, > >> I've added a few new routines to a string library I've been working > >

Re: str-utils change proposal, round 2

2009-05-14 Thread Sean Devlin
Hmmm... it sounds like there would be use for a "string table utils" or something like that. On May 14, 11:12 am, Daniel Lyons wrote: > On May 14, 2009, at 7:14 AM, Stuart Halloway wrote: > > > > > FYI: I am working on an open-source CSV parser in Clojure. Splitting > > on delimiters is rarely e

Re: lazy-cat

2009-05-16 Thread Sean Devlin
Clearly you are all dog people. Lazy cat is redundant. On May 16, 3:55 pm, Meikel Brandmeyer wrote: > Hi, > > Am 16.05.2009 um 21:48 schrieb George Jahad: > > > I can't come up with  a reason to use lazy-cat over concat.  Is it > > just around for backwards compatibility, or am I missing someth

Re: lazy-cat

2009-05-16 Thread Sean Devlin
p. Sean On May 16, 4:13 pm, Laurent PETIT wrote: > 2009/5/16 Sean Devlin : > > > > > Clearly you are all dog people. > > Hello, > > What means calling others "dog people" exactly ? > > Not being a native english person, I'm unsure whether th

Re: lazy-cat

2009-05-16 Thread Sean Devlin
I was making a joke about housecats. Maybe I should file a bug report saying cat should default to being lazy :) Again, sorry for the confusion. On May 16, 4:34 pm, Meikel Brandmeyer wrote: > Hi, > > Am 16.05.2009 um 21:58 schrieb Sean Devlin: > > > Lazy cat is redundant.

Re: Clojure at JavaOne

2009-05-21 Thread Sean Devlin
The duck streams library should give some examples the Java crowd will be ready to appreciate. That, or maybe use the with-open macro. My $.02 On May 21, 7:42 am, Rich Hickey wrote: > On May 21, 3:39 am, mikel wrote: > > > > > On May 18, 7:36 am, Rich Hickey wrote: > > > > I'll be doing two

some vs. every?

2009-05-26 Thread Sean Devlin
I just noticed a quirk in the core API. The some and every? functions have different naming conventions. Is there a reason for this? If not I think renaming/creating an alias some? would be very helpful. --~--~-~--~~~---~--~~ You received this message because you

Re: some vs. every?

2009-05-26 Thread Sean Devlin
r...)) Just more to discuss On May 26, 9:02 am, Sean Devlin wrote: > I just noticed a quirk in the core API.  The some and every? functions > have different naming conventions.  Is there a reason for this?  If > not I think renaming/creating an alia

Re: some vs. every?

2009-05-26 Thread Sean Devlin
sult of the predicate, filter returns the seq item > for which predicate matches. > > Concerning the result of some, it seems better to return a more > meaningful value, because it still can be used as logical true, e.g. > in an if or when construct ... > > 2009/5/26 Sean Devlin : >

Re: some vs. every?

2009-05-26 Thread Sean Devlin
Oops, thanks On May 26, 9:45 am, Laurent PETIT wrote: > Please refer to Chouser's answer for your main point, > > Regards, > > -- > laurent > > 2009/5/26 Sean Devlin : > > > > > Okay, excellent counterexample for some.  I understand that behavior >

Re: quote vs quasiquote

2009-05-26 Thread Sean Devlin
I would lead the desired term with ~' For example: `(+ 1 2) => (clojure.core/+ 1 2) `(~'+ 1 2) => (+ 1 2) This is very useful when defining a function in a macro On May 26, 2:30 pm, kyle smith wrote: > user> (def nums '(1 2 3)) > #'user/nums > user> (def funs '((+ (1 2 3)) (- (1 2 3 > #'

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
CuppoJava, Could you give us a little more information what you're trying to do? What type of macro-macros are you writing? On May 28, 4:58 am, Konrad Hinsen wrote: > On 28.05.2009, at 03:11, CuppoJava wrote: > > > I'm using macroexpand-1 right now, but it's not terribly useful as > > backquote

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
Okay, this looks a lot like the ruby yeild statement. Is that what inspired you? On May 28, 12:50 pm, CuppoJava wrote: > That's unfortunate. It would have made matters much easier for me. > > The macro I'm attempting to write is: > > (defblockfn my_block_fn [arg1 arg2 func] >   (op1 arg1) >   (

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
Okay, great. That's my background too. Without discussing a specific application, I think what you're looking for can be achieved by normal macros and functions in Clojure. I'll try implement the collect method in Clojure, and hopefully that will explain things. Let's start by creating a colle

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
On May 28, 3:01 pm, Meikel Brandmeyer wrote: > Hi, > > Am 28.05.2009 um 20:11 schrieb Sean Devlin: > > > Without discussing a specific application, I think what you're looking > > for can be achieved by normal macros and functions in Clojure.  I'll >

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
On May 28, 3:10 pm, CuppoJava wrote: > Thank you Meikel for going to the trouble of writing out the full > macro. It's going to take me a while to decipher it, and hopefully > grasp some understanding at the end of it. "I find defblockfn very useful for functions that take a single function as

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
Okay, good to know. It's interesting to see other approaches. It's how we collectively get better. My $.02: (with_file "myfile.txt" #(write "asdf") (close)) Sean On May 28, 3:23 pm, CuppoJava wrote: > It's useful in all the cases where a blocks are useful in Ruby. It > simply saves

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
That's true. Good job Meikel, macro master! On May 28, 3:31 pm, CuppoJava wrote: > Correction: By "My macro" I, of course, mean "Meikel's macro" since > you're the one that actually got it working. > > Have to give credit where it's due. =) --~--~-~--~~~---~--~~

Re: Macro Writing Helper?

2009-05-28 Thread Sean Devlin
Likewise. Good discussion. On May 28, 4:49 pm, Meikel Brandmeyer wrote: > Hi, > > Am 28.05.2009 um 22:23 schrieb CuppoJava: > > > Thanks to Meikel and Sean for their input and help. > > You are welcome. :) > > Sincerely > Meikel > >  smime.p7s > 5KViewDownload --~--~-~--~~--

Programming Clojure Arrives!

2009-05-28 Thread Sean Devlin
I just got my copy of Programming Clojure in the mail today. This is the only time I expect to see the book in pristine condition, as I know it will get bookmarked, highlighted, and well used in a hurry. Congratulations Stuart! --~--~-~--~~~---~--~~ You received t

Re: The thread ring problem

2009-05-29 Thread Sean Devlin
Would type hints help at all? On May 29, 11:40 am, Laurent PETIT wrote: > Hi, > > Here is my attempt, for the real benchmark test, it has an honorable > result of 62 sec. (if there is no flaw in my algorithm, of course). > > ;; file shootout/ring.clj > (ns shootout.ring >   (:gen-class)) > > (de

Feedback on clipboard library

2009-06-01 Thread Sean Devlin
Hello Everyone, I've created a library for interacting with the clipboard. It's a wrapper for the AWT clipboard library.You can find it here: http://github.com/francoisdevlin/devlinsf-clojure-utils/tree/master *Note - I changed the location of my string library for anyone following that. =

Re: feature request: docstring for defstruct

2009-06-02 Thread Sean Devlin
This would encourage documenting structs, so I think this is a good idea. Sean On Jun 2, 11:31 am, Stuart Halloway wrote: > I would like to see defstruct take an optional docstring. Would such a   > patch be welcome? > > Stu --~--~-~--~~~---~--~~ You received thi

Re: What's the function that checks if an object is "sequence-able"?

2009-06-03 Thread Sean Devlin
I don't know either, but you can use the following work around (defn my-seq[object] (instance? clojure.lang.Seqable object)) (my-seq []) =>true (my-seq {}) =>true (my-seq #{}) =>true (my-seq '()) =>true (my-seq :a) => false (my-seq 'a-symbol) => false Still, it would be nice to know the righ

Re: Macro Writing Helper?

2009-06-03 Thread Sean Devlin
Could you throw together some live examples and unit tests? On Jun 3, 1:10 pm, CuppoJava wrote: > In case anybody else found defblockfn useful, here's the final > version. The original didn't work when you used destructuring in the > argument list of the function. > > (defn remove_destructuring

Re: Where does the language end and the libraries begin?

2009-06-04 Thread Sean Devlin
There was this language wiritten in '58 that can do just that. It's called LISP. Here's Paul Grahams paper on eval: http://lib.store.yahoo.net/lib/paulgraham/jmc.ps Get to the part where he defines eval, and let your brain stay on that for a while. You'll see WHY macros work, and never ever go

Re: defnk addition to c.c.def

2009-06-04 Thread Sean Devlin
Gut gemacht! Absolutely amazing Meikel. Now get some well earned sleep. Sean On Jun 4, 6:22 pm, Meikel Brandmeyer wrote: > Hi again, > > Am 05.06.2009 um 00:06 schrieb Meikel Brandmeyer: > > > The docstring is a bit contorted but I'm too sleepy now, > > to get that right... > > And of course

Re: defnk addition to c.c.def

2009-06-05 Thread Sean Devlin
ln "Maximum number of iterations reached") nil) true (recur next-x (inc iter-count))) So it's paying off already! On Jun 4, 7:02 pm, "Stephen C. Gilardi" wrote: > On Jun 4, 2009, at 6:54 PM, Sean Devlin wrote: > > > Gut gemacht

Where is group by?

2009-06-05 Thread Sean Devlin
Okay, I may be going nuts here. I can seem to find the group by function anymore. Where is it? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroup

Re: Where is group by?

2009-06-05 Thread Sean Devlin
Okay, found it. clojure.contrib.seq-utils On Jun 5, 10:15 am, Sean Devlin wrote: > Okay, I may be going nuts here.  I can seem to find the group by > function anymore.  Where is it? --~--~-~--~~~---~--~~ You received this message because you are subscri

Re: Where is group by?

2009-06-05 Thread Sean Devlin
For those of you that may have the same problem in the future, check the index: http://code.google.com/p/clojure-contrib/wiki/ApiDocIndex Great work. On Jun 5, 10:25 am, Sean Devlin wrote: > Okay, found it. > > clojure.contrib.seq-utils > > On Jun 5, 10:15 am, Sean Devlin wr

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
Try adding type hints. Assuming all-zips returns a list of strings: (defn all-zips-MD5 [] "Returns a lazy list of all possible American zipcodes, as MD5 digests." (let [digester (java.security.MessageDigest/getInstance "MD5")] (map (fn [#^java.util.String to-digest] (.update

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
On Jun 5, 11:14 am, Daniel Lyons wrote: > On Jun 5, 2009, at 8:56 AM, Daniel Jomphe wrote: > > > I need to generate a list of all possible American zipcodes, MD5- > > digested. Later on, I will need to do much more involving stuff, > > processor-wize, with this. But already, generating a naive

Re: Optimizing cross-product mappings

2009-06-05 Thread Sean Devlin
Sounds like a candidate for the daily WTF... On Jun 5, 12:54 pm, Daniel Jomphe wrote: > You guessed mostly right, Daniel :) This guy hashed some fields of his > client's database, replacing the original content with its hashed > version. I don't know everything, but he at least obfuscated the >

Re: Threadring Benchmark

2009-06-05 Thread Sean Devlin
This problem came up on the mailing list recently: http://groups.google.com/group/clojure/browse_thread/thread/5e0c078d0ad8b8bc# You might want to compare your code to what was done here, but at a glance the implementations are similar. You provide relative speed comparisons (Such and such is %

Spam in file section

2009-06-08 Thread Sean Devlin
Not quite sure what the right way to report this is. There seems to be some spam in the file report. The "Mathis-Oberg- Insulating_Guide.pdf" seems to be out of place. My apologies if this is a false positive. --~--~-~--~~~---~--~~ You received this message becau

Re: Thoughts on bags?

2009-06-08 Thread Sean Devlin
I think I know what you mean by a "bag", but I'm not quite sure. How does a bag compare to a set, vector and/or list? On Jun 9, 1:31 am, Richard Newman wrote: > The relational operations work on sets. That's often useful, but there   > are situations in which preserving cardinality is more usef

Monad problem in c.c svn 926

2009-06-09 Thread Sean Devlin
I was trying to play with the monad facility in c.c. I'm using Aquamacs & SLIME, and I ran into the following problem: user=> (use 'clojure.contrib.monads) java.lang.Exception: Unable to resolve symbol: get-method in this context (accumulators.clj:60) I think this is a bug. Not sure, though.

Re: You know you've been writing too much Clojure when...

2009-06-09 Thread Sean Devlin
You're writing an email and ;Rich Hickey is a no good... comment out a line instead of deleting it :) (Fortunately I caught this before I hit send) On Jun 4, 8:48 am, BrianS wrote: > You see a license plate in front of you DEFN1A3F and you wonder what > the function 1A3F would return...ha

Re: Monad problem in c.c svn 926

2009-06-09 Thread Sean Devlin
Hmmm... I just tested this in Enclojure. use works fine there. Still doesn't work on my Aquamacs/SLIME setup. I'll check my config. On Jun 10, 2:14 am, Konrad Hinsen wrote: > On 09.06.2009, at 23:48, Sean Devlin wrote: > > > I was trying to play with the monad facil

Date Adapter Utility

2009-06-11 Thread Sean Devlin
Hey everyone, I'm looking for feedback on a date utility library I'm writing. It's still early in it's design, and I want to see if other people see anything. It's designed to create various forms of date objects. It's available on github here: http://github.com/francoisdevlin/devlinsf-clojure

Re: Date Adapter Utility

2009-06-12 Thread Sean Devlin
bringing up this point. On Jun 12, 10:19 am, "AndrewC." wrote: > On Jun 12, 2:24 am, Sean Devlin wrote: > > > Hey everyone, > > I'm looking for feedback on a date utility library I'm writing. > > Without wanting to seem down on your obvious care and hard

Universal Date utility

2009-06-15 Thread Sean Devlin
Hey everyone, There have been a couple of threads discussing date utilities in this group. http://groups.google.com/group/clojure/browse_thread/thread/d98e8efd8d5517b2# http://groups.google.com/group/clojure/browse_thread/thread/659503e698ede0b5/9dda25f36f102799?lnk=gst&q=joda#9dda25f36f102799

Re: will clojure evolve to be able to do systems programming?

2009-06-16 Thread Sean Devlin
What exactly do you mean by systems programming? If you mean hardware stuff that's outside the scope of the JVM, then no, I doubt it. However, I am hard pressed to think of situations that you can code with Java SE (dunno about ME) that you can't handle with Clojure. Now that I think about it,

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Sean Devlin
Hari, First, I'd recommend you watch Rich's videos on Clojure, both for Java programmers and LISP programmers. In it Rich explains why Clojure *isn't* OO. It's heresy to some who has written lots of Java, but once you see Clojure in action, everything starts to make sense. I know when I went do

Re: Rebinding functions?

2009-06-16 Thread Sean Devlin
Yes, people have shown examples on this list where (+ a b) is dramatically faster than (+ a b c) On Jun 16, 1:42 pm, Paul Stadig wrote: > On Tue, Jun 16, 2009 at 1:38 PM, Michel Salim wrote: > > > > > It's currently not possible to dynamically rebind functions: > > > (binding [+ -] (+ 5 3)) =

Re: binding at the REPL

2009-06-16 Thread Sean Devlin
Did you try this from a fresh REPL? Maybe you made a typo somewhere? I can't reproduce it. user=> (def dozen 12) #'user/dozen user=> (binding [dozen 13] dozen) 13 On Jun 16, 2:08 pm, Stuart Halloway wrote: > This surprised me. What part of my mental model needs to be   > adjusted? :-) > > user

Re: binding at the REPL

2009-06-16 Thread Sean Devlin
I use 1.0, btw. Tested both on OSX and Windows. On Jun 16, 2:19 pm, Mark Volkmann wrote: > On Tue, Jun 16, 2009 at 1:08 PM, Stuart > > Halloway wrote: > > > This surprised me. What part of my mental model needs to be > > adjusted? :-) > > > user=> (def dozen 12) > > #'user/dozen > > > user=> (b

Re: Shouldn't c.l.Namespace implement c.l.Named?

2009-06-16 Thread Sean Devlin
To borrow a term from ruby, the API should follow the "Principle of Least Surprise". While ns-name works, I agree with pmf. It would be nice if c.l.Namepsace implemented c.l.Named My $.02 On Jun 16, 3:25 pm, Meikel Brandmeyer wrote: > Hi, > > Am 16.06.2009 um 19:42 schrieb pmf: > > > I've not

Re: No OO restrictions is good. why not still add dependency injection?

2009-06-16 Thread Sean Devlin
That would be point 5 :) On Jun 16, 3:45 pm, Daniel Lyons wrote: > Sean, > > On Jun 16, 2009, at 10:59 AM, Sean Devlin wrote: > > > The last example was okay, but it felt a little forced.  Let's create > > a function to do the currying for us: > > > user=&

Re: Clojure goes Git!

2009-06-16 Thread Sean Devlin
Thanks you! On Jun 16, 8:17 pm, Rich Hickey wrote: > Clojure and contrib repos are now on GitHub: > > http://github.com/richhickey/clojurehttp://github.com/richhickey/clojure-contrib > > Issues and other development collaboration has moved to Assembla: > > http://www.assembla.com/spaces/clojureh

Re: accum

2009-06-16 Thread Sean Devlin
Daniel, don't feed the WrexTroll On Jun 17, 12:44 am, Daniel Lyons wrote: > On Jun 16, 2009, at 10:34 PM, Wrexsoul wrote: > > > > > > > > > I'm shocked that this is missing from clojure.core: > > > (defn accum [f init coll] > >  (loop [x init c coll] > >    (if (empty? c) > >      x > >      (re

Re: accum

2009-06-16 Thread Sean Devlin
Wrexsoul, Your right, I was out of line. I'm sorry. I should go through the effort to explain myself rather than resort to personal attacks. Sean On Jun 17, 1:25 am, Wrexsoul wrote: > On Jun 17, 12:57 am, Sean Devlin wrote: > > > Daniel, don't feed the WrexTroll &g

Re: reasoning/logic programming from Clojure

2009-06-17 Thread Sean Devlin
Sounds awesome! Will you be able to post any material after the talk? You know, slides, videos, notes, etc? Sean On Jun 17, 5:35 am, Daniel Lyons wrote: > Hi everyone, > > I'm doing a short talk on declarative/logic programming, reasoning and   > expert systems for the Albuquerque Lisp/Scheme

Re: Apply a function to some values in a map

2009-06-18 Thread Sean Devlin
Here's my solution to the problem. It's a bit long winded, so bear with me (or ignore it :)) I defined a function trans (defn trans [& params]...) Let me show an example: user=> (def test-map {:a 0 :b "B" :c "C"}) #'user/test-map user=> ((trans :count count) test-map) {:count 3, :a 0, :b "B"

Re: Apply a function to some values in a map

2009-06-18 Thread Sean Devlin
; (= (list-to-map 1 2 3 4) (hash-map 1 2 3 4)) > true > > On Jun 18, 11:19 pm, Sean Devlin wrote: > > > Here's my solution to the problem.  It's a bit long winded, so bear > > with me (or ignore it :)) > > > I defined a function trans > > > (d

Re: What are people using Clojure for?

2009-06-18 Thread Sean Devlin
I'm the "report guy", which means a lot of speadsheet/database/erp/ html scraping/mind reading type work. I use Clojure for a lot of ad- hoc data processing. The following things make my job a lot easier: * Quick feedback from the REPL * Abstracting everything to a hash-map * map/filter/remo

Re: Which map access is more idiomatic

2009-06-18 Thread Sean Devlin
I like the map-key pattern, especially inside a function. (fn [my-var] ({"A" 1 :b "one"} my-var)) In this example, the my-var works properly when passed a string. (fn [my-var] (my-var {"A" 1 :b "one"})) The second example breaks when passed a string. On Jun 18, 8:37 pm, kkw wrote: > (my

Re: Dynamically accessing static fields

2009-06-22 Thread Sean Devlin
There's already a miglayout wrapper in contrib. It seemed usable when I looked at it. On Jun 22, 7:35 am, Laurent PETIT wrote: > Hi, > > BTW, if it can be an option for you, there's also the MigLayout layout > manager (http://www.miglayout.com/) that allows to write constraints > as Strings. It

Re: macroexpand question

2009-06-22 Thread Sean Devlin
Another advantage to the second form is that it doesn't collide with any versions of x you may have defined ;This will do weird stuff to x (let [x 2] (take-until1 (do-stuff-to-x))) ;This will behave like you expect (let [x 2] (take-until2 (do-stuff-to-x))) Meikel wrote a good set of guidelines

Moving Window Function

2009-06-22 Thread Sean Devlin
Hey all, Does anyone know of a moving window function? I'm curious if there are any tools like this for digital signals processing, 30-day moving averages, etc. Sean --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C

Re: Moving Window Function

2009-06-23 Thread Sean Devlin
e > > On Tue, Jun 23, 2009 at 8:36 AM, Sean Devlin wrote: > > > > > Hey all, > > Does anyone know of a moving window function?  I'm curious if there > > are any tools like this for digital signals processing, 30-day moving > > averages, etc. > > > Se

Re: Clojure and JAX-WS

2009-06-24 Thread Sean Devlin
How about a combination of the following tools instead of the Java API: c.c.prxml c.c.duck-streams compojure I haven't tried this, and I have never worked with SOAP, so take it with an appropriately sized grain of salt. On Jun 24, 1:09 pm, Richard Newman wrote: > > No response. > > > Not even

Re: Hash Consing

2009-06-29 Thread Sean Devlin
I'm pretty sure Clojure already does this, because of the built in equality by value. I'm pretty sure the hash keys work of off the value, too. Do you have any code you could post to github or something? That would help us determine if such a thing already exisits. I know this doesn't save you

Apache POI wrapper????

2009-07-01 Thread Sean Devlin
Hey, Has anyone out there written an Apache POI wrapper yet? Sean --~--~-~--~~~---~--~~ 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

Re: Apache POI wrapper????

2009-07-01 Thread Sean Devlin
Hmmm... good to know POI still needs work. I guess I'll just stick with CSV & tab delimited for now. Thanks! On Jul 1, 1:56 pm, Richard Newman wrote: > > Has anyone out there written an Apache POI wrapper yet? > > I started to (for Excel processing), only to abandon it in disgust.   > POI is j

Blog on the history of C++

2009-07-02 Thread Sean Devlin
Hey all, I found this blog entry on how C++ replaced C, and it made me think of how Clojure interacts with Java. Not a direct comparison, but I figure I'm not the only on who'll like it. http://ejohnson.blogs.com/software/2004/11/i_find_c_intere.html Hope someone enjoys it. --~--~-~--~-

Flag spam in files?

2009-07-06 Thread Sean Devlin
Hey everyone, I've noticed on several occasions there's spam in the file section (like right now. e.g. "SexyBabe.html"). What's the preferred approach to handle this: 1. Ignore it 2. Mention it on this list 3. Use a system for tagging files as spam 4. Some other idea? --~--~-~--~---

Re: Is this unquote dangerous?

2009-07-06 Thread Sean Devlin
I think your unquote is okay. ClojureQL does something similar. However, my gut says this should be in a doseq, not a for statement. Could be totally wrong, tough. My $.02 Sean On Jul 6, 2:39 pm, Mike wrote: > Newbie question here.  Probably answered in Stu's book, but I forgot > it at home

Re: Questions / guidelines for adopting Clojure

2009-07-07 Thread Sean Devlin
Let me take a stab at you parametrization question > * Parametrization of "function groups" * > > Lets say I have a bunch of functions that provide database operations > (read, write, delete, ...). They all share information about the > database the operate on. In an OO language, I would define t

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
This seems like a good use for a macro. A couple of thoughts: 1. Use arrays instead of lists In clojure, it is "best practice" to use arrays for data. So, your macro call should look like this. (match [1 2 3] [1 x] (+ x x) [1 x y] (+ x y)) 2. Could you post the source to mat

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
4. Is this example from SICP? On Jul 8, 12:12 pm, Sean Devlin wrote: > This seems like a good use for a macro.  A couple of thoughts: > > 1.  Use arrays instead of lists > In clojure, it is "best practice" to use arrays for data.  So, your > macro call should look lik

Re: Save current namespace like a Smalltalk image

2009-07-08 Thread Sean Devlin
Isn't this why you would use a doc string, and not a comment? On Jul 8, 12:14 pm, Daniel Lyons wrote: > On Jul 8, 2009, at 5:46 AM, Robert Campbell wrote: > > > It seems strange to me that Clojure doesn't support this concept   > > natively > > Comments are part of the problem. Clojure's reader

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
Laurent, I don't quite understand your point. Could you please explain it a little more? Thanks On Jul 8, 12:16 pm, Laurent PETIT wrote: > 2009/7/8 Sean Devlin : > > > > > This seems like a good use for a macro.  A couple of thoughts: > > > 1.  Use arrays ins

Re: Newbie macro problems

2009-07-08 Thread Sean Devlin
Good point. I'll be careful to use the term vector in the future, and array for java interop only. On Jul 8, 12:30 pm, Laurent PETIT wrote: > 2009/7/8 Sean Devlin : > > > > > Laurent, > > > I don't quite understand your point.  Could you please explain it a

Re: From Java to Clojure

2009-07-09 Thread Sean Devlin
One question on design intent before feedback. Is your intent to have this Clojure code called by Java code later? On Jul 9, 7:31 am, Patrik Fredriksson wrote: > Hi! > > I started to look closer at Clojure after Rich Hickey's presentation > at QCon London in March, this is my first post. I spe

Re: From Java to Clojure

2009-07-09 Thread Sean Devlin
dered); >         assertTrue(unordered.isEmpty()); >         assertTrue(ordered.isEmpty()); >     } > >     public void testJavaImpl() { >         doTestOrderByFreq(new JavaOrderer()); >     } > >     public void testClojureImpl() { >         doTestOrderByFreq(new step3.pneh

Re: On laziness and with-open

2009-07-09 Thread Sean Devlin
That pages says the scopes system is already designed. To you have any preliminary design docs posted somewhere? On Jul 9, 2:59 pm, Stuart Sierra wrote: > On Jul 9, 6:10 am, Mike wrote: > > > Is there a pattern out there in Clojure for handling laziness at the > > same time as handling resourc

Re: From Java to Clojure

2009-07-10 Thread Sean Devlin
To quote Benjamin Stewart: ;; the body of this fn should probably be a macro that takes ;; any number of comparisons and or-chain them correctly such that ;; ties cascade to the next comparison and obviates the need for ;; explicit calls to false-if-zero. Does it already exist? This could be do

Re: ArithmeticException with doubles

2009-07-10 Thread Sean Devlin
A quick java program: public static void main(String[] args) { System.out.println(1.0/0.0); } Infinity On Jul 10, 11:08 am, John Harrop wrote: > This is odd: > user=> (/ 1.0 0.0) > # (NO_SOURCE_FILE:0)> > > Shouldn't it be Double/POSITIVE_INFINITY? --~--~-~--~~~---

Re: Clojure cheat sheet

2009-07-10 Thread Sean Devlin
Okay, I just printed the color version... Damn! This is awesome! I need to find some really heavy paper now, or a laminator machine, or both. Good job. On Jul 10, 10:27 am, Steve Tayon wrote: > Hi all, > > I uploaded a new revision. > > What's new? > - filled tables with colours (grey version

  1   2   3   4   5   6   >