Re: Clojure turns 5

2012-10-16 Thread Alex Baranosky
Clojure is the gift that keep giving. I, for one, really appreciate what you've done Rich, and can't wait to work with it more and take part in the community as it grows. Alex On Tue, Oct 16, 2012 at 9:39 PM, Robert Luo wrote: > It was an incredible language, five years with clojure is an incr

Re: ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread David Nolen
It may be worth considering adding an oget to complement aget as was suggesting during ClojureScript/Lua development. David On Tue, Oct 16, 2012 at 11:30 PM, Evan Mezeske wrote: > Hmm after reading that docstring, /me hopes he didn't just recommend > something for its not-intended purpose

Re: Clojure turns 5

2012-10-16 Thread Robert Luo
It was an incredible language, five years with clojure is an incredible journey, helping me understand programming better, and do programming better. Thanks Rich! On Wednesday, October 17, 2012 9:53:55 AM UTC+8, Rich Hickey wrote: > > I released Clojure 5 years ago today. It's been a terrific ri

Re: Inconsistent Exceptions

2012-10-16 Thread AtKaaZ
Compile compliance level: 1.6 Generated class files compatibility: 1.6 Source compatibility: 1.6 I think regardless of what jdk you use to run/compile them, these 3 (or at least the first 2) are affecting what you said. I got those from eclipse (but there should be command line equivalents of thos

Re: Clojure turns 5

2012-10-16 Thread AtKaaZ
That's *a lot* of hard work. I am amazed of how much work goes into making such great software with the studying and the many years spent training yourself(generally speaking, not just Rich, but certainly I myself am not part of that list) before the project even started. Sometimes it just boggles

Re: ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-16 Thread Nick Klauer
Other than the PDF being colorful, no. :) It does make a beautiful setting on my wall next to my computer, though. -Nick -- 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

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Arlen Cuss
On Wednesday, 17 October 2012 at 4:11 AM, Phil Hagelberg wrote: > http://home.pipeline.com/~hbaker1/ObjectIdentity.html Thanks for the link, too—I'm working through it with interest. As for mutability in Rouge, I had another thought—freezing (or possibly duping then freezing) Ruby String objects

Remembering locations in a zipper

2012-10-16 Thread Timothy Baldridge
I have a zipper and here's the code I'm trying to execute: 1) search through all nodes until a match for a predicate is found 2) starting at that node go up to its parent then mark all children of the parent with extra info 3) the parent has the option to go to it's parent and perform step 2 as we

Re: Clojure turns 5

2012-10-16 Thread kovas boguta
Congrats! The output coming out of Rich and Clojure/core lately is coming at an unbelievable pace. Keep up the good work :) On Tue, Oct 16, 2012 at 11:15 PM, David Nolen wrote: > Congrats! > > > On Tuesday, October 16, 2012, Rich Hickey wrote: >> >> I released Clojure 5 years ago today. It's be

Re: ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread Frank Siebenlist
Looking at the source of cljs.core/js->clj, I see that aget is also used to access the object properties by name-string… So please tell /me not to worry ;-) -FS. On Oct 16, 2012, at 8:30 PM, Evan Mezeske wrote: > Hmm after reading that docstring, /me hopes he didn't just recommend > someth

Re: ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread Evan Mezeske
Hmm after reading that docstring, /me hopes he didn't just recommend something for its not-intended purpose :) On Tuesday, October 16, 2012 8:29:47 PM UTC-7, FrankS wrote: > > Thanks - that works - that was too easy ;-) > > I looked at the docstring before of aget because I remembered vague

Re: ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread Frank Siebenlist
Thanks - that works - that was too easy ;-) I looked at the docstring before of aget because I remembered vaguely that that was how it used to work before .- : cljs.core/aget - Function ([array i] [array i & idxs]) Returns the value at the index. Dismissed it for object-access after read

Re: ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread Evan Mezeske
I think the easiest solution is to use "aget" and "aset". There may be a better way, but if so I'm not aware of it. http://stackoverflow.com/questions/9861485/clojurescript-interop On Tuesday, October 16, 2012 6:21:45 PM UTC-7, FrankS wrote: > > I understand that you can call js-methods and get

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Brian Marick
On Oct 16, 2012, at 1:19 PM, Arlen Cuss wrote: > My initial solution is to freeze all strings in the reader. This prevents > the most obvious issues, as it means any string read in from the Rouge code > itself is immutable. A problem with `freeze` in Ruby is that it both prevents changing the

Re: Clojure turns 5

2012-10-16 Thread David Nolen
Congrats! On Tuesday, October 16, 2012, Rich Hickey wrote: > I released Clojure 5 years ago today. It's been a terrific ride so far. > > Thanks to everyone who contributes to making Clojure, and its community, > great. > > Rich > > -- > You received this message because you are subscribed to the

Re: Clojure turns 5

2012-10-16 Thread Softaddicts
Congratulations Rich, http://3.bp.blogspot.com/_F0yEiHzEaRc/S1NUOQ1kNeI/C14/cAUqKY8nISk/s1600-h/HappyBdayFiveCandles.jpg You can try to blow the candles :) Happy birthday ! Luc > I released Clojure 5 years ago today. It's been a terrific ride so far. > > Thanks to everyone who contrib

Re: Clojure turns 5

2012-10-16 Thread Paul Mooser
Thank you for clojure. Using clojure has exposed me to new ideas and made be a better programmer. I consider myself lucky to be able to use it every day at work. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to

Re: Clojure turns 5

2012-10-16 Thread XPherior
Thanks to everyone. This community is transforming software engineering in a great way. On Tuesday, October 16, 2012 10:01:29 PM UTC-4, solussd wrote: > > Whoo hoo!! Party!!! > > Thanks to everyone, especially Rich, for creating and contributing to > Clojure. :) > > --- > Joseph Smith > j...

Re: Clojure turns 5

2012-10-16 Thread Joseph Smith
Whoo hoo!! Party!!! Thanks to everyone, especially Rich, for creating and contributing to Clojure. :) --- Joseph Smith j...@uwcreations.com @solussd On Oct 16, 2012, at 8:54 PM, Rich Hickey wrote: > I released Clojure 5 years ago today. It's been a terrific ride so far. > > Thanks to everyo

Re: Clojure turns 5

2012-10-16 Thread Baishampayan Ghose
That's huge! Time flies. Happy Birthday Clojure and thank you very much Rich for creating Clojure and fostering this amazing community. Regards, BG On Tue, Oct 16, 2012 at 6:54 PM, Rich Hickey wrote: > I released Clojure 5 years ago today. It's been a terrific ride so far. > > Thanks to everyone

Re: Clojure turns 5

2012-10-16 Thread David Jagoe
Happy Birthday Clojure. And thanks Rich! On 16 October 2012 18:54, Rich Hickey wrote: > I released Clojure 5 years ago today. It's been a terrific ride so far. > > Thanks to everyone who contributes to making Clojure, and its community, > great. > > Rich > > -- > You received this message becau

Clojure turns 5

2012-10-16 Thread Rich Hickey
I released Clojure 5 years ago today. It's been a terrific ride so far. Thanks to everyone who contributes to making Clojure, and its community, great. Rich -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure

Re: AOT-compilation, record types and DynamicClassLoader

2012-10-16 Thread Kevin Downey
have you cleaned out the classes/ directory recently? AOT'ing, deftypes/defrecords, and lein when combined can exhibit issues with stale generate classes for deftypes/defrecords. I would also try adding (:gen-class) to your ns form. AOT compilation is effectively a nop for the namespace without it,

ClojureScript: how to call a js method when you have the method-string?

2012-10-16 Thread Frank Siebenlist
I understand that you can call js-methods and get properties thru: (.a-method some-js-object param) and (.-a-prop some-js-object) respectively, but how do you invoke either when you have the method/property as a string? The following doesn't seem to work: (let [m "a-method"

Re: [ANN] Immutant 0.5.0 released

2012-10-16 Thread Michael Klishin
2012/10/16 Toby Crawley > * We expose the Quartz job schedulers for each app, allowing you to use > Quartzite instead of the Immutant job api, > while still taking advantage of singleton jobs within a cluster > Nice, thank you! -- MK http://github.com/michaelklishin http://twitter.com/michae

Re: Cdr car

2012-10-16 Thread kovas boguta
A number of "classic" lisp books have been translated to clojure, for instance http://juliangamble.com/blog/2012/07/20/the-little-schemer-in-clojure/ Personally I felt relieved when I saw that clojure had abandoned the anachronistic car/cdr stuff; the sequence abstraction is a lot nicer. There a

Re: Cdr car

2012-10-16 Thread Andy Fingerhut
Curtis: You can do this if you want: (def car first) (def cdr rest) but most people accustomed to Clojure would be much more familiar with first and rest. The Content of the Address and Data Registers haven't been applicable for a long time, but it wasn't only the names that are changed -- f

Re: Cdr car

2012-10-16 Thread Baishampayan Ghose
`car` is called `first` here and `cdr` could mean either `rest` or `next` depending on what you mean/need. And oh, `cons` is not exactly the same one from Common Lisp, etc. Regards, BG On Tue, Oct 16, 2012 at 3:40 PM, Curtis wrote: > Hello - I was familar with lisp years ago and am very new to

Cdr car

2012-10-16 Thread Curtis
Hello - I was familar with lisp years ago and am very new to clojure. I am having a hard time understanding how to find 'car' and 'cdr'. The nice thing about these functions is they always seem to be a part of lisp. I would like to use the little lisper to teach lisp to my co-workers so that w

gen-class :exposes field access

2012-10-16 Thread queshaw
Hi, I'm trying to create a class, instances of which need to access protected fields of the superclass's superclass. But, I am failing so far. Is this a bug or am I doing something wrong: java: package com.example; public class Example { protected static String PROTECTED_FIELD = "this is

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Michael Fogus
I would probably look at the work that Robert Hyatt has done around parallel search in Crafty. He's published his findings far and wide and may still be active online. He's a wealth of information and fairly nice guy. -- -- http://blog.fogus.me -- http://github.com/fogus -- -- You received this

Hiccup -> HTML -> PNG

2012-10-16 Thread nchurch
Has anyone generated PNGs (or any image) from Hiccup in Clojure? I see an older Java library for this: http://code.google.com/p/java-html2image/ Curious to hear about any experience with this library, or if there is a better solution out there. Thanks, Nick. -- You received this message beca

Re: A/B testing in Clojure?

2012-10-16 Thread millettjon
I haven't but will be needing to do so in the next month or two. I'd be interested to hear if you made any progress and possibly in collaborating. Jon On Monday, October 8, 2012 11:04:10 AM UTC-3, Simon Holgate wrote: > > Hi, > > Is anyone doing split (A/B) testing in Clojure? What are you using

Re: Making CLJS output smaller

2012-10-16 Thread David Nolen
On Tue, Oct 16, 2012 at 5:38 PM, Herwig Hochleitner wrote: > > The emitter still can not look ahead in its single pass, but thinking > about it, it seems to me your proposal could be implemented by lazily > initializing global-hierachy in derive. > Sounds good! > > >> Please also note: I'm not

Re: Making CLJS output smaller

2012-10-16 Thread Herwig Hochleitner
2012/10/16 David Nolen > >> But the invokations in javascript output work even when not using google >> closure at all, e.g. the REPL. >> > > Yes because we don't try to optimize them. > And suppose one tried to optimize them: With an established concept of compilation units, it's straightforwar

AOT-compilation, record types and DynamicClassLoader

2012-10-16 Thread Chris Jeris
I have a problem where I am trying to do an isa? or instance? check on an object of a record type which is defined in an AOT-compiled namespace. The isa? check fails because -- under circumstances which I do not yet well understand -- the object I actually have is an instance of its class in a clo

ANN: LibTetris and cljs-tetris

2012-10-16 Thread Andreas Liljeqvist
So the time had come to make a library version of my Tetris-project. [libtetris "0.1.0] github: https://github.com/bonega/libtetris There is even some documentationthanks to Marginalia. I have ported my Clojures

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Jack Moffitt
> scenario. The minute forking occurs however you lose coordination > capabilities (at least this is my understanding). He said it very casually > in the video that is why this has been bugging me so much... Fork/Join is just threads, so I'm not sure why you'd lose coordination capabilities. You

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Jim - FooBar();
On 16/10/12 21:48, Alan Malloy wrote: You will get better results from a game-programming forum, or indeed from a google search for "parallel alpha beta" than from a bunch of clojure guys with no particular experience in your problem domain. The question is more around JDK7 and reducers. Google

Re: trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
On 16/10/12 21:45, Alan Malloy wrote: But really I don't think trampoline is a very compelling problem- solver here: the primary (only?) gain from trampoline is in reducing stack depth, and I rather doubt that you can calculate minimax for even a few hundred ply. So you're in no danger of a stack

Re: parallel alpha-beta pruning possible?

2012-10-16 Thread Alan Malloy
You will get better results from a game-programming forum, or indeed from a google search for "parallel alpha beta" than from a bunch of clojure guys with no particular experience in your problem domain. On Oct 16, 1:27 pm, "Jim - FooBar();" wrote: > After watching this presentation[1] by Brian G

Re: trampoline not compatible with reducers?

2012-10-16 Thread Alan Malloy
Reducers don't enter into the picture at all: this code is just as broken with clojure.core/reduce and clojure.core/map. The immediate problem that Kevin is trying to draw your attention to is that you are calling (reduce max (map my-fn coll)), where my-fn sometimes returns a number, and sometimes

Re: [ANN] Immutant 0.5.0 released

2012-10-16 Thread Simone Mosciatti
It looks great, well done... waiting for the 1.0... -- 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

parallel alpha-beta pruning possible?

2012-10-16 Thread Jim - FooBar();
After watching this presentation[1] by Brian Goetz, in which he discusses the fork-join framework and how it is intended to be used I was left with a major question. Around the end of the talk he said and I quote "...fork-join can be used for game-tree exploration..." while the slides actuall

ANN: zombie 0.2.0

2012-10-16 Thread XPherior
Zombie is a Clojure framework for semantic transformations of map-based data. It's often useful in testing to abstractly state how two pieces of data are different, rather than explicitly conjure up concrete values. I hope this helps to capture the essence of tests better, especially for tests t

Re: Smarter code reloading with tools.namespace 0.2.0

2012-10-16 Thread Hugo Duncan
Timothy Washington writes: > 2) Running emacs with nrepl.el. I fire up "*M-x nrepl-ritz-jack-in*" ritz-repl-utils includes a namespace dependency graph in ritz.repl-utils.namespaces. It doesn't yet include a refresh type function, but that would be straightforward to add on top of a call to `(t

[ANN] Immutant 0.5.0 released

2012-10-16 Thread Toby Crawley
We released Immutant 0.5.0 today, with a few bugfixes and some new features. Some notable changes: * You can now easily run your tests inside the Immutant container via `lein immutant test` * We expose the Quartz job schedulers for each app, allowing you to use Quartzite instead of the Immutant

Re: trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
'my-min' and 'my-max' simply wrap core/min core/max. You mean i have to trampoline these calls as well? return something like this? : #(r/reduce (trampoline my-max) ;;was my-max (r/map (fn [child] (minimize (:tree child) (dec d))) (:children tree))) Jim On

Re: Smarter code reloading with tools.namespace 0.2.0

2012-10-16 Thread Stuart Sierra
'ring-devel' depends on 'ns-tracker', which uses tools.namespace 0.1.3: https://github.com/weavejester/ns-tracker/blob/master/project.clj Dependency resolution will only allow one version of the library, so your project gets tools.namespace 0.2.0, not 0.1.3. The two releases are not compatible,

Re: trampoline not compatible with reducers?

2012-10-16 Thread Kevin Downey
if you look further down the stacktrace (where it refers to your code instead of clojure.lang.Numbers.lt) it will give you line numbers in your code to look at. you are calling these trampolined functions without trampoline. On Tue, Oct 16, 2012 at 11:24 AM, Jim - FooBar(); wrote: > On 16/10/12

Re: Making CLJS output smaller

2012-10-16 Thread David Nolen
On Tue, Oct 16, 2012 at 2:41 PM, Herwig Hochleitner wrote: > 2012/10/16 David Nolen > >> None of the invocation optimizations make any sense for anything other >> that advanced optimization. > > > But the invokations in javascript output work even when not using google > closure at all, e.g. the

Re: Making CLJS output smaller

2012-10-16 Thread Herwig Hochleitner
2012/10/16 David Nolen > None of the invocation optimizations make any sense for anything other > that advanced optimization. But the invokations in javascript output work even when not using google closure at all, e.g. the REPL. > They hard code static assumptions that might get invalidated

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Arlen Cuss
Hi Phil, On Wednesday, 17 October 2012 at 4:11 AM, Phil Hagelberg wrote: > Interesting project. Thanks! > What are you planning on doing about the fact that Ruby has mutable > strings? Seems like that would be a deal-breaker for implementing > Clojure's equality semantics. > > http://home.pip

Re: trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
On 16/10/12 19:15, Kevin Downey wrote: you are declaring the functions return doubles, but in fact returning functions or doubles yes you're right (my bad) but the same thing happens without the type-hinting - albeit in a different place and different originating function: ClassCastException

Re: trampoline not compatible with reducers?

2012-10-16 Thread Kevin Downey
you are declaring the functions return doubles, but in fact returning functions or doubles On Tue, Oct 16, 2012 at 11:06 AM, Jim - FooBar(); wrote: > Hi everyone, > > I'm pretty sure i'm using trampoline the right way but still I get this > exception: > > ClassCastException Clondie24.lib.search$s

trampoline not compatible with reducers?

2012-10-16 Thread Jim - FooBar();
Hi everyone, I'm pretty sure i'm using trampoline the right way but still I get this exception: ClassCastException Clondie24.lib.search$search$minimize__3075$fn__3076 cannot be cast to java.lang.Number Clondie24.lib.search/search/minimize--3075 (search.clj:47) here is the code: (defn sea

Re: Making CLJS output smaller

2012-10-16 Thread David Nolen
None of the invocation optimizations make any sense for anything other that advanced optimization. They hard code static assumptions that might get invalidated in any compilation unit other than whole program. We don't need to look at the whole program at once. Think about why we need declare and

Re: Making CLJS output smaller

2012-10-16 Thread Herwig Hochleitner
2012/10/16 David Nolen > > ClojureScript programmers benefit from the assumption of whole program > optimization for production code. Also remember we have analyze-file. > > They most certainly do, but in my mind this assumption is only made in the google closure compiler, right now. I see analyz

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Phil Hagelberg
On Fri, Oct 12, 2012 at 4:40 AM, Arlen Christian Mart Cuss wrote: > I'd like to announce Rouge, which is an implementation of Clojure on Ruby. Interesting project. What are you planning on doing about the fact that Ruby has mutable strings? Seems like that would be a deal-breaker for implementin

Re: Making CLJS output smaller

2012-10-16 Thread David Nolen
On Tue, Oct 16, 2012 at 12:27 PM, Herwig Hochleitner wrote: > 2012/10/16 David Nolen > >> >> I'm aware of this one as well. But again I think we can and should do a >> quick fix in the compiler for this. Either the user used multimethods or >> they did not. >> > > I don't see how such a quick fi

Re: Making CLJS output smaller

2012-10-16 Thread Herwig Hochleitner
2012/10/16 David Nolen > > I'm aware of this one as well. But again I think we can and should do a > quick fix in the compiler for this. Either the user used multimethods or > they did not. > I don't see how such a quick fix could be done, without the compiler gaining a concept of "the whole pro

Re: Correct usage of data-readers

2012-10-16 Thread Stuart Sierra
One data_readers.clj file can't override another: it's an error if they contain the same tags with different functions. So if a library defines its data reader tags, you can't override them *at read-time* in your app. You can always override readers dynamically at run-time by binding *data-read

ANN: Minderbinder v0.2.0

2012-10-16 Thread Fogus
Minderbinder is a Clojure library for defining unit conversions available at read, compile and run time. More information is available on the [Minderbinder source repo](https://github.com/fogus/minderbinder). Use Include the following in your [Leiningen](https://github.com/technomancy/l

Re: Rouge: Ruby + Clojure

2012-10-16 Thread Armando Blancas
Finally came around to install a recent Ruby build and ran a little test script just to get a feel for the startup time. Looks good, though the faster the merrier. ~ $ ruby --version ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-darwin10.8.0] ~/dev/tools/rouge $ cat test.clj (defn square

Re: Smarter code reloading with tools.namespace 0.2.0

2012-10-16 Thread Timothy Washington
I tracked down the problem. Funny thing is that tools.namespace is failing when trying to reload the ring component inside of noir. Looking at * nrepl-ritz.el* (0.5.0), which uses *nrepl.el* (0.1.4), there are a few references to namespace. But I don't think that has anything to do with tools.names

Re: ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-16 Thread Andy Fingerhut
Yes, the PDF versions of the cheat sheet used to fit into 2 A4 or US letter sized pages quite nicely, before I started adding more things to it. Now I'm sure they can fit into 3 such pages quite nicely, but to fit into 2 would require reducing the font size. Since it no longer fit into 2, I hav

Re: Correct usage of data-readers

2012-10-16 Thread Justin Kramer
On Tuesday, October 16, 2012 9:07:49 AM UTC-4, Stuart Sierra wrote: > "- is it appropriate to include data_readers.clj in a library - given that > file is in the root?" > > No. data_readers.clj is intended for application developers. Libraries may > define data reader functions and suggest tags

Re: ANN: Clojure 1.3 and 1.4 Cheat Sheet v7

2012-10-16 Thread Nick Klauer
I noticed that the PDF downloads seems a bit off. At least in my case, the standard PDFleaves alot of whitespace. -- You received this message because you are subscribed to the Google G

Re: Smarter code reloading with tools.namespace 0.2.0

2012-10-16 Thread Stuart Sierra
> # clojure/tools/namespace__init.class or *clojure/tools/namespace.clj* on > classpath: > > > > Now, somewhere in the code, something is looking for > clojure.tools.namespace.clj. But that's just a directory in the > project

Re: Correct usage of data-readers

2012-10-16 Thread Stuart Sierra
"- is it appropriate to include data_readers.clj in a library - given that file is in the root?" No. data_readers.clj is intended for application developers. Libraries may define data reader functions and suggest tags for consumers of that library. -S -- You received this message because you

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Gergely Szabó
Thanks for the explanation. My assumption was that evaling a compiled function would not work. When I tried it I was really surprised that it did for some simple cases. I think it would be better if it never worked. This inconsistent behavior is confusing. Anyway, the workaround I found is to

Re: How to represent trees for use with zippers

2012-10-16 Thread Caspar Hasenclever
Hi Dave, I don't know if there is the one true way of representing a tree as a vector, but clojure.zip allows you to zip over pretty much any structure you like, as long as you provide the right functions. The zipper function is a bit like an informal protocol in that way. The built-in vector-zip

Re: Simple way to get image from url

2012-10-16 Thread Jim foo.bar
On 16/10/12 13:25, Zhitong He wrote: another way to solve this, from http://users.utu.fi/machra/posts/2011-08-24-2-reddit-clojure.html (ns myapp.app (:require [clojure.java.io :as io])) (defn copy [uri file] (with-open [in (io/input-stream uri) out (io/out

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Jim foo.bar
On 16/10/12 13:20, Michael Gardner wrote: On Oct 16, 2012, at 5:16 AM, Jim foo.bar wrote: so you're saying that if I write a for-loop in Java that populates an array with constants from 1-1 and then a 2nd loop to add them up, it would happen at compile-time and i would get the same timing

Re: Making CLJS output smaller

2012-10-16 Thread David Nolen
On Tue, Oct 16, 2012 at 7:19 AM, Herwig Hochleitner wrote: > Certainly, such a simple optimization (omitting var reads in a statement > context) could live in the emitter. > The next stumbling block to a smaller clojurescript, however, is the > global-hierarchy var, which doesn't get removed by th

Re: Simple way to get image from url

2012-10-16 Thread Zhitong He
another way to solve this, from http://users.utu.fi/machra/posts/2011-08-24-2-reddit-clojure.html (ns myapp.app (:require [clojure.java.io :as io])) (defn copy [uri file] (with-open [in (io/input-stream uri) out (io/output-stream file)] (io/copy in ou

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Michael Gardner
On Oct 16, 2012, at 5:16 AM, Jim foo.bar wrote: > so you're saying that if I write a for-loop in Java that populates an array > with constants from 1-1 and then a 2nd loop to add them up, it would > happen at compile-time and i would get the same timing-result? Maybe, maybe not. Compilers a

Re: Making CLJS output smaller

2012-10-16 Thread Herwig Hochleitner
2012/10/16 David Nolen > > Yep I think there are quite a few things like this. But I don't think we > need an optimization pass for this paticular case (and I'm not saying > that's not a good idea - see below). Hopefully we can a direct patch for > this issue around top level deftypes/records. >

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Tassilo Horn
"Jim foo.bar" writes: Hi Jim, >> One example that does things like constant-folding like macrology is >> the unit conversion macro in Let Over Lambda that compiles to >> constants if both value and unit are given literally (recursively). > > unit conversion! this is exactly what i had in mind!!!

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Jim foo.bar
On 16/10/12 11:49, Tassilo Horn wrote: One example that does things like constant-folding like macrology is the unit conversion macro in Let Over Lambda that compiles to constants if both value and unit are given literally (recursively). unit conversion! this is exactly what i had in mind!!! wh

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Tassilo Horn
"Jim - FooBar();" writes: >> You add the numbers at compile time, and then time how long it takes >> to...do nothing to them, at runtime. You are comparing N to zero, not >> to some smaller factor of N. > > yes but this seems almost unbelievable...i mean for simple numeric > operations this littl

Re: CDS progress report, week 1

2012-10-16 Thread Andreas Liljeqvist
Great work guys! This is a great gift to the community. On Mon, Oct 15, 2012 at 7:01 PM, Wes Freeman wrote: > I've been watching the repo. Thanks for all the effort on this, guys. > > Wes > > > On Mon, Oct 15, 2012 at 12:07 PM, Michael Klishin < > michael.s.klis...@gmail.com> wrote: > >> ## TL;D

Re: Simple way to get image from url

2012-10-16 Thread Yakovlev Roman
Ok that were good examples thanks Final variant add to project.clj [clj-http "0.5.6"] add ref to lib in ns (ns myapp.app *(:require [clj-http.client :as client] ))* function (defn write-file [url] (with-open [w (clojure.java.io/output-stream "img.jpg" )] ; output file (.write w (:b

Re: Evaluating an anonymous function with closure

2012-10-16 Thread Jim foo.bar
On 16/10/12 03:50, Michael Gardner wrote: On Oct 15, 2012, at 7:45 PM, Andy Fingerhut wrote: For the case of arithmetic on compile-time constants, I believe that many C, Java, etc. compilers already perform the arithmetic at compile time. Known as "constant folding", yes. so you're saying

Re: How to represent trees for use with zippers

2012-10-16 Thread mwillson
Dave, Your first attempt looks OK to me. (require '(clojure [zip :as z])) (def zipper (z/vector-zip [:A [:B [:D :E]] [:C [:F :G]]])) (defn pre-order [loc] (when-not (z/end? loc) (when-not (z/branch? loc) (println (z/node loc))) (recur (z/next loc user=> (pre-order zipper) :

Re: core.match and AOT

2012-10-16 Thread Paudi Moriarty
See http://dev.clojure.org/jira/browse/MATCH-63 for details. Paudi On 15 October 2012 23:21, David Nolen wrote: > On Mon, Oct 15, 2012 at 5:09 PM, Paudi Moriarty < > pmoria...@annadaletech.com> wrote: > >> It's broken since alpha10, alpha9 works fine. >> >> Paudi >> > > That's useful to know, t