Re: clojure struct with java

2011-10-14 Thread Alexander Taggart
I suspect this...

Var struct = RT.var(clojure.core, struct,employee :diego 10 :coach 
1000); 

isn't doing what you think it will.  That will set the root binding of 
clojure.core/struct to the string you gave it.  you probably want to get the 
var for the struct function, and then invoke it with the arguments to create 
an employee struct instance.

-- 
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: Reactions to google dart?

2011-10-14 Thread Nicolas
For me the real meaning of this is that support for new features in
closure library will stop in its actual form in the years to come.
Only bugs will be corrected, no more. This is already the case in a
sence I think, because before Dart, GWT was viewed as the new official
way to make new web applications at google.

Closure library is not where google put effort for new developpments.

GWT somewhat failed on some aspects and now google is betting on Dart.

For short term, this change nothing to us.

In the long term we might have to choose between staying on a legacy
library (closure library in JS form) or compile to Dart instead of JS.
For raw clojure script code, this would not be very important. As the
semantics could be preserved.

But call to APIs might change quite a lot. New APIs under Dart might
have really different behavior than actual closure library. Like in a
sence GWT API is already totally different beast than closure library.

Long term this might mean that instead of compilling to raw JS and
having a dependancy on closure library, we might choose to compile to
raw Dart and use new Dart APIs. In a sence to keep with the with the
latest trend and benefits of latest features.

This is not the only choice, as long as the closure compiler from
google is working and there are not too many bugs in closure library,
there is no real problem. As this is open source, nothing prevent us
to fix things ourselves if needed...

Maybe we are more interrested by the compiler itself and by the low
level closure API providing access to all browser features (DOM...)
than using cutting edge API that will not be idiomatic clojure
anyway.

If we want more idiomatic libraries, we will have to make them
ourselves anyways.

My 2 cents...

On Oct 11, 4:43 pm, Timothy Washington twash...@gmail.com wrote:
  What I have in mind is not related to Dart, but to the support of
  Closure Tools from Google.

  Will Dart javascript compatibility layer/javascript compilation for
  non-Chrom(e)(ium) browsers include the Closure Tools Suite ?

  2011/10/10 David Nolen dnolen.li...@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


SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Alan O'Donnell
Hi everyone,

I've encountered an unexpected NullPointerException while translating
some early SICP code into Clojure 1.3.0. In particular, I'm
implementing the iterative sqrt procedure from section 1.1.7.

Here's my code:

(defn square [x] (* x x))

(defn abs [x]
  (cond
( x 0) (- x)
:else x))

(defn average [x y]
  (/ (+ x y) 2))

(defn sqrt
  ([x] (sqrt 1.0 x))
  ([guess x]
(letfn [(good-enough? [guess]
  ( (abs (- (square guess) x)) 0.001))
(improve [guess]
  (average guess (/ x guess)))]
  (if (good-enough? guess)
guess
(recur (improve guess) x)

Rather mysteriously, this works correctly for inputs less than roughly
(square 2718.259...); anything larger throws a NullPointerException
clojure.lang.Numbers.lt (Numbers.java:3693).

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
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


When to use mutable state

2011-10-14 Thread pistacchio
I'm implementing a litte game thing in Clojure. So far I'm passing
around a world status object among functions. It is very
functional and I can simulate any moment of the game my simply
feeding the system with a made-up world state.

Since Clojure has a very sophisticate system for managing state
(references, atoms...) I wanted to know what is the more idiomatic way
of programming Clojure, whether to use its system or to stick to a
more functional approach.

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: Clojure videocast mentioning SuperCSV?

2011-10-14 Thread James Petry
Found it! Stuart Halloway's Clojure in the 
Fieldhttp://www.infoq.com/presentations/Clojure-in-the-Field


-- 
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: newbie, installation problem

2011-10-14 Thread Andrew
Sagar, I had trouble on Windows until Mark Rathwell suggested following the 
instructions at http://sourceforge.net/apps/wordpress/codesounding/tag/emacs

-- 
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: When to use mutable state

2011-10-14 Thread Timothy Baldridge
On Fri, Oct 14, 2011 at 7:58 AM, pistacchio pistacc...@gmail.com wrote:
 I'm implementing a litte game thing in Clojure. So far I'm passing
 around a world status object among functions. It is very
 functional and I can simulate any moment of the game my simply
 feeding the system with a made-up world state.


Well you're going to get a slight performance boost by going to a
controlled mutable state as you won't have to modify your entire state
tree whenever any object changes, you'll only have to modify the part
that changes. But what I see as the biggest benefit to using mutable
state, is being able multi-thread your program. Running everything on
one thread is s 20th century. ;-)

Timothy

-- 
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: newbie, installation problem

2011-10-14 Thread Mark Rathwell
 I don't know how to install CLOJURE on Windows but i have
 installed it on Ubuntu
 Should i have to learn Java first?

You don't need to know Java, you just need to have it installed
already.  Have another look at the Clojure getting started wiki page
that Phil linked [1].  Linked from that page are installation
instructions and tutorials for Clooj and Leiningen.  Those are
generally where you will want to start if you are not familiar with
emacs or any of the big Java IDEs.

[1] http://dev.clojure.org/display/doc/Getting+Started+for+Beginners

 Sagar, I had trouble on Windows until Mark Rathwell suggested
 following the instructions at
 http://sourceforge.net/apps/wordpress/codesounding/tag/emacs

Those instructions are for getting swank-clojure working with emacs on
windows.  If you want to use emacs as your editor, the workaround
presented there may help.


On Fri, Oct 14, 2011 at 9:24 AM, Andrew ache...@gmail.com wrote:



 --
 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: SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Armando Blancas
With 1.3/OSX this code worked up to:

user= (sqrt 1)
100.0

and then hanged here:

user= (sqrt 10)
~ $

On Oct 13, 7:04 pm, Alan O'Donnell alan.m.odonn...@gmail.com
wrote:
 Hi everyone,

 I've encountered an unexpected NullPointerException while translating
 some early SICP code into Clojure 1.3.0. In particular, I'm
 implementing the iterative sqrt procedure from section 1.1.7.

 Here's my code:

 (defn square [x] (* x x))

 (defn abs [x]
   (cond
     ( x 0) (- x)
     :else x))

 (defn average [x y]
   (/ (+ x y) 2))

 (defn sqrt
   ([x] (sqrt 1.0 x))
   ([guess x]
     (letfn [(good-enough? [guess]
               ( (abs (- (square guess) x)) 0.001))
             (improve [guess]
               (average guess (/ x guess)))]
       (if (good-enough? guess)
         guess
         (recur (improve guess) x)

 Rather mysteriously, this works correctly for inputs less than roughly
 (square 2718.259...); anything larger throws a NullPointerException
 clojure.lang.Numbers.lt (Numbers.java:3693).

 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
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] dj 0.1.0 released

2011-10-14 Thread Brent Millare
In master, I added clojurescript support. Note: the clojurescript bootstrap 
scripts require curl, make sure you have that before installing.

dj cljs install

installs clojurescript to dj/usr/src/

dj cljs repl

starts a cljs repl

-- 
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: SICP sqrt function generates unexpected NullPointerException

2011-10-14 Thread Alan O'Donnell
Armando, I get the same behavior as you with Clojure 1.2.1. But if I lein 
dep Clojure 1.3.0, I'm back to NullPointerExceptions.

-- 
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: When to use mutable state

2011-10-14 Thread Michael Gardner
On Oct 14, 2011, at 8:48 AM, Timothy Baldridge wrote:

 On Fri, Oct 14, 2011 at 7:58 AM, pistacchio pistacc...@gmail.com wrote:
 I'm implementing a litte game thing in Clojure. So far I'm passing
 around a world status object among functions. It is very
 functional and I can simulate any moment of the game my simply
 feeding the system with a made-up world state.
 
 
 Well you're going to get a slight performance boost by going to a
 controlled mutable state as you won't have to modify your entire state
 tree whenever any object changes, you'll only have to modify the part
 that changes. But what I see as the biggest benefit to using mutable
 state, is being able multi-thread your program. Running everything on
 one thread is s 20th century. ;-)

Clojure's data structures are designed to support efficient creation of 
modified versions via structural sharing; e.g. a map created via assoc shares 
much of the same memory as the map from which it was created. So unless you're 
building the entire game state from scratch each time, you don't have to worry 
about modifying the entire state tree as opposed to a small portion of it.

Not saying you won't get any performance boost from using mutation, just that 
the performance of the functional solution is not nearly as bad as you might 
think. As always, profiling trumps guessing about performance bottlenecks.

On Oct 14, 2011, at 7:58 AM, pistacchio wrote:

 Since Clojure has a very sophisticate system for managing state
 (references, atoms...) I wanted to know what is the more idiomatic way
 of programming Clojure, whether to use its system or to stick to a
 more functional approach.

Don't feel you have to just use atoms etc just because they're there. Clojure 
is basically a functional language; mutability is limited to a few specific 
constructs precisely because idiomatic Clojure code is expected to be nearly 
all functional, with mutability used only as necessary. Performance might be 
one reason to use mutability (though see above); another might be that some 
framework you're using more-or-les requires it.

For example, Java's Swing has you provide a callback function that is supposed 
to know how to draw your app's content. But Swing can't pass your current world 
state to your callback, so the callback needs to be able to access the world 
state in some other way. A global atom holding the world state is a pretty 
natural solution in that case.

-- 
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


Sum on a list of maps

2011-10-14 Thread der
Hi,

I'm a Clojure newbie trying to the following simple task:

Given a list of maps of the followign format: ({Type A, Value
5} {Type B, Value 4} {Type A, Value 7.2} {Type
A, Value 25.4} {Type B, Value 2.982})

I want to compute a list of maps such that each type appears once in
the list and the value of the type is the sum of the values, so that
in the example it would be:

({Type, A, Value, 37.6} {Type, B, Value, 6.982})

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
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: integration with jQuery

2011-10-14 Thread Curious Fox

Thanks! It looks super easy and I'm sure it'll do the trick.

Honestly, I first did a search by jQuery and came across Alright,
fess up, who's unhappy with clojurescript? (http://groups.google.com/
group/clojure/browse_thread/thread/5b0a1c161938e6eb/a714e9e512838e90?
lnk=gstq=jquery#a714e9e512838e90).

After reading it I got totally confused as it makes an impression that
dealing with jQuery is something nearly impossible.


On Oct 13, 1:21 pm, David Nolen dnolen.li...@gmail.com wrote:
 ClojureScript can access globals via js/foo. You can easily interact with
 your existing codebase using this simple feature. For example:

 (ns foo.bar)

 (def j js/jQuery)

 (.text (j div#foo) jQuery works!)

 Were you looking for something more sophisticated then this?

 David







 On Wed, Oct 12, 2011 at 8:08 PM, Frank Warren fra...@gmail.com wrote:
  Howdy

  This particular story starts with vast existing code base using
  jQuery. We'd love to switch to ClojureScript given its pure
  awesomeness, but we still have to somehow cope with the existing bits,
  at least to maintain the same lookfeel.

  Is there any good approach to invoke jQuery functionality from
  ClojureScript?

  Is it feasible to wrap existing jQuery into some sort of helper class
  and invoke it instead?

  I would highly appreciate any suggestions,
  F.

  --
  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: Exception in thread main java.lang.Exception: Unable to resolve symbol: PK♥♦¶

2011-10-14 Thread Stuart Sierra
Unable to resolve symbol: ___ in this context is a Clojure compiler error 
thrown when the compiler encounters a symbol which has not been defined. A 
symbol with funky non-ASCII characters in it probably results from trying 
to load a binary file of some sort. PK is the magic number for a 
ZIP-compressed file, so you may be trying to load/compile a ZIP file or JAR 
file, instead of Clojure source code.

-Stuart Sierra
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

clojure newbie collection question

2011-10-14 Thread Dennis Haupt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

if i got it right, filter/remove and map (basically all batch
transform functions) return lazy sequences. to convert them to real
collections again, i do (vec lazyseq) in case i want the result to be
stored in a vector.

correct?

what happens if i traverse the lazy sequence more than once? is the
result cached like in a scala stream, or is a lazy seq in clojure
similar to a view in scala that is calculated each time it's traversed?




-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJOmHZiAAoJENRtux+h35aGHYIQAKeYGf6BEsBVvlTbxF0NEiM2
O9u8jPnUwpRcqsoslROX8YCKpTjppnG/YpaGI98OkZXPLXK6f3JDo60gV6oF143L
mntpi1RrQ3DDPFfFzsSGpK1k/eoqaR+E6dOeWOeC/FkGjotjaDN4KlJp9PsdaAmZ
2atZX2Nr8Ock+gRnteupJEbWPJ5kbPm0W/cYojnCGKgPcxTZ67BFEnpTtWfYzPGC
v5vn8+OP/dw5kwAgnvQoSl4AVB7BkGFL4dDeKeayR6MstLKlfl8mJeecliZlc4iy
rbMWIu5rHJGYyFDnejzbubfwSkYUrCtfMjvD4Zz69ArTLOrWtKKe+WDFFawi0QeM
gYleGeFPhX9adHF/uyojDljy+LhnX65+2Q5fnUXTa5+QX0F3oxrCs9C0lPJwmYpy
HplJrh7YoeHRXSh/vlBm5Y8FMaIwW2mCn7SmdldHZz0TrURwQaD8hUwgNl6fMPgO
YOe2lopReZofT7jdR40fhtGakv/+RFwhgDZY66zp13b5ab79uhMrt0jMG3pHHwgs
2bBeZol2V+RsROXi2aVOBPrRQWpVDWxQn4Ky/0PV5QjapqTNe/2ZDxtCM7O4acqf
9f7XoY1tWYhWNCCkHtl9VvkqQJtgeJdkODd4+ksu1hhg70JfE++q4Drml31wOpNo
3vCvGa1fsATKhsbzc9zi
=sU9o
-END PGP SIGNATURE-

-- 
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: integration with jQuery

2011-10-14 Thread Stuart Sierra
 Honestly, I first did a search by jQuery and came across
 Alright, fess up, who's unhappy with clojurescript?

That's really unfortunate. ClojureScript can be used with any JavaScript 
library. What you won't get, in most cases, is the advanced-mode 
optimizations of Google's Closure compiler applied to the 3rd-party library. 
But you didn't have that writing straight JavaScript either.

-S

-- 
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

lein not configured properly

2011-10-14 Thread Bruce Gordon
I first followed the directions at 
http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
, but then abandoned that effort thanks to irc advice. I then started
following the http://dev.clojure.org/display/doc/Getting+Started+with+Leiningen
directions. However I suspect I am not configured properly since the
search isn't working-see below.

 bruce@mepis1:~/bin$ lein search hadoop
 Warning: couldn't download index for http://repo1.maven.org/maven2
 Warning: couldn't download index for http://clojars.org/repo/

bruce@mepis1:~/bin$ lein version
Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM

Next I backed out my explicit install of ant and maven via apt-get
remove ant and apt-get remove maven2

but lein still yields the same result.

Should I uninstall lein (how?), and start over?

-- 
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: lein not configured properly

2011-10-14 Thread Mark Rathwell
Are you behind a firewall or proxy that would be blocking .zip files?
lein search first makes sure it has an updated index from those
repositories, and if not tries to download and unzip those index
files:

http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip
http://clojars.org/repo/.index/nexus-maven-repository-index.zip

Can you download those files in a browser?

(Also, there is a lein specific group at
http://groups.google.com/group/leiningen )

 - Mark

On Fri, Oct 14, 2011 at 1:55 PM, Bruce Gordon brucebgor...@gmail.com wrote:
 I first followed the directions at 
 http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
 , but then abandoned that effort thanks to irc advice. I then started
 following the 
 http://dev.clojure.org/display/doc/Getting+Started+with+Leiningen
 directions. However I suspect I am not configured properly since the
 search isn't working-see below.

  bruce@mepis1:~/bin$ lein search hadoop
  Warning: couldn't download index for http://repo1.maven.org/maven2
  Warning: couldn't download index for http://clojars.org/repo/

 bruce@mepis1:~/bin$ lein version
 Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM

 Next I backed out my explicit install of ant and maven via apt-get
 remove ant and apt-get remove maven2

 but lein still yields the same result.

 Should I uninstall lein (how?), and start over?

 --
 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


Faster clojure.data.json

2011-10-14 Thread Stuart Sierra
I spent some time this morning on performance enhancements to
clojure.data.json, including a fix for DJSON-1. I just pushed release
0.1.2 to Sonatype; it will reach Maven Central in a few hours.

I added a `benchmark` function to clojure.data.json-test for easy
comparison. On Clojure 1.3.0, I get these numbers:

  ;; clojure.data.json 0.1.1
  Elapsed time: 2288.791 msecs
  Elapsed time: 1821.382 msecs
  Elapsed time: 1803.054 msecs
  Elapsed time: 1745.032 msecs
  Elapsed time: 1729.438 msecs
  Elapsed time: 1725.459 msecs
  Elapsed time: 1715.483 msecs
  Elapsed time: 1719.421 msecs

  ;; clojure.data.json 0.1.2
  Elapsed time: 398.622 msecs
  Elapsed time: 157.456 msecs
  Elapsed time: 123.712 msecs
  Elapsed time: 105.424 msecs
  Elapsed time: 60.018 msecs
  Elapsed time: 59.023 msecs
  Elapsed time: 51.412 msecs
  Elapsed time: 64.738 msecs

It can probably be made faster still, but that's a good start.

Next steps: a better API. The boolean argument for keyword vs string
keys is obscure. Keyword/option-style arguments would be better. With
that option being more visible, I'm really tempted revert to string
keys as the default. It's the only safe option: Otherwise, you can
easily get Clojure keywords that cannot be pr'd and read back.

-Stuart Sierra
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: lein not configured properly

2011-10-14 Thread Bruce Gordon
I am in a VirtualBox VM (running SimplyMepis) hosted in Windows Vista.
From within the vm I can download those files from a browser.

On Oct 14, 2:17 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
 Are you behind a firewall or proxy that would be blocking .zip files?
 lein search first makes sure it has an updated index from those
 repositories, and if not tries to download and unzip those index
 files:

 http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.ziphttp://clojars.org/repo/.index/nexus-maven-repository-index.zip

 Can you download those files in a browser?

 (Also, there is a lein specific group 
 athttp://groups.google.com/group/leiningen)

  - Mark







 On Fri, Oct 14, 2011 at 1:55 PM, Bruce Gordon brucebgor...@gmail.com wrote:
  I first followed the directions 
  athttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
  , but then abandoned that effort thanks to irc advice. I then started
  following 
  thehttp://dev.clojure.org/display/doc/Getting+Started+with+Leiningen
  directions. However I suspect I am not configured properly since the
  search isn't working-see below.

   bruce@mepis1:~/bin$ lein search hadoop
   Warning: couldn't download index forhttp://repo1.maven.org/maven2
   Warning: couldn't download index forhttp://clojars.org/repo/

  bruce@mepis1:~/bin$ lein version
  Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM

  Next I backed out my explicit install of ant and maven via apt-get
  remove ant and apt-get remove maven2

  but lein still yields the same result.

  Should I uninstall lein (how?), and start over?

  --
  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: lein not configured properly

2011-10-14 Thread Mark Rathwell
Run 'lein repl', then copy in and run the code below.  Post back
whether you get an error (and what it is), or if it finishes without a
problem (this is downloading a 50MB file, so give it a few minutes).

(import 'java.io.File)

(import 'java.net.URL)

(require '[clojure.java.io :as io])

(def u (URL. 
http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.zip;))

(defn download-index [url]
  (with-open [stream (.openStream url)]
(println Downloading index from - url ... this may take a while.)
(let [tmp (java.io.File/createTempFile lein index)]
  (try (io/copy stream tmp)
   (println copied stream to tmp:  tmp)
   (finally (.delete tmp))

(download-index u)



On Fri, Oct 14, 2011 at 2:26 PM, Bruce Gordon brucebgor...@gmail.com wrote:
 I am in a VirtualBox VM (running SimplyMepis) hosted in Windows Vista.
 From within the vm I can download those files from a browser.

 On Oct 14, 2:17 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
 Are you behind a firewall or proxy that would be blocking .zip files?
 lein search first makes sure it has an updated index from those
 repositories, and if not tries to download and unzip those index
 files:

 http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.ziphttp://clojars.org/repo/.index/nexus-maven-repository-index.zip

 Can you download those files in a browser?

 (Also, there is a lein specific group 
 athttp://groups.google.com/group/leiningen)

  - Mark







 On Fri, Oct 14, 2011 at 1:55 PM, Bruce Gordon brucebgor...@gmail.com wrote:
  I first followed the directions 
  athttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html
  , but then abandoned that effort thanks to irc advice. I then started
  following 
  thehttp://dev.clojure.org/display/doc/Getting+Started+with+Leiningen
  directions. However I suspect I am not configured properly since the
  search isn't working-see below.

   bruce@mepis1:~/bin$ lein search hadoop
   Warning: couldn't download index forhttp://repo1.maven.org/maven2
   Warning: couldn't download index forhttp://clojars.org/repo/

  bruce@mepis1:~/bin$ lein version
  Leiningen 1.6.1.1 on Java 1.6.0_26 Java HotSpot(TM) 64-Bit Server VM

  Next I backed out my explicit install of ant and maven via apt-get
  remove ant and apt-get remove maven2

  but lein still yields the same result.

  Should I uninstall lein (how?), and start over?

  --
  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

-- 
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: lein not configured properly

2011-10-14 Thread Bruce Gordon
lein repl gives an error!


bruce@mepis1:~/cloj2$ lein repl
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from clojars
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from central
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from clojars
Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from central
An error has occurred while processing the Maven artifact tasks.
 Diagnosis:

Unable to resolve artifact: Missing:
--
1) org.clojure:clojure:jar:1.2.1

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file

  Alternatively, if you host your own repository you can deploy the
file there:
  mvn deploy:deploy-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) org.clojure:clojure:jar:1.2.1

--
1 required artifact is missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)



Exception in thread main java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jline.ConsoleRunner.main(ConsoleRunner.java:69)
Caused by: Unable to resolve artifact: Missing:
--
1) org.clojure:clojure:jar:1.2.1

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file

  Alternatively, if you host your own repository you can deploy the
file there:
  mvn deploy:deploy-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) org.clojure:clojure:jar:1.2.1

--
1 required artifact is missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)

 (NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:457)
at clojure.lang.Var.invoke(Var.java:377)
at clojure.lang.AFn.applyToHelper(AFn.java:172)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
... 5 more
Caused by: Unable to resolve artifact: Missing:
--
1) org.clojure:clojure:jar:1.2.1

  Try downloading the file manually from the project website.

  Then, install it using the command:
  mvn install:install-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file

  Alternatively, if you host your own repository you can deploy the
file there:
  mvn deploy:deploy-file -DgroupId=org.clojure -
DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
1) org.apache.maven:super-pom:jar:2.0
2) org.clojure:clojure:jar:1.2.1

--
1 required artifact is missing.

for artifact:
  org.apache.maven:super-pom:jar:2.0

from the specified remote repositories:
  clojars (http://clojars.org/repo/),
  central (http://repo1.maven.org/maven2)


at
org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:
175)
at
org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:
678)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:
90)
at

Re: lein not configured properly

2011-10-14 Thread Bruce Gordon
Is this normal?

bruce@mepis1:~/cloj2$ mvn
bash: mvn: command not found


On Oct 14, 3:17 pm, Bruce Gordon brucebgor...@gmail.com wrote:
 lein repl gives an error!

 
 bruce@mepis1:~/cloj2$ lein repl
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from clojars
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from central
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from clojars
 Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.jar from central
 An error has occurred while processing the Maven artifact tasks.
  Diagnosis:

 Unable to resolve artifact: Missing:
 --
 1) org.clojure:clojure:jar:1.2.1

   Try downloading the file manually from the project website.

   Then, install it using the command:
       mvn install:install-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file

   Alternatively, if you host your own repository you can deploy the
 file there:
       mvn deploy:deploy-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file -Durl=[url] -DrepositoryId=[id]

   Path to dependency:
         1) org.apache.maven:super-pom:jar:2.0
         2) org.clojure:clojure:jar:1.2.1

 --
 1 required artifact is missing.

 for artifact:
   org.apache.maven:super-pom:jar:2.0

 from the specified remote repositories:
   clojars (http://clojars.org/repo/),
   central (http://repo1.maven.org/maven2)

 Exception in thread main java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
 39)
         at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp 
 l.java:
 25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at jline.ConsoleRunner.main(ConsoleRunner.java:69)
 Caused by: Unable to resolve artifact: Missing:
 --
 1) org.clojure:clojure:jar:1.2.1

   Try downloading the file manually from the project website.

   Then, install it using the command:
       mvn install:install-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file

   Alternatively, if you host your own repository you can deploy the
 file there:
       mvn deploy:deploy-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file -Durl=[url] -DrepositoryId=[id]

   Path to dependency:
         1) org.apache.maven:super-pom:jar:2.0
         2) org.clojure:clojure:jar:1.2.1

 --
 1 required artifact is missing.

 for artifact:
   org.apache.maven:super-pom:jar:2.0

 from the specified remote repositories:
   clojars (http://clojars.org/repo/),
   central (http://repo1.maven.org/maven2)

  (NO_SOURCE_FILE:0)
         at clojure.lang.Compiler.eval(Compiler.java:5440)
         at clojure.lang.Compiler.eval(Compiler.java:5391)
         at clojure.core$eval.invoke(core.clj:2382)
         at clojure.main$eval_opt.invoke(main.clj:235)
         at clojure.main$initialize.invoke(main.clj:254)
         at clojure.main$script_opt.invoke(main.clj:270)
         at clojure.main$main.doInvoke(main.clj:354)
         at clojure.lang.RestFn.invoke(RestFn.java:457)
         at clojure.lang.Var.invoke(Var.java:377)
         at clojure.lang.AFn.applyToHelper(AFn.java:172)
         at clojure.lang.Var.applyTo(Var.java:482)
         at clojure.main.main(main.java:37)
         ... 5 more
 Caused by: Unable to resolve artifact: Missing:
 --
 1) org.clojure:clojure:jar:1.2.1

   Try downloading the file manually from the project website.

   Then, install it using the command:
       mvn install:install-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file

   Alternatively, if you host your own repository you can deploy the
 file there:
       mvn deploy:deploy-file -DgroupId=org.clojure -
 DartifactId=clojure -Dversion=1.2.1 -Dpackaging=jar -Dfile=/path/to/
 file -Durl=[url] -DrepositoryId=[id]

   Path to dependency:
         1) org.apache.maven:super-pom:jar:2.0
         2) org.clojure:clojure:jar:1.2.1

 --
 1 required artifact is missing.

 for artifact:
   org.apache.maven:super-pom:jar:2.0

 from the specified remote repositories:
   clojars (http://clojars.org/repo/),
   central (http://repo1.maven.org/maven2)

         at
 org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.j 
 ava:
 175)
         at
 org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifact 
 Task.java:
 678)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
 39)
    

Re: lein not configured properly

2011-10-14 Thread Phil Hagelberg
On Fri, Oct 14, 2011 at 12:20 PM, Bruce Gordon brucebgor...@gmail.com wrote:
 Is this normal?

 bruce@mepis1:~/cloj2$ mvn
 bash: mvn: command not found

Yes, you don't need to have Maven installed to use Leiningen.

It looks like your JVM simply can't access the network. Could be a
variety of issues, including DNS resolution, firewalls, or IPv6
problems.

-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: Sum on a list of maps

2011-10-14 Thread Islon Scherer
The best i could think was:

 (defn calc-types [coll]
  (let [types (map (fn [m] {:type (get m Type) :value (Double/parseDouble 
(get m Value))}) coll)  ; convert keys to keywords and values to doubles
it1 (sort-by :type types) ; sort by type
a (atom (:type (first it1)))
it2 (partition-by (fn [m] (if (not= (:type m) @a) (do (reset! a 
(:type m)) true) false)) it1)] ; partition by type
(map (fn [l] {:type (:type (first l)), :value (reduce + (map :value 
l))}) it2))) ; map reduce

Hope it helps.
P.S: Try to use keywords and numbers instead of strings, the function will 
be simpler

-- 
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: clojure newbie collection question

2011-10-14 Thread Meikel Brandmeyer
Hi,

cached.

Sincerely
Meikel

-- 
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: lein not configured properly

2011-10-14 Thread Bruce Gordon
To see if that hypothesis is true I can try some java program that
tries to access the network. I have some stand alone java program that
is built with Maven. I can install maven, and then see if I can build
the program. If yes then java can access the web...

On Oct 14, 3:22 pm, Phil Hagelberg p...@hagelb.org wrote:
 On Fri, Oct 14, 2011 at 12:20 PM, Bruce Gordon brucebgor...@gmail.com wrote:
  Is this normal?

  bruce@mepis1:~/cloj2$ mvn
  bash: mvn: command not found

 Yes, you don't need to have Maven installed to use Leiningen.

 It looks like your JVM simply can't access the network. Could be a
 variety of issues, including DNS resolution, firewalls, or IPv6
 problems.

 -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: Reactions to google dart?

2011-10-14 Thread Isaac Gouy


On Oct 11, 7:43 am, Timothy Washington twash...@gmail.com wrote:
 I believe this is google's official blog http://dartinside.com/ to discuss
 and track issues around Dart http://www.dartlang.org/ ...


H - Dart Inside The Unofficial Google Dart Blog

Dart Inside is an online service from Trifork A/S, and is not
affiliated with Google®. 

-- 
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: lein not configured properly

2011-10-14 Thread Bruce Gordon
Good thinking. Don't have an answer yet but maven failed with
---
Downloading: 
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-
resources-plugin:pom:2.3' from repository central (http://
repo1.maven.org/maven2): Error transferring file: Network is
unreachable
Downloading: 
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-
resources-plugin:pom:2.3' from repository central (http://
repo1.maven.org/maven2): Error transferring file: Network is
unreachable
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error building POM (may not be this project's POM).



I should remove and add Sun Java. Of course I don't want to do it
exactly the way I did it last time:-). Any suggestions? -Bruce

On Oct 14, 3:22 pm, Phil Hagelberg p...@hagelb.org wrote:
 On Fri, Oct 14, 2011 at 12:20 PM, Bruce Gordon brucebgor...@gmail.com wrote:
  Is this normal?

  bruce@mepis1:~/cloj2$ mvn
  bash: mvn: command not found

 Yes, you don't need to have Maven installed to use Leiningen.

 It looks like your JVM simply can't access the network. Could be a
 variety of issues, including DNS resolution, firewalls, or IPv6
 problems.

 -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


[ClojureScript]: Breaking change coming WRT object property access syntax

2011-10-14 Thread Fogus
The ticket http://dev.clojure.org/jira/browse/CLJS-89 and the design
page
http://www.google.com/url?sa=Dq=http://dev.clojure.org/display/design/Unified%2BClojureScript%2Band%2BClojure%2Bfield%2Baccess%2Bsyntax
describe the details of the change in ClojureScript.

I would like to make this change (and the related Clojure changes)
sooner rather than later to avoid maximal pain.  Breaking changes
stink, but I think that this particular change justifies the cost at
this stage.

Thoughts?

Thanks
:F

-- 
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: Sum on a list of maps

2011-10-14 Thread Dave Ray
Someone cleverer than me to post the built-in function that already
does exactly what you want, but here's one way:

(defn sum-by-type [in]
  (- in
(group-by #(get % Type))
(map
  (fn [[k vs]]
{Type k
 Value (reduce
(fn [acc v] (+ acc (Double/parseDouble (get v Value
0
vs)}

All the strings don't help much.

Cheers,

Dave

On Fri, Oct 14, 2011 at 1:25 PM, der derealme.derea...@gmail.com wrote:
 Hi,

 I'm a Clojure newbie trying to the following simple task:

 Given a list of maps of the followign format: ({Type A, Value
 5} {Type B, Value 4} {Type A, Value 7.2} {Type
 A, Value 25.4} {Type B, Value 2.982})

 I want to compute a list of maps such that each type appears once in
 the list and the value of the type is the sum of the values, so that
 in the example it would be:

 ({Type, A, Value, 37.6} {Type, B, Value, 6.982})

 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
 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: lein not configured properly

2011-10-14 Thread Bruce Gordon
found this gem http://www.mepis.org/docs/en/index.php?title=Java_How-tos

which contained

MEPIS 11

To install the proprietary sun-java6 version (the most current version
that exists in the stable debian repositories) and remove the default
openjdk-6-jre* java packages  icedtea6-plugin packages, execute this
command in the konsole:
su -c 'apt-get install sun-java6-plugin sun-java6-fonts openjdk-6-
jre*-'
You will have to accept the license terms during the install (page
down as needed to get to the bottom).
Next this command is now needed to change the setting of
net.ipv6.bindv6only so java apps can have net access:
su -c 'sed -i s/net.ipv6.bindv6only\ =\ 1/net.ipv6.bindv6only\ =\
0/ /etc/sysctl.d/bindv6only.conf  invoke-rc.d procps restart'


and voila, as easy as 1,2,3 :-), 4,5,6,7,8,9...

lein repl now works!

thank you very much for helping!

-Bruce

On Oct 14, 3:38 pm, Bruce Gordon brucebgor...@gmail.com wrote:
 Good thinking. Don't have an answer yet but maven failed with
 ---
 Downloading:http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resource...
 [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-
 resources-plugin:pom:2.3' from repository central (http://
 repo1.maven.org/maven2): Error transferring file: Network is
 unreachable
 Downloading:http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resource...
 [WARNING] Unable to get resource 'org.apache.maven.plugins:maven-
 resources-plugin:pom:2.3' from repository central (http://
 repo1.maven.org/maven2): Error transferring file: Network is
 unreachable
 [INFO]
 
 [ERROR] BUILD ERROR
 [INFO]
 
 [INFO] Error building POM (may not be this project's POM).

 

 I should remove and add Sun Java. Of course I don't want to do it
 exactly the way I did it last time:-). Any suggestions? -Bruce

 On Oct 14, 3:22 pm, Phil Hagelberg p...@hagelb.org wrote:







  On Fri, Oct 14, 2011 at 12:20 PM, Bruce Gordon brucebgor...@gmail.com 
  wrote:
   Is this normal?

   bruce@mepis1:~/cloj2$ mvn
   bash: mvn: command not found

  Yes, you don't need to have Maven installed to use Leiningen.

  It looks like your JVM simply can't access the network. Could be a
  variety of issues, including DNS resolution, firewalls, or IPv6
  problems.

  -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: Sum on a list of maps

2011-10-14 Thread Walter van der Laan
You could first turn the Values from String into Double like this:
(defn step1 [coll]
  (map (fn [m]
 (assoc m Value (Double/parseDouble (m Value
   coll))

Next, you can use reduce to calculate the sum per Value:
(defn step2 [coll]
  (reduce (fn [res m]
(let [k (m Type)
  v (m Value)]
  (assoc res k (+ v (get res k 0)
  {}
  coll))

This yields a map:
{B 6.982, A 37.594}

Finally, this map can be turned into the list that you want:
(defn step3 [m]
  (map (fn [[k v]]
 {Type k Value (format %.3f v)})
   m))

The steps can be rolled into one function like this:
(defn der [coll]
  (- coll
  step1
  step2
  step3))

-- 
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: Sum on a list of maps

2011-10-14 Thread Baishampayan Ghose
 I'm a Clojure newbie trying to the following simple task:

 Given a list of maps of the followign format: ({Type A, Value
 5} {Type B, Value 4} {Type A, Value 7.2} {Type
 A, Value 25.4} {Type B, Value 2.982})

 I want to compute a list of maps such that each type appears once in
 the list and the value of the type is the sum of the values, so that
 in the example it would be:

 ({Type, A, Value, 37.6} {Type, B, Value, 6.982})

 Any ideas?

I might write it like this -

(defn sum-by-type [coll]
(for [[k v] (group-by #(% Type) coll)]
{Type k Value (apply + (map (comp #(Float/parseFloat %)
#(% Value)) v))}))

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: Sum on a list of maps

2011-10-14 Thread Sean Corfield
On Fri, Oct 14, 2011 at 10:25 AM, der derealme.derea...@gmail.com wrote:
 Given a list of maps of the followign format: ({Type A, Value
 5} {Type B, Value 4} {Type A, Value 7.2} {Type
 A, Value 25.4} {Type B, Value 2.982})

Folks are posting solutions but I wondered why your map keys are
strings and why the values are also strings instead of numbers?

If the keys were keywords, you could just use :type instead of #(%
Type) or #(get % Type) which would make for cleaner code. Just a
thought.
-- 
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: Sum on a list of maps

2011-10-14 Thread Alan Malloy
Probably CSV or some other externally-input data. And FWIW I like BG's
solution - it's what I would have written, except it's better.

On Oct 14, 2:11 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 10:25 AM, der derealme.derea...@gmail.com wrote:
  Given a list of maps of the followign format: ({Type A, Value
  5} {Type B, Value 4} {Type A, Value 7.2} {Type
  A, Value 25.4} {Type B, Value 2.982})

 Folks are posting solutions but I wondered why your map keys are
 strings and why the values are also strings instead of numbers?

 If the keys were keywords, you could just use :type instead of #(%
 Type) or #(get % Type) which would make for cleaner code. Just a
 thought.
 --
 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: Oxjure - Oxford Clojure Group

2011-10-14 Thread Folcon
Hey Everyone,

It's been a week since I've posted this and I've gotten back some interest 
:). I'm just going to ask people who are interested to chime in with a day 
they would like to have it on or if they are not overly concerned a 
preference for having meetings during the week or the weekend.

Folcon

-- 
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: Sum on a list of maps

2011-10-14 Thread Baishampayan Ghose
On Sat, Oct 15, 2011 at 3:16 AM, Alan Malloy a...@malloys.org wrote:
 Probably CSV or some other externally-input data. And FWIW I like BG's
 solution - it's what I would have written, except it's better.

Thanks Alan :-)

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


Pipe function

2011-10-14 Thread Daniel Bell
One higher-order function I've found useful as I've goofed around with
clojure has been one that I made up myself, but it's proved so useful
and so simple that I have to believe it's in core somewhere:

(defn pipe [test value f]
  (if (test value)
(f value)
value))

Is this a core function I'm just missing?

-- 
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: integration with jQuery

2011-10-14 Thread Curious Fox

Oh, I see. Now I totally get it.
Thank you for the detailed explanation.


On Oct 14, 10:55 am, Stuart Sierra the.stuart.sie...@gmail.com
wrote:
  Honestly, I first did a search by jQuery and came across
  Alright, fess up, who's unhappy with clojurescript?

 That's really unfortunate. ClojureScript can be used with any JavaScript
 library. What you won't get, in most cases, is the advanced-mode
 optimizations of Google's Closure compiler applied to the 3rd-party library.
 But you didn't have that writing straight JavaScript either.

 -S

-- 
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


ClojureScript: API documentation

2011-10-14 Thread Curious Fox
Hi,

Is there any easy way to discover available functions in ClojureScript
REPL?

I ended up reading source code and documenting it all in an org-mode
file, is it the best strategy? How can I improve it?

Am I correct that 'doc and 'find-doc are not available during REPL
since it's running on JavaScript platform, which doesn't have
reflection and do not support metadata?

Thanks again,
Frank

-- 
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: Sum on a list of maps

2011-10-14 Thread der
Thanks for all of the useful replies, I'll try them later.

Unfortunately I don't control the input list of maps which is the
result of a web service.

On Oct 14, 10:11 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Fri, Oct 14, 2011 at 10:25 AM, der derealme.derea...@gmail.com wrote:
  Given a list of maps of the followign format: ({Type A, Value
  5} {Type B, Value 4} {Type A, Value 7.2} {Type
  A, Value 25.4} {Type B, Value 2.982})

 Folks are posting solutions but I wondered why your map keys are
 strings and why the values are also strings instead of numbers?

 If the keys were keywords, you could just use :type instead of #(%
 Type) or #(get % Type) which would make for cleaner code. Just a
 thought.
 --
 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: Sum on a list of maps

2011-10-14 Thread Jestan Nirojan
I would write like this

(defn sum-by-type [coll]
  (- coll
   (map (fn [ {v Value t Type } ] {t (read-string v) }))
   (apply (partial merge-with +

If the map is keyword int map, it will be simpler than above

(defn sum-by-type [coll]
  (- coll
   (map (fn [ {v :value t :type } ] {t v}))
   (apply (partial merge-with +


Jestan.


On Oct 14, 10:25 pm, der derealme.derea...@gmail.com wrote:
 Hi,

 I'm a Clojure newbie trying to the following simple task:

 Given a list of maps of the followign format: ({Type A, Value
 5} {Type B, Value 4} {Type A, Value 7.2} {Type
 A, Value 25.4} {Type B, Value 2.982})

 I want to compute a list of maps such that each type appears once in
 the list and the value of the type is the sum of the values, so that
 in the example it would be:

 ({Type, A, Value, 37.6} {Type, B, Value, 6.982})

 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
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: Sum on a list of maps

2011-10-14 Thread Jestan Nirojan
I would write like this

(defn sum-by-type [coll]
(- coll
   (map (fn [ {v Value t Type } ] {t (read-string v) }))
   (apply (partial merge-with +

If the map keyword based, it will be simpler than above

(defn sum-by-type [coll]
(- coll
   (map (fn [ {v :value t :type } ] {t v}))
   (apply (partial merge-with +)))

Jestan Nirojan.
On Oct 15, 12:46 am, Dave Ray dave...@gmail.com wrote:
 Someone cleverer than me to post the built-in function that already
 does exactly what you want, but here's one way:

 (defn sum-by-type [in]
   (- in
     (group-by #(get % Type))
     (map
       (fn [[k vs]]
         {Type k
          Value (reduce
                     (fn [acc v] (+ acc (Double/parseDouble (get v Value
                     0
                     vs)}

 All the strings don't help much.

 Cheers,

 Dave







 On Fri, Oct 14, 2011 at 1:25 PM, der derealme.derea...@gmail.com wrote:
  Hi,

  I'm a Clojure newbie trying to the following simple task:

  Given a list of maps of the followign format: ({Type A, Value
  5} {Type B, Value 4} {Type A, Value 7.2} {Type
  A, Value 25.4} {Type B, Value 2.982})

  I want to compute a list of maps such that each type appears once in
  the list and the value of the type is the sum of the values, so that
  in the example it would be:

  ({Type, A, Value, 37.6} {Type, B, Value, 6.982})

  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
  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


Sample (simple!) game on rosettacode.org

2011-10-14 Thread pistacchio
Hi,
if your're not aware of rosettacode.org, it is a very interesting wiki
where people submit algorithms and short programs in different
languages so than it is easy to compare how different languages
approach the same problem.

To start learning Clojure, I've tried to implement RCRPG, that is a
very minimal dungeon exploring game. You can check the code on the
wiki (http://rosettacode.org/wiki/RCRPG/Clojure) and I've also set up
a git repository on https://github.com/pistacchio/rosettacode.clojure.rcrpg

This is my very first approach to Clojure, so I'd love to see comments
and corrections on my code by more expert coders. It's a wiki, so by
contributing you'll help the rosettacode project and me! ^__^

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: ClojureScript: API documentation

2011-10-14 Thread David Nolen
Frank,

Apologies, ClojureScript at the moment is designed with a bit of a bias
towards people to who already know Clojure. This is unfortunate since there
are many people who could use ClojureScript *today* who don't need or want
to invest in Clojure on the JVM.

Because of the bias some obvious things aren't there yet (remember this is a
language that's about 4 months old). Perhaps including docstrings should be
a compiler option which is enabled by default (not compiling in advanced
mode). Perhaps it should also be the default when launching the Rhino based
REPL. I think that including the full set of documentation functions from
Clojure would be big usability win.

Thanks for bringing it up, we'll try to work on it.

David

On Fri, Oct 14, 2011 at 2:27 PM, Curious Fox fra...@gmail.com wrote:

 Hi,

 Is there any easy way to discover available functions in ClojureScript
 REPL?

 I ended up reading source code and documenting it all in an org-mode
 file, is it the best strategy? How can I improve it?

 Am I correct that 'doc and 'find-doc are not available during REPL
 since it's running on JavaScript platform, which doesn't have
 reflection and do not support metadata?

 Thanks again,
 Frank

 --
 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: Pipe function

2011-10-14 Thread Alan Malloy
I really liked this one too, though my first draft of it was more like
(defn pipe [test f]
  (fn [value]
(...)))

I've since expanded and generalized it into three related functions
you can see at 
https://github.com/flatland/useful/blob/develop/src/useful/fn.clj#L16

fix is basically your pipe, except it takes a series of test/f pairs,
and to-fix is my original version, returning a function of x instead
of computing on x immediately (this is handy as you can map (to-fix
string? read-string) over a collection, for example).

Given accepts only one clause and is shaped right for use in -
thread chains, like:

(- x
inc
(given even? / 2))

I would love to see something like one of these make it into Clojure
proper, but given that I usually complain about clojure.core being too
big, I would be perfectly happy to see it in some other namespace. In
the meantime, take useful for a spin, and see if the enhanced versions
of pipe are of any use to you.

If nothing else, I recommend you change the argument order to your
pipe function: (defn pipe [value test f]) is clearly the correct
signature, since it means that (like fix) you can use it in update-in/
alter/swap!/- chains.

On Oct 14, 3:47 pm, Daniel Bell dchristianb...@gmail.com wrote:
 One higher-order function I've found useful as I've goofed around with
 clojure has been one that I made up myself, but it's proved so useful
 and so simple that I have to believe it's in core somewhere:

 (defn pipe [test value f]
   (if (test value)
         (f value)
         value))

 Is this a core function I'm just missing?

-- 
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: : Breaking change coming WRT object property access syntax

2011-10-14 Thread Kevin Lynagh
I agree with you on making breaking changes sooner rather than later.
This one seems fine to me; I execute no-arg functions on JavaScript
objects more than I directly refer to them, so it'll be nice to not
have to write (. obj (m)) anymore.

On Oct 14, 12:44 pm, Fogus mefo...@gmail.com wrote:
 The tickethttp://dev.clojure.org/jira/browse/CLJS-89and the design
 pagehttp://www.google.com/url?sa=Dq=http://dev.clojure.org/display/desig...
 describe the details of the change in ClojureScript.

 I would like to make this change (and the related Clojure changes)
 sooner rather than later to avoid maximal pain.  Breaking changes
 stink, but I think that this particular change justifies the cost at
 this stage.

 Thoughts?

 Thanks
 :F

-- 
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]: Breaking change coming WRT object property access syntax

2011-10-14 Thread Jack Moffitt
 Thoughts?

I like it. +1 to it going in sooner rather than later.

jack.

-- 
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]: Breaking change coming WRT object property access syntax

2011-10-14 Thread David Nolen
Sorry I didn't copy my perspective over here from clojure-dev as someone
who's been working as a JavaScript dev for the past 6 years
-


The proposed change is not optimal and I think it clashes with the realities
of JavaScript interop.

(.property foo)

Currently gives us a notion of place, that means we can set it:

(set! (.property foo) bar)

This convention is quite common in many JavaScript APIs, for example pretty
everything in the browser:

(set! (.id foo) my-css-id))
(set! (.fillStyle ctxt) rgb(255, 150, 0))

Now compare to the proposed change:

(set! (. foo :id) my-css-id))
(set! (. ctxt :fillStyle) rgb(255, 150, 0))

I don't see any win. Any proposed change should account for the fact that
getters / setters are not a convention in JS and many, many APIs expect
direct field access.

David

On Fri, Oct 14, 2011 at 9:15 PM, Jack Moffitt j...@metajack.im wrote:

  Thoughts?

 I like it. +1 to it going in sooner rather than later.

 jack.

 --
 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: [ClojureScript]: Breaking change coming WRT object property access syntax

2011-10-14 Thread Mark Rathwell
 Now compare to the proposed change:
 (set! (. foo :id) my-css-id))
 (set! (. ctxt :fillStyle) rgb(255, 150, 0))

In the original discussion in this list, a couple alternatives similar
to the following were suggested for property access to remain closer
to the Clojure situation:

(set! (.:id foo) my-css-id))
(set! (.:fillStyle ctxt) rgb(255, 150, 0))

Were those thrown out for being too ugly?

 - Mark


On Fri, Oct 14, 2011 at 9:19 PM, David Nolen dnolen.li...@gmail.com wrote:
 Sorry I didn't copy my perspective over here from clojure-dev as someone
 who's been working as a JavaScript dev for the past 6 years
 -


 The proposed change is not optimal and I think it clashes with the realities
 of JavaScript interop.
 (.property foo)
 Currently gives us a notion of place, that means we can set it:
 (set! (.property foo) bar)
 This convention is quite common in many JavaScript APIs, for example pretty
 everything in the browser:
 (set! (.id foo) my-css-id))
 (set! (.fillStyle ctxt) rgb(255, 150, 0))
 Now compare to the proposed change:
 (set! (. foo :id) my-css-id))
 (set! (. ctxt :fillStyle) rgb(255, 150, 0))
 I don't see any win. Any proposed change should account for the fact that
 getters / setters are not a convention in JS and many, many APIs expect
 direct field access.
 David
 On Fri, Oct 14, 2011 at 9:15 PM, Jack Moffitt j...@metajack.im wrote:

  Thoughts?

 I like it. +1 to it going in sooner rather than later.

 jack.

 --
 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

-- 
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]: Breaking change coming WRT object property access syntax

2011-10-14 Thread Devin Walters
Responding to an earlier point in this thread: Now is the time for breaking 
changes. ClojureScript is alpha. Use in production by enterprising folk should 
not be discouraged, but at the sa(m|n)e time, I don't believe there have been 
any mixed messages regarding whether or not cljs is production-ready. Let's 
make something great and skip the save backwards compatibility! discussion 
for later.

Sent via mobile

On Oct 14, 2011, at 8:48 PM, Mark Rathwell mark.rathw...@gmail.com wrote:

 Now compare to the proposed change:
 (set! (. foo :id) my-css-id))
 (set! (. ctxt :fillStyle) rgb(255, 150, 0))
 
 In the original discussion in this list, a couple alternatives similar
 to the following were suggested for property access to remain closer
 to the Clojure situation:
 
 (set! (.:id foo) my-css-id))
 (set! (.:fillStyle ctxt) rgb(255, 150, 0))
 
 Were those thrown out for being too ugly?
 
 - Mark
 
 
 On Fri, Oct 14, 2011 at 9:19 PM, David Nolen dnolen.li...@gmail.com wrote:
 Sorry I didn't copy my perspective over here from clojure-dev as someone
 who's been working as a JavaScript dev for the past 6 years
 -
 
 
 The proposed change is not optimal and I think it clashes with the realities
 of JavaScript interop.
 (.property foo)
 Currently gives us a notion of place, that means we can set it:
 (set! (.property foo) bar)
 This convention is quite common in many JavaScript APIs, for example pretty
 everything in the browser:
 (set! (.id foo) my-css-id))
 (set! (.fillStyle ctxt) rgb(255, 150, 0))
 Now compare to the proposed change:
 (set! (. foo :id) my-css-id))
 (set! (. ctxt :fillStyle) rgb(255, 150, 0))
 I don't see any win. Any proposed change should account for the fact that
 getters / setters are not a convention in JS and many, many APIs expect
 direct field access.
 David
 On Fri, Oct 14, 2011 at 9:15 PM, Jack Moffitt j...@metajack.im wrote:
 
 Thoughts?
 
 I like it. +1 to it going in sooner rather than later.
 
 jack.
 
 --
 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
 
 -- 
 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: ClojureScript: API documentation

2011-10-14 Thread Devin Walters
+100. Doc, source, ns-publics etc. will drive adoption.

Sent via mobile

On Oct 14, 2011, at 7:07 PM, David Nolen dnolen.li...@gmail.com wrote:

 Frank,
 
 Apologies, ClojureScript at the moment is designed with a bit of a bias 
 towards people to who already know Clojure. This is unfortunate since there 
 are many people who could use ClojureScript *today* who don't need or want to 
 invest in Clojure on the JVM.
 
 Because of the bias some obvious things aren't there yet (remember this is a 
 language that's about 4 months old). Perhaps including docstrings should be a 
 compiler option which is enabled by default (not compiling in advanced mode). 
 Perhaps it should also be the default when launching the Rhino based REPL. I 
 think that including the full set of documentation functions from Clojure 
 would be big usability win.
 
 Thanks for bringing it up, we'll try to work on it.
 
 David
 
 On Fri, Oct 14, 2011 at 2:27 PM, Curious Fox fra...@gmail.com wrote:
 Hi,
 
 Is there any easy way to discover available functions in ClojureScript
 REPL?
 
 I ended up reading source code and documenting it all in an org-mode
 file, is it the best strategy? How can I improve it?
 
 Am I correct that 'doc and 'find-doc are not available during REPL
 since it's running on JavaScript platform, which doesn't have
 reflection and do not support metadata?
 
 Thanks again,
 Frank
 
 --
 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

-- 
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