Re: Why that slowness?

2011-07-22 Thread Alan Malloy
On Jul 21, 2:39 pm, Tassilo Horn tass...@member.fsf.org wrote:
 Alan Malloy a...@malloys.org writes:

 Hi Alan,

  Any hints?

  (1) The first version is doing way less work. It tries the first rule
  until it runs out of steam, then the second rule, then the third rule.
  If the third rule produces a structure that the first rule could have
  matched, it will never be tried, because the first rule is done. The
  second version, however, keeps reducing the structure using all three
  rules until there are no transformation available.

 Yes, that's true.  However, in my test graph, it's basically a fixed
 point reduction from 10 elements to 16.  The first rule is the only
 one that is able to produce a new match for the third rule.  It pulls
 constants in trees of binary operations towards the leafs (for
 commutative, associative ops) so that the third rule can evaluate them.
 The second and third rule don't influence each other.

 Hm, it's highly likely that you have to perform the first rule several
 times to make the third rule applicable at all...

  (2) Your implementation of choose is pretty inefficient itself. rand-
  nth is slow, remove is slow...If you're using it in a performance-
  sensitive area, I would write it differently. Especially, you could
  probably gain a lot by making choose return a function, rather than
  immediately execute something, so that it can pre-compute the data
  that it will use more than once. Something like this (untested):

 Ok, that's only 397 times slower which might also be a coincidence due
 to the randomness. :-)

  (defn choose
    [ funs]
    (let [fnmap (vec funs)]

 Why do you think this performs better than doing (vec funs) as init
 expression in the loop (and then not returning a function but a value)?

Because I only call choose once, in my implementation. Thus the vec
call only happens once; after that, iteratively is only calling the
function returned by choose.

      (fn []
        (loop [fns fnmap, tries-left (count fns)]
          (when-not (zero? tries-left)
            (let [idx (rand-int tries-left)
                  f (get fns idx)
                  val (f)]
              (or val (recur (assoc fns idx
                                    (get fns (dec tries-left)))
                             (dec tries-left)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Problem Running ClojureScript on OpenJDK

2011-07-22 Thread Sean Corfield
And then you can't run the resulting JS on node - anything I can try
to get you guys more info?

sean@sean-netbook:~/node$ node nodehello.js

/home/sean/node/nodehello.js:1
(defn test-stuff
  

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected identifier
at Module._compile (module.js:397:25)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at Array.anonymous (module.js:421:10)
at EventEmitter._tickCallback (node.js:126:26)


On Thu, Jul 21, 2011 at 11:44 PM, Sean Corfield seancorfi...@gmail.com wrote:
 FWIW, I get this same error trying to compile the basic examples for
 Node.js as well:

 cljsc nodehello.cljs {:optimizations :advanced :target :nodejs}  nodehello.js

 sun.org.mozilla.javascript.EvaluatorException: Encountered code
 generation error while compiling function test_stuff: generated
 bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
        at 
 sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
        at 
 sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
        at sun.org.mozilla.javascript.Context.compileImpl(Context.java:2391)
        at sun.org.mozilla.javascript.Context.compileString(Context.java:1359)
        at sun.org.mozilla.javascript.Context.compileString(Context.java:1348)
        at sun.org.mozilla.javascript.Context.evaluateString(Context.java:1101)
        at cljs.compiler$eval1.invoke(compiler.clj:921)
        at cljs.compiler$load_stream.invoke(compiler.clj:944)
        at cljs.compiler$load_file.invoke(compiler.clj:954)
        at cljs.closure$compile_form_seq.invoke(closure.clj:206)
        at cljs.closure$compile_file.invoke(closure.clj:228)
        at cljs.closure$eval1120$fn__1121.invoke(closure.clj:266)
        at cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
        at cljs.closure$eval1107$fn__1108.invoke(closure.clj:280)
        at cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
        at cljs.closure$build.invoke(closure.clj:695)
        at user$eval1246.invoke(cljsc.clj:21)
        at clojure.lang.Compiler.eval(Compiler.java:6406)
        at clojure.lang.Compiler.load(Compiler.java:6843)
        at clojure.lang.Compiler.loadFile(Compiler.java:6804)
        at clojure.main$load_script.invoke(main.clj:282)
        at clojure.main$script_opt.invoke(main.clj:342)
        at clojure.main$main.doInvoke(main.clj:426)
        at clojure.lang.RestFn.invoke(RestFn.java:512)
        at clojure.lang.Var.invoke(Var.java:421)
        at clojure.lang.AFn.applyToHelper(AFn.java:185)
        at clojure.lang.Var.applyTo(Var.java:518)
        at clojure.main.main(main.java:37)


 On Thu, Jul 21, 2011 at 11:15 PM, Sean Corfield seancorfi...@gmail.com 
 wrote:
 I made these changes but still got exceptions trying to start the cljs
 repl (although code seemed to work just fine in the repl after this
 exception). I'm about to move onto node.js installation on ubuntu 11
 at this point...

 sun.org.mozilla.javascript.EvaluatorException: Encountered code
 generation error while compiling function test_stuff: generated
 bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
        at 
 sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
        at 
 sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
        at 
 sun.org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
        at sun.org.mozilla.javascript.Context.compileImpl(Context.java:2391)
        at sun.org.mozilla.javascript.Context.compileString(Context.java:1359)
        at sun.org.mozilla.javascript.Context.compileString(Context.java:1348)
        at 
 sun.org.mozilla.javascript.Context.evaluateString(Context.java:1101)
        at cljs.compiler$eval1.invoke(compiler.clj:921)
        at cljs.compiler$load_stream.invoke(compiler.clj:944)
        at cljs.compiler$goog_require$fn__804.invoke(compiler.clj:966)
        at cljs.compiler$goog_require.invoke(compiler.clj:965)
        at clojure.lang.Var.invoke(Var.java:405)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
 

Re: ClojureScript announcement video

2011-07-22 Thread kjeldahl
Maybe I'm just having connectivity issues today, but I had lots of
trouble getting anything from that link (endless spinner). I had more
luck with this link (which is to the same video): http://blip.tv/play/AYLJyC4C
.

On Jul 22, 5:34 am, Chouser chou...@gmail.com wrote:
 Video is now available of Rich Hickey's talk at ClojureNYC yesterday
 announcing ClojureScript.

 http://blip.tv/clojure/rich-hickey-unveils-clojurescript-5399498

 Thanks to the Clojure/core team for getting this online so rapidly!
 --Chouser

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureScript announcement video

2011-07-22 Thread Baishampayan Ghose
 Video is now available of Rich Hickey's talk at ClojureNYC yesterday
 announcing ClojureScript.

 http://blip.tv/clojure/rich-hickey-unveils-clojurescript-5399498

 Thanks to the Clojure/core team for getting this online so rapidly!

Link to download the file directly, just in case -
http://blip.tv/file/get/Richhickey-RichHickeyUnveilsClojureScript918.avi

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] CongoMongo 0.1.6-SNAPSHOT

2011-07-22 Thread Bruce Durling
Sean,

Great news. Where is the best git repo to follow this from/issue pull
requests to?

cheers,
Bruce

On Fri, Jul 22, 2011 at 03:58, Sean Corfield seancorfi...@gmail.com wrote:
 On Clojars. Fixes (almost) all reflection warnings but should
 otherwise be identical to 0.1.5-SNAPSHOT.
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View -- http://corfield.org/
 World Singles, LLC. -- http://worldsingles.com/
 Railo Technologies, Inc. -- http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

 --
 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 from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: BUG REPORT: ClojureScript : Portable Path Support

2011-07-22 Thread Mark Derricutt
Oh don't say that!  That was going to be my weekend project - looking at adding 
ClojureScript support to clojure-maven-plugin.

I made a coffee-maven-plugin for our web guys the other week and now we've got 
a chance to sway them over to clojure ( well, I don't think that'll happen 
easily tho ).


On 21/07/2011, at 4:40 PM, Sean Corfield wrote:

 Even better would be ClojureScript with maven support
 
 Didn't Rich say he hopes Maven doesn't come anywhere near ClojureScript? :)



smime.p7s
Description: S/MIME cryptographic signature


Re: How to Return Vector of Vectors

2011-07-22 Thread octopusgrabbus
Thanks for the example.

On Jul 21, 10:15 pm, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson kwess...@gmail.com wrote:
  On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus
  octopusgrab...@gmail.com wrote:
  And do you have a suggestion for a functional way?

  Yes. Change

  (doseq [one-full-csv-row all-csv-rows]
   (let [accumail-csv-row one-full-csv-row
         q-param (zipmap accumail-url-keys accumail-csv-row)
         accu-q-param (first (rest (split-at 3 q-param)))
         billing-param (first (split-at 3 q-param))]
     (conj param-vec accu-q-param billing-param)))

  to

  (reduce
   (fn [one-full-csv-row]
     (let [q-param (zipmap accumail-url-keys one-full-csv-row)
           accu-q-param (first (rest (split-at 3 q-param)))
           billing-param (first (split-at 3 q-param))]
       [accu-q-param billing-param]))
   []
   all-csv-rows)

 Er, that's weird. I don't know what happened there. Obviously that should be

 (reduce
   (fn [param-vec one-full-csv-row]
     (let [q-param (zipmap accumail-url-keys one-full-csv-row)
           accu-q-param (first (rest (split-at 3 q-param)))
           billing-param (first (split-at 3 q-param))]
       (conj param-vec [accu-q-param billing-param])))
   []
   all-csv-rows)

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] ClojureScript

2011-07-22 Thread Vincent
What is possible use of ClojureScript ? 

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to Return Vector of Vectors

2011-07-22 Thread Ulises
An alternative is to use partition together with interleave:

user (partition 2 (interleave [ 1 2 ] [ \a \b ]))
((1 \a) (2 \b))

Combined with (map vec ...) you should get:
user (map vec (partition 2 (interleave [ 1 2 ] [ \a \b ])))
([1 \a] [2 \b])
user

U

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Argh - was Re: Re: Re: Re: Re: Re: The Last Programming Language

2011-07-22 Thread Nick
On 22/07/11 05:30, daly wrote:
 On Thu, 2011-07-21 at 23:03 -0400, Jeff Dik wrote:
 On Tue, Jul 19, 2011 at 9:04 PM, daly d...@axiom-developer.org wrote:
 On Tue, 2011-07-19 at 20:14 -0400, Adam Richardson wrote:
 On Tue, Jul 19, 2011 at 6:23 PM, Brian Hurt bhur...@gmail.com wrote:
 What's this awk-a-mel he speaks of?  Ocaml, pronounced
 oh-camel, I
 know very well, but I've never heard of this awk-a-mel.  :-)

 Seriously, his pronunciation of ocaml highlights, I think,
 the core
 problem of his talk.  There has been significant development
 in
 languages, just not in the popular languages.  It's been over
 there in
 the fringe languages.


 I will confess that as I listened to the presentation (when I got the
 email with Tim's link, I just started the video while I was working on
 some drudgery), I felt like he missed some of the language features
 promoted in functional languages.


 He worded functional programming contributions in terms of advancing
 the idea of limiting/protecting variable assignment (immutability),
 and to me, that's missing the points of first class functions (which,
 in light of what he says OOP languages brought to the table, actually
 provided protected function pointers through purely functional
 languages without any need for OOP) and an emphasis on function purity
 and limiting the scope of unpure functions (to me, this goes beyond
 merely protecting assignment.)


 These omissions, coupled with the mispronunciations of functional
 programming language names, and the value placed on the last language
 being homoiconic (without much justification) had me wondering how
 much he actually has used languages such as OCaml or Haskell.

 Homoiconic representation is fundamentally important and lacking
 in other languages. The programs == data idea is what makes the
 macro facility work, allows dynamic program construction, compile
 to core, etc. There is a story going around that McCarthy attended
 a python talk where they made the claim that python IS a lisp-like
 language. John pointed out that if it lacks homoiconicity it cannot
 be a lisp. (I probably have the details wrong).

 Perhaps the last 6 or 7 paragraphs to
 http://smuglispweeny.blogspot.com/2008/02/ooh-ooh-my-turn-why-lisp.html?

 Jeff
 
 Yes, that's the story. --Tim
 

Ouch.

This is an appeal for posters to think of their readers and trim for
readability. In this style, even having scrolled several pages and found one
insertion, there is no guarantee...




 OCaml came from ML but the ideas came before either one. Lisp supported
 functional programming long before either language. I believe the point
 Robert was trying to make was that very few languages have increased our
 stock of fundamental ideas. OCaml is not one of them.

 Indeed languages (like Spad) built on lisp STILL support ideas I have
 not seen anywhere else (e.g. dispatching on the return type as well as
 the argument types).

 Robert suggests that we need to develop a standard language.
 Good luck with that.

 I participated in the reviews of the X3J13 Common Lisp standard
 (behind the scenes by passing on my comments and markups to people who
 had the proposal directly). Trying to define a standard programming
 language would be the ultimate language war. It has been tried several
 times before (PL/I included everything and C++0x is trying hard to
 include everything).

 At best I believe we will muddle along and I will continue to be
 rejected during job interviews for working in python 2.7 and not
 knowing python 3.0. Forty years of lisp programming just makes
 me too old to hire for any real programming job. Heck, I probably
 don't know the difference between OCaml and awk-a-mel so I clearly
 cannot program. :-)


...that I have found them all




 I don't need to know how many digits somebody can recite Pi to, but I
 would like to know how his experience with awk-a-mel lead him to
 believe that functional programming comes down to protecting variable
 assignment :)


 That all said, if Clojure is the seed for the last language, I'd be a
 happy man.


...so I have the scan the whole abominable nest of quotes!

 I believe that Robert missed the fundamental point though. It is
 NOT just the space of ideas that makes lisp the right language.
 Another key reason is impedance matching. (An impedance mismatch
 is when you hook a soda straw to a firehose).

 Programs exist to bridge the gap between the idea domain and the
 machine domain. Some languages are close to the machine, like assembler,
 so you have to carry your idea all the way to the machine. Some
 languages are close to the problem (e.g. Mathematica) but the compiler
 has to cross the gap to the machine. This is where the ability to
 create domain-specific languages in the same syntax matters.

 Lisp is the only language I know that allows you to work across the
 whole spectrum in a single language. It is 

Why is this code so slow?

2011-07-22 Thread Oskar
Hi!

I was doing some project euler problems and I wrote the following
code. It is really slow, and I would like to know why and how it can
be made faster. Not that I care much about this code in particular,
but I want to understand Clojure better.

(def vs (int-array 401))
(def ss (boolean-array 401))

(defn sk [k]
  (if (aget ss k)
(aget vs k)
(let [ans
  (if ( k 56)
(- (mod (+ 13 (- (* k 23)) (* 37 k k k))
100) 50)
(- (mod (+ (sk (- k 24)) (sk (- k 55))) 100)
50))]
  (do (aset vs k ans) (aset ss k true) ans

(time (dorun (map sk (range 10

The call above takes 20 seconds, which is surprisingly slow (at least
to me). The same thing in Python it takes under under 1 (not sure
exactly how long). Why so slow?

The python version I tried:

data = [None]*401

def sk(k):
if data[k] is None:
if k = 55:
ans = ((13 - 23 * k + 37 *
k**3) % 100) - 50
else:
ans = ((data[k-24] + data[k-55] + 100)
% 100) - 50
data[k] = ans
return ans
else:
return data[k]

a = map(sk, range(10)) ; almost instant

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Anyone on Google+ yet?

2011-07-22 Thread Eric Budd
gplus.to/calamitous

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

suggestion: update

2011-07-22 Thread Vinzent
Hello,
in clojure.core we have assoc and assoc-in, dissoc and dissoc-in (in
the incubator), but there is only update-in, without update.
Implementation might look like this:

(defn update [m  kfs]
  (let [coll (partition 2 kfs)]
(reduce (fn [m [k f]] (update-in m [k] f))
m coll)))

This can be used as follows:
(update {:a 1 :b 2 :c 3} :a inc :c dec)
= {:a 2, :b 2, :c 2}

Any thoughts?

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Anyone on Google+ yet?

2011-07-22 Thread Simon Holgate
Hi, has anyone got a spare invite for me, please? :)

On Jul 15, 3:09 pm, Sergey Didenko sergey.dide...@gmail.com wrote:
 Jeremy, I can send you an invitation. Do you need it?

 On Fri, Jul 15, 2011 at 4:53 PM, Jeremy Heiler jeremyhei...@gmail.comwrote:







  Is Google+ invite based? How did all of you get a profile?

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: BUG REPORT: ClojureScript : Portable Path Support

2011-07-22 Thread Troy Clevenger
This patch here fixes the path issues on windows for me.  I haven't
tested it on a non-windows system though. Thought I'd post it here in
case it helps anyone.

http://content.wuala.com/contents/Daedalus/DropBox/Fixed-unoptimized-compile-in-windows.diff?dl=1

Regards,

Troy

On Jul 20, 10:12 pm, pmbauer paul.michael.ba...@gmail.com wrote:
 Per instructions from redinger and jgehtland (patch addressing one issue
 attached).

 Three separate issues so far re: path support on windows

 * compiler path regex is not portable, cljs/compiler.clj:1096 (see attached
 patch, thanks amalloy for the assist)

 * generated JS has path problems on windows
 goog.addDependency(*
 ..\..\..\..\..\..\..\/C:/tmp/clojurescript/samples/twitterbuzz/out/cljs/co 
 re.js
 *, ['cljs.core'], ['goog.string', 'goog.string.StringBuffer', 'goog.object',
 'goog.array']);

 * helper launch scripts on windows (under cygwin), more a feature than bug

  portable-path-regex.diff
  1KViewDownload

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Project Management with Leiningen or Gradle

2011-07-22 Thread Dan
Aside from the fact that Leiningen is coded in Clojure and Gradle in
Groovy are there any other noteworthy differences? Are there any
benefits of using Leiningen over Gradle and vice-versa? Thanks.

Best,
Dan

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Can't find clojure.main in clojurescript's script/repl on Windows

2011-07-22 Thread Troy Clevenger

On Jul 21, 5:50 pm, Tamreen Khan histor...@gmail.com wrote:
 Hmm, I have clojure.jar, but not clojure-1.3.jar in clojurescript/lib



 On Thu, Jul 21, 2011 at 5:49 PM, Tamreen Khan histor...@gmail.com wrote:
  Yes. It worked fine.

  On Thu, Jul 21, 2011 at 5:48 PM, Devin Walters dev...@gmail.com wrote:

   Did you run script/bootstrap?

  You need a clojure-1.3 jar in your clojurescript/lib directory.

  On Thursday, July 21, 2011 at 4:45 PM, Tamreen Khan wrote:
   Hi everyone, I'm trying to get the repl for Clojurescript to start under
  Windows but keep running into the following error:

   Exception in thread main java.lang.NoClassDefFoundError: clojure/main
   Caused by: java.lang.ClassNotFoundException: clojure.main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
   Could not find the main class: clojure.main. Program will exit.

   I've tried both running the script under cygwin and putting the contents
  into a batch file and running it with cmd.exe (it shouldn't be a problem
  since script/repl just contains one command which starts the java runtime
  with a few options). I've even tried changing the forward slashes in the
  command to backslashes.

   Also, I'm running these commands from the clojurescript root directory.
  Even though it probably won't affect it I've set CLOJURESCRIPT_HOME as 
  well.
  Any ideas?

    --
    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 (mailto:
  clojure@googlegroups.com)
    Note that posts from new members are moderated - please be patient with
  your first post.
    To unsubscribe from this group, send email to
   clojure+unsubscr...@googlegroups.com (mailto:
  clojure+unsubscr...@googlegroups.com)
    For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en

  --
  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 from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

For me, if I replaced the : in the classpath argument with ; I was
able to get the repl working.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread Ken Wesson
On Thu, Jul 21, 2011 at 9:32 AM, Oskar oskar.kv...@gmail.com wrote:
 Hi!

 I was doing some project euler problems and I wrote the following
 code. It is really slow, and I would like to know why and how it can
 be made faster. Not that I care much about this code in particular,
 but I want to understand Clojure better.

    (def vs (int-array 401))
    (def ss (boolean-array 401))

    (defn sk [k]
      (if (aget ss k)
        (aget vs k)
        (let [ans
              (if ( k 56)
                (- (mod (+ 13 (- (* k 23)) (* 37 k k k))
 100) 50)
                (- (mod (+ (sk (- k 24)) (sk (- k 55))) 100)
 50))]
          (do (aset vs k ans) (aset ss k true) ans

    (time (dorun (map sk (range 10

 The call above takes 20 seconds, which is surprisingly slow (at least
 to me). The same thing in Python it takes under under 1 (not sure
 exactly how long). Why so slow?

I'd guess boxed arithmetic. But first you might want to look into
memoizing sk and making the recursive calls use the memoized version.

If that doesn't make it fast enough, try using Clojure 1.3 (if you
aren't already) and using primitives in sk including for its arguments
and return value.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] ClojureScript

2011-07-22 Thread Mark Rathwell
The main target use case seems to be browser based apps that would make
heavy use of javascript, the kind of apps that would otherwise be built
using with libraries/frameworks such as Google Closure Library, Dojo,
SproutCore, Backbone w/ jQuery, etc.

Michael Fogus has also mentioned command line scripting as another possible
use case, as node.js would not have the slow jvm startup times that make CLI
work rough right now.



On Fri, Jul 22, 2011 at 6:05 AM, Vincent vincent@gmail.com wrote:

 What is possible use of ClojureScript ?

 --
 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 from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Anyone on Google+ yet?

2011-07-22 Thread Tassilo Horn
Simon Holgate simon.holg...@googlemail.com writes:

 Hi, has anyone got a spare invite for me, please? :)

I did so. :-)

Bye,
Tassilo

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread David Nolen
(set! *warn-on-reflection* true)
(set! *unchecked-math* true)

(defn sk [^longs vs ^booleans ss]
  (fn ^long [^long k]
(if (aget ss k)
  (aget vs k)
  (let [ans (if ( k 56)
  (- (mod (+ 13 (- (* k 23)) (* 37 k k k))
  100) 50)
  (- (mod (+ (aget vs (- k 24))
 (aget vs (- k 55))) 100)
 50))]
(do (aset vs k (long ans))
(aset ss k true)
ans)

(comment
 (time
  (dorun
   (map (sk (long-array 401)
(boolean-array 401))
(range 10
 )

Not sure if this preserves your code. On my machine running 1.3.0-beta1 this
takes 300-400ms once the JVM has warmed up.

David

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: How to Return Vector of Vectors

2011-07-22 Thread octopusgrabbus

On Jul 21, 10:15 pm, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson kwess...@gmail.com wrote:
  On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus
  octopusgrab...@gmail.com wrote:
  And do you have a suggestion for a functional way?

Is all-csv-rows being re-bound with the results of [] and then
returned as the function's value? And again, thanks. This is exactly
what I was looking for.

(defn ret-params
Generates all q-parameters and returns them in a vector of
vectors.
[all-csv-rows]
(reduce
  (fn [param-vec one-full-csv-row]
(let [q-param (zipmap accumail-url-keys one-full-csv-row)
  accu-q-param (first (rest (split-at 3 q-param)))
  billing-param (first (split-at 3 q-param))]
  (conj param-vec [accu-q-param billing-param])))
  []
  all-csv-rows))


  Yes. Change

  (doseq [one-full-csv-row all-csv-rows]
   (let [accumail-csv-row one-full-csv-row
         q-param (zipmap accumail-url-keys accumail-csv-row)
         accu-q-param (first (rest (split-at 3 q-param)))
         billing-param (first (split-at 3 q-param))]
     (conj param-vec accu-q-param billing-param)))

  to

  (reduce
   (fn [one-full-csv-row]
     (let [q-param (zipmap accumail-url-keys one-full-csv-row)
           accu-q-param (first (rest (split-at 3 q-param)))
           billing-param (first (split-at 3 q-param))]
       [accu-q-param billing-param]))
   []
   all-csv-rows)

 Er, that's weird. I don't know what happened there. Obviously that should be

 (reduce
   (fn [param-vec one-full-csv-row]
     (let [q-param (zipmap accumail-url-keys one-full-csv-row)
           accu-q-param (first (rest (split-at 3 q-param)))
           billing-param (first (split-at 3 q-param))]
       (conj param-vec [accu-q-param billing-param])))
   []
   all-csv-rows)

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureScript

2011-07-22 Thread faenvie
in the first place i did not realize, how smart this move is,
but then ... clojure rocks ... javascript reaches ...

and as a sideeffect a first implementation of clojure-in-clojure
is rolled out into the wild even before clojure 1.3 is released.
in addition that works as a showcase for porting clojure to 'foreign'
host-systems.

IMO dependency on gclosure is a risk but pros oubalance cons
in this respect.

congrats

On Jul 21, 2:40 am, Christopher Redinger redin...@gmail.com wrote:
 In case you missed the announcement streamed from this evening's NYC Clojure
 Group.

 https://github.com/clojure/clojurescript

 Clojure to JS compiler. Power of Clojure. Reach of JavaScript.

 Please use this Clojure mailing list for ClojureScript discussion.

 We plan to have a recording of tonight's talk posted soon.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] CongoMongo 0.1.6-SNAPSHOT

2011-07-22 Thread Sean Corfield
On Fri, Jul 22, 2011 at 1:02 AM, Bruce Durling b...@otfrom.com wrote:
 Great news. Where is the best git repo to follow this from/issue pull
 requests to?

The official repo is https://github.com/aboekhoff/congomongo

Several of us now have push rights to the official Clojars location:
http://clojars.org/congomongo

I noticed a ticket opened asking for a non-snapshot release - any
opinions on that? A 0.1.6 release? Maybe push to a 0.2.0 at this
point? Maybe I'll start a new thread on that...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] ClojureScript

2011-07-22 Thread Vincent
that means , if i write a clojure program using javax.swing to build windows 
based appl. manipulating database at backend ( all written in clojure)
, this will be converted to javascript and we will be able to run as web 
appljust as GWT.


-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] ClojureScript

2011-07-22 Thread Wilson MacGyver
No I don't think so. Clojurescript doesn't have java libs, so your swing
calls will nit work
On Jul 22, 2011 1:49 PM, Vincent vincent@gmail.com wrote:
 that means , if i write a clojure program using javax.swing to build
windows
 based appl. manipulating database at backend ( all written in clojure)
 , this will be converted to javascript and we will be able to run as web
 appljust as GWT.


 --
 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 from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] ClojureScript

2011-07-22 Thread Mark Rathwell
No, you cannot use java libraries with ClojureScript, you would instead use
the Google Closure Library or pure clojure.  Same as with the CLR version,
you can only make use of .NET libs.


On Fri, Jul 22, 2011 at 1:48 PM, Vincent vincent@gmail.com wrote:

 that means , if i write a clojure program using javax.swing to build
 windows based appl. manipulating database at backend ( all written in
 clojure)
 , this will be converted to javascript and we will be able to run as web
 appljust as GWT.


  --
 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 from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en


-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Argh - was Re: Re: Re: Re: Re: Re: The Last Programming Language

2011-07-22 Thread Alan Malloy
On Jul 22, 3:35 am, Nick oinksoc...@letterboxes.org wrote:
 On 22/07/11 05:30, daly wrote:
  On Thu, 2011-07-21 at 23:03 -0400, Jeff Dik wrote:
  On Tue, Jul 19, 2011 at 9:04 PM, daly d...@axiom-developer.org wrote:
  On Tue, 2011-07-19 at 20:14 -0400, Adam Richardson wrote:
  On Tue, Jul 19, 2011 at 6:23 PM, Brian Hurt bhur...@gmail.com wrote:
          What's this awk-a-mel he speaks of?  Ocaml, pronounced
          oh-camel, I
          know very well, but I've never heard of this awk-a-mel.  :-)

          Seriously, his pronunciation of ocaml highlights, I think,
          the core
          problem of his talk.  There has been significant development
          in
          languages, just not in the popular languages.  It's been over
          there in
          the fringe languages.

  I will confess that as I listened to the presentation (when I got the
  email with Tim's link, I just started the video while I was working on
  some drudgery), I felt like he missed some of the language features
  promoted in functional languages.

  He worded functional programming contributions in terms of advancing
  the idea of limiting/protecting variable assignment (immutability),
  and to me, that's missing the points of first class functions (which,
  in light of what he says OOP languages brought to the table, actually
  provided protected function pointers through purely functional
  languages without any need for OOP) and an emphasis on function purity
  and limiting the scope of unpure functions (to me, this goes beyond
  merely protecting assignment.)

  These omissions, coupled with the mispronunciations of functional
  programming language names, and the value placed on the last language
  being homoiconic (without much justification) had me wondering how
  much he actually has used languages such as OCaml or Haskell.

  Homoiconic representation is fundamentally important and lacking
  in other languages. The programs == data idea is what makes the
  macro facility work, allows dynamic program construction, compile
  to core, etc. There is a story going around that McCarthy attended
  a python talk where they made the claim that python IS a lisp-like
  language. John pointed out that if it lacks homoiconicity it cannot
  be a lisp. (I probably have the details wrong).

  Perhaps the last 6 or 7 paragraphs to
 http://smuglispweeny.blogspot.com/2008/02/ooh-ooh-my-turn-why-lisp.html?

  Jeff

  Yes, that's the story. --Tim

 Ouch.

 This is an appeal for posters to think of their readers and trim for
 readability. In this style, even having scrolled several pages and found one
 insertion, there is no guarantee...











  OCaml came from ML but the ideas came before either one. Lisp supported
  functional programming long before either language. I believe the point
  Robert was trying to make was that very few languages have increased our
  stock of fundamental ideas. OCaml is not one of them.

  Indeed languages (like Spad) built on lisp STILL support ideas I have
  not seen anywhere else (e.g. dispatching on the return type as well as
  the argument types).

  Robert suggests that we need to develop a standard language.
  Good luck with that.

  I participated in the reviews of the X3J13 Common Lisp standard
  (behind the scenes by passing on my comments and markups to people who
  had the proposal directly). Trying to define a standard programming
  language would be the ultimate language war. It has been tried several
  times before (PL/I included everything and C++0x is trying hard to
  include everything).

  At best I believe we will muddle along and I will continue to be
  rejected during job interviews for working in python 2.7 and not
  knowing python 3.0. Forty years of lisp programming just makes
  me too old to hire for any real programming job. Heck, I probably
  don't know the difference between OCaml and awk-a-mel so I clearly
  cannot program. :-)

 ...that I have found them all



  I don't need to know how many digits somebody can recite Pi to, but I
  would like to know how his experience with awk-a-mel lead him to
  believe that functional programming comes down to protecting variable
  assignment :)

  That all said, if Clojure is the seed for the last language, I'd be a
  happy man.

 ...so I have the scan the whole abominable nest of quotes!

  I believe that Robert missed the fundamental point though. It is
  NOT just the space of ideas that makes lisp the right language.
  Another key reason is impedance matching. (An impedance mismatch
  is when you hook a soda straw to a firehose).

  Programs exist to bridge the gap between the idea domain and the
  machine domain. Some languages are close to the machine, like assembler,
  so you have to carry your idea all the way to the machine. Some
  languages are close to the problem (e.g. Mathematica) but the compiler
  has to cross the gap to the machine. This is where the ability to
  create domain-specific languages in 

Re: Why that slowness?

2011-07-22 Thread Alan Malloy
On Jul 21, 11:23 pm, Alan Malloy a...@malloys.org wrote:
 On Jul 21, 2:39 pm, Tassilo Horn tass...@member.fsf.org wrote:
  Alan Malloy a...@malloys.org writes:

  Hi Alan,

   Any hints?

   (1) The first version is doing way less work. It tries the first rule
   until it runs out of steam, then the second rule, then the third rule.
   If the third rule produces a structure that the first rule could have
   matched, it will never be tried, because the first rule is done. The
   second version, however, keeps reducing the structure using all three
   rules until there are no transformation available.

  Yes, that's true.  However, in my test graph, it's basically a fixed
  point reduction from 10 elements to 16.  The first rule is the only
  one that is able to produce a new match for the third rule.  It pulls
  constants in trees of binary operations towards the leafs (for
  commutative, associative ops) so that the third rule can evaluate them.
  The second and third rule don't influence each other.

  Hm, it's highly likely that you have to perform the first rule several
  times to make the third rule applicable at all...

   (2) Your implementation of choose is pretty inefficient itself. rand-
   nth is slow, remove is slow...If you're using it in a performance-
   sensitive area, I would write it differently. Especially, you could
   probably gain a lot by making choose return a function, rather than
   immediately execute something, so that it can pre-compute the data
   that it will use more than once. Something like this (untested):

  Ok, that's only 397 times slower which might also be a coincidence due
  to the randomness. :-)

   (defn choose
     [ funs]
     (let [fnmap (vec funs)]

  Why do you think this performs better than doing (vec funs) as init
  expression in the loop (and then not returning a function but a value)?

 Because I only call choose once, in my implementation. Thus the vec
 call only happens once; after that, iteratively is only calling the
 function returned by choose.

But I agree, saving the three-element (vec) call is unlikely to make
much difference; I was hoping there would be more work to take
advantage of in the closure.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread Dmitry Gutov
In case the two replies above didn't drive the point home, the Python
version is not recursive (it uses results memoized in the data array).
So, not the same thing.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
Is there a clojure json library that works in clojure 1.3?
I tried danlarkin/clojure-json but it gives me error: 
java.lang.IllegalArgumentException: Unable to resolve classname: 
IPersistentMap, compiling:(org/danlarkin/json/encoder.clj:144)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: JSON library for clojure 1.3

2011-07-22 Thread Wilson MacGyver
I'm still using https://github.com/mmcgrana/clj-json with 1.2, it's
worth a try though, since
it's just a wrapper for jackson.

On Fri, Jul 22, 2011 at 5:05 PM, Islon Scherer islonsche...@gmail.com wrote:
 Is there a clojure json library that works in clojure 1.3?
 I tried danlarkin/clojure-json but it gives me error:
 java.lang.IllegalArgumentException: Unable to resolve classname:
 IPersistentMap, compiling:(org/danlarkin/json/encoder.clj:144)

 --
 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 from this group, send email to
 clojure+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en



-- 
Omnem crede diem tibi diluxisse supremum.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: JSON library for clojure 1.3

2011-07-22 Thread Sean Corfield
On Fri, Jul 22, 2011 at 2:05 PM, Islon Scherer islonsche...@gmail.com wrote:
 Is there a clojure json library that works in clojure 1.3?

How about: [org.clojure/data.json 0.1.1] (formerly clojure.contrib.json)?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


better community docs: getting started

2011-07-22 Thread Stuart Halloway
I am working through a few of the pages on clojure.org with two goals:

(1) remove or fix anything that is outdated or incorrect

(2) move to the community site (dev.clojure.org) things that should be 
maintained by the community.

As a first pass, I have trimmed http://clojure.org/getting_started, and quite 
clearly linked out to http://dev.clojure.org/display/doc/Getting+Started for 
advice on tools, IDEs, etc.

The community getting started page could be much better. In particular, people 
have opined that there should be a clear, no-choices-to-make path For Newbies 
section.Help welcome!

Stu


Stuart Halloway
Clojure/core
http://clojure.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: better community docs: getting started

2011-07-22 Thread Aaron Cohen
On Fri, Jul 22, 2011 at 5:22 PM, Stuart Halloway
stuart.hallo...@gmail.comwrote:

 I am working through a few of the pages on clojure.org with two goals:

 (1) remove or fix anything that is outdated or incorrect

 I really like how minimal that is now.

A quick suggestion: shouldn't the Copyright date be updated too?

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
Thanks Sean, org.clojure/data.json worked like a charm.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

better community docs: contrib

2011-07-22 Thread Stuart Halloway
The Contrib link in the top right corner of clojure.org now points to 
http://dev.clojure.org/display/doc/Clojure+Contrib.

Currently, this landing page is just a list of links to the various contrib 
projects. Not great, but that is better than the old link, which simply dumped 
you into the old, monolithic contrib git repository.

More important, http://dev.clojure.org/display/doc/Clojure+Contrib is a 
community-managed page, so Clojure/core isn't a bottleneck on improving it. 
Help requested to make http://dev.clojure.org/display/doc/Clojure+Contrib 
better.

Cheers,
Stu


Stuart Halloway
Clojure/core
http://clojure.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: better community docs: getting started

2011-07-22 Thread Stuart Halloway
 I am working through a few of the pages on clojure.org with two goals:
 
 (1) remove or fix anything that is outdated or incorrect
 
 I really like how minimal that is now.
 
 A quick suggestion: shouldn't the Copyright date be updated too? 


Yuo. Fixed, thanks.

Stu


Stuart Halloway
Clojure/core
http://clojure.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] CongoMongo 0.1.6-SNAPSHOT

2011-07-22 Thread Michael Klishin
2011/7/22 Sean Corfield seancorfi...@gmail.com

 I noticed a ticket opened asking for a non-snapshot release - any
 opinions on that?


Sounds like something that deserves 0.1.6, not 0.2.0.

-- 
MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: JSON library for clojure 1.3

2011-07-22 Thread Lee Hinman
On Jul 22, 3:05 pm, Islon Scherer islonsche...@gmail.com wrote:
 Is there a clojure json library that works in clojure 1.3?
 I tried danlarkin/clojure-json but it gives me error:
 java.lang.IllegalArgumentException: Unable to resolve classname:
 IPersistentMap, compiling:(org/danlarkin/json/encoder.clj:144)

Check out Cheshire also: http://github.com/dakrone/cheshire

It's based off of clj-json, but more up to date.

- Lee

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: better community docs: getting started

2011-07-22 Thread Phil Hagelberg
Stuart Halloway stuart.hallo...@gmail.com writes:

 As a first pass, I have trimmed http://clojure.org/getting_started, and quite
 clearly linked out to http://dev.clojure.org/display/doc/Getting+Started for
 advice on tools, IDEs, etc.

That's a huge improvement; glad to see it finally getting some attention.

I have heard that the single-dot syntax is deprecated for use outside
macro writing. So this sample should probably be replaced:

(. javax.swing.JOptionPane (showMessageDialog nil Hello World))

The modern equivalent would be:

(javax.swing.JOptionPane/showMessageDialog nil Hello World)

-Phil

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: better community docs: contrib

2011-07-22 Thread pmbauer
Would be glad to help.
I have a JIRA account (CA signed, etc) but no perms to add/edit pages.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: better community docs: contrib

2011-07-22 Thread pmbauer
P.S.
JIRA account ID: pmbauer

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: better community docs: getting started

2011-07-22 Thread Alan Malloy
On Jul 22, 3:32 pm, Phil Hagelberg p...@hagelb.org wrote:
 Stuart Halloway stuart.hallo...@gmail.com writes:
  As a first pass, I have trimmedhttp://clojure.org/getting_started, and quite
  clearly linked out tohttp://dev.clojure.org/display/doc/Getting+Startedfor
  advice on tools, IDEs, etc.

 That's a huge improvement; glad to see it finally getting some attention.

 I have heard that the single-dot syntax is deprecated for use outside
 macro writing. So this sample should probably be replaced:

     (. javax.swing.JOptionPane (showMessageDialog nil Hello World))

 The modern equivalent would be:

     (javax.swing.JOptionPane/showMessageDialog nil Hello World)

You also need the bare-dot syntax for distinguishing fields from no-
arg methods: (. foo (x)) vs (. foo x) - iirc (.x foo) can have trouble
deciding which one to expand into.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: better community docs: getting started

2011-07-22 Thread Sean Corfield
On Fri, Jul 22, 2011 at 2:22 PM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
 I am working through a few of the pages on clojure.org with two goals:
 (1) remove or fix anything that is outdated or incorrect
 (2) move to the community site (dev.clojure.org) things that should be
 maintained by the community.
 As a first pass, I have trimmed http://clojure.org/getting_started, and
 quite clearly linked out
 to http://dev.clojure.org/display/doc/Getting+Started for advice on tools,
 IDEs, etc.

Thank you!

A question about the packaging of the Developer Releases on the
downloads page: in the 1.2.1 ZIP, there's clojure.jar exactly as
mentioned on the getting_started page; in the 1.3.0 Beta 1 ZIP,
there's clojure-1.3.0-beta1.jar and clojure-1.3.0-beta1-slim.jar - is
that just an artifact of the interim builds? (and is the assumption
that folks reading getting_started aren't likely to try non-stable
releases?)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: [ANN] ClojureScript

2011-07-22 Thread Sean Corfield
On Fri, Jul 22, 2011 at 10:48 AM, Vincent vincent@gmail.com wrote:
 that means , if i write a clojure program using javax.swing to build windows
 based appl. manipulating database at backend ( all written in clojure)
 , this will be converted to javascript and we will be able to run as web
 appljust as GWT.

No, but I expect you could use ClojureScript on top of Node.js to
build end-to-end web applications using the various database modules
for Node.js (just like you'd use wrappers around Java libraries in
regular Clojure). It might be interesting to see some of the Clojure
libraries that wrap Java libraries get Node.js compatible variants...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: How to Return Vector of Vectors

2011-07-22 Thread Ken Wesson
On Fri, Jul 22, 2011 at 8:47 AM, octopusgrabbus
octopusgrab...@gmail.com wrote:

 On Jul 21, 10:15 pm, Ken Wesson kwess...@gmail.com wrote:
 On Thu, Jul 21, 2011 at 10:13 PM, Ken Wesson kwess...@gmail.com wrote:
  On Thu, Jul 21, 2011 at 8:36 PM, octopusgrabbus
  octopusgrab...@gmail.com wrote:
  And do you have a suggestion for a functional way?

 Is all-csv-rows being re-bound with the results of [] and then
 returned as the function's value?

Not really. Nothing's being rebound. But reduce is good for tasks that
amount to accumulating a result while looping over a collection.
(reduce + 0 [3 1 7 2 9]) gives 22 because it starts with 0, then adds
3, then adds 1, then adds 7 ... and (reduce conj [] [1 6 9 5 7]) would
produce [1 6 9 5 7] by taking an empty vector, generating a vector [1]
from it, then a vector [1 6], etc., and returning the end result. In
both cases the objects are not changing; 0 doesn't become 3 and then 4
and [] doesn't become [1] and then [1 6], rather, a reference to 0 is
replaced with a reference to 3 and then one to 4, and a reference to
[] with a reference to [1] and then one to [1 6]. The final reference
gets returned.

Locals aren't being rebound, though; if you stuck a (println
all-csv-rows) in there it would emit the same thing the function got
as parameter. A (println param-vec) inside the (fn ...) would show
changing values, but only because each time the fn got called it got
called with a different value as first argument. During the course of
a single run of the fn, param-vec isn't being rebound either.

But the effect is similar to an old-fashioned Java mutating loop like:

List paramList = new ArrayList();
for (Row v : allCSVRows) {
...
paramList.add(something);
}
return paramList;

but without the potential issues of having mutable state. The
immutable vectors make it closer to

List paramList = Collections.unmodifiableList(new ArrayList());
for (Row v : allCSVRows) {
...
paramList = Collections.unmodifiableList(new
ArrayList(paramList).add(something));
}
return paramList;

but the persistent nature of Clojure vectors makes the copying step
much more efficient than copying the ArrayList above would be, due to
structure sharing.

But then there's the immutable local variables, so conceptually we
aren't even mutating the local paramList to point to new List
instances. With Java you'd have to use a recursive function with no
TCO to do this. In Clojure, conceptually that's what we do do, with
(fn [x y] ... (recur a b)) or (loop [x 1 y 2] ... (recur a b)) and the
latter conceptually a shorthand for ((fn [x y] ... (recur a b)) 1 2)
and (recur) just the same as calling that enclosing function, only
with TCO. But the JVM doesn't really let you do this, so under the
hood it compiles to bytecode that uses mutating locals like paramList
above to carry the parameters through the recursion. But this mutation
is never exposed to the programmer! You can trust that param-vec will
behave as an immutable local for the duration of the fn or loop body,
and when it is mutated you're conceptually in a different invocation
of the (in the loop case, itself conceptual) function.

 And again, thanks. This is exactly
 what I was looking for.

You're welcome.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: better community docs: getting started

2011-07-22 Thread Stuart Halloway
 I am working through a few of the pages on clojure.org with two goals:
 (1) remove or fix anything that is outdated or incorrect
 (2) move to the community site (dev.clojure.org) things that should be
 maintained by the community.
 As a first pass, I have trimmed http://clojure.org/getting_started, and
 quite clearly linked out
 to http://dev.clojure.org/display/doc/Getting+Started for advice on tools,
 IDEs, etc.
 
 Thank you!
 
 A question about the packaging of the Developer Releases on the
 downloads page: in the 1.2.1 ZIP, there's clojure.jar exactly as
 mentioned on the getting_started page; in the 1.3.0 Beta 1 ZIP,
 there's clojure-1.3.0-beta1.jar and clojure-1.3.0-beta1-slim.jar - is
 that just an artifact of the interim builds? (and is the assumption
 that folks reading getting_started aren't likely to try non-stable
 releases?)

I think it is reasonable to expect that someone grabbing a non-stable build 
would recognize the trailing version goo as build artifact. I guess we'll find 
out. :-)

Stu

Stuart Halloway
Clojure/core
http://clojure.com

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
I'll take a look, but I only need basic json encoding/decoding right now.

Islon

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Problem Running ClojureScript on OpenJDK

2011-07-22 Thread db
I believe that the issue can be avoided with OpenJDK by disabling
Rhino optimization.

generated bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)

This appears to be identical to what the fantom guys have encountered:

http://fantom.org/sidewalk/topic/1181

Although instead of switching jvms, I'm going to try to make it work
with OpenJDK.

I'm planning to try a few things:

- Use a newer version of Rhino (trunk from Mozilla).
- Try the change recommended by the Fantom team.
- Look for a JSR 223-compatible replacement for the Rhino impl-
specific Context usage.

I'll post the results shortly.




On Jul 22, 2:58 am, Sean Corfield seancorfi...@gmail.com wrote:
 And then you can't run the resulting JS on node - anything I can try
 to get you guys more info?

 sean@sean-netbook:~/node$ node nodehello.js

 /home/sean/node/nodehello.js:1
 (defn test-stuff
       

 node.js:134
         throw e; // process.nextTick error, or 'error' event on first tick
         ^
 SyntaxError: Unexpected identifier
     at Module._compile (module.js:397:25)
     at Object..js (module.js:408:10)
     at Module.load (module.js:334:31)
     at Function._load (module.js:293:12)
     at Array.anonymous (module.js:421:10)
     at EventEmitter._tickCallback (node.js:126:26)







 On Thu, Jul 21, 2011 at 11:44 PM, Sean Corfield seancorfi...@gmail.com 
 wrote:
  FWIW, I get this same error trying to compile the basic examples for
  Node.js as well:

  cljsc nodehello.cljs {:optimizations :advanced :target :nodejs}  
  nodehello.js

  sun.org.mozilla.javascript.EvaluatorException: Encountered code
  generation error while compiling function test_stuff: generated
  bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
         at 
  sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
         at 
  sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.compile(Codegen.java:91)
         at sun.org.mozilla.javascript.Context.compileImpl(Context.java:2391)
         at 
  sun.org.mozilla.javascript.Context.compileString(Context.java:1359)
         at 
  sun.org.mozilla.javascript.Context.compileString(Context.java:1348)
         at 
  sun.org.mozilla.javascript.Context.evaluateString(Context.java:1101)
         at cljs.compiler$eval1.invoke(compiler.clj:921)
         at cljs.compiler$load_stream.invoke(compiler.clj:944)
         at cljs.compiler$load_file.invoke(compiler.clj:954)
         at cljs.closure$compile_form_seq.invoke(closure.clj:206)
         at cljs.closure$compile_file.invoke(closure.clj:228)
         at cljs.closure$eval1120$fn__1121.invoke(closure.clj:266)
         at 
  cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
         at cljs.closure$eval1107$fn__1108.invoke(closure.clj:280)
         at 
  cljs.closure$eval1056$fn__1057$G__1047__1064.invoke(closure.clj:187)
         at cljs.closure$build.invoke(closure.clj:695)
         at user$eval1246.invoke(cljsc.clj:21)
         at clojure.lang.Compiler.eval(Compiler.java:6406)
         at clojure.lang.Compiler.load(Compiler.java:6843)
         at clojure.lang.Compiler.loadFile(Compiler.java:6804)
         at clojure.main$load_script.invoke(main.clj:282)
         at clojure.main$script_opt.invoke(main.clj:342)
         at clojure.main$main.doInvoke(main.clj:426)
         at clojure.lang.RestFn.invoke(RestFn.java:512)
         at clojure.lang.Var.invoke(Var.java:421)
         at clojure.lang.AFn.applyToHelper(AFn.java:185)
         at clojure.lang.Var.applyTo(Var.java:518)
         at clojure.main.main(main.java:37)

  On Thu, Jul 21, 2011 at 11:15 PM, Sean Corfield seancorfi...@gmail.com 
  wrote:
  I made these changes but still got exceptions trying to start the cljs
  repl (although code seemed to work just fine in the repl after this
  exception). I'm about to move onto node.js installation on ubuntu 11
  at this point...

  sun.org.mozilla.javascript.EvaluatorException: Encountered code
  generation error while compiling function test_stuff: generated
  bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)
         at 
  sun.org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
         at 
  sun.org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.reportClassFileFormatException(Codegen.java:196)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.generateCode(Codegen.java:329)
         at 
  sun.org.mozilla.javascript.optimizer.Codegen.compileToClassFile(Codegen.java:182)
         at 
  

A Couple of emacs questions

2011-07-22 Thread yair
I searched google for these but came up short, I was wondering if
anyone here could help.  I use emacs with clojure and really like it.
There are two things I haven't been able to do successfully so far.

1. Following the CDT instructions here (http://georgejahad.com/clojure/
swank-cdt.html), I can get CDT working but the emacs shortcuts aren't
being recognised.  Setting bps on functions and exceptions works fine,
but to set a bp on a line you need the emacs shortcut.

2. I added the source jar of a java library I am using (nifty-gui) to
the dev dependencies in my lein project (I basically made sure it is
the same as the clojure-source jar's format).  The jar with the
sources in in my lib/dev but I can't Meta-. into any of the classes
from clojure code.

I'm hoping someone here can tell me what I'm doing wrong.

Thanks

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Problem Running ClojureScript on OpenJDK

2011-07-22 Thread Sean Corfield
On Fri, Jul 22, 2011 at 7:08 PM, db donald.bl...@gmail.com wrote:
 I believe that the issue can be avoided with OpenJDK by disabling
 Rhino optimization.

    generated bytecode for method exceeds 64K limit. (cljs/core.cljs#2743)

 This appears to be identical to what the fantom guys have encountered:

 http://fantom.org/sidewalk/topic/1181

 Although instead of switching jvms, I'm going to try to make it work
 with OpenJDK.

Thanx Donald!

I may just switch to the Sun, er, Oracle JVM since I've a feeling one
of my other projects (not yet migrated to my netbook) will require
that JVM anyway...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread Oskar
Thanks for the replies everyone!

About the Python version not being recursive: Oh yeah, didn't even
think about that, but it shouldn't matter that much, or? With all the
right type hints the clojure version should be much faster than the
previous one even with recursion, right?

On Jul 22, 10:51 pm, Dmitry Gutov raa...@gmail.com wrote:
 In case the two replies above didn't drive the point home, the Python
 version is not recursive (it uses results memoized in the data array).
 So, not the same thing.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread Ken Wesson
On Fri, Jul 22, 2011 at 11:02 PM, Oskar oskar.kv...@gmail.com wrote:
 Thanks for the replies everyone!

 About the Python version not being recursive: Oh yeah, didn't even
 think about that, but it shouldn't matter that much, or? With all the
 right type hints the clojure version should be much faster than the
 previous one even with recursion, right?

How many times does the recursive version recalculate, say, (sk 1)? It
calculates (sk 1). Later it reaches (sk 56) which calculates (sk 1)
again. Then (sk 80) recalculates (sk 56) which recalculates (sk 1),
and (sk 111) does likewise, while (sk 104) recalculates (sk 80), which
recalculates (sk 56) ...

So, the answer to your question is probably not. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Why is this code so slow?

2011-07-22 Thread Sean Corfield
FWIW, out of the box on Clojure 1.3.0 with no changes at all, your
code took about 8 seconds on my machine on the first run. Since your
sk function will reuse the arrays, subsequent runs don't calculate any
new values, they just return the pre-calculated ones. Subsequent runs
took about 2 seconds on my machine.

I took David's version and ran that on Clojure 1.3.0 with about the
same results as he saw. Even naming the anonymous function and using
recursive calls (instead of the aget vs substitution that David did)
produced reasonable results (closer to 400ms instead of closer to
300ms) - just to address Ken's comment since the ss / vs arrays
essentially memoize the calls, even in your original code.

Out of curiosity, I modified David's version to pull the array creation out:

(def skk (sk (long-array 401) (boolean-array 401)))
(time (dorun (map skk (range 10

First run, same (as expected). Subsequent runs (only retrieving
numbers, not calculating them), about 10ms.

Eliminating reflection and using unchecked math are going to get you
some pretty darn fast Clojure code!

Sean

On Thu, Jul 21, 2011 at 6:32 AM, Oskar oskar.kv...@gmail.com wrote:
 I was doing some project euler problems and I wrote the following
 code. It is really slow, and I would like to know why and how it can
 be made faster. Not that I care much about this code in particular,
 but I want to understand Clojure better.

    (def vs (int-array 401))
    (def ss (boolean-array 401))

    (defn sk [k]
      (if (aget ss k)
        (aget vs k)
        (let [ans
              (if ( k 56)
                (- (mod (+ 13 (- (* k 23)) (* 37 k k k))
 100) 50)
                (- (mod (+ (sk (- k 24)) (sk (- k 55))) 100)
 50))]
          (do (aset vs k ans) (aset ss k true) ans

    (time (dorun (map sk (range 10

 The call above takes 20 seconds, which is surprisingly slow (at least
 to me). The same thing in Python it takes under under 1 (not sure
 exactly how long). Why so slow?

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: ClojureScript

2011-07-22 Thread Arthur Edelstein
Hi Christopher,

 We plan to have a recording of tonight's talk posted soon.

I'm looking forward to seeing it. Thanks! :)

Arthur

-- 
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 from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en