Re: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 1:28 AM, Sean Corfield  wrote:
> On Fri, Mar 23, 2012 at 8:44 PM, Cedric Greevey  wrote:
>> #{foo bar baz} is somewhat ugly. It occurs to me that one could modify
>> the reader to additionally accept
>>
>> {{foo bar baz}}
>
> My concern is that {{1 2 3 4}5} is currently legal - a map with a map
> as a key and 5 as the value. That means that the reader couldn't tell
> if {{ introduced your set notation or the start of a nested map
> without looking arbitrarily far ahead. And that problem gets worse if
> you encounter {{{ or  or... {{{ could introduce a nested map, a
> map of your sets or one of your sets containing a map...

The other objections are fair enough -- matters of taste. But the
above is a technical problem with a simple fix: make one pass over the
source, converting it into a rudimentary AST whose nodes just look
like (thing thing thing), #(thing thing thing), [thing thing thing],
{thing thing thing}, and #{thing thing thing} (the file as a whole can
be regarded as implicitly wrapped in (do ... )); then (assuming no
unbalanced delimiters) make a second pass doing the rest of the
reader's job. The second pass will see a {...} node with one direct
child that is also a {...} node in, and only in, the case of the
proposed set syntax. (It will also allow { {foo bar baz}} and
similarly as sets.)

As for the aesthetics, what I like about {{...}} is that the
delimiters are symmetrical, unlike #{...}, and it would allow one to
reserve use of the # mark to, mostly, closures, so # would stand out
more as typically indicating a lambda. (The #{...} syntax then remains
comparatively desirable in the specific case that the set literal is
being used as a predicate, as it's both a set and a lambda in that
context.)

-- 
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 cheatsheet with tooltips (alpha)

2012-03-24 Thread Andy Fingerhut
There are still some problems with this, but it is ready for experimental use, 
at least.  Alex, please don't put this on clojure.org -- it ain't ready yet.

http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheatsheet-full.html

I found and used TipTip for tooltips [1], because it advertises the ability to 
keep the tooltips within the browser window no matter where the cursor is 
relative to the window border.  I've tweaked a few settings that may cause it 
to fail to do this properly sometimes, and there are many cases where the 
tooltip appears so close to the cursor that it "flashes" on and off quickly.  
As a workaround, try moving the cursor away from the tooltip, but still 
hovering over the link if you can.  If anyone knows how to correct those 
problems by tweaking the JavaScript code or CSS settings, please let me know.

The tooltips consist of the normal doc strings, with the first line of dashes 
removed, and truncated to the first 15 lines if it is longer than that (very 
few are).  Most links go to clojuredocs.org, as usual.

Give it a test drive and see what you think.

Andy


[1] http://code.drewwilson.com/entry/tiptip-jquery-plugin

-- 
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: New(er) Clojure cheatsheet hot off the presses

2012-03-24 Thread David Martin
I agree that title attribute is the way to go. You shouldn't use the alt
attribute for tooltips though, as this violates accessibility standards.
Alt should either contain a literal description of the image, or be left
empty.
On Mar 23, 2012 1:11 PM, "Cedric Greevey"  wrote:

> On Fri, Mar 23, 2012 at 3:57 PM, Andy Fingerhut
>  wrote:
> > Thanks for the suggestions, folks.
> >
> > Cedric, have you tried your method before?  I'm not sure, but I think it
> was
> > the thing that I tried that led me to add (b) to my list of preference.
> I
> > like anything that makes the development job easier, but not if it
> violates
> > that preference.
>
> The tooltip could, in principle, extend beyond the browser window, but
> the link would have to be at the far right edge of the window, the
> text would have to be long or the pointer would have to be near the
> right edge of the link, AND the browser window would have to,
> bizarrely, not be maximized.
>
> In particular, if you fear that the tooltip would extend beyond the
> screen edge so half of it wasn't displayed at all, that won't happen
> -- at least, not in Firefox.
>
> The last time I saw it the cheat sheet's main content occupied a
> vertical strip with fairly wide margins left and right. Unless you're
> putting the full text of the Declaration of Independence into one of
> the tooltips I don't see there being much likelihood of a problem
> there.
>
> Furthermore, eschewing standard tooltips and using JS or something to
> roll your own would likely render the tooltips inaccessible (or worse,
> confusing) with screen-reader software for the visually impaired.
>
> --
> 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: why do we need a (require…)?

2012-03-24 Thread Brandon Bloom
"This is not a good idea, for many reasons, the simplest of which is: it 
makes loading a side effect of calling a function in a module. Since 
loading can have arbitrary effects, it shouldn't be implicit. This isn't 
warranted by the meager benefits it might provide." -- Rich Hickey

http://dev.clojure.org/jira/browse/CLJ-461

On Friday, March 23, 2012 4:37:15 PM UTC-7, FrankS wrote:
>
> I can see the need for refer and alias, but why can the compiler not infer 
> from the use of a fully qualified name that a namespace (or class) that is 
> not loaded yet, has to be "required"?
>
> Or did I miss anything?
>
> -FrankS.
>
>

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

2012-03-24 Thread Brandon Bloom
> The first step would be just to get the compiler to emit an optional 
source map.

That's definitely the first step! After that, there's going to need to be 
some way to serve those source maps via HTTP upon request from the browser.

However, there's a first step to the first step: Getting column data. The 
reader currently seems to only produce a :line key in the metadata map.

> Bonus points if we can merge source maps from the ClojureScript compiler 
and Closure advanced compilation.

Could you please clarify? Do you mean for multi-level mapping?

See the "Multi-level Mapping Notes" section in the v3 spec:
https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?hl=en_US&pli=1&pli=1

It seems like once they agree upon a header (as opposed to the javascript 
comment syntax) this would also be useful for providing pre-macro-expansion 
vs post-macro-expansion source maps.

-- 
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: SuperDevMode and SourceMaps for ClojureScript debugging

2012-03-24 Thread Brandon Bloom

>
> Any suggestions on how to get started on tackling that?
>

Let's join discussions on this... over 
here: https://groups.google.com/d/topic/clojure/BUW6-1DqSsI/discussion

-- 
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: [OT] Any other italian Clojure users?

2012-03-24 Thread Mimmo Cosenza
I'm italian living in milan. Setting up a local clojure user group could be 
very interesting. 
I would not say I'm still a programmer. I did a lot of lisp/prolog 
programming in the 80's, c++/objective-c at the beginning of the 90's, and 
java from the very beginning of the language (1995).
After I long trip in the land of nouns, is nice and resting to come back 
home in the lands of verbs. 

mimmo

On Friday, March 23, 2012 4:56:35 PM UTC+1, Simone Mosciatti wrote:
>
> im italian but now im living in USA...
> I will come back in july...
> Im from Siena
>
> Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
> scritto:
>>
>> Hi,
>>
>> I just want to know if there are any other italian Clojure users in
>> the ml, maybe for open an Italian Clojure User Group and organize some
>> meetings...
>>
>> Thanks,
>> -- 
>> Marco Dalla Stella
>> web: http://thediracsea.org
>> twitter: http://twitter.com/kra1iz3c
>>
>>
> Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
> scritto:
>>
>> Hi,
>>
>> I just want to know if there are any other italian Clojure users in
>> the ml, maybe for open an Italian Clojure User Group and organize some
>> meetings...
>>
>> Thanks,
>> -- 
>> Marco Dalla Stella
>> web: http://thediracsea.org
>> twitter: http://twitter.com/kra1iz3c
>>
>>
> Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
> scritto:
>>
>> Hi,
>>
>> I just want to know if there are any other italian Clojure users in
>> the ml, maybe for open an Italian Clojure User Group and organize some
>> meetings...
>>
>> Thanks,
>> -- 
>> Marco Dalla Stella
>> web: http://thediracsea.org
>> twitter: http://twitter.com/kra1iz3c
>>
>>
> Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
> scritto:
>>
>> Hi,
>>
>> I just want to know if there are any other italian Clojure users in
>> the ml, maybe for open an Italian Clojure User Group and organize some
>> meetings...
>>
>> Thanks,
>> -- 
>> Marco Dalla Stella
>> web: http://thediracsea.org
>> twitter: http://twitter.com/kra1iz3c
>>
>>
> Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
> scritto:
>>
>> Hi,
>>
>> I just want to know if there are any other italian Clojure users in
>> the ml, maybe for open an Italian Clojure User Group and organize some
>> meetings...
>>
>> Thanks,
>> -- 
>> Marco Dalla Stella
>> web: http://thediracsea.org
>> twitter: http://twitter.com/kra1iz3c
>>
>>

-- 
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 cheatsheet with tooltips (alpha)

2012-03-24 Thread mnicky
The tooltips themselves seem pretty nice, but on smaller windows, they are 
sometimes placed behind the edges and thus not visible: 
http://i.imgur.com/YA4gF.png

On Saturday, March 24, 2012 11:15:20 AM UTC+1, Andy Fingerhut wrote:
>
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't 
> ready yet.
>
>
> http://homepage.mac.com/​jafingerhut/files/cheatsheet-​clj-1.3.0-v1.4-tooltips/​cheatsheet-full.html
>
> I found and used TipTip for tooltips [1], because it advertises the 
> ability to keep the tooltips within the browser window no matter where the 
> cursor is relative to the window border.  I've tweaked a few settings that 
> may cause it to fail to do this properly sometimes, and there are many 
> cases where the tooltip appears so close to the cursor that it "flashes" on 
> and off quickly.  As a workaround, try moving the cursor away from the 
> tooltip, but still hovering over the link if you can.  If anyone knows how 
> to correct those problems by tweaking the JavaScript code or CSS settings, 
> please let me know.
>
> The tooltips consist of the normal doc strings, with the first line of 
> dashes removed, and truncated to the first 15 lines if it is longer than 
> that (very few are).  Most links go to clojuredocs.org, as usual.
>
> Give it a test drive and see what you think.
>
> Andy
>
>
> [1] 
> http://code.drewwilson.com/​entry/tiptip-jquery-plugin
>

On Saturday, March 24, 2012 11:15:20 AM UTC+1, Andy Fingerhut wrote:
>
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't 
> ready yet.
>
>
> http://homepage.mac.com/​jafingerhut/files/cheatsheet-​clj-1.3.0-v1.4-tooltips/​cheatsheet-full.html
>
> I found and used TipTip for tooltips [1], because it advertises the 
> ability to keep the tooltips within the browser window no matter where the 
> cursor is relative to the window border.  I've tweaked a few settings that 
> may cause it to fail to do this properly sometimes, and there are many 
> cases where the tooltip appears so close to the cursor that it "flashes" on 
> and off quickly.  As a workaround, try moving the cursor away from the 
> tooltip, but still hovering over the link if you can.  If anyone knows how 
> to correct those problems by tweaking the JavaScript code or CSS settings, 
> please let me know.
>
> The tooltips consist of the normal doc strings, with the first line of 
> dashes removed, and truncated to the first 15 lines if it is longer than 
> that (very few are).  Most links go to clojuredocs.org, as usual.
>
> Give it a test drive and see what you think.
>
> Andy
>
>
> [1] 
> http://code.drewwilson.com/​entry/tiptip-jquery-plugin
>

On Saturday, March 24, 2012 11:15:20 AM UTC+1, Andy Fingerhut wrote:
>
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't 
> ready yet.
>
>
> http://homepage.mac.com/​jafingerhut/files/cheatsheet-​clj-1.3.0-v1.4-tooltips/​cheatsheet-full.html
>
> I found and used TipTip for tooltips [1], because it advertises the 
> ability to keep the tooltips within the browser window no matter where the 
> cursor is relative to the window border.  I've tweaked a few settings that 
> may cause it to fail to do this properly sometimes, and there are many 
> cases where the tooltip appears so close to the cursor that it "flashes" on 
> and off quickly.  As a workaround, try moving the cursor away from the 
> tooltip, but still hovering over the link if you can.  If anyone knows how 
> to correct those problems by tweaking the JavaScript code or CSS settings, 
> please let me know.
>
> The tooltips consist of the normal doc strings, with the first line of 
> dashes removed, and truncated to the first 15 lines if it is longer than 
> that (very few are).  Most links go to clojuredocs.org, as usual.
>
> Give it a test drive and see what you think.
>
> Andy
>
>
> [1] 
> http://code.drewwilson.com/​entry/tiptip-jquery-plugin
>

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

Re: Alternate set literal syntax?

2012-03-24 Thread Softaddicts
I would suggest that we introduced some klingon characters in the language,
we could then satisfy all these alien desires to change a syntax that has been 
established 4 years ago.

We have a product driving an hospital here, your "esthetic" considerations do 
not
fit in my deployment plan. This is not a toy language anymore... That era is 
behind
us since Jan. 2009.

With nearly 5 versions out since 2009, I think that we can say that the 
language has 
reached  some maturity at least regarding the syntax.

Now we are in the framework selection phase to meet greater challenges and
improving internals and platform availability.

I suggest you clone the source code and create your custom reader version.
Then you will be free to apply any change you may feel appropriate.

vaj HabHa''a' je 'uSDu'lIj joj

Luc


> On Sat, Mar 24, 2012 at 1:28 AM, Sean Corfield  wrote:
> > On Fri, Mar 23, 2012 at 8:44 PM, Cedric Greevey  wrote:
> >> #{foo bar baz} is somewhat ugly. It occurs to me that one could modify
> >> the reader to additionally accept
> >>
> >> {{foo bar baz}}
> >
> > My concern is that {{1 2 3 4}5} is currently legal - a map with a map
> > as a key and 5 as the value. That means that the reader couldn't tell
> > if {{ introduced your set notation or the start of a nested map
> > without looking arbitrarily far ahead. And that problem gets worse if
> > you encounter {{{ or  or... {{{ could introduce a nested map, a
> > map of your sets or one of your sets containing a map...
> 
> The other objections are fair enough -- matters of taste. But the
> above is a technical problem with a simple fix: make one pass over the
> source, converting it into a rudimentary AST whose nodes just look
> like (thing thing thing), #(thing thing thing), [thing thing thing],
> {thing thing thing}, and #{thing thing thing} (the file as a whole 
> be regarded as implicitly wrapped in (do ... )); then (assuming no
> unbalanced delimiters) make a second pass doing the rest of the
> reader's job. The second pass will see a {...} node with one direct
> child that is also a {...} node in, and only in, the case of the
> proposed set syntax. (It will also allow { {foo bar baz}} and
> similarly as sets.)
> 
> As for the aesthetics, what I like about {{...}} is that the
> delimiters are symmetrical, unlike #{...}, and it would allow one to
> reserve use of the # mark to, mostly, closures, so # would stand out
> more as typically indicating a lambda. (The #{...} syntax then remains
> comparatively desirable in the specific case that the set literal is
> being used as a predicate, as it's both a set and a lambda in that
> context.)
> 
> -- 
> 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
> 
--
Softaddicts sent by ibisMail!

-- 
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: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread mnicky
Thanks for the explanations!
So is there a way to build a set or map that has sorting property 
independent from the element lookup?

On Friday, March 16, 2012 2:03:15 AM UTC+1, Alan Malloy wrote:
>
> And this is exactly as it should be. The sorted set has no way to 
> compare items other than by your comparator. If it just arbitrarily 
> decided to use = instead of checking that (zero? (compare x y)) it 
> would not be using your comparator. 
>
> Note also that the behavior of contains? is consistent with conj and 
> disj: if the item is contained in the set, then conj will keep size 
> the same and disj will decrease it; otherwise conj will increase the 
> size and disj will leave it the same. 
>
> On Mar 15, 3:39 pm, Stuart Campbell  wrote: 
> > Actually, sorted-map-by does behave the same way, but in your example 
> you 
> > tried to lookup a value instead of a key: 
> > 
> > user> (def m (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b])) 
> > #'user/m 
> > user> (get m [1 :foo]) 
> > [2 :b] 
> > 
> > It looks like PersistentTreeMap.entryAt<
> http​s://github.com/clojure/​clojure/blob/master/src/jvm/​clojure/lang/P...>is
>  
>
> > responsible for this behaviour. 
> > 
> > Regards, 
> > Stuart 
> > 
> > On 13 March 2012 05:20, mnicky  wrote: 
> > 
> > > It seems that when using the sorted set with my own comparator 
> > > (sorted-set-by), 
> > > the lookup via 'contains?' function is based only on the part of the 
> items 
> > > that participate in the ordering: 
> > 
> > > (contains? (sorted-set [1 :a] [2 :b]) [2 :c]) 
> > > ;=> false 
> > 
> > > (contains? (sorted-set-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]) [2 :c]) 
> > > ;=> true 
> > 
> > > The documentation of 'sorted-set-by' says that the _whole_ items are 
> keys: 
> > 
> > > (doc sorted-set-by) 
> > > ; clojure.core/sorted-set-by 
> > > ; ([comparator & keys]) 
> > > ; Returns a new sorted set with supplied keys, using the supplied 
> > > comparator. 
> > > ; nil 
> > 
> > > So according to the documentation of 'contains?', it should do lookup 
> > > based on the whole items, not just their parts used in the comparator: 
> > 
> > > (doc contains?) 
> > > ; clojure.core/contains? 
> > > ; ([coll key]) 
> > > ; Returns true if key is present in the given collection, otherwise 
> > > ; returns false. Note that for numerically indexed collections like 
> > > ; vectors and Java arrays, this tests if the numeric key is within the 
> > > ; range of indexes. 'contains?' operates constant or logarithmic time; 
> > > ; it will not perform a linear search for a value. See also 'some'. 
> > > ; nil 
> > 
> > > It's also worth noting that 'sorted-map-by' doesn't behave in this 
> way: 
> > 
> > > (contains? (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]) [2 :c]) 
> > > ;=> false 
> > 
> > > Can this be a bug? If not, what's the reason behind this behavior? 
> > 
> > > -- Mnicky 
> > 
> > >  -- 
> > > 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+unsubscribe@​googlegroups.com
> > >  
> > > For more options, visit this group at 
> > >http://groups.google.com/​group/clojure?hl=en


On Friday, March 16, 2012 2:03:15 AM UTC+1, Alan Malloy wrote:
>
> And this is exactly as it should be. The sorted set has no way to 
> compare items other than by your comparator. If it just arbitrarily 
> decided to use = instead of checking that (zero? (compare x y)) it 
> would not be using your comparator. 
>
> Note also that the behavior of contains? is consistent with conj and 
> disj: if the item is contained in the set, then conj will keep size 
> the same and disj will decrease it; otherwise conj will increase the 
> size and disj will leave it the same. 
>
> On Mar 15, 3:39 pm, Stuart Campbell  wrote: 
> > Actually, sorted-map-by does behave the same way, but in your example 
> you 
> > tried to lookup a value instead of a key: 
> > 
> > user> (def m (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b])) 
> > #'user/m 
> > user> (get m [1 :foo]) 
> > [2 :b] 
> > 
> > It looks like PersistentTreeMap.entryAt<
> http​s://github.com/clojure/​clojure/blob/master/src/jvm/​clojure/lang/P...>is
>  
>
> > responsible for this behaviour. 
> > 
> > Regards, 
> > Stuart 
> > 
> > On 13 March 2012 05:20, mnicky  wrote: 
> > 
> > > It seems that when using the sorted set with my own comparator 
> > > (sorted-set-by), 
> > > the lookup via 'contains?' function is based only on the part of the 
> items 
> > > that participate in the ordering: 
> > 
> > > (contains? (sorted-set [1 :a] [2 :b]) [2 :c]) 
> > > ;=> false 
>

{ANN}Clojure-Control 0.3.2 is out

2012-03-24 Thread dennis zhuang
Hi,all
   I am pleased to announce that clojure-control 0.3.2 is
out.Clojure-control is a clojure DSL for system admin and deployment with
many remote machines via ssh.Please see
https://github.com/killme2008/clojure-control

   Main highlights in 0.3.2:
1.You can include other clusters in defcluster,for example,you have defined
cluster named frontend and backend,then you can define a new cluster
named all to include all of them:

  (defcluster :all
  :includes [:frontend :backend])

2.Fixed issue 11: control could not run on some jdk version.
3.Adds new commands for lein control plugin,you can start a control server
by "lein control server",then you don't have to compile control file every
time when running task,you can run task by "lein control run mycluster task
-r",it will connect to control server and run the task on server,returns
result to client at last.
4.Improve api document.

You can upgrade control by "lein plugin install control 0.3.2" and change
the dependency version in project.clj.



--
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread Philip Potter
There's java.util.LinkedHashSet:

http://docs.oracle.com/javase/6/docs/api/java/util/LinkedHashSet.html

Its iterator will preserve insertion order, but it will ignore duplicates
when inserted. It has a number of disadvantages:

* only available on clj-jvm
* not a persistent data structure, with all the pain that brings
* doesn't permit arbitrary iterator orders,  only insertion order

It would be an interesting exercise to reimplement Linkedhashset as a
persistent data structure, implementing IPersistentSet and Seqable.

Phil
On Mar 24, 2012 1:29 PM, "mnicky"  wrote:

> Thanks for the explanations!
> So is there a way to build a set or map that has sorting property
> independent from the element lookup?
>
> On Friday, March 16, 2012 2:03:15 AM UTC+1, Alan Malloy wrote:
>>
>> And this is exactly as it should be. The sorted set has no way to
>> compare items other than by your comparator. If it just arbitrarily
>> decided to use = instead of checking that (zero? (compare x y)) it
>> would not be using your comparator.
>>
>> Note also that the behavior of contains? is consistent with conj and
>> disj: if the item is contained in the set, then conj will keep size
>> the same and disj will decrease it; otherwise conj will increase the
>> size and disj will leave it the same.
>>
>> On Mar 15, 3:39 pm, Stuart Campbell  wrote:
>> > Actually, sorted-map-by does behave the same way, but in your example
>> you
>> > tried to lookup a value instead of a key:
>> >
>> > user> (def m (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]))
>> > #'user/m
>> > user> (get m [1 :foo])
>> > [2 :b]
>> >
>> > It looks like PersistentTreeMap.entryAt<
>> http​s://github.com/clojure/​clojure/blob/master/src/jvm/​clojure/lang/P...>is
>>
>> > responsible for this behaviour.
>> >
>> > Regards,
>> > Stuart
>> >
>> > On 13 March 2012 05:20, mnicky  wrote:
>> >
>> > > It seems that when using the sorted set with my own comparator
>> > > (sorted-set-by),
>> > > the lookup via 'contains?' function is based only on the part of the
>> items
>> > > that participate in the ordering:
>> >
>> > > (contains? (sorted-set [1 :a] [2 :b]) [2 :c])
>> > > ;=> false
>> >
>> > > (contains? (sorted-set-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]) [2 :c])
>> > > ;=> true
>> >
>> > > The documentation of 'sorted-set-by' says that the _whole_ items are
>> keys:
>> >
>> > > (doc sorted-set-by)
>> > > ; clojure.core/sorted-set-by
>> > > ; ([comparator & keys])
>> > > ; Returns a new sorted set with supplied keys, using the supplied
>> > > comparator.
>> > > ; nil
>> >
>> > > So according to the documentation of 'contains?', it should do lookup
>> > > based on the whole items, not just their parts used in the
>> comparator:
>> >
>> > > (doc contains?)
>> > > ; clojure.core/contains?
>> > > ; ([coll key])
>> > > ; Returns true if key is present in the given collection, otherwise
>> > > ; returns false. Note that for numerically indexed collections like
>> > > ; vectors and Java arrays, this tests if the numeric key is within
>> the
>> > > ; range of indexes. 'contains?' operates constant or logarithmic
>> time;
>> > > ; it will not perform a linear search for a value. See also 'some'.
>> > > ; nil
>> >
>> > > It's also worth noting that 'sorted-map-by' doesn't behave in this
>> way:
>> >
>> > > (contains? (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]) [2 :c])
>> > > ;=> false
>> >
>> > > Can this be a bug? If not, what's the reason behind this behavior?
>> >
>> > > -- Mnicky
>> >
>> > >  --
>> > > 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+unsubscribe@​googlegroups.com
>> > > For more options, visit this group at
>> > >http://groups.google.com/​group/clojure?hl=en
>
>
> On Friday, March 16, 2012 2:03:15 AM UTC+1, Alan Malloy wrote:
>>
>> And this is exactly as it should be. The sorted set has no way to
>> compare items other than by your comparator. If it just arbitrarily
>> decided to use = instead of checking that (zero? (compare x y)) it
>> would not be using your comparator.
>>
>> Note also that the behavior of contains? is consistent with conj and
>> disj: if the item is contained in the set, then conj will keep size
>> the same and disj will decrease it; otherwise conj will increase the
>> size and disj will leave it the same.
>>
>> On Mar 15, 3:39 pm, Stuart Campbell  wrote:
>> > Actually, sorted-map-by does behave the same way, but in your example
>> you
>> > tried to lookup a value instead of a key:
>> >
>> > user> (def m (sorted-map-by #(< (%1 0) (%2 0)) [1 :a] [2 :b]))
>> > #'user/m
>> > user> (get m [1 :foo])
>> > [2 :b]
>> >
>> > It looks like Persiste

GSOC Idea: Interactive documentation with autodoc

2012-03-24 Thread Zack Maril
Goal of project: Extend (or fork) autodoc such that it can create and run 
interactive documentation for any project.

Example for the take function:
 
*take*function

Usage: (take n coll)

Returns a lazy sequence of the first n items in coll, or all items if
there are fewer than n.

*Example: *
* (take 10 (range 20))  Eval!*
*Output: *
*[0 1 2 3 4 5 6 7 8 9]*
Added in Clojure version 1.0
And then the user could change the code in the browser, it would be sent 
off to the server, and the new user would get the answer back:
*Example:  (take 5 (range 20))  Eval!*
*Output: [0 1 2 3 4]*
*
*
To make this work, autodoc would need to be extended in two major ways:
1. When generating the html, autodoc would look for metadata within 
each definition. If it found :examples within the data, then it would add 
in a number of  elements and eval buttons prefilled with the 
given examples.   
Example definition:
(defn take

  "Returns a lazy sequence of the first n items in coll, or all items if
  there are fewer than n."
  {:added "1.0"
   :static true
   :examples ['(take 5 (range 10)),'(take 3 (drop 5 (range 1 11)))]}
  [n coll]
  (lazy-seq
   (when (pos? n) 
 (when-let [s (seq coll)]
  (cons (first s) (take (dec n) (rest s)))

2. Have it ship with a webserver that runs something similar to tryclojure 
and has all of the routes set up for the documentation to work 
automagically. A very basic use of clojail. An interesting challenge would 
be finding a way to get  outputs besides text to work (things like charts 
for incanter). 

Conceptually, this isn't too hard to imagine as a project. The main brunt 
of the work would be writing all of the examples for each project. Even 
then, there are a ton of examples on clojuredocs.org that are under the EPL 
license. Having interactive documentation would be pretty cool though. The 
only place I have seen it so far has been in Mathematica, and that was only 
after you bought the program. If people are interested in this being made, 
I'll be the first to volunteer as a student.

Would people be interested in this as a project for GSOC?
-Zack 

-- 
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: revisiting community funding?

2012-03-24 Thread Phil Hagelberg
Sean Corfield  writes:

> I can't think of a single large open source project that doesn't
> require a contributor agreement in place.

Don't be silly; there are hundreds of projects larger, older, and more
successful than Clojure that don't require such busywork. On the other
hand it's pretty clear that your opinion and my opinion are not relevant
regarding topics like this; the project is still using Jira for crying
out loud.

-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: ClojureScript source maps

2012-03-24 Thread David Nolen
On Fri, Mar 23, 2012 at 10:51 PM, Brandon Bloom  wrote:

> > The first step would be just to get the compiler to emit an optional
> source map.
>
> That's definitely the first step! After that, there's going to need to be
> some way to serve those source maps via HTTP upon request from the browser.
>
> However, there's a first step to the first step: Getting column data. The
> reader currently seems to only produce a :line key in the metadata map.
>

Yep. This would require enhancing the Clojure reader. I don't think that's
feasible for 1.4, but probably worth pursuing for 1.5. Even without it, we
can still get line level debugging which is better than nothing and write
the code to use :column data when available.


> Could you please clarify? Do you mean for multi-level mapping?
>

Yes. Again this is really just bonus points. Priority 1 is just improving
the development experience.


> See the "Multi-level Mapping Notes" section in the v3 spec:
> https://docs.google.com/**document/d/**1U1RGAehQwRypUTovF1KRlpiOFze0b**
> -_2gc6fAH0KY0k/edit?hl=en_US&**pli=1&pli=1
>
> It seems like once they agree upon a header (as opposed to the javascript
> comment syntax) this would also be useful for providing pre-macro-expansion
> vs post-macro-expansion source maps.
>

 We could also decide to handle multi-mapping ourselves - that is write the
code that can produce a merged source map.

David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure cheatsheet with tooltips (alpha)

2012-03-24 Thread Rostislav Svoboda
Hi Andy

On 24 March 2012 11:15, Andy Fingerhut  wrote:
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't ready 
> yet.
>
> http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheatsheet-full.html
>
> Give it a test drive and see what you think.

Slick! :)

I tested the tooltips on chrome, firefox and even on my android. On
chrome I find the tooltip boxes too transparent. On firefox the
transparency is fine but the tooltip font size is bigger than the
font-size used on the page (which IMO could be larger anyway) On the
android, well yea no tooltips appear :) so you need to do this back &
forth clicking as before. Interestingly when you go back then a
tooltip is placed behind the screen edges and it's kind of difficult
to get rid of it. The same appearance like reported here:

> The tooltips themselves seem pretty nice, but on smaller windows, they are
> sometimes placed behind the edges and thus not visible:
> http://i.imgur.com/YA4gF.png

Bost

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

2012-03-24 Thread Rostislav Svoboda
A nice list of tools and libraries I stumbled upon. Enjoy!

http://www.clojure-toolbox.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


eval seq of forms in another ns

2012-03-24 Thread Renat Yuldashev
How to evaluate each form from the vector of forms inside of the different 
namespace?
I want to have a seq of the evaluation results as a result.
Smth. like this:

(eval-with-ns 'user ['(+ 1 2 3) '(- 5 4) '(defn f [] [])])
=> (6 3 #'user/f)

I know about with-ns, but don't know how to use it to solve this problem.

-- 
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 cheatsheet with tooltips (alpha)

2012-03-24 Thread Peter Buckley
The tooltips work well on my BlackBerry, thanks!

-Original Message-
From: Rostislav Svoboda 
Sender: clojure@googlegroups.com
Date: Sat, 24 Mar 2012 13:18:57 
To: 
Reply-To: clojure@googlegroups.com
Subject: Re: Clojure cheatsheet with tooltips (alpha)

Hi Andy

On 24 March 2012 11:15, Andy Fingerhut  wrote:
> There are still some problems with this, but it is ready for experimental 
> use, at least.  Alex, please don't put this on clojure.org -- it ain't ready 
> yet.
>
> http://homepage.mac.com/jafingerhut/files/cheatsheet-clj-1.3.0-v1.4-tooltips/cheatsheet-full.html
>
> Give it a test drive and see what you think.

Slick! :)

I tested the tooltips on chrome, firefox and even on my android. On
chrome I find the tooltip boxes too transparent. On firefox the
transparency is fine but the tooltip font size is bigger than the
font-size used on the page (which IMO could be larger anyway) On the
android, well yea no tooltips appear :) so you need to do this back &
forth clicking as before. Interestingly when you go back then a
tooltip is placed behind the screen edges and it's kind of difficult
to get rid of it. The same appearance like reported here:

> The tooltips themselves seem pretty nice, but on smaller windows, they are
> sometimes placed behind the edges and thus not visible:
> http://i.imgur.com/YA4gF.png

Bost

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Alexander Yakushev
Your point is clear and valid but isn't it a bit harsh to write the 
response in a tone like this? After all we are asking and answering 
questions here, it's not like something is going to change after one 
request.

BTW it is nice to hear Clojure being reliable enough in people's eyes to be 
used in such a serious application.

On Saturday, March 24, 2012 2:17:57 PM UTC+2, Luc wrote:
>
> I would suggest that we introduced some klingon characters in the language,
> we could then satisfy all these alien desires to change a syntax that has 
> been 
> established 4 years ago.
>
> We have a product driving an hospital here, your "esthetic" considerations 
> do not
> fit in my deployment plan. This is not a toy language anymore... That era 
> is behind
> us since Jan. 2009.
>
>

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Softaddicts
Hey, we all have our rough edges :)

I'm 50, there's less life in front of me than behind. Debating about the sex of 
angels looks to me a bad way of using the not so many hours left in our lives
on significant problems before the final exit.

It's not the first time requests similar to this one pop out on this mailing 
list.
The problem here is a timing issue, we left this phase of discussions a while
ago (looks light years to me).

Nobody is forced to use Clojure, if it this not appeals to your esthetic
values, no problem, just use something else.

You have what you think is a great idea, well, implement it, toy with it and 
then present
your conclusions and hard facts here.

This approach will yield at least two benefits:

A) it will demonstrate that it's doable and will make limitations clear if any 
exists

B) the effort required will make you realize if you get enough bang for your 
buck.

There's so many existing projects to do out there to keep your entire life busy
using Clojure, why spend time (even think time) re-inventing the wheel ?

As for the Klingon stuff, I do not have bumps in my forehead or elsewhere :)))

Luc

> Your point is clear and valid but isn't it a bit harsh to write the 
> response in a tone like this? After all we are asking and answering 
> questions here, it's not like something is going to change after one 
> request.
> 
> BTW it is nice to hear Clojure being reliable enough in people's eyes to be 
> used in such a serious application.
> 
> On Saturday, March 24, 2012 2:17:57 PM UTC+2, Luc wrote:
> >
> > I would suggest that we introduced some klingon characters in the language,
> > we could then satisfy all these alien desires to change a syntax that has 
> > been 
> > established 4 years ago.
> >
> > We have a product driving an hospital here, your "esthetic" considerations 
> > do not
> > fit in my deployment plan. This is not a toy language anymore... That era 
> > is behind
> > us since Jan. 2009.
> >
> >
> 
> -- 
> 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
--
Softaddicts sent by ibisMail!

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Softaddicts

Forgot to add these:

http://dev.clojure.org/display/community/Clojure+Success+Stories
http://www.quora.com/Whos-using-Clojure-in-production

> Your point is clear and valid but isn't it a bit harsh to write the 
> response in a tone like this? After all we are asking and answering 
> questions here, it's not like something is going to change after one 
> request.
> 
> BTW it is nice to hear Clojure being reliable enough in people's eyes to be 
> used in such a serious application.
> 
> On Saturday, March 24, 2012 2:17:57 PM UTC+2, Luc wrote:
> >
> > I would suggest that we introduced some klingon characters in the language,
> > we could then satisfy all these alien desires to change a syntax that has 
> > been 
> > established 4 years ago.
> >
> > We have a product driving an hospital here, your "esthetic" considerations 
> > do not
> > fit in my deployment plan. This is not a toy language anymore... That era 
> > is behind
> > us since Jan. 2009.
> >
> >
> 
> -- 
> 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
--
Softaddicts sent by ibisMail!

-- 
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: eval seq of forms in another ns

2012-03-24 Thread N8Dawgrr
If I remember rightly I solved this by binding *ns* before the eval, e.g.

(binding [*ns* some-namespace]
  (eval form))

On Saturday, March 24, 2012 5:12:29 PM UTC, Renat Yuldashev wrote:
>
> How to evaluate each form from the vector of forms inside of the different 
> namespace?
> I want to have a seq of the evaluation results as a result.
> Smth. like this:
>
> (eval-with-ns 'user ['(+ 1 2 3) '(- 5 4) '(defn f [] [])])
> => (6 3 #'user/f)
>
> I know about with-ns, but don't know how to use it to solve this problem.
>

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

2012-03-24 Thread Brandon Bloom

>
>  We could also decide to handle multi-mapping ourselves - that is write 
> the code that can produce a merged source map.
>

It seems likely (already done?) for browsers to support the X-SourceMap 
header and //@ comments for the target use case of CoffeeScript -> 
Javascript -> Minified Javascript

Also, it seems preferable to let the browser do it, so their debugger can 
operate at various levels of source translation depending on your needs.

So why bother doing it ourselves? For the Rhino environment?

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Scott Jaderholm
On Sat, Mar 24, 2012 at 1:44 AM, Cedric Greevey  wrote:
> On Sat, Mar 24, 2012 at 1:28 AM, Sean Corfield  wrote:
>> On Fri, Mar 23, 2012 at 8:44 PM, Cedric Greevey  wrote:
>>> #{foo bar baz} is somewhat ugly. It occurs to me that one could modify
>>> the reader to additionally accept
>>>
>>> {{foo bar baz}}
>>
>> My concern is that {{1 2 3 4}5} is currently legal - a map with a map
>> as a key and 5 as the value. That means that the reader couldn't tell
>> if {{ introduced your set notation or the start of a nested map
>> without looking arbitrarily far ahead. And that problem gets worse if
>> you encounter {{{ or  or... {{{ could introduce a nested map, a
>> map of your sets or one of your sets containing a map...
>
> The other objections are fair enough -- matters of taste. But the
> above is a technical problem with a simple fix: make one pass over the
> source, converting it into a rudimentary AST whose nodes just look

I think the word "reader" above applies both to the human and computer
kinds. You've only addressed the problem for the computer. A user
would still have to look at the end of the collection to know if it is
a set or map (or use editor).

> As for the aesthetics, what I like about {{...}} is that the
> delimiters are symmetrical, unlike #{...}, and it would allow one to
> reserve use of the # mark to, mostly, closures, so # would stand out
> more as typically indicating a lambda.

Sorry to break it to you, but # is used in many places other than
lambdas, so even if you remove it from #{} you still have foo#, #^foo,
#^{foo bar}, #'foo, #"foo", #_foo, #foo{1 2}, #foo[1 2], and others
I've probably forgotten.

One option you have is to use Emacs to replace #{} and #() with
something distinctive looking.

(dolist (mode '(clojure-mode slime-repl-mode))
  (eval-after-load mode `(font-lock-add-keywords
  ',mode
  (mapcar
   (lambda (pair)
 `(,(car pair)
   (0 (progn (compose-region (match-beginning 1)
 (match-end 1)
,(cadr pair))
 nil
   `(("\\(#\\){" "∈")
 ("\\(#\\)(""ƒ")
 ("(\\(fn\\)[\[[:space:]]" "λ")
 ("(\\(comp\\)[\[[:space:]]" "∘")
 ("(\\(range\\)[\[[:space:]]" "ℝ")
 ("(\\(apply \+\\)[\[[:space:]]" "∑")
 ("(\\(Math/pi\\)[\[[:space:]]" "π")
 ("(\\(->\\)[\[[:space:]]" "→")
 ("(\\(partial\\)[\[[:space:]]" "þ")
 ("(\\(complement\\)[\[[:space:]]" "¬")
 ;; not working
 ;; ("Math/pi[:space:]" "π")
 ;; ("(\\(apply \+\\)[\[[:space:]]" "∑")
 )

Cheers,
Scott

-- 
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: labrepl in eclipse 3.6

2012-03-24 Thread vertigho
I had the same experience, and it was caused by the absence of a
schema definition in the pom.xml file that is included with the
labrepl files downloaded from git.

Assuming you're problem is being caused by what caused mine, you'll
see the warning icon (yellow triangle with '!') on your labrepl
project in the workspace/project explorer area of Eclipse. If you look
in the 'Problems' tab and expand the Warnings entries in the tab view,
you'll see a Warning indicating that "There is no schema defined for
this pom.xml" file in the labrepl project. If you right-click on this
specific Warning message in the Problems tab, select Quick Fix from
the context menu, and hit the 'Finish' button in the dialog which
appears (which suggests a single solution of 'Add Schema information
to the specified pom.xml file'), Eclipse will add the proper xml
schema to the pom.xml file and you'll be able to run labrepl as
documented.

On Mar 7, 5:02 am, nilesh Shah  wrote:
> I am a novice at both java and clojure.  I installed the counterclockwise
> eclipse plugin and the labrepl as 
> perhttp://dev.clojure.org/display/doc/Getting+Started+with+Eclipse+and+C
>  After install one of the steps is to
>
> Enable Clojure Support
>
>    - Right-click the "labrepl" project in Package Explorer and choose
>    "Enable/disable Clojure language support"
>
> When I do this I get "Error while tryiing to toggle clojure language
> support for project labrepl:"
>
> Any suggestion as to what this means and how I can proceed to get the lab
> working ?
>
> Thx

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Jeremy Heiler
On Sat, Mar 24, 2012 at 6:38 PM, Scott Jaderholm  wrote:
> On Sat, Mar 24, 2012 at 1:44 AM, Cedric Greevey  wrote:
>> As for the aesthetics, what I like about {{...}} is that the
>> delimiters are symmetrical, unlike #{...}, and it would allow one to
>> reserve use of the # mark to, mostly, closures, so # would stand out
>> more as typically indicating a lambda.
>
> Sorry to break it to you, but # is used in many places other than
> lambdas, so even if you remove it from #{} you still have foo#, #^foo,
> #^{foo bar}, #'foo, #"foo", #_foo, #foo{1 2}, #foo[1 2], and others
> I've probably forgotten.

Along those lines, the # character is the "dispatch macro [which]
causes the reader to use a reader macro from another table, indexed by
the character following #" So, it's a little more than just syntactic
sugar.

http://clojure.org/reader

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


What is wrong with ClojureQL?

2012-03-24 Thread Daniel Jomphe
Since Korma appeared, it seems ClojureQL isn't mentioned anywhere anymore.

Are there solid reasons why Korma took all the attention to itself? Are 
there situations in which ClojureQL would be more recommended than Korma?

In case nobody remembers CQL : http://clojureql.org/

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

2012-03-24 Thread Sean Allen
On Sun, Jul 24, 2011 at 1:19 PM, John  wrote:

> Is there any interest in having ClojureScript generate source maps?
>
> http://code.google.com/p/closure-compiler/wiki/SourceMaps
>
> There are a couple of ways to accomplish this.
>
>
Lots of interest from me.

-- 
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: New(er) Clojure cheatsheet hot off the presses

2012-03-24 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 4:43 PM, David Martin  wrote:
> I agree that title attribute is the way to go. You shouldn't use the alt
> attribute for tooltips though, as this violates accessibility standards. Alt
> should either contain a literal description of the image, or be left empty.

Be sure to tell xkcd that. (Why can't it be both?)

-- 
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: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread Cedric Greevey
In increasing order of difficulty...

Option 1:

Extend your comparator to sort first on the key you're actually
interested in, then if that key isn't different on the others
more-or-less arbitrarily.

Option 2:

Keep the data unsorted in a hash-set. Sort when you need sorted data,
e.g. for user presentation, by using a sort function that outputs a
seq. (Inefficient if the sort will then be performed often for a given
set.)

Option 3:

Implement your own sorted set type that handles sort-order collisions
by having plain sets as equality buckets, using deftype, gen-class, or
Java.

Option 4:

Convince Rich Hickey that having the built in sorted-set not deal with
order collisions (ala Option 3, above) is as silly as if he'd had
hash-set not deal with hash collisions. :)

-- 
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: What is wrong with ClojureQL?

2012-03-24 Thread Chris Granger
you can find discussion of this in a few places, but here's a decent
one:

https://news.ycombinator.com/item?id=3420691

Cheers,
Chris.

On Mar 24, 7:54 pm, Daniel Jomphe  wrote:
> Since Korma appeared, it seems ClojureQL isn't mentioned anywhere anymore.
>
> Are there solid reasons why Korma took all the attention to itself? Are
> there situations in which ClojureQL would be more recommended than Korma?
>
> In case nobody remembers CQL :http://clojureql.org/

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 3:46 PM, Softaddicts
 wrote:
> Hey, we all have our rough edges :)
>
> I'm 50, there's less life in front of me than behind. Debating about the sex 
> of
> angels looks to me a bad way of using the not so many hours left in our lives
> on significant problems before the final exit.

If this particular thread's topic does not interest you, and you feel
reading, and debating in, it would waste your time, perhaps you should
just ignore it.

-- 
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: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 6:38 PM, Scott Jaderholm  wrote:
>
> Sorry to break it to you, but # is used in many places other than
> lambdas, so even if you remove it from #{} you still have foo#, #^foo,
> #^{foo bar}, #'foo, #"foo", #_foo, #foo{1 2}, #foo[1 2], and others
> I've probably forgotten.

I was not talking about the number of things it's used for, but rather
the frequency of the uses in production code; sorry if that wasn't
clear.

My experience is that the highest frequency of #s in production code
is at the starts of lambdas; the next highest is regexes, which as
programs of a sort are also quasi-lambda-like (though not usable
directly as operators). Autogensyms in macros are a distant third and
use the # as a suffix, not a prefix. The other uses of # are less
frequent still. At the bottom of the heap, #_ is only used temporarily
in debugging, for the most part.

-- 
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: Alternate set literal syntax?

2012-03-24 Thread ChrisR
I don't mind the #{} syntax, however I feel that if alternate syntax
were to be introduced (for whatever datatype) it should be the unicode
parenthesis since they 1. Look nice, 2. No addition of extra
characters (I value succinctness), 3. They work in most common
existing structured editing environments- emacs/paredit supports
unicode parens right now, whereas a construct like {{}} would break
down pretty fast. The downside (however minor) is the user has to
remap some key-binding to support it.

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


core.logic now runs under ClojureScript

2012-03-24 Thread David Nolen
There's a lot of work left to do but I was able to successfully solve the
zebra puzzle with core.logic running under JavaScript via V8 in ~170ms.
There's tons of performance optimization yet to do, but to give some
perspective Peter Norvig's version for CL that compiled Prolog took ~17.4
seconds to do it in the 90s.

Clojure on the JVM can solve the problem in about ~2-3ms. I think with some
work we can get within an order of magnitude on modern JS engines :)

Cheers,
David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 9:39 PM, Cedric Greevey  wrote:
> In increasing order of difficulty...
>
> Option 1:
>
> Extend your comparator to sort first on the key you're actually
> interested in, then if that key isn't different on the others
> more-or-less arbitrarily.

Or use this:

(defn po->to [po]
  (let [m (atom #{})]
(fn [a b]
  (or
(po a b)
(and
  (not (po b a))
  (or
(< (hash a) (hash b))
(and
  (== (hash a) (hash b))
  (not= a b)
  (or (contains? @m [a b])
(and
  (not (contains? @m [b a]))
  (swap! m conj [a b]))

(defn sorted-set-po [po & keys]
  (apply sorted-set-by (po->to po) keys))

Input: a partial order (may be true for a b, true for b a, or false for both).

Output: a sorted-set that uses a total order built from the partial
order. For things where the po says neither a < b nor b < a, it will
first compare their hashes. If those don't collide, the order of a and
b is decided that way. If they do, and a and b are not actually equal,
it will arbitrarily pick one to be "less than" the other and remember
its decision so that the ordering of unequal, hash-colliding items
will remain consistent.

Notes:
1. The memory use can grow over time due to the memoization-like
behavior using the atom. However, this only occurs for items with both
order and hash collisions, which should be extraordinarily infrequent.
(If hashes were uniform on [0,2^32-1] you'd need an average of around
65,000 items before, per the birthday paradox, a single collision was
likely within your collection. And then it would probably be for a
pair of items that po considered unequal.) So the memory use growth
should be small (for collections of thousands to millions of items) to
nonexistent (for smaller ones).

2. Two sorted-set-pos with the same items, where they were added in
different sequences, may not sort them in the same order, though this
should be rare (again tied to the frequency of order+hash collisions).
But this is not really a problem since, if you're sorting with a
partial order, it makes sense to consider the ordering within equality
buckets of the partial order to be undefined (the way ordering of an
entire hash-set is undefined) and thus does not make sense to make
program semantics depend on the ordering. Also, all sets compare equal
purely by having the same contents (I checked APersistentSet.java to
be sure) so the two sorted-set-pos would still compare equal despite
traversing their elements in slightly different sequences.

Here's a clooj REPL session testing po->to. Note that the last tests
intentionally induce an order+hash collision of unequal items and
check that the same instance of a po->to produces consistent results
when given the colliding items in either order (that is, it always
returns logical true when given the items in one order and always
returns logical false when given them in the opposite order). The very
last tests verify that it always returns false for equal items.

user=>
(def foo (po->to #(< (:a %1) (:a %2
#'user/foo

user=>
(foo {:a 1 :b 1} {:a 2 :b 1})
true

user=>
(foo {:a 1 :b 1} {:a 2 :b 1})
true

user=>
(foo {:a 1 :b 1} {:a 2 :b 1})
true

user=>
(foo {:a 2 :b 1} {:a 1 :b 1})
false

user=>
(foo {:a 2 :b 1} {:a 1 :b 1})
false

user=>
(foo {:a 1 :b 1} {:a 1 :b 2})
true

user=>
(foo {:a 1 :b 1} {:a 1 :b 2})
true

user=>
(foo {:a 1 :b 1} {:a 1 :b 2})
true

user=>
(foo {:a 1 :b 2} {:a 1 :b 1})
false

user=>
(foo {:a 1 :b 2} {:a 1 :b 1})
false

user=>
(foo {:a 1 :b 2} {:a 1 :b 1})
false

user=>
(hash {:a 1 :b 1 :c 1})
-1253235521

user=>
(hash {:a 1 :b 1 :c 2})
-1253235522

user=>
(hash {:a 1 :b 2 :c 1})
-1253235520

user=>
(hash {:a 1 :b 0 :c 1})
-1253235522

user=>
(foo {:a 1 :b 1 :c 2} {:a 1 :b 0 :c 1})
#{[{:a 1, :c 2, :b 1} {:a 1, :c 1, :b 0}]}

user=>
(foo {:a 1 :b 1 :c 2} {:a 1 :b 0 :c 1})
true

user=>
(foo {:a 1 :b 1 :c 2} {:a 1 :b 0 :c 1})
true

user=>
(foo {:a 1 :b 0 :c 1} {:a 1 :b 1 :c 2})
false

user=>
(foo {:a 1 :b 0 :c 1} {:a 1 :b 1 :c 2})
false

user=>
(foo {:a 1 :b 0 :c 1} {:a 1 :b 1 :c 2})
false

user=>
(def bar (po->to #(< (:a %1) (:a %2
#'user/bar

user=>
(bar {:a 1 :b 0 :c 1} {:a 1 :b 1 :c 2})
#{[{:a 1, :c 1, :b 0} {:a 1, :c 2, :b 1}]}

user=>
(bar {:a 1 :b 0 :c 1} {:a 1 :b 1 :c 2})
true

user=>
(bar {:a 1 :b 1 :c 2} {:a 1 :b 0 :c 1})
false

user=>
(bar {:a 1 :b 1 :c 2} {:a 1 :b 0 :c 1})
false

user=>
(bar {:a 1 :b 1 :c 2} {:a 1 :b 1 :c 2})
false

user=>
(bar {:a 1 :b 1 :c 2} {:a 1 :b 1 :c 2})
false

user=>
(bar {:a 1 :b 0 :c 1} {:a 1 :b 0 :c 1})
false

user=>
(bar {:a 1 :b 0 :c 1} {:a 1 :b 0 :c 1})
false

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

Re: Clojure Toolbox

2012-03-24 Thread dennis zhuang
Another link http://cnlojure.org/open.html

2012/3/24 Rostislav Svoboda 

> A nice list of tools and libraries I stumbled upon. Enjoy!
>
> http://www.clojure-toolbox.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




-- 
庄晓丹
Email:killme2...@gmail.com xzhu...@avos.com
Site:   http://fnil.net
Twitter:  @killme2008

-- 
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: What is wrong with ClojureQL?

2012-03-24 Thread Craig Brozefsky
Daniel Jomphe  writes:

> Since Korma appeared, it seems ClojureQL isn't mentioned anywhere anymore.
>
> Are there solid reasons why Korma took all the attention to itself? Are there
> situations in which ClojureQL would be more recommended than Korma?

The functional apporach CQL takes to constructing SQL queries is just
right in my book.  I want the full power of SQL: unions, intersections,
projections, aggregates, functions, composition of qualifiers etc...

In my case I've got a database with 100+ tables.  A very small set of
them are "objects" like users, and organizations.  The rest are
mostly core.logic fact statements (with type and other metadata)
dumped into a table for each relation.  Lastly, there are some some
index tables to make some common, yet complicated, searches we support
really fast.

There are almost no artificial keys in the data tables, no notion of
object identity for the most part either.  We have these soft "entities"
which conventiently map into sql data types, so work as key values
themselves.

I don't wanna diss on Korma tho, just that the data model it is aiming
at is not the one I want.

-- 
Craig Brozefsky 
Premature reification is the root of all evil

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