Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 20:46, Mike Meyer wrote: > The first problem with that is that this stuff seems show up > *everywhere* in Javaland. It's not just web apps, it's pretty much > anything. You just lost me completely with your argumentation. I wrote a small desktop utility (simple problem, simple so

Re: Knowing in advance the complexity of count

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 21:01, Randy Hudson wrote: > Inexplicably (counted? "abcd") returns false. Why should it? String does not implement Counted. Sincerely Meikel -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: matching with wild-cards in clojure multi-methods

2010-09-10 Thread Meikel Brandmeyer
Hi, On 9 Sep., 21:47, Daniel Werner wrote: > Could this be a bug? No. Clojure does not enforce contracts in several places. Feed wrong things in and get undefined behaviour back. Only the contract is guaranteed. Everything else is an implementation detail and might change at any moment. Sincer

Re: Simple things should be simple

2010-09-10 Thread Laurent PETIT
2010/9/10 Meikel Brandmeyer : > Hi, > > On 9 Sep., 20:46, Mike Meyer 620...@mired.org> wrote: > >> The first problem with that is that this stuff seems show up >> *everywhere* in Javaland. It's not just web apps, it's pretty much >> anything. > > You just lost me completely with your argumentation

Re: Knowing in advance the complexity of count

2010-09-10 Thread Laurent PETIT
2010/9/10 Meikel Brandmeyer : > Hi, > > On 9 Sep., 21:01, Randy Hudson wrote: > >> Inexplicably (counted? "abcd") returns false. > > Why should it? String does not implement Counted. Maybe when Counted becomes a protocol and is then extended to java.lang.String ? (Does this make sense ?) -- Yo

Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, On 10 Sep., 10:27, Laurent PETIT wrote: > while I admit I haven't read *all* the answers to Meikel's question in > their entirety, what I've understood is that : > >   * he's not talking about clojure the language, but its ecosystem > (the JVM host and the J2EE stuff -de facto standard for w

Re: Knowing in advance the complexity of count

2010-09-10 Thread Meikel Brandmeyer
Hi, On 10 Sep., 10:33, Laurent PETIT wrote: > Maybe when Counted becomes a protocol and is then extended to > java.lang.String ? > > (Does this make sense ?) Hmmm... Then you can't implement count for seqs anymore. Given you want the Counted protocol to provide a O(1) count function (really na

Re: Simple things should be simple

2010-09-10 Thread Laurent PETIT
2010/9/10 Meikel Brandmeyer : > Hi, > > On 10 Sep., 10:27, Laurent PETIT wrote: > >> while I admit I haven't read *all* the answers to Meikel's question in >> their entirety, what I've understood is that : >> >>   * he's not talking about clojure the language, but its ecosystem >> (the JVM host an

[ANN] http.async.client v0.2.0

2010-09-10 Thread Hubert Iwaniuk
I'm happy to announce release of http.async.client v0.2.0 an Asynchronous HTTP Client for Clojure. This is wrapper/adapter on top of http://github.com/AsyncHttpClient/async-http-client Project: http://github.com/neotyk/http.async.client/ Documentation: http://neotyk.github.com/http.async.client

Re: Some Problem with Recursion

2010-09-10 Thread Stefan Rohlfing
@ Nicolas and ajuc Thank you very much for showing me where I went wrong! With so many parentheses it sometimes happens that I misplace one Now the output of the function is as expected: (defn prefix->postfix [expr] (if (coll? expr) (let [ [op arg1 arg2] expr] [ (prefix->postfix arg1

Re: Some Problem with Recursion

2010-09-10 Thread Laurent PETIT
2010/9/10 Stefan Rohlfing : > @ Nicolas and ajuc > > Thank you very much for showing me where I went wrong! With so many > parentheses it sometimes happens that I misplace one > > Now the output of the function is as expected: > > (defn prefix->postfix [expr] >  (if (coll? expr) >    (let [ [op arg

Re: Some Problem with Recursion

2010-09-10 Thread Stefan Rohlfing
Hi Laurent, Thanks for your detailed explanation! It greatly helped me understand the usage of quoting. Stefan On Sep 10, 5:27 pm, Laurent PETIT wrote: > 2010/9/10 Stefan Rohlfing : > > > > > > > > > > > @ Nicolas and ajuc > > > Thank you very much for showing me where I went wrong! With so man

Re: A difficult Metaphor for Macros (especially for Java people)

2010-09-10 Thread Adam Burry
On Sep 9, 5:06 pm, alux wrote: > But, @Luc > "pushing the advantage of Lisp > macros to the forefront is not obvious if the audience cannot compare > with another (good/simple) implementation they understand well." > > Thats why I want to use a nifty metaphor ;-) Even your dumbest Java developer

Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Paul D. Fernhout
I'm just trying out Clojure a bit, so this may be an obvious simple thing I'm misunderstanding. This code in the test file below allows editing a Clojure function that is updated when an "Update Code" button is pressed, with the new value connected to a GUI button "Click Me!" as a proxy Action

Re: Simple things should be simple

2010-09-10 Thread Alessio Stalla
On Sep 9, 6:06 pm, Phil Hagelberg wrote: > On Thu, Sep 9, 2010 at 8:38 AM, Mike Meyer > > wrote: > > And two tools - lein and clojure itself. > > I'm not sure Clojure should be counted separately since you're not > installing it yourself. > > > So we go from 3, 0, 1 to 6, 4, 2. I'm not sure that

testing local functions?

2010-09-10 Thread alux
Hello, I always thought it to be good style to make helper functions only as visible as needed, e.g. by using letfn. But when I want to test my code, I just dont see a way to access these local functions for tests. (I've seen fogus playing with the test of functions that are namespace private ht

Re: testing local functions?

2010-09-10 Thread James Reeves
On 10 September 2010 12:24, alux wrote: > I always thought it to be good style to make helper functions only as > visible as needed, e.g. by using letfn. > > But when I want to test my code, I just dont see a way to access these > local functions for tests. I don't believe you can. You could make

Re: testing local functions?

2010-09-10 Thread alux
Hi James, thanks for your answer. > your tests should be testing your public interface Hhmmm. Well, I tend to disagree here. I sometimes like to have tests in place for things I want to refactor. To not inadvertently do something foolish. But I agree that this is not easily accomplishable. Gre

Re: testing local functions?

2010-09-10 Thread Christian Vest Hansen
>From someone who's window to your code is your public API, a refactoring should make no observable change. So if you only test on the public API, but you test it thoroughly, then your tests will ensure that this property holds. Tests that delve into implementation details and private things, are

Re: Simple things should be simple

2010-09-10 Thread John Cromartie
On Sep 9, 11:47 am, Mike Meyer wrote: > On Thu, 9 Sep 2010 16:28:48 +0100 > > Edmund Jackson wrote: > > Hi Mike, > > >     Could you perhaps present a counter-example of greater simplicity ? > > $ cat - > /usr/local/www/apache22/cgi-bin/hello-world.sh > #!/bin/sh > > echo 'Content-type: text/pla

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Sean Devlin
Try printing out the *ns* variable in the fn. Chances are your code is being created in a different *ns* than it is being run. You can also try using the fully qualified path to get to JOptionPane, that may help too. On Sep 9, 9:43 pm, "Paul D. Fernhout" wrote: > I'm just trying out Clojure a b

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Laurent PETIT
Got it. You cannot invoke (import) (or (ns)) from within the function definition. The function is already being evaluated, and it's "too late". This works fine for me: (do (import '(javax.swing JOptionPane)) ((fn [] (println "Hello World") (println (+ 2 2)) (JOptionPane/showMess

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Sean Devlin
I've also used the with-ns package in contrib to fix this. On Sep 10, 9:03 am, Laurent PETIT wrote: > Got it. You cannot invoke (import) (or (ns)) from within the function > definition. The function is already being evaluated, and it's "too > late". > > This works fine for me: > > (do >   (import

Re: Simple things should be simple

2010-09-10 Thread brianh
Just to be contrary ;) A one time investment of 2 minutes (I did have to scrounge in contrib to locate these after all): (defn make-stupid-simple-script [f content] (spit f content) (sh "chmod" "755" (.getName f))) for the eternal pleasure of using: user=> (make-stupid-simple-script (File.

Re: Simple things should be simple

2010-09-10 Thread gary ng
On Fri, Sep 10, 2010 at 4:47 AM, John Cromartie wrote: > #!/usr/local/bin/clj > > (println "Content-type: text/plain\n") > (println "Hello, World!") > ^D > > Is that simple enough? > That was my thought too, java/clojure console app should not be more complex than python etc. The issue is the star

Re: [ANN] Leiningen 1.3.1

2010-09-10 Thread lprefontaine
I solved my maven corruption problem. On if the m2 index folder was not cleaned properly. Luc P, lprefonta...@softaddicts.ca wrote .. > Hi Phil, > > I upgraded to 1.3.1 but started to experience some problems with > my our-classe-only hook. I made it return 0 since 1.3.1 expects a numeric > re

Leiningen-1.4.0-SNAPSHOT missing

2010-09-10 Thread Bahman Movaqar
Hi List, Today, trying to setup Clojure I downloaded 'leiningen.bat' from (http://github.com/technomancy/leiningen/raw/master/bin/lein.bat) and 'self-install' fails: C:\Users\Bahman>lein self-install SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc syswgetrc = C:\Program Files\GnuWin32/etc/wgetr

Re: Simple things should be simple

2010-09-10 Thread John Newman
Finally, > cat - > /usr/local/www/apache22/cgi-bin/hello-world > > #!/usr/local/bin/clj > > (println "Content-type: text/plain\n") > (println "Hello, World!") > ^D I can start using Clojure again :) John -- You received this message because you are subscribed to the Google Groups "Clojure" gro

Re: A difficult Metaphor for Macros (especially for Java people)

2010-09-10 Thread lprefontaine
Adam Burry wrote .. > On Sep 9, 5:06 pm, alux wrote: > > But, @Luc > > "pushing the advantage of Lisp > > macros to the forefront is not obvious if the audience cannot compare > > with another (good/simple) implementation they understand well." > > > > Thats why I want to use a nifty metaphor ;-)

Re: Simple things should be simple

2010-09-10 Thread cody koeninger
On Sep 10, 1:32 am, Mike Meyer wrote: > I think that Java's strength is enterprise-level, highly scalable web > servers make people assume that every problem must be a nail for that > hammer. I think that Unix's strength is small independent programs communicating over standard I/O makes you as

What is ring/jetty doing with my *out*?

2010-09-10 Thread Colin Steele
It seems that when using ring/jetty, *out* is getting eaten or thrown away. I'm a n00b to clojure and the java world in general, but it seems odd that (prn something) should silently fail? I'm guessing that I'm missing some configuration somewhere? Help? :) --Colin -- You received this messa

Re: Leiningen-1.4.0-SNAPSHOT missing

2010-09-10 Thread Bahman Movaqar
On 2010/9/10 19:07, Bahman Movaqar wrote: > Hi List, > > Today, trying to setup Clojure I downloaded 'leiningen.bat' from > (http://github.com/technomancy/leiningen/raw/master/bin/lein.bat) and > 'self-install' fails: > C:\Users\Bahman>lein self-install > SYSTEM_WGETRC = c:/progra~1/wget/etc/

Re: What is ring/jetty doing with my *out*?

2010-09-10 Thread James Reeves
On 10 September 2010 15:39, Colin Steele wrote: > It seems that when using ring/jetty, *out* is getting eaten or thrown > away.  I'm a n00b to clojure and the java world in general, but it > seems odd that (prn something) should silently fail?  I'm guessing > that I'm missing some configuration so

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread Isaac Gouy
On Sep 9, 10:15 pm, gary ng wrote: > On Thu, Sep 9, 2010 at 10:04 PM, Isaac Gouy wrote: > > Is there any point speculating about this as outsiders? > > > It was available - Data.HashTable seems to be copyright 2003. > > >http://ogi.altocumulus.org/~hallgren/Programatica/tools/pfe.cgi?Data >

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
That ought to be correct, but I can't reconcile that with the error message. Doesn't the "Can't embed object in code, maybe print-dup not defined" error only appear in macros, when some object being spliced into a macro's expansion is not a basic Clojure form? Yet, you are correct, commenting out t

Re: A difficult Metaphor for Macros (especially for Java people)

2010-09-10 Thread Adam Burry
On Sep 10, 1:10 pm, lprefonta...@softaddicts.ca wrote: > Adam Burry wrote .. > > > On Sep 9, 5:06 pm, alux wrote: > > > But, @Luc > > > "pushing the advantage of Lisp > > > macros to the forefront is not obvious if the audience cannot compare > > > with another (good/simple) implementation they u

Clojure User Group around Geneva ?

2010-09-10 Thread Stéphane Tavera
Hi everyone, As a beginner in Clojure, I'm wondering if there is any kind of Clojure User Group around Geneva ? (If not, some friends of mine and I are willing to create one.) Thanks in advance, __ s t -- You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
You're right about the namespace-qualification: I accidentally macroexpanded with syntax-quote rather than quote. My mistake; the actual expansion is the same, but without namespace-qualification. Using (var ~fn-name) results in the same error, unfortunately. I think now the attempted embedding of

Re: Leiningen-1.4.0-SNAPSHOT missing

2010-09-10 Thread Phil Hagelberg
On Fri, Sep 10, 2010 at 7:37 AM, Bahman Movaqar wrote: > Also another strange thing is that when I open a command prompt and > enter 'lein self-install' it fails; I figured out I have to issue a > dummy 'lein new' first for 'self-install' to start. >  C:\Users\Bahman>lein self-install >  The synta

clojure-test-mode elpa version still out of date?

2010-09-10 Thread User7
I'm using emacs starter kit and clojure-test-mode 1.4 installed using elpa. Running clojure-tests-run-tests seems to work fine, but clojure- test-run-test seems flakey. This blog post from May says the elpa version is out of date. http://otfrom.wordpress.com/2010/05/16/leiningen-clojure-1-2-and

Re: Simple things should be simple

2010-09-10 Thread Raoul Duke
On Fri, Sep 10, 2010 at 1:27 AM, Laurent PETIT wrote: > These last few months, working on ccw has been particularly > interesting because I've had feedback from users, especially Lee. Lee > has challenged a lot of what I had considered to be "simple things" in > ccw. I can say that when you're in

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
I've solved the problem. I found that it only occurred when general- defmaker was called with its forms argument containing another general- defmaker call with def-form being defmacro. Thus, in the inner general- defmaker call, the *result* of (NamedRule. (delay …)) was embedded into a defmacro cal

Re: Macro problems with delay

2010-09-10 Thread joshua-choi
I've solved the problem. I found that it only occurred when general- defmaker was called with its forms argument containing another general- defmaker call with def-form being defmacro. Thus, in the inner general- defmaker call, the *result* of (NamedRule. (delay …)) was embedded into a defmacro cal

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread gary ng
On Fri, Sep 10, 2010 at 8:49 AM, Isaac Gouy wrote: >> Huh ? point ? it was just a casual comment, no point was intended. And >> I have read some comments by Don that what is in the shoutout is way >> faster than Data.HashTable > > > If you knew there was another option why write "I doubt there is

A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Chas Emerick
With a huge helping hand from Relevance, the host of the Conj in October, I'm hoping we can make it possible for Anthony Simpson (you may know him as Raynes in #clojure irc) to attend the conference. The blog post tells the story: http://bit.ly/9dmeDe I hope you'll check it out, and help in

Re: What is ring/jetty doing with my *out*?

2010-09-10 Thread Colin Steele
Ahhh... I found it. I was actually using "print" not "prn". Switching to prn works! :) (flushing?) On Sep 10, 11:30 am, James Reeves wrote: > On 10 September 2010 15:39, Colin Steele wrote: > > > It seems that when using ring/jetty, *out* is getting eaten or thrown > > away.  I'm a n00b to cloj

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread Isaac Gouy
On Sep 10, 10:35 am, gary ng wrote: > On Fri, Sep 10, 2010 at 8:49 AM, Isaac Gouy wrote: > >> Huh ? point ? it was just a casual comment, no point was intended. And > >> I have read some comments by Don that what is in the shoutout is way > >> faster than Data.HashTable > > > If you knew there

Re: Leiningen-1.4.0-SNAPSHOT missing

2010-09-10 Thread Bahman Movaqar
On 2010/9/10 21:42, Phil Hagelberg wrote: > On Fri, Sep 10, 2010 at 7:37 AM, Bahman Movaqar wrote: >> Also another strange thing is that when I open a command prompt and >> enter 'lein self-install' it fails; I figured out I have to issue a >> dummy 'lein new' first for 'self-install' to start. >

Re: Leiningen-1.4.0-SNAPSHOT missing

2010-09-10 Thread Bahman Movaqar
On 2010/9/10 21:42, Phil Hagelberg wrote: > On Fri, Sep 10, 2010 at 7:37 AM, Bahman Movaqar wrote: >> Also another strange thing is that when I open a command prompt and >> enter 'lein self-install' it fails; I figured out I have to issue a >> dummy 'lein new' first for 'self-install' to start. >

Re: clojure-test-mode elpa version still out of date?

2010-09-10 Thread User7
I downloaded clojure-mode from http://github.com/technomancy/clojure-mode and installed both clojure-mode.el and clojure-test-mode.el using M-x package-install-from-buffer. On the following set of tests, M-x clojure-test-run-tests seems to work, but M-x clojure-test-run-test on just the pass func

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread gary ng
On Fri, Sep 10, 2010 at 11:13 AM, Isaac Gouy wrote: > Clearly, they did choose "to write all that code" "in order to get a > much faster program" - I can't tell you if Andy had noticed the > benchmark was about "Hashtable update and k-nucleotide strings" or > whether he knew about Data.HashTable.

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Alan
Did we really get this done in an hour? I haven't been part of the community for long, but Rayne has been helpful to me already on #clojure so I was going to donate a bit. Did I already miss my chance? On Sep 10, 10:39 am, Chas Emerick wrote: > With a huge helping hand from Relevance, the host of

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Sean Devlin
Welcome to Clojure On Sep 10, 2:55 pm, Alan wrote: > Did we really get this done in an hour? I haven't been part of the > community for long, but Rayne has been helpful to me already on > #clojure so I was going to donate a bit. Did I already miss my chance? > > On Sep 10, 10:39 am, Chas Emerick

Re: testing local functions?

2010-09-10 Thread Brian Marick
I've worked out a way to test local functions. When I tried it out by hand, it felt good. See here: http://bit.ly/b1AoG7 Implementing it is on my wishlist for Midje, my test framework. http://github.com/marick/Midje On Sep 10, 2010, at 6:24 AM, alux wrote: > Hello, > > I always thought it t

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Chas Emerick
Just a little over an hour, yes! Raynes is going to the Conj. Thanks to all who donated. More info, numbers, and more thank-yous here: http://bit.ly/aj0XPr And, if you *wanted* to donate, but ended up coming in after we hit our goal, please read the above post anyway. :-) Thanks again t

Re: Simple things should be simple

2010-09-10 Thread Mike Meyer
On Fri, 10 Sep 2010 00:03:22 -0700 (PDT) Meikel Brandmeyer wrote: > Hi, > > On 9 Sep., 20:46, Mike Meyer 620...@mired.org> wrote: > > > The first problem with that is that this stuff seems show up > > *everywhere* in Javaland. It's not just web apps, it's pretty much > > anything. > > You jus

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Rayne
I wrote a brief thank you post on my blog (actually the first post on this new blog. :>) http://blog.acidrayne.net/thank-you-for-sending-me-to-the-conj I'm unbelievably excited. I love you guys. On Sep 10, 2:09 pm, Chas Emerick wrote: > Just a little over an hour, yes!  Raynes is going to the C

Re: Simple things should be simple

2010-09-10 Thread Mike Meyer
On Fri, 10 Sep 2010 07:11:18 -0700 gary ng wrote: > On Fri, Sep 10, 2010 at 4:47 AM, John Cromartie wrote: > > #!/usr/local/bin/clj > > > > (println "Content-type: text/plain\n") > > (println "Hello, World!") > > ^D > > > > Is that simple enough? > > > That was my thought too, java/clojure conso

Generating functions programmatically

2010-09-10 Thread icemaze
Hi, I'm developing a small DSL with Clojure and I need to define many similar functions. I'd like to do that programmatically, of course. My solution (involving a simple macro) doesn't work, so I won't bother you with it. I'll post it if anyone asks. Basically what I need is: given a list of keyw

Re: Macro problems with delay

2010-09-10 Thread Cyrus Harmon
This still doesn't quite add up to me. What's the consequence of not alter-var-root'ing maker-var# if def-form is a defmacro? Why would def-form be a defmacro in the first place? Also, I don't think you've given the example of the actual call that gave the error, only the macroexpansion of it.

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Rayne
Just told that the site went down: not sure why, but I'll work on it later. Sorry. <3 On Sep 10, 2:21 pm, Rayne wrote: > I wrote a brief thank you post on my blog (actually the first post on > this new blog. > :>)http://blog.acidrayne.net/thank-you-for-sending-me-to-the-conj > > I'm unbelievably

Re: Generating functions programmatically

2010-09-10 Thread Alan
I actually did this just the other day, to create a simple C-style enum macro (I assume someone has a better version; this was a learning exercise). You can see my project at www.github.com/amalloy/enum. It sounds like your problem might be constructing the symbol to define; the solution will look

Re: Generating functions programmatically

2010-09-10 Thread Alan
SPOILER BELOW. I'm not sure how much help you want, so I went ahead and wrote your macro. Whitespace padding so that you won't see it if you don't want the whole solution: user=> (defmacro make-fn [key] (let [sym (->> key name (str "synthetic-") symbol)] `(defn ~sym [n#] (= n# ~key

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Alan
It's working for me now (but wasn't earlier, so this is probably a sign that it's fixed). On Sep 10, 12:57 pm, Rayne wrote: > Just told that the site went down: not sure why, but I'll work on it > later. Sorry. <3 > > On Sep 10, 2:21 pm, Rayne wrote: > > > I wrote a brief thank you post on my bl

Re: testing local functions?

2010-09-10 Thread alux
Brian, thats way cool! (I still have to think this through, thats high magic!) Thank you for sharing this, and kind regards, alux On 10 Sep., 21:04, Brian Marick wrote: > I've worked out a way to test local functions. When I tried it out by hand, > it felt good. See here:http://bit.ly/b1AoG7 >

Re: Generating functions programmatically

2010-09-10 Thread icemaze
Alan, thank you for your reply. Unfortunately your solution is very similar to mine and it suffers from the same problem (maybe I'm using it incorrectly, I don't know). If I write: (doseq [x '(:a :b)] (make-fn x)) it defines a single function "synthetic-x". Is there a way to make this work?

Re: Simple things should be simple

2010-09-10 Thread Phil Hagelberg
On Fri, Sep 10, 2010 at 12:17 PM, Mike Meyer wrote: > 1) Write program in chosen language that runs on the JVM. > 2) Compile program to class file(s). > 3) Use some tool to create a manifest file. > 4) Run jar to create jar file. > 5) Distribute jar file. > > Users can then run it via double-click

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread Isaac Gouy
On Sep 10, 11:54 am, gary ng wrote: > On Fri, Sep 10, 2010 at 11:13 AM, Isaac Gouy wrote: > > Clearly, they did choose "to write all that code" "in order to get a > > much faster program" - I can't tell you if Andy had noticed the > > benchmark was about "Hashtable update and k-nucleotide strin

Re: A Clojure "Scholarship": Let's send Raynes to the Conj!

2010-09-10 Thread Rayne
http://blog.acidrayne.net/?p=4 I threw up a wordpress site and posted this there. Maybe it'll last through a couple requests. :p On Sep 10, 2:57 pm, Rayne wrote: > Just told that the site went down: not sure why, but I'll work on it > later. Sorry. <3 > > On Sep 10, 2:21 pm, Rayne wrote: > > > >

Re: Simple things should be simple

2010-09-10 Thread Meikel Brandmeyer
Hi, Am 10.09.2010 um 21:17 schrieb Mike Meyer: > 1) Write program in chosen unix-friendly interpreted language. You lost exactly here. "unix-friendly". Since you keep putting your context over everything, I will also keep on putting mine over everything. Ruby, Python, Perl, Tcl, ... are all no

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread gary ng
On Fri, Sep 10, 2010 at 2:04 PM, Isaac Gouy wrote: > It's starting to look like actually there was a point you wanted to > make ;-) You mean the 'no chice' part ? yes. You mean the why not Data.Hashtable comment ? I don't think so. > > If you change the requirement to something else you'd simpl

Re: clojure-test-mode elpa version still out of date?

2010-09-10 Thread Bruce Durling
Hi, On Fri, Sep 10, 2010 at 18:15, User7 wrote: > > I'm using emacs starter kit and clojure-test-mode 1.4 installed using > elpa.  Running clojure-tests-run-tests seems to work fine, but clojure- > test-run-test seems flakey.  This blog post from May says the elpa > version is out of date. > > ht

partition-starting-every : yet another partition function

2010-09-10 Thread Matt Smith
problem: convert a collection [1 2 0 1 2 3 0 1 2 3 0 0 1 2] into partitions like: ((1 2) (0 1 2 3) (0 1 2 3) (0) (0 1 2)) In this case, start each partition on a 0. I looked at the various partition functions but none of them would do the trick without adding unnecessary complexity. Instead I w

Convenience (was Simple things should be simple)

2010-09-10 Thread Stuart Halloway
Hi Mike, I think this is more about convenience than simplicity. In both Unix and Java deployment is complex, and often complicated as well. In spite of this, small, one-off things should be convenient to deploy, and Unix does this better in some contexts. There is no reason we can't make one-

Re: Generating functions programmatically

2010-09-10 Thread Hubert Iwaniuk
Hi icemaze, Please look at how fns are generated in http.async.client http://github.com/neotyk/http.async.client/blob/master/src/http/async/client/util.clj#L54 this macro is later used here: http://github.com/neotyk/http.async.client/blob/master/src/http/async/client.clj#L43 HTH, Hubert. On Se

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread Isaac Gouy
On Sep 10, 2:22 pm, gary ng wrote: -snip- > My initial comment was all about 'it seems that Haskell submission is > not the typical elegant form' and to me because of the specific you > want to measure, there is no acceptable elegant Haskell form. So what are we to do when there's a problem tha

Re: Generating functions programmatically

2010-09-10 Thread Alan
I see. It's hard to imagine how this could work, since macros don't have access to runtime data like the value of x in your example. Perhaps you're better off writing a function that returns a closure, and iteratively def'ing those? user=> (defn make-kw-fn [kw] #(= kw %)) #'user/make-kw-f

Re: Generating functions programmatically

2010-09-10 Thread Alan
PS this is super-ugly and I'm always embarrassed when I find myself using eval in a lisp. While this works, I'd love it if someone could tell me how to do it with macros. On Sep 10, 3:07 pm, Alan wrote: > I see. It's hard to imagine how this could work, since macros don't > have access to runtime

Re: Clojure 1.2 and the Computer Language Benchmarks Game

2010-09-10 Thread gary ng
On Fri, Sep 10, 2010 at 3:06 PM, Isaac Gouy wrote: > So what are we to do when there's a problem that has "no acceptable > elegant Haskell form"? Depending on the intend, for you benchmark program, write something like what it is now. For real life cases, call an exnternal library, use another la

Re: Simple things should be simple

2010-09-10 Thread Mike Meyer
On Fri, 10 Sep 2010 23:21:01 +0200 Meikel Brandmeyer wrote: > Hi, > > Am 10.09.2010 um 21:17 schrieb Mike Meyer: > > > 1) Write program in chosen unix-friendly interpreted language. > > You lost exactly here. "unix-friendly". Since you keep putting your context > over everything, I will also

Re: Convenience (was Simple things should be simple)

2010-09-10 Thread Mike Meyer
On Fri, 10 Sep 2010 17:29:24 -0400 Stuart Halloway wrote: > Hi Mike, > > I think this is more about convenience than simplicity. In both Unix and Java > deployment is complex, and often complicated as well. In spite of this, > small, one-off things should be convenient to deploy, and Unix does

Re: Generating functions programmatically

2010-09-10 Thread Robert McIntyre
Why not explicitly feed the macro the keyword map if that is what it wants? (defmacro ultra-synth [prefix keywords] (let [symbols (map (comp symbol name) keywords) fn-names (map (comp symbol (partial str prefix) name) keywords) defn-forms (map

Re: Generating functions programmatically

2010-09-10 Thread Alan
It sounds like he's going to be given the list of keywords by the user, and won't have it as a compile-time literal. Maybe he's load'ing a .clj file, for example, that someone will write in the future. Maybe you can combine our two approaches to get something that works and isn't ugly, but I'm havi

Re: Generating functions programmatically

2010-09-10 Thread icemaze
Yeah, I guess I could use a macro to generate the "call" to the other macro in a way similar to how you used it. Thank you, that should definitely work. I'll try it right now. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: Generating functions programmatically

2010-09-10 Thread icemaze
I agree: eval never looks pretty. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe fr

Re: Generating functions programmatically

2010-09-10 Thread Robert McIntyre
there's always apply-macro from contrib for doing perverse stuff like that, so you don't have to *see* eval if you don't want to :) --Robert McIntyre On Fri, Sep 10, 2010 at 8:24 PM, icemaze wrote: > I agree: eval never looks pretty. > > -- > You received this message because you are subscribed

Re: Generating functions programmatically

2010-09-10 Thread icemaze
Yes, I think I'll have to pass the keywords as literals. I don't think there's a way around that (other than using eval, as per Alan's solution). I was too excited about Hubert's hint and I found myself in the exact same problem with the second macro. -- You received this message because you are

Re: Generating functions programmatically

2010-09-10 Thread icemaze
You are mostly right in your assumptions: I could dump the keywords in the clj as literals but it would be tedious and not elegant at all. Eval's not pretty but it works; plus it's there for a reason, like working around the shortcomings of the language (and of my brain). I was about to post my so

Re: Generating functions programmatically

2010-09-10 Thread Btsai
This is probably not the prettiest way to do it, but I think it gets the job done: (defn make-sym [keyword] (->> keyword name (str "prefix-") symbol)) (defn make-fn [keyword] (let [n (gensym)] (list 'defn (make-sym keyword) [n] (list '= n keyword (defmacro make-fns [keywords] `(do ~

Re: Problem importing JOptionPane from a string evaluated by load-string

2010-09-10 Thread Paul D. Fernhout
On 9/10/10 9:03 AM, Laurent PETIT wrote: Got it. You cannot invoke (import) (or (ns)) from within the function definition. The function is already being evaluated, and it's "too late". This works fine for me: (do (import '(javax.swing JOptionPane)) ((fn [] (println "Hello World")

Re: Improved stack traces

2010-09-10 Thread Mike Hinchey
I found when working on ticket 191 (dead now, I suppose) that counting the stack elements is not reliable, but = works to get rid of duplicates. Below you can compare java's to your new function - the clojure has one duplicate element (the very last one). Also, I find the "..." useful to know som

Re: Generating functions programmatically

2010-09-10 Thread Robert McIntyre
That is very elegant but has the exact same problem in that the macro must be called on a literal vector of keywords. --Robert McIntyre On Fri, Sep 10, 2010 at 5:41 PM, Btsai wrote: > This is probably not the prettiest way to do it, but I think it gets > the job done: > > (defn make-sym [keyword