Re: Does Pedestal have a future in the long run

2013-11-19 Thread Geraldo Lopes de Souza
As for UI.  

Isnt reactjs (facebook renderer library) a good fit for pedestal ?

it appears to use the same ideas of webfui. Webfui's author even 
complimented reacjts guys for their work: 
https://groups.google.com/forum/#!searchin/reactjs/conrad/reactjs/e3bYersyd64/fH83IFqXb2oJ

There are a recent integration with our beloved clojurescript.
https://github.com/piranha/pump

An extern:
https://github.com/steida/este-library/blob/master/externs/react.js

And look at this Flux thing:
https://github.com/cascadiajs/2013.cascadiajs.com/blob/master/a-better-way-to-structure-clientside-apps_jingc.md
(Imutable structures and getting away from two way data binding)


On Tuesday, November 19, 2013 5:26:52 AM UTC-2, Murtaza Husain wrote:
>
>
> I also personally like pedestal. However couple of reasons are holding me 
> back - 
>
> 1) An easier integration with UI. All current frameworks such as Angular 
> etc focus on easing the DOM manipulation. You define your model, and then 
> define the relationship of your model with the DOM. The framework then 
> takes care of it. 
>
> Inversely pedestal focuses on easing the state management / event 
> propagation for a web app. Yes this is a big concern on big single page 
> apps. However most of the apps I work with, the former, DOM manipulation is 
> the concern that dominates. 
>
> Thus introduction of a nice widget system, which provides facilities for 
> the former will go a long way to accelerate the adoption of pedestal.
>
> 2) Another problem is the cognitive load in developing a pedestal app. 
> There are too many settings, multiple ways to do the same things, concepts 
> that seem to overlap, lack of simple easy to grasp recipe type examples. 
>
> I would like to have an easy way to start and develop with pedestal. There 
> is too much to learn before you write your first line of code, and I dont 
> even think I can ask a new developer to just go and learn pedestal on his 
> own. So please bring down the barrier. 
>
> Hope to use pedestal on my projects soon. And a big thanks to the pedestal 
> team for this amazing piece of code. 
>
> Thanks,
> Murtaza
>
>
> On Tuesday, November 12, 2013 10:44:38 AM UTC+5:30, Mars0i wrote:
>>
>> Thanks, Cedric, for insightful comments about documentation.
>>
>> I'll add that for me, if the only documentation is a video, I have to 
>> *really* want to learn about a programming tool to go any further.  Videos 
>> don't allow you to take in information any faster than  information at 
>> exactly the speed at which the video presents it.  Reading lets you go 
>> faster, or slower, or visually decide what to skip, or find passages by 
>> their content.  Even without hyperlinks.  (Yes, when motion matters, video 
>> is nice.)
>>
>> On Monday, November 11, 2013 12:04:09 AM UTC-6, Cedric Greevey wrote:
>>>
>>> IMO it can often be a lack of readable, searchable, nice-to-navigate 
>>> text/hypertext that can be a barrier to entry. In fact all of these are 
>>> unfortunately common in various parts of the geekosphere:
>>>
>>> 1. Projects whose *only* documentation (or the only version of certain 
>>> key information) is in videos. Not searchable. Not easy to navigate to a 
>>> particular part (need to remember roughly when it is, or rewatch half the 
>>> thing). Expensive for mobile users with capped or per-megabyte data plans.
>>>
>>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Job spam] Write Clojure in your pajamas, for decent money in a pleasant company, remote pairing all the time

2013-11-19 Thread Thiago Massa
H1B sponsor?


On Tue, Nov 19, 2013 at 1:47 AM, gaz jones  wrote:

> *your :)
>
>
> On Mon, Nov 18, 2013 at 9:46 PM, gaz jones wrote:
>
>> If you're account had a picture like his, YES.
>>
>>
>> On Mon, Nov 18, 2013 at 5:45 PM, Tony Tam  wrote:
>>
>>> Hi,
>>>
>>> I'm always curious about remarks like this:
>>>
>>>
>>> A link to your Github profile counts for much more than a stellar
 resume. Doesn't have to be in Clojure.

>>>
>>> If I sent you a like to a github profile that looked like yours (
>>> https://github.com/alexeyv?tab=repositories), would I ever get an
>>> answer? I mean, it's very probable that all your activity is going into
>>> private repos.
>>>
>>>  --
>>> --
>>> 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 unsubscribe from this group and stop receiving emails from it, send
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons
Hi Ryan

I'm really impressed with Caribou but would make one request that will make 
my life easier. I'm a big fan of Angular JS and the template tags for 
Angular and Caribou clash. Is there any chance these could be changed from 
{{ to {% (or something similar)? 

The best result for me would be the standard template tags get changed in 
Caribou but a compromise would be the ability to change the tags on a per 
page basis.

cheers

Dave

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: instaparse: composing smaller rules into a bigger one

2013-11-19 Thread Jim - FooBar();

Hi Mark,

Your comments were spot on! Changing the SPACE tag makes it work and I 
can also get rid of all the '?' after 'SPACE'. Also hiding the actual 
spaces makes it look a lot nicer. Many many thanks for this...:)


I applied to register at the instaparse google group and my registration 
is pending. While it is pending would you mind answering an additional 
question? I have reworked my grammar to this (again observe the bold bits):




"S  = PHRASE+ SPACE END
   PHRASE = DDIPK | DDI | ENCLOSED |  TOKEN (SPACE TOKEN PUNCT?)*
*DDIPK =  PK SPACE TO SPACE DRUG SPACE EFF?*
   DDI =  MECH SPACE DRUG SPACE TOKEN
*EFF =* *BE? SPACE (SIGN | XFOLD)? SPACE MECH SPACE (ADV | XFOLD)?*
   TOKEN = (DOSE | NUM | DRUG | PK | PERCENTAGE | XFOLD | CYP | MECH | 
SIGN | TO | ENCLOSED | COMMA) / WORD

= #'\\w+'
= #'\\p{Punct}'
   XFOLD = NUM SPACE '-'? SPACE 'fold' SPACE #'[a-z]+ses?'?
   ROUTE = #'(?i)oral|intravenous'
   UNIT = 'mg' | 'g'
   DOSE = NUM SPACE UNIT SPACE INTERVAL?
   INTERVAL = #'[a-z]+ce'? SPACE ADV | NUM SPACE 'times per' TIME | '/' 
TIME

   TIME =  'hour' | 'day' | 'week'
   PERCENTAGE = NUM SPACE ('%' | #'per(\\s|\\-)?cent')
   ENCLOSED = PAREN | SQBR
=  #'\\(.*\\)'
=   #'\\[.*\\]'
NUM =  #'[0-9]+'
CYP =  #'CYP[A-Z0-9]*'
ADV =   #'[a-z]+ly'
= <#'\\s*'>
DRUG = ROUTE? SPACE
  (#'(?i)\\b+\\w+a[z|st|p]ine?\\b+' |
   #'(?i)\\b+\\w+[i|u]dine?\\b+'|
   #'(?i)\\b+\\w+azo[l|n]e?\\b+'|
   #'(?i)\\b+\\w+tamine?\\b+'   |
   #'(?i)\\b+\\w+zepam\\b+' |
   #'(?i)\\b+\\w+zolam\\b+' |
   #'(?i)\\b+\\w+[y|u]lline?\\b+'   |
   #'(?i)\\b+\\w+artane?\\b+'   |
   #'(?i)\\b+\\w+retine?\\b+'   |
   #'(?i)\\b+\\w+navir\\b+' |
   #'(?i)\\b+\\w+ocaine\\b+'|
   #'(?i)didanosine|tenofovir|vaprisol|conivaptan|amlodipine')

PK =  MECH? 
#'(?i)exposure|bioavailability|lower?(\\s|\\-)?clearance|AUC|half\\-life|Cmax'

MECH =  #'[a-z]+e(s|d)'
SIGN =  ADV | NEG
NEG = 'not' | #'un[a-z]*ed'
 = 'to' | 'of'
BE = 'is' | 'are' | 'was' | 'were'
  (*  DO = 'does' | 'do' | 'did' *)
= ','
  (*  = 'as' | 'its' | 'by' *)
END =  '.' "

Now consider the sentence: "Exposure to oral didanosine is 
_significantly increased_ when coadministered with tenofovir disoproxil 
fumarate."


My very first tag is this, which is perfect:
 [:PHRASE
  [:DDIPK
   [:PK "Exposure"]
   "to"
   [:DRUG [:ROUTE "oral"] "didanosine"]
   [:EFF
[:BE "is"]
[:SIGN [:ADV "significantly"]]
[:MECH "increased"

but now consider the same sentence slightly different: "Exposure to oral 
didanosine is _increased significantly_ when coadministered with 
tenofovir disoproxil fumarate."


 [:PHRASE
  [:DDIPK
   [:PK "Exposure"]
   "to"
   [:DRUG [:ROUTE "oral"] "didanosine"]
   [:EFF [:MECH "increased"
 [:PHRASE
  [:TOKEN [:SIGN [:ADV "significantly"]]]

Shouldn't the EFF rule have caught the [:SIGN [:ADV "significantly"]] 
tag? Why did it start a new PHRASE ? The same thing happens with XFOLD. 
iF the 'x-fold' is before the adverb (2-fold increases) it shows in the 
DDIPK tag otherwise (increases 2-fold)  it appears after it in a new 
PHRASE tag. I'm pretty sure the rule covers both cases and in fact it 
reaches the EFF rule but it never mathes the *(ADV | XFOLD)? *rule. I am 
presuming this is something quite simple...


As always, thanks in advance,

Jim


On 19/11/13 00:38, Mark Engelberg wrote:

Seems like there are (at least) two issues here.

1.  You have a preference in mind that is not expressed by the 
grammar.  The parse that was outputted is a valid parse that fits all 
the rules of the grammar.  If you want the parser to prefer DRUGPK and 
EFF interpretations over other interpretations, you need to specify 
that, for example:
   TOKEN = DRUGPK / EFF / (NUM | DRUG | PK | MECH | SIGN | ENCLOSED) / 
WORD


2.  Your rule for space is " = #'\\s+'", i.e., one or more 
spaces.  But the way your other rules utilize the SPACE rule, this 
causes a problem.  For example, you define DRUGPK as ending with SPACE 
(and that ending SPACE is part of the DRUGPK token), but your S rule 
also says that tokens (including DRUGPK) must be /followed/ by a 
SPACE. So the DRUGPK rule will never be satisfied, because it is 
including the ending whitespace as part of the token, and then there's 
no whitespace following the token as required by the S rule.  As 
another example, your EFF rule begins "BE? SPACE SIGN? SPACE MECH" and 
if the optional BE and SIGN aren't present, it's looking for two 
mandatory spaces in a row.


I suggest changing your rule to " = #'\\s*'", i.e., zero or 
more spaces.  Or if you don't actually care about seeing the spaces in 
your parse output, you can change it to " = <#'\\s*'>".


If you make both those changes, you'll get:

=> (parsePK "Exposure to didanosine is increased when coadministered 
with tenofovir disoproxil fumarate [Table 5 and see Clinical 
Pharmacokinetics (12.3, Tables 9

Re: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread Khalid Jebbari
At least you can change Angular.js template tags. 
See 
http://stackoverflow.com/questions/8302928/angularjs-with-django-conflicting-template-tags
 
for a how-to and potential problems with this approach.

On Tuesday, November 19, 2013 11:27:14 AM UTC+1, David Simmons wrote:
>
> Hi Ryan
>
> I'm really impressed with Caribou but would make one request that will 
> make my life easier. I'm a big fan of Angular JS and the template tags for 
> Angular and Caribou clash. Is there any chance these could be changed from 
> {{ to {% (or something similar)? 
>
> The best result for me would be the standard template tags get changed in 
> Caribou but a compromise would be the ability to change the tags on a per 
> page basis.
>
> cheers
>
> Dave
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Colin Yates
Hi all,

I have a sequence of {:key K :value V} maps.  There is no guarantee that 
there is one map for every known K.  I need to ensure that there is a map 
for each known K.

Imagine the sequence represents a distribution between 1 and 5.  The 
initial sequence might only be [{:key 3 :value 30} {:key 4 :value 40}].  I 
want it to be [{:key 1 :value nil} {:key 2 :value nil} {:key 3 :value 30} 
{:key 4 :value 40} {:key 5 :value nil}].

(There is a sensible reason for {:key K :value V} rather than {K V} by the 
way, but it would be possible to temporarily represent the sequence as [K1 
V1 K2 V2] and then convert it back.)

In Java I would do something like:

// create a convenient look up to avoid nasty N^2 lookups
Map keyToValue = new HashMap
for (Map kvMap: kvSequence) 
  keyToValue.put(kvMap.get("key"), kvMap.put("value"));

List allKeys = calculateAllKeys();

List> results = new Array
for (Object key: allKeys)
  Object result  = keyToValue.get(key); // null is fine for missing keys
  results.put(key, result);

return results;

What is the (far more elegant and succinct!) way in Clojure?

My intuition says something like create a map of K/V (i.e. {k1 nil k2 nil}) 
for all known keys, convert the existing sequence of maps into a flattened 
map, merge them together allowing the original sequence to take precedence 
and then group them back into [{:key k1 :value v1} {:key k2 :value v2}].

Any hints/clues - is this the right approach?

Thanks a bunch!

Col


-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons
Hi Khalid 

yes I'm aware you can change the template tags (and the pitfalls :-)). I 
thought it would be easier to see if we could avoid this problem all 
together by using a different set of tags (especially as Caribou is Alpha 
release and hopefully open to change). BTW I don't intend to miss Angular 
and Caribou templates tags in the same page, I just want to be able to use 
the Caribous admin etc AND have my own pages use Angular.

cheers

Dave

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Jim - FooBar();

On 19/11/13 11:29, Colin Yates wrote:
Imagine the sequence represents a distribution between 1 and 5.  The 
initial sequence might only be [{:key 3 :value 30} {:key 4 :value 
40}].  I want it to be [{:key 1 :value nil} {:key 2 :value nil} {:key 
3 :value 30} {:key 4 :value 40} {:key 5 :value nil}].



(def map-seq  [{:key 3 :value 30} {:key 4 :value 40}])
(def mandatory-keys (range 1 6))

(sort-by :key
(reduce
 #(if (some #{%2} (map :key %))
 %
(conj % {:key %2 :value nil})) map-seq mandatory-keys))

=> ({:key 1, :value nil} {:key 2, :value nil} {:key 3, :value 30} {:key 
4, :value 40} {:key 5, :value nil})



Jim

--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Jim - FooBar();

On 19/11/13 11:42, Jim - FooBar(); wrote:

On 19/11/13 11:29, Colin Yates wrote:
Imagine the sequence represents a distribution between 1 and 5.  The 
initial sequence might only be [{:key 3 :value 30} {:key 4 :value 
40}].  I want it to be [{:key 1 :value nil} {:key 2 :value nil} {:key 
3 :value 30} {:key 4 :value 40} {:key 5 :value nil}].



(def map-seq  [{:key 3 :value 30} {:key 4 :value 40}])
(def mandatory-keys (range 1 6))

(sort-by :key
(reduce
 #(if (some #{%2} (map :key %))
 %
(conj % {:key %2 :value nil})) map-seq mandatory-keys))

=> ({:key 1, :value nil} {:key 2, :value nil} {:key 3, :value 30} 
{:key 4, :value 40} {:key 5, :value nil})



Jim



of course if the keys are known in advance, you don't want to calculate 
them every single time:


(let [ks (map :key map-seq)]
(sort-by :key
(reduce
 #(if (some #{%2} ks) %
   (conj % {:key %2 :value nil})) map-seq mandatory-keys)))

Jim

--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Chas Emerick
One note on the ordering questions: each of them were constructed to 
present a randomized ordering to each new respondent, so there was no 
bias introduced by a default ordering.


Cheers,

- Chas

On 11/18/2013 03:09 PM, kovas boguta wrote:

Great job Chas.

Some notes on methodology and then some general comments

- That the survey was not featured on HN this time without a doubt
alone accounts for the slight dip in responses
- The 'missing' people are more likely fall into the 'hobbyist' camp,
which might explain the increased % of people using clojure at work in
this year's survey
- The increased # of questions probably also reduces survey conversion
(I wonder how many people viewed versus completed the survey)
- There is some bias inherent to the initial ordering in the
reordering-based questions; I for one dragged the most important items
to the top, and didn't carefully think about changing the ordering
beneath that.

I find it impressive that 76% of respondents report using clojure for
web development. This, in spite of a lack of a unified web framework
stretching from the DB to the client, and general confusion in the
masses about what the best solution to use is.




On Mon, Nov 18, 2013 at 2:32 PM, Chas Emerick  wrote:

Results of this year's survey are available here:

http://cemerick.com/2013/11/18/results-of-the-2013-state-of-clojure-clojurescript-survey/

Thank you to all that participated!

Best,

- Chas

--
--
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 unsubscribe from this group and stop receiving emails from it, send an
email to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Colin Yates
Great stuff - thanks Jim.  (not sure why my previous post got lost)

On Tuesday, November 19, 2013 11:48:17 AM UTC, Jim foo.bar wrote:
>
> On 19/11/13 11:42, Jim - FooBar(); wrote: 
> > On 19/11/13 11:29, Colin Yates wrote: 
> >> Imagine the sequence represents a distribution between 1 and 5.  The 
> >> initial sequence might only be [{:key 3 :value 30} {:key 4 :value 
> >> 40}].  I want it to be [{:key 1 :value nil} {:key 2 :value nil} {:key 
> >> 3 :value 30} {:key 4 :value 40} {:key 5 :value nil}]. 
> > 
> > 
> > (def map-seq  [{:key 3 :value 30} {:key 4 :value 40}]) 
> > (def mandatory-keys (range 1 6)) 
> > 
> > (sort-by :key 
> > (reduce 
> >  #(if (some #{%2} (map :key %)) 
> >  % 
> > (conj % {:key %2 :value nil})) map-seq mandatory-keys)) 
> > 
> > => ({:key 1, :value nil} {:key 2, :value nil} {:key 3, :value 30} 
> > {:key 4, :value 40} {:key 5, :value nil}) 
> > 
> > 
> > Jim 
>
>
> of course if the keys are known in advance, you don't want to calculate 
> them every single time: 
>
> (let [ks (map :key map-seq)] 
> (sort-by :key 
> (reduce 
>   #(if (some #{%2} ks) % 
> (conj % {:key %2 :value nil})) map-seq mandatory-keys))) 
>
> Jim 
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Jim - FooBar();

On 19/11/13 11:29, Colin Yates wrote:

In Java I would do something like:

// create a convenient look up to avoid nasty N^2 lookups
Map keyToValue = new HashMap
for (Map kvMap: kvSequence)
  keyToValue.put(kvMap.get("key"), kvMap.put("value"));

List allKeys = calculateAllKeys();

List> results = new Array
for (Object key: allKeys)
  Object result  = keyToValue.get(key); // null is fine for missing keys
  results.put(key, result);

return results;



this code doesn't do any sorting of keys so I'm not sure it would give 
you the exact desired result you posted...


Jim

--
--
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ExceptionInfo.toString() isn't much informative

2013-11-19 Thread Alice
I found it inconvenient that the printed message of the thrown 
ExceptionInfo object doesn't include the attached map.

user=> (throw (ex-info "foo" {:type "my error"}))
ExceptionInfo foo  clojure.core/ex-info (core.clj:4327)

When testing the function that throws ExceptionInfo, I have to wrap it with 
try/catch to see the map.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Brian Craft


On Monday, November 18, 2013 3:58:10 PM UTC-8, kovasb wrote:
>
> There are a large number of high quality libraries like instaparse, 
> cascalog, storm, overtone, friend, etc. I find it pretty easy to tell 
> the difference between a hobby and production project. Besides the 
> typically liveliness measures, its also helpful to know the reputation 
> (or lack thereof) of the people behind the projects. 
>

Yes, there are these fairly advanced libraries in very specific domains, 
but the core libraries are extremely weak.

For example, I have a project with rather modest requirements, one of them 
being abstract path manipulation. In javascript:

path.normalize(path.join("one", "two", "..", "three"))
'one/three'

ruby:

irb(main):003:0> Pathname.new("one") + "two" + ".." + "three"
=> #

python:

>>> os.path.normpath(os.path.join("one", "two", "..", "three"))
'one/three'

In clojure, people recommend me.raynes.fs:

=> (fs/file "one" "two" ".." "three")
#

ugh. 

=> (fs/normalized-path (fs/file "one" "two" ".." "three"))
#

um, no. Turns out there is no abstract path join + normalization in 
me.raynes.fs. I haven't found an alternative in clojure.

This is trivial to work around, but I hit this kind of thing constantly 
with every clojure library I use: clojure libraries are about 70% 
implemented, and 90% correct, which makes a weak foundation. I was amused 
to find the Lisp Curse article a few weeks ago, which describes this 
situation. It's often easier to write something from scratch than to patch 
one of the partially-implemented libraries. But this scales poorly, and one 
is truly starting from zero with clojure.

Of course clojure is a relatively new language, with a much smaller number 
of users than javascript, python, and ruby, so I expect the libraries to be 
less complete. What I don't expect is clojure users to report that the 
libraries are just great. Clojure libraries are very weak compared to other 
modern languages.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


parse a text file that has some binary characters

2013-11-19 Thread smk
Hi
I am trying to parse a text file that has some binary characters(such as 
0x001 or 0x002) and replace them with text characters.
How to do it in clojure?
Thanks in advance
...smk

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Patrick Kristiansen
> This is trivial to work around, but I hit this kind of thing
> constantly with every clojure library I use: clojure libraries are
> about 70% implemented, and 90% correct, which makes a weak foundation.
> I was amused to find the Lisp Curse article a few weeks ago, which
> describes this situation. It's often easier to write something from
> scratch than to patch one of the partially-implemented libraries. But
> this scales poorly, and one is truly starting from zero with clojure.
> 
> Of course clojure is a relatively new language, with a much smaller
> number of users than javascript, python, and ruby, so I expect the
> libraries to be less complete. What I don't expect is clojure users to
> report that the libraries are just great. Clojure libraries are very
> weak compared to other modern languages.

Don't you think it counts that you can easily use the underlying
platform's facilities? If you are using ClojureScript with nodejs, you
can just use the path functions present there. If you are using Clojure
on the JVM, you have an equivalent option. This may even be the
explanation that you feel Clojure libraries are 70 % implemented,
because it is so easy to use what is already available.

I don't think it is always feasible or a good idea to reimplement the
platform's facilities just to make them look more Clojuresque.
Furthermore, I don't believe that you can even consider it "unidiomatic"
to use your platform through Clojure's interop. Remember, one of
Clojure's value proposition is exactly that: the ability to reuse the
libraries already available on the host platform.

Best regards,
Patrick

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Brandon Adams
I realize that's just an example, but I wouldn't expect to need anything
other than interop to do this (off the top, maybe java.nio.file.Path can be
constructed directly?):

(defn normalize-path [& rest] (-> (reduce #(new java.io.File %1 %2) rest)
.toPath .normalize))





On Tue, Nov 19, 2013 at 8:22 AM, Brian Craft  wrote:

>
>
> On Monday, November 18, 2013 3:58:10 PM UTC-8, kovasb wrote:
>>
>> There are a large number of high quality libraries like instaparse,
>> cascalog, storm, overtone, friend, etc. I find it pretty easy to tell
>> the difference between a hobby and production project. Besides the
>> typically liveliness measures, its also helpful to know the reputation
>> (or lack thereof) of the people behind the projects.
>>
>
> Yes, there are these fairly advanced libraries in very specific domains,
> but the core libraries are extremely weak.
>
> For example, I have a project with rather modest requirements, one of them
> being abstract path manipulation. In javascript:
>
> path.normalize(path.join("one", "two", "..", "three"))
> 'one/three'
>
> ruby:
>
> irb(main):003:0> Pathname.new("one") + "two" + ".." + "three"
> => #
>
> python:
>
> >>> os.path.normpath(os.path.join("one", "two", "..", "three"))
> 'one/three'
>
> In clojure, people recommend me.raynes.fs:
>
> => (fs/file "one" "two" ".." "three")
> #
>
> ugh.
>
> => (fs/normalized-path (fs/file "one" "two" ".." "three"))
> #
>
> um, no. Turns out there is no abstract path join + normalization in
> me.raynes.fs. I haven't found an alternative in clojure.
>
> This is trivial to work around, but I hit this kind of thing constantly
> with every clojure library I use: clojure libraries are about 70%
> implemented, and 90% correct, which makes a weak foundation. I was amused
> to find the Lisp Curse article a few weeks ago, which describes this
> situation. It's often easier to write something from scratch than to
> patch one of the partially-implemented libraries. But this scales poorly,
> and one is truly starting from zero with clojure.
>
> Of course clojure is a relatively new language, with a much smaller number
> of users than javascript, python, and ruby, so I expect the libraries to be
> less complete. What I don't expect is clojure users to report that the
> libraries are just great. Clojure libraries are very weak compared to other
> modern languages.
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: New Functional Programming Job Opportunities

2013-11-19 Thread Dave Tenny
Fun reading!

On Monday, November 18, 2013 2:00:02 AM UTC-5, Sean Murphy wrote:
>
> Here are some functional programming job opportunities that were posted 
> recently: 
>
> Clojure Engineers Needed! at Factual 
> http://functionaljobs.com/jobs/8657-clojure-engineers-needed-at-factual 
>
> Cheers, 
> Sean Murphy 
> FunctionalJobs.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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Phillip Lord
Brian Craft  writes:

> For example, I have a project with rather modest requirements, one of them 
> being abstract path manipulation. In javascript:
>
> path.normalize(path.join("one", "two", "..", "three"))
> 'one/three'
>
> ruby:
>
> irb(main):003:0> Pathname.new("one") + "two" + ".." + "three"
> => #
>
> python:
>
 os.path.normpath(os.path.join("one", "two", "..", "three"))
> 'one/three'
>
> In clojure, people recommend me.raynes.fs:
>
> => (fs/file "one" "two" ".." "three")
> #
>
> ugh. 
>
> => (fs/normalized-path (fs/file "one" "two" ".." "three"))
> #
>
> um, no. Turns out there is no abstract path join + normalization in 
> me.raynes.fs. I haven't found an alternative in clojure.
>
> This is trivial to work around, but I hit this kind of thing constantly 
> with every clojure library I use: clojure libraries are about 70% 
> implemented, and 90% correct, which makes a weak foundation. I was amused 
> to find the Lisp Curse article a few weeks ago, which describes this 
> situation. It's often easier to write something from scratch than to patch 
> one of the partially-implemented libraries. But this scales poorly, and one 
> is truly starting from zero with clojure.


One of the interesting questions, I think, is the embrace the host
notion. One solution to the problems you describe is to just use the
equivalent java libraries. Is this a failure of the clojure library
ecosystem or a pragmatic solution? 

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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: cider status

2013-11-19 Thread Phillip Lord

I discovered one of the reasons for my issues with stability yesterday.
The version of clojure-test-mode on marmalade still depends on nrepl
(rather than cider), so, despite my best efforts to remove nrepl.el it
was still getting pulled back in.

Fun and games!

Phil

Phillip Lord  writes:

> I have tried it a couple of times and keep reverting back to nrepl. One
> of the biggest issues is nrepl-ritz which depends on nrepl and not
> nrepl-client. So switching to cider appears to mean ditching ritz.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Laurent PETIT
2013/11/19 Phillip Lord 

> Brian Craft  writes:
>
> > For example, I have a project with rather modest requirements, one of
> them
> > being abstract path manipulation. In javascript:
> >
> > path.normalize(path.join("one", "two", "..", "three"))
> > 'one/three'
> >
> > ruby:
> >
> > irb(main):003:0> Pathname.new("one") + "two" + ".." + "three"
> > => #
> >
> > python:
> >
>  os.path.normpath(os.path.join("one", "two", "..", "three"))
> > 'one/three'
> >
> > In clojure, people recommend me.raynes.fs:
> >
> > => (fs/file "one" "two" ".." "three")
> > #
> >
> > ugh.
> >
> > => (fs/normalized-path (fs/file "one" "two" ".." "three"))
> > #
> >
> > um, no. Turns out there is no abstract path join + normalization in
> > me.raynes.fs. I haven't found an alternative in clojure.
> >
> > This is trivial to work around, but I hit this kind of thing constantly
> > with every clojure library I use: clojure libraries are about 70%
> > implemented, and 90% correct, which makes a weak foundation. I was amused
> > to find the Lisp Curse article a few weeks ago, which describes this
> > situation. It's often easier to write something from scratch than to
> patch
> > one of the partially-implemented libraries. But this scales poorly, and
> one
> > is truly starting from zero with clojure.
>
>
> One of the interesting questions, I think, is the embrace the host
> notion. One solution to the problems you describe is to just use the
> equivalent java libraries. Is this a failure of the clojure library
> ecosystem or a pragmatic solution?
>

YMMV : a pragmatic solution to not have to do host interop, which is less
supported by text editors / IDEs than aliased clojure functions :-)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Michael Klishin
2013/11/19 Brian Craft 

> What I don't expect is clojure users to report that the libraries are just
> great. Clojure libraries are very weak compared to other modern languages.


Bold statement, Brian. Surely you've tried at least 60% of the libraries
out there to make
your judgement more scientific than a survey with thousands of participants
;)

Please try finding a sane concurrency library in Ruby, or use the standard
library primitives.
Try working with binary protocols or even basic statistical problems in
JavaScript. And ask yourself
what % of Python libraries is of the same quality as Requests. Or go work
with crypto libraries
in any of the above.

Clojure's standard library is small but at least if you ask me, overall it
is higher quality than most languages
out there. Certainly leaps and bounds better engineering-wise than Ruby.
-- 
MK

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

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


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread James Reeves
On 19 November 2013 14:22, Brian Craft  wrote:

>
> For example, I have a project with rather modest requirements, one of them
> being abstract path manipulation. In javascript:
>
> path.normalize(path.join("one", "two", "..", "three"))
> 'one/three'
>
> ruby:
>
> irb(main):003:0> Pathname.new("one") + "two" + ".." + "three"
> => #
>
> python:
>
> >>> os.path.normpath(os.path.join("one", "two", "..", "three"))
> 'one/three'
>
> In clojure, people recommend me.raynes.fs:
>
> => (fs/file "one" "two" ".." "three")
> #
>

What about:

(-> (io/file "one" "two" ".." "three") .toPath .normalizePath)

I think in this case it's more a problem with the Java API, which the fs
library wraps. Until Java 7, I don't think relative path normalisation
existed in the core Java libraries.

- James

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to convert this simple (and inefficient) fibonacci function to # format

2013-11-19 Thread anguscom...@gmail.com
Did this get returned from my htc

Sent from my HTC

- Reply message -
From: "Angus" 
To: 
Subject: How to convert this simple (and inefficient) fibonacci function to # 
format
Date: Wed, Nov 13, 2013 17:41


I know this fibonacci function is not optimal but I want to learn one step 
at a time.  I want to be able to apply this approach to 4clojure which 
disallows a lot of things including defn. 

This is my implementation so far: 

(defn fib [x] 
   (cond 
  (= x 0) 0 
  (= x 1) 1 
  :else 
 (+ (fib (- x 1)) (fib (- x 2)


So I thought about something like this:

(#(fn fib [x] 
   (cond 
  (= x 0) 0 
  (= x 1) 1 
  :else 
 (+ (fib (- x 1)) (fib (- x 2)
  8)

But trying that in a REPL I get error:

clojure.lang.ArityException: Wrong number of args (1) passed to: 
sandbox28956$eval28971$fn

So how can I call this as a one line REPL?

I though using apply with a one element list might work, but no.

(apply #(fn fib [x](cond (= x 0) 0 (= x 1) 1  :else  (+ (fib (- x 1)) (fib 
(- x 2) '(8))


-- 
-- 
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 a topic in the Google 
Groups "Clojure" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/clojure/5xV74YC-9C4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Phillip Lord
Laurent PETIT  writes:

>> One of the interesting questions, I think, is the embrace the host
>> notion. One solution to the problems you describe is to just use the
>> equivalent java libraries. Is this a failure of the clojure library
>> ecosystem or a pragmatic solution?
>>
>
> YMMV : a pragmatic solution to not have to do host interop, which is less
> supported by text editors / IDEs than aliased clojure functions :-)

Oh, I've written an reasonably large library over the top of a Java API
which adds (relatively) little but adds a nice syntax, in a evaluative
environment, and hides a few of the boring details (using Stuart
Sierra's top antipattern in clojure
http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope!).

I really don't know the answer to the question yet.

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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Laurent PETIT
2013/11/19 Phillip Lord 

> Laurent PETIT  writes:
>
> >> One of the interesting questions, I think, is the embrace the host
> >> notion. One solution to the problems you describe is to just use the
> >> equivalent java libraries. Is this a failure of the clojure library
> >> ecosystem or a pragmatic solution?
> >>
> >
> > YMMV : a pragmatic solution to not have to do host interop, which is less
> > supported by text editors / IDEs than aliased clojure functions :-)
>
> Oh, I've written an reasonably large library over the top of a Java API
> which adds (relatively) little but adds a nice syntax, in a evaluative
> environment, and hides a few of the boring details (using Stuart
> Sierra's top antipattern in clojure
> http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope!).
>
> I really don't know the answer to the question yet.
>

Me neither,

I can just observe that those days, I'm writing little wrappers over the
libraries I learn (in the Eclipse world), starting with just "very thin
wrappers just to isolate interop". And that I build upon that. A layer
after the other.

Too early to draw any conclusion for me. Time will tell.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Question regarding core.async

2013-11-19 Thread bob


Hi, 

There are two fn, one is to spawn the channel and the other is to send the 
message to the channel, 

The problem is that if the time to handle the message(or command) is more than 
the specified timeout time, and then another messages are emitted to the 
channel before the channel finish handling the previous message, such messages 
will be lost. those messages will not be seen by the channel.

firstly I thought it is caused by the buffer size of channel, but it seems it 
not the truth.

I am not sure what I missed.

Thanks

(defn register-channel
  "register a channel, the channel listens to event/command
   and responsible for handling them.
   the channels are mapped as {$:type {$:from channel}}"
  [channel-map type from handler]
  (func/put-if-absence!
   channel-map [type from]
   (fn []
 (let [ch (chan)]
   (log/debug "register channel" type from ch)
   (go (while true
 (let [cmd (! ch event)))
  ;;FIXME the latter command will be lost if several commands are sent
  (when-not (nil? timeout-ms)
(go (alts! (conj ch-seq (timeout timeout-ms
(log/debug "done result within" timeout-ms)))

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Generating functions from data

2013-11-19 Thread John D. Hume
After some experience with excessively meta-programmed Ruby apps, I
generally try to design an API that is as clean (or almost) as what I'm
tempted to generate and avoid the metaprogramming. For example
(api/get-user-by-id "123") is only slightly nicer than (api/get-by-id :user
"123"), so if the former requires code that some of the team will be afraid
to touch, or requires an extra build step, I prefer the latter.

Maybe if you spell out some of the boiler-plate you want to eliminate we'll
have a better idea of what you're trying to achieve.


On Mon, Nov 18, 2013 at 8:51 PM, Jeremy Heiler wrote:

> On Mon, Nov 18, 2013 at 7:48 PM, Jeremy Heiler wrote:
>
>> I am interested in what you think about generating functions at compile
>> time (with a macro) from data. The specific use case I am thinking about
>> pertains to libraries for large web services with a lot of endpoints. A
>> cost-benefit analysis could probably be done for what size is appropriate,
>> but lets just assume the number of endpoints is large enough for you to
>> start thinking about this.
>>
>> Potential advantages include:
>>
>> - Less boilerplate. It would be less annoying to maintain data that
>> represents each endpoint and generate the boilerplate than it is to
>> maintain a lot of repetitive code.
>>
>> - Shareable. The work done to maintain the endpoint data could be used by
>> multiple libraries for multiple languages. In fact, it could be maintained
>> by the web service itself.
>>
>> Potential disadvantages include:
>>
>> - Limited discoverability. If the code is generated at compile time,
>> there is no direct source for it, which may hinder the ability to view or
>> generate documentation with your favorite tool(s).
>>
>> - Complicated edge cases. Endpoints that require extra code are usually
>> edge cases, but not always. Regardless, breaking from the template may
>> complicate the code further. (I don't think this is a difficult problem to
>> solve, though.)
>>
>> One way to alleviate the "limited discoverability" problem is to generate
>> source code at build time. This is what you would do in langauges like
>> Java, and that has always left me frustrated, so I am not inclined to think
>> it's a good idea. However, feel free to make the case!
>>
>> A language like Clojure makes doing this relatively easy, but is it
>> simple?
>>
>
> Another consequence of this that I forgot to mention in the mail above is
> that there will either need to be way for the library to self-execute the
> macro or require the user to initialize the library. The latter might not
> be too bad considering global (immutable) configuration such as
> authentication credentials and URLs are necessary.
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
http://elhumidor.blogspot.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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread Frank Hale
I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to compile
into an executable using  Clojure.Compile.exe.

Code:

(ns clojureclr-test
(:gen-class))

(defn -main []
(println "Hello, World))

When I attempt to compile the code using Clojure.Compile.exe I get the
following error:

C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
Compiling clojureclr-test to .System.IO.FileNotFoundException: Could not
locate
clojureclr_test.clj.dll or clojureclr_test.clj on load path.
   at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound) in
d:\wo
rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
   at clojure/core$load$fn__17179__17183.invoke() in :line 0
   at clojure/core$load__17186.doInvoke(Object ) in :line 0
   at clojure/core$load_one__17059.invoke(Object , Object , Object ) in
:line 0
   at clojure/core$compile$fn__17193__17197.invoke() in :line 0
   at clojure/core$compile__17200.invoke(Object ) in :line 0
   at BootstrapCompile.Compile.Main(String[] args) in
d:\work\clojure-clr\Clojur
e\Clojure.Compile\Compile.cs:line 78

Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but that
did not resolve this compilation issue. Is there anything special I need to
do in order to set up the Clojure compiler in order to produce executables
or DLLs?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread Shantanu Kumar
Hi Frank,

(Saw your post shared on ClojureCLR Google+ but was unable to comment.)

This may be slightly tangential but you might want to look at lein-clr: 
https://github.com/kumarshantanu/lein-clr

It makes these things easier to do on the command-line. You need to install 
Java and Leiningen to run lein-clr. It automatically takes care of setting 
CLOJURE_LOAD_PATH and CLOJURE_COMPILE_PATH environment variables.

Shantanu

On Tuesday, 19 November 2013 22:18:07 UTC+5:30, Frank Hale wrote:
>
> I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to compile 
> into an executable using  Clojure.Compile.exe.
>
> Code:
>
> (ns clojureclr-test
> (:gen-class))
> 
> (defn -main []
> (println "Hello, World))
>
> When I attempt to compile the code using Clojure.Compile.exe I get the 
> following error:
>
> C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
> Compiling clojureclr-test to .System.IO.FileNotFoundException: Could not 
> locate
> clojureclr_test.clj.dll or clojureclr_test.clj on load path.
>at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound) in 
> d:\wo
> rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
>at clojure/core$load$fn__17179__17183.invoke() in :line 0
>at clojure/core$load__17186.doInvoke(Object ) in :line 0
>at clojure/core$load_one__17059.invoke(Object , Object , Object ) in 
> :line 0
>at clojure/core$compile$fn__17193__17197.invoke() in :line 0
>at clojure/core$compile__17200.invoke(Object ) in :line 0
>at BootstrapCompile.Compile.Main(String[] args) in 
> d:\work\clojure-clr\Clojur
> e\Clojure.Compile\Compile.cs:line 78
>
> Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but that 
> did not resolve this compilation issue. Is there anything special I need to 
> do in order to set up the Clojure compiler in order to produce executables 
> or DLLs?
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread Frank Hale
Ugh, as it always goes right after posting to a mailing list you find out
what the problem is. My clojure source file name was the problem. I had a
dash in the filename and apparently that is a problem. All is well. LOL!


On Tue, Nov 19, 2013 at 11:54 AM, Shantanu Kumar
wrote:

> Hi Frank,
>
> (Saw your post shared on ClojureCLR Google+ but was unable to comment.)
>
> This may be slightly tangential but you might want to look at lein-clr:
> https://github.com/kumarshantanu/lein-clr
>
> It makes these things easier to do on the command-line. You need to
> install Java and Leiningen to run lein-clr. It automatically takes care of
> setting CLOJURE_LOAD_PATH and CLOJURE_COMPILE_PATH environment variables.
>
> Shantanu
>
>
> On Tuesday, 19 November 2013 22:18:07 UTC+5:30, Frank Hale wrote:
>>
>> I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to compile
>> into an executable using  Clojure.Compile.exe.
>>
>> Code:
>>
>> (ns clojureclr-test
>> (:gen-class))
>>
>> (defn -main []
>> (println "Hello, World))
>>
>> When I attempt to compile the code using Clojure.Compile.exe I get the
>> following error:
>>
>> C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
>> Compiling clojureclr-test to .System.IO.FileNotFoundException: Could not
>> locate
>> clojureclr_test.clj.dll or clojureclr_test.clj on load path.
>>at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound)
>> in d:\wo
>> rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
>>at clojure/core$load$fn__17179__17183.invoke() in :line 0
>>at clojure/core$load__17186.doInvoke(Object ) in :line 0
>>at clojure/core$load_one__17059.invoke(Object , Object , Object ) in
>> :line 0
>>at clojure/core$compile$fn__17193__17197.invoke() in :line 0
>>at clojure/core$compile__17200.invoke(Object ) in :line 0
>>at BootstrapCompile.Compile.Main(String[] args) in
>> d:\work\clojure-clr\Clojur
>> e\Clojure.Compile\Compile.cs:line 78
>>
>> Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but
>> that did not resolve this compilation issue. Is there anything special I
>> need to do in order to set up the Clojure compiler in order to produce
>> executables or DLLs?
>>
>>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread Frank Hale
Thanks Shantanu, I will look into lein-clr.


On Tue, Nov 19, 2013 at 11:57 AM, Frank Hale  wrote:

> Ugh, as it always goes right after posting to a mailing list you find out
> what the problem is. My clojure source file name was the problem. I had a
> dash in the filename and apparently that is a problem. All is well. LOL!
>
>
> On Tue, Nov 19, 2013 at 11:54 AM, Shantanu Kumar  > wrote:
>
>> Hi Frank,
>>
>> (Saw your post shared on ClojureCLR Google+ but was unable to comment.)
>>
>> This may be slightly tangential but you might want to look at lein-clr:
>> https://github.com/kumarshantanu/lein-clr
>>
>> It makes these things easier to do on the command-line. You need to
>> install Java and Leiningen to run lein-clr. It automatically takes care of
>> setting CLOJURE_LOAD_PATH and CLOJURE_COMPILE_PATH environment variables.
>>
>> Shantanu
>>
>>
>> On Tuesday, 19 November 2013 22:18:07 UTC+5:30, Frank Hale wrote:
>>>
>>> I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to compile
>>> into an executable using  Clojure.Compile.exe.
>>>
>>> Code:
>>>
>>> (ns clojureclr-test
>>> (:gen-class))
>>>
>>> (defn -main []
>>> (println "Hello, World))
>>>
>>> When I attempt to compile the code using Clojure.Compile.exe I get the
>>> following error:
>>>
>>> C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
>>> Compiling clojureclr-test to .System.IO.FileNotFoundException: Could
>>> not locate
>>> clojureclr_test.clj.dll or clojureclr_test.clj on load path.
>>>at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound)
>>> in d:\wo
>>> rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
>>>at clojure/core$load$fn__17179__17183.invoke() in :line 0
>>>at clojure/core$load__17186.doInvoke(Object ) in :line 0
>>>at clojure/core$load_one__17059.invoke(Object , Object , Object ) in
>>> :line 0
>>>at clojure/core$compile$fn__17193__17197.invoke() in :line 0
>>>at clojure/core$compile__17200.invoke(Object ) in :line 0
>>>at BootstrapCompile.Compile.Main(String[] args) in
>>> d:\work\clojure-clr\Clojur
>>> e\Clojure.Compile\Compile.cs:line 78
>>>
>>> Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but
>>> that did not resolve this compilation issue. Is there anything special I
>>> need to do in order to set up the Clojure compiler in order to produce
>>> executables or DLLs?
>>>
>>>  --
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


configure leiningen to use library when repl starts

2013-11-19 Thread Andy Smith
Hi,

 total newbie here and have come unstuck with the repl configuration. How 
can I configure my leiningen project's clj file to call '(use 
'clojure.math.numeric-tower)' when the repl is started with 'lein repl'? I 
have tried adding the command to the repl-options but I get a java 
exception when I start the repl :

(defproject test "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]
 [org.clojure/math.numeric-tower "0.0.2"]])
  :repl-options {
 :init (clojure.core/use 'clojure.math.numeric-tower)}



andy@Aspire-V3-571:~/projects/clojure/test$ lein repl
Exception in thread "main" java.lang.ClassNotFoundException: org.clojure 
(project.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:5206)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
at clojure.lang.Compiler.analyze(Compiler.java:5193)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
at clojure.lang.Compiler.analyze(Compiler.java:5193)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$MapExpr.parse(Compiler.java:2499)
at clojure.lang.Compiler.analyze(Compiler.java:5195)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4671)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4329)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3174)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5368)
at clojure.lang.Compiler.analyze(Compiler.java:5191)
at clojure.lang.Compiler.eval(Compiler.java:5422)
at clojure.lang.Compiler.load(Compiler.java:5858)
at clojure.lang.Compiler.loadFile(Compiler.java:5821)
at clojure.lang.RT$3.invoke(RT.java:296)
at leiningen.core$read_project$fn__2167.invoke(core.clj:127)
at leiningen.core$read_project.invoke(core.clj:126)
at leiningen.core$read_project.invoke(core.clj:130)
at leiningen.core$_main.doInvoke(core.clj:320)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval73.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
at clojure.lang.Compiler.eval(Compiler.java:5392)
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)
Caused by: java.lang.ClassNotFoundException: org.clojure
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at clojure.lang.RT.classForName(RT.java:1566)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:852)
at clojure.lang.Compiler$HostExpr.access$300(Compiler.java:654)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5572)
at clojure.lang.Compiler.analyze(Compiler.java:5173)
... 41 more


Thanks for your help

Andy

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


running command when lein repl starts

2013-11-19 Thread Andy Smith
Hi,

How can I get a command such as '(use 'clojure.math.numeric-tower)' to run 
when I start the repl with 'lein repl' ? I currently have my leiningen 
project setup as the following :

(defproject test "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]
 [org.clojure/math.numeric-tower "0.0.2"]])
  :repl-options {
 :dependencies [
 [org.clojure/math.numeric-tower "0.0.2"]]
 :init (clojure.core/use 'clojure.math.numeric-tower)}



and the error I get is as follows :


andy@Aspire-V3-571:~/projects/clojure/test$ lein repl
Exception in thread "main" java.lang.ClassNotFoundException: org.clojure 
(project.clj:1)
at clojure.lang.Compiler.analyze(Compiler.java:5206)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
at clojure.lang.Compiler.analyze(Compiler.java:5193)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
at clojure.lang.Compiler.analyze(Compiler.java:5193)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$MapExpr.parse(Compiler.java:2499)
at clojure.lang.Compiler.analyze(Compiler.java:5195)
at clojure.lang.Compiler.analyze(Compiler.java:5152)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4671)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4329)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3174)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5368)
at clojure.lang.Compiler.analyze(Compiler.java:5191)
at clojure.lang.Compiler.eval(Compiler.java:5422)
at clojure.lang.Compiler.load(Compiler.java:5858)
at clojure.lang.Compiler.loadFile(Compiler.java:5821)
at clojure.lang.RT$3.invoke(RT.java:296)
at leiningen.core$read_project$fn__2167.invoke(core.clj:127)
at leiningen.core$read_project.invoke(core.clj:126)
at leiningen.core$read_project.invoke(core.clj:130)
at leiningen.core$_main.doInvoke(core.clj:320)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval73.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
at clojure.lang.Compiler.eval(Compiler.java:5392)
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)
Caused by: java.lang.ClassNotFoundException: org.clojure
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at clojure.lang.RT.classForName(RT.java:1566)
at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:852)
at clojure.lang.Compiler$HostExpr.access$300(Compiler.java:654)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5572)
at clojure.lang.Compiler.analyze(Compiler.java:5173)
... 41 more



What am I doing wrong? Thanks in advance.

Andy

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread Josh Kamau
Is it intentional that you are using clojure 1.3.0 instead of a newer
version like 1.5.1 ?

Do  "lein deps"   to download the dependencies.

Then do lein repl

Josh


On Tue, Nov 19, 2013 at 8:08 PM, Andy Smith wrote:

> Hi,
>
> How can I get a command such as '(use 'clojure.math.numeric-tower)' to run
> when I start the repl with 'lein repl' ? I currently have my leiningen
> project setup as the following :
>
> (defproject test "1.0.0-SNAPSHOT"
>   :description "FIXME: write description"
>   :dependencies [[org.clojure/clojure "1.3.0"]
>  [org.clojure/math.numeric-tower "0.0.2"]])
>   :repl-options {
>  :dependencies [
>  [org.clojure/math.numeric-tower "0.0.2"]]
>  :init (clojure.core/use 'clojure.math.numeric-tower)}
>
>
>
> and the error I get is as follows :
>
>
> andy@Aspire-V3-571:~/projects/clojure/test$ lein repl
> Exception in thread "main" java.lang.ClassNotFoundException: org.clojure
> (project.clj:1)
> at clojure.lang.Compiler.analyze(Compiler.java:5206)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
> at clojure.lang.Compiler.analyze(Compiler.java:5193)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
> at clojure.lang.Compiler.analyze(Compiler.java:5193)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$MapExpr.parse(Compiler.java:2499)
> at clojure.lang.Compiler.analyze(Compiler.java:5195)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4671)
> at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4329)
> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3174)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:5368)
> at clojure.lang.Compiler.analyze(Compiler.java:5191)
> at clojure.lang.Compiler.eval(Compiler.java:5422)
> at clojure.lang.Compiler.load(Compiler.java:5858)
> at clojure.lang.Compiler.loadFile(Compiler.java:5821)
> at clojure.lang.RT$3.invoke(RT.java:296)
> at leiningen.core$read_project$fn__2167.invoke(core.clj:127)
> at leiningen.core$read_project.invoke(core.clj:126)
> at leiningen.core$read_project.invoke(core.clj:130)
> at leiningen.core$_main.doInvoke(core.clj:320)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval73.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5425)
> at clojure.lang.Compiler.eval(Compiler.java:5392)
> 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)
> Caused by: java.lang.ClassNotFoundException: org.clojure
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at
> clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:270)
> at clojure.lang.RT.classForName(RT.java:1566)
> at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:852)
> at clojure.lang.Compiler$HostExpr.access$300(Compiler.java:654)
> at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5572)
> at clojure.lang.Compiler.analyze(Compiler.java:5173)
> ... 41 more
>
>
>
> What am I doing wrong? Thanks in advance.
>
> Andy
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an

Re: Generating functions from data

2013-11-19 Thread Jeremy Heiler
On Tue, Nov 19, 2013 at 11:44 AM, John D. Hume wrote:

> After some experience with excessively meta-programmed Ruby apps, I
> generally try to design an API that is as clean (or almost) as what I'm
> tempted to generate and avoid the metaprogramming. For example
> (api/get-user-by-id "123") is only slightly nicer than (api/get-by-id
> :user "123"), so if the former requires code that some of the team will be
> afraid to touch, or requires an extra build step, I prefer the latter.
>
> Maybe if you spell out some of the boiler-plate you want to eliminate
> we'll have a better idea of what you're trying to achieve.
>

One specific example is my App.net library:

https://github.com/literally/paprika/blob/0be6da626258ca1336224310a0413d15b64c20c1/src/paprika/core.clj#L56

As you see, there is a function for every endpoint that delegates to a
single function call that handles most of the cases rather
straightforwardly. This however feels like a maintenance nightmare. If for
some reason the common function requires a significant change, then
everything will be affected. Whereas if the functions were generated at
compile time, then the changes would "propagate" by design.

This may not be a real problem, though. I just feel like the super
repetitive nature of this code is a smell, but I'm not entirely sure.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread Andy Smith
Ok valid point, but I still get the same kind of errors?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread David Powell
Hmm, maybe you need to use this:
https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L209

-- 
Dave



On Tue, Nov 19, 2013 at 5:51 PM, Andy Smith wrote:

> Ok valid point, but I still get the same kind of errors?
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread Ryan Spangler
David,

Certainly.  There is already a facility to change them, I just haven't
exposed that to the user yet!  This will come out in the next release.


On Tue, Nov 19, 2013 at 3:39 AM, David Simmons wrote:

> Hi Khalid
>
> yes I'm aware you can change the template tags (and the pitfalls :-)). I
> thought it would be easier to see if we could avoid this problem all
> together by using a different set of tags (especially as Caribou is Alpha
> release and hopefully open to change). BTW I don't intend to miss Angular
> and Caribou templates tags in the same page, I just want to be able to use
> the Caribous admin etc AND have my own pages use Angular.
>
> cheers
>
> Dave
>
> --
> --
> 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 a topic in the
> Google Groups "Clojure" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/clojure/KeyaMJERW0o/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread David Powell
Hmm, no it is just a syntax thing with your project, This works:

(defproject test "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.5.1"]
 [org.clojure/math.numeric-tower "0.0.2"]]
  :repl-options {:init (use 'clojure.math.numeric-tower)}
)

You had closed the opening paren on the :dependencies line.  And
:dependencies isn't allowed inside :repl-options, which was causing the
org.clojure error.


-- 
Dave



On Tue, Nov 19, 2013 at 5:56 PM, David Powell  wrote:

> Hmm, maybe you need to use this:
>
> https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L209
>
> --
> Dave
>
>
>
> On Tue, Nov 19, 2013 at 5:51 PM, Andy Smith 
> wrote:
>
>> Ok valid point, but I still get the same kind of errors?
>>
>>  --
>> --
>> 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 unsubscribe from this group and stop receiving emails from it, send an
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread Andy Smith
yes, Ive seen that but it doesnt seem to help me greatly. Just out of 
curiosity how do you generally setup your repl so it already includes these 
kind of common libraries? I dont really want to be typing lots of 'use' 
commands into the repl every time i start it. Is using leiningen the wrong 
way to do this?

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread David Powell
I tend to work on files in emacs or an IDE, with a linked repl, rather than
at a raw repl, so the file I'm working on will tend to have an ns directive
that will require the appropriate namespaces, so I just eval that when I
open the file.



On Tue, Nov 19, 2013 at 6:05 PM, Andy Smith wrote:

> yes, Ive seen that but it doesnt seem to help me greatly. Just out of
> curiosity how do you generally setup your repl so it already includes these
> kind of common libraries? I dont really want to be typing lots of 'use'
> commands into the repl every time i start it. Is using leiningen the wrong
> way to do this?
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: running command when lein repl starts

2013-11-19 Thread Andy Smith
oops, you are right but if I paste into my project.clj I get a different 
error when I run lein repl

andy@Aspire-V3-571:~/projects/clojure/test$ lein repl
Exception in thread "main" java.lang.IllegalArgumentException: No value 
supplied for key: [:init (use (quote clojure.math.numeric-tower))] 
(NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:5441)
at clojure.lang.Compiler.eval(Compiler.java:5392)
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)
Caused by: java.lang.IllegalArgumentException: No value supplied for key: 
[:init (use (quote clojure.math.numeric-tower))]
at 
clojure.lang.PersistentHashMap.createWithCheck(PersistentHashMap.java:89)
at clojure.core$hash_map.doInvoke(core.clj:327)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:540)
at leiningen.repl$repl_options.invoke(repl.clj:16)
at leiningen.repl$repl_server.doInvoke(repl.clj:69)
at clojure.lang.RestFn.applyTo(RestFn.java:146)
at clojure.core$apply.invoke(core.clj:546)
at leiningen.repl$repl.invoke(repl.clj:145)
at clojure.lang.Var.invoke(Var.java:365)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$apply_task.invoke(core.clj:262)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:161)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval73.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
... 11 more

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: cider status

2013-11-19 Thread Colin Yates
That's the culprit - I was wondering why nrepl wouldn't disappear!

For me, cider has been rock solid with midje-mode, but I am not really 
exercising it too much.

On Tuesday, November 19, 2013 2:56:05 PM UTC, Phillip Lord wrote:
>
>
> I discovered one of the reasons for my issues with stability yesterday. 
> The version of clojure-test-mode on marmalade still depends on nrepl 
> (rather than cider), so, despite my best efforts to remove nrepl.el it 
> was still getting pulled back in. 
>
> Fun and games! 
>
> Phil 
>
> Phillip Lord > writes: 
>
> > I have tried it a couple of times and keep reverting back to nrepl. One 
> > of the biggest issues is nrepl-ritz which depends on nrepl and not 
> > nrepl-client. So switching to cider appears to mean ditching ritz. 
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: configure leiningen to use library when repl starts

2013-11-19 Thread Colin Yates
Something that works is putting ":injections [(require 'clojure.repl)]" in 
.lein/profiles.clj.

It works (as evidenced by (doc ...) working in "lein repl") but I don't 
know if that is the correct approach.

On Tuesday, November 19, 2013 4:57:48 PM UTC, Andy Smith wrote:
>
> Hi,
>
>  total newbie here and have come unstuck with the repl configuration. How 
> can I configure my leiningen project's clj file to call '(use 
> 'clojure.math.numeric-tower)' when the repl is started with 'lein repl'? I 
> have tried adding the command to the repl-options but I get a java 
> exception when I start the repl :
>
> (defproject test "1.0.0-SNAPSHOT"
>   :description "FIXME: write description"
>   :dependencies [[org.clojure/clojure "1.3.0"]
>  [org.clojure/math.numeric-tower "0.0.2"]])
>   :repl-options {
>  :init (clojure.core/use 'clojure.math.numeric-tower)}
>
>
>
> andy@Aspire-V3-571:~/projects/clojure/test$ lein repl
> Exception in thread "main" java.lang.ClassNotFoundException: org.clojure 
> (project.clj:1)
> at clojure.lang.Compiler.analyze(Compiler.java:5206)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
> at clojure.lang.Compiler.analyze(Compiler.java:5193)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$VectorExpr.parse(Compiler.java:2592)
> at clojure.lang.Compiler.analyze(Compiler.java:5193)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$MapExpr.parse(Compiler.java:2499)
> at clojure.lang.Compiler.analyze(Compiler.java:5195)
> at clojure.lang.Compiler.analyze(Compiler.java:5152)
> at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4671)
> at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4329)
> at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3174)
> at clojure.lang.Compiler.analyzeSeq(Compiler.java:5368)
> at clojure.lang.Compiler.analyze(Compiler.java:5191)
> at clojure.lang.Compiler.eval(Compiler.java:5422)
> at clojure.lang.Compiler.load(Compiler.java:5858)
> at clojure.lang.Compiler.loadFile(Compiler.java:5821)
> at clojure.lang.RT$3.invoke(RT.java:296)
> at leiningen.core$read_project$fn__2167.invoke(core.clj:127)
> at leiningen.core$read_project.invoke(core.clj:126)
> at leiningen.core$read_project.invoke(core.clj:130)
> at leiningen.core$_main.doInvoke(core.clj:320)
> at clojure.lang.RestFn.invoke(RestFn.java:410)
> at clojure.lang.AFn.applyToHelper(AFn.java:161)
> at clojure.lang.RestFn.applyTo(RestFn.java:132)
> at clojure.core$apply.invoke(core.clj:542)
> at leiningen.core$_main.invoke(core.clj:332)
> at user$eval73.invoke(NO_SOURCE_FILE:1)
> at clojure.lang.Compiler.eval(Compiler.java:5425)
> at clojure.lang.Compiler.eval(Compiler.java:5392)
> 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)
> Caused by: java.lang.ClassNotFoundException: org.clojure
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at 
> clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:270)
> at clojure.lang.RT.classForName(RT.java:1566)
> at clojure.lang.Compiler$HostExpr.maybeClass(Compiler.java:852)
> at clojure.lang.Compiler$HostExpr.access$300(Compiler.java:654)
> at clojure.lang.Compiler.analyzeSymbol(Compiler.java:5572)
> at clojure.lang.Compiler.analyze(Compiler.java:5173)
> ... 41 more
>
>
> Thanks for your help
>
> Andy
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails fr

Re: Do web apps need Clojure?

2013-11-19 Thread Colin Yates
this.

The ease of which data can be mangled and transformed was the primary 
reason I chose Clojure over Java, Groovy and Scala.

That, and the fact the language is just so darn expressive.

On Thursday, November 14, 2013 8:56:59 AM UTC, Islon Scherer wrote:
>
> For me it's about 1 thing: Data.
>
> A web application is about taking data from the user, transform it and 
> store it on the database and take data from the database, transform it and 
> show it to the user.
> Clojure is the best language I used to work with data, it just gives you a 
> composable set of tools and then get out of your way, and there's always 
> macros for the more complex use cases.
> We have a web application that serves edn data to our clojurescript 
> frontend, our webdevelopers created a new site for mobile in backbone.js 
> that used json, I had just to create a function (ring middleware) that 
> transformed my edn data to json based on the accept header.
>
> My 2¢
>
> On Thursday, November 14, 2013 9:11:04 AM UTC+1, Bastien Guerry wrote:
>>
>> Marcus Blankenship  writes: 
>>
>> > Brian, that’s really interesting.  I think we’re seeing something 
>> > similar, and are going to look at Pedestal and Caribou as options for 
>> > a project we’re working on.  Are their others we should consider? 
>>
>> Perhaps you should consider starting from scratch, in parallel. 
>>
>> Maybe that's because I'm a beginner in both the language and in web 
>> development, but so far I've found it's the best way to understand the 
>> choices behind framaworks.  Otherwise I would confuse "web development" 
>> with those choices, and I feel the richness of the Clojure ecosystem 
>> is precisely to open your mind about "web development". 
>>
>> 2 cents, 
>>
>> -- 
>>  Bastien 
>>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[ANN] Leiningen 2.3.4 released

2013-11-19 Thread Phil Hagelberg

Hello folks. I'm happy to announce the release of Leiningen 2.3.4.

This one is primarily a bugfix release; though there are a few minor
enhancements.

## 2.3.4 / 2013-11-18

* Suggest `:exclusions` to possibly confusing `:pedantic?` dependencies. 
(Nelson Morris, Phil Hagelberg)
* Optionally look for snapshot templates in `new` task. (Travis Vachon)
* Allow task chains to be declared without commas in project.clj. (Jean Niklas 
L'orange)
* Support extra configurability in `:pom-plugins`. (Dominik Dziedzic)
* Fix a bug where implicit :aot warning triggered incorrectly. (Jean Niklas 
L'orange)
* Fix a bug where `lein repl connect` ignored port argument. (Toby Crawley)

This brings all the functionality of the deprecated lein-pedantic plugin
into Leiningen itself. The snapshot template functionality allows
template developers to test their changes more easily, and the support
for improved task chaining allows us to express higher-order task
invocations in project.clj in a properly nested way without resorting to
commas, which are a hack to work around shell arguments' lack of
structuring.

As usual, running `lein upgrade` will pull in the latest stable release,
and if you run into any issues you can always run `lein downgrade 2.3.3`
to go back to the previous release. Please report any issues on the
Leiningen mailing list or the GitHub issue tracker.

Thanks to all the contributors and users who helped us get to this release.

-Phil


pgpUt1J75Nnv1.pgp
Description: PGP signature


Re: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-19 Thread David Simmons

>
> Ryan - that is great news. Are we allowed to know what else will be 
> release :-).
>

cheers

Dave 

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Sean Corfield
To Michael: It is fairly up to date - there have only been a few small
changes to java.jdbc since the last updates to that part of
clojure-doc.org. Now that java.jdbc 0.3.0 has hit beta and has a
stable API for release, I feel more comfortable about updating the
clojure-doc.org pages to include the handful of changes that are
missing. It has been expanded quite a bit from the original version
that was part of the clojure.java.jdbc repo.

I'm a little disappointed that after moving it to clojure-doc.org
specifically to remove the CA barrier to entry, none of java.jdbc's
users have taken the time to provide updates to the documentation
site. The whole point of moving it to clojure-doc.org was to enable
community contribution.

To Andrey: I'm a bit disappointed you didn't offer to contribute to
java.jdbc's documentation since you found it lacking, and that you
didn't raise your concerns about either the documentation or the API
with me, rather than creating your own library based on the old API.
Open source projects improve through collaboration.

That said, there's always room for more libraries and alternative
approaches. I'll be a lot happier with java.jdbc when I'm able to
strip the old API out after it has been deprecated for a few releases
- and I'll point out that the API changes from 0.2.x to 0.3.0 are
primarily in response to feedback from Clojure/core. java.jdbc is in
fairly heavy production use these days so I'm having to be more
conservative about changing it than I would if it were just "my"
project and not a Clojure contrib library :)

Sean


On Sat, Nov 16, 2013 at 9:02 AM, Michael Klishin
 wrote:
>
> 2013/11/16 Andrey Antukh 
>>
>>
>> - Lack of documentation.
>
>
> FTR, there is some documentation for java.jdbc, but it certainly
> isn't being actively worked on (despite not being covered by the CA) and may
> already be out of date.
>
> http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
>
> If you'd like to contribute:
> http://github.com/clojuredocs/guides
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Sean Corfield
On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> Additionally I have
> copied some useful functions like parsing dbspec to URI or a map of
> protocol->cases
> and the rest are written from scratch.

Looking through the source code, there are quite a few functions
copied directly from parts of java.jdbc - even maintaining docstrings,
making it clear you copied and pasted them - but I notice that you
have not maintained the copyright or license from java.jdbc.

Would you like to explain why you have copied open source software
without respecting the license and contributors?
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Re: [ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread dmiller
ClojureCLR follows ClojureJVM in translating hyphens in namespace names to 
underscores in filenames.

-David


On Tuesday, November 19, 2013 11:00:37 AM UTC-6, Frank Hale wrote:
>
> Thanks Shantanu, I will look into lein-clr.
>
>
> On Tue, Nov 19, 2013 at 11:57 AM, Frank Hale 
> > wrote:
>
>> Ugh, as it always goes right after posting to a mailing list you find out 
>> what the problem is. My clojure source file name was the problem. I had a 
>> dash in the filename and apparently that is a problem. All is well. LOL!
>>
>>
>> On Tue, Nov 19, 2013 at 11:54 AM, Shantanu Kumar 
>> 
>> > wrote:
>>
>>> Hi Frank,
>>>
>>> (Saw your post shared on ClojureCLR Google+ but was unable to comment.)
>>>
>>> This may be slightly tangential but you might want to look at lein-clr: 
>>> https://github.com/kumarshantanu/lein-clr
>>>
>>> It makes these things easier to do on the command-line. You need to 
>>> install Java and Leiningen to run lein-clr. It automatically takes care of 
>>> setting CLOJURE_LOAD_PATH and CLOJURE_COMPILE_PATH environment variables.
>>>
>>> Shantanu
>>>
>>>
>>> On Tuesday, 19 November 2013 22:18:07 UTC+5:30, Frank Hale wrote:

 I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to 
 compile into an executable using  Clojure.Compile.exe.

 Code:

 (ns clojureclr-test
 (:gen-class))
 
 (defn -main []
 (println "Hello, World))

 When I attempt to compile the code using Clojure.Compile.exe I get the 
 following error:

 C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
 Compiling clojureclr-test to .System.IO.FileNotFoundException: Could 
 not locate
 clojureclr_test.clj.dll or clojureclr_test.clj on load path.
at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound) 
 in d:\wo
 rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
at clojure/core$load$fn__17179__17183.invoke() in :line 0
at clojure/core$load__17186.doInvoke(Object ) in :line 0
at clojure/core$load_one__17059.invoke(Object , Object , Object ) 
 in :line 0
at clojure/core$compile$fn__17193__17197.invoke() in :line 0
at clojure/core$compile__17200.invoke(Object ) in :line 0
at BootstrapCompile.Compile.Main(String[] args) in 
 d:\work\clojure-clr\Clojur
 e\Clojure.Compile\Compile.cs:line 78

 Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but 
 that did not resolve this compilation issue. Is there anything special I 
 need to do in order to set up the Clojure compiler in order to produce 
 executables or DLLs?

  -- 
>>> -- 
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+u...@googlegroups.com .
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread gaz jones
"Because there is no patch for human stupidity"?


On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield wrote:

> On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> > Additionally I have
> > copied some useful functions like parsing dbspec to URI or a map of
> > protocol->cases
> > and the rest are written from scratch.
>
> Looking through the source code, there are quite a few functions
> copied directly from parts of java.jdbc - even maintaining docstrings,
> making it clear you copied and pasted them - but I notice that you
> have not maintained the copyright or license from java.jdbc.
>
> Would you like to explain why you have copied open source software
> without respecting the license and contributors?
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Super-simple recursive-descent parser in Clojure?

2013-11-19 Thread markjszy
Hi everyone,

I have been learning Clojure for a little bit now and had thought about 
using the language to try to explore compilation/language parsing. I had a 
lot of trouble getting a recursive-descent parser implementation 
implemented in the language, and was hoping someone might be able to shed 
some light on what I'm missing.

So, from what I understand, the simplest of the recursive descent 
implementations just has you define a bunch of functions, each of which is 
capable of yielding a production for the left side of a simple (say, LL1 
grammar). And then you kick off the parsing process by calling one of the 
functions, which ends up having all the others called like a domino effect 
until parsing is complete.

Here's the crux of my problem: in an immutable world, is there any simple 
manageable way to get that model to work? It seems to me that you can't get 
around the need for a global, mutable stream that every function is capable 
of popping items off of. I have this impression because I don't see how 
else the recursion would work - if my top-level function, A, says "grab the 
first element and compile program", I expect that by the time it gets 
execution control back, it should not see anything really left in the 
stream of parsable tokens - the stream should have been consumed by the 
cascade of other functions that were called.

I gave up on using refs/atoms, and ended up looking at parser combinators 
like Parsatron, but in all honesty, they are a little over my head at the 
moment.

Thanks for any advice on this matter, or any other insight about getting 
started with topics in compilation!

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Softaddicts
You have the typical profile of people who do not understand open source.
To you, open source is the same thing has a side hobby, ...
with lack of commitment and seriousness.

How do you expect open source software quality to improve if each of us
starts to spin off our own flavor of the same lib ?
How is this a constructive cooperating effort ?
How can open source software be used in production in this context ?

Some people are using this stuff to build serious solutions to hard problems.

I will not even rant about copying without the copyright.

It's the overall lack of logic and self centric egoism that you exhibit that 
makes 
me rant.

You should apply the maxim you have thrown in this thread to yourself.
You are much more representative of it than anyone else I saw
on this mailing list in 5 years.

Punk.

Luc P.

> "Because there is no patch for human stupidity"?
> 
> 
> On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield wrote:
> 
> > On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> > > Additionally I have
> > > copied some useful functions like parsing dbspec to URI or a map of
> > > protocol->cases
> > > and the rest are written from scratch.
> >
> > Looking through the source code, there are quite a few functions
> > copied directly from parts of java.jdbc - even maintaining docstrings,
> > making it clear you copied and pasted them - but I notice that you
> > have not maintained the copyright or license from java.jdbc.
> >
> > Would you like to explain why you have copied open source software
> > without respecting the license and contributors?
> > --
> > Sean A Corfield -- (904) 302-SEAN
> > An Architect's View -- http://corfield.org/
> > World Singles, LLC. -- http://worldsingles.com/
> >
> > "Perfection is the enemy of the good."
> > -- Gustave Flaubert, French realist novelist (1821-1880)
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> 
> -- 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
--
Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


ANN Elastisch 1.3.0-rc1 is released

2013-11-19 Thread Michael Klishin
Elastisch [1] is a minimalistic Clojure client for ElasticSearch.

1.3.0-rc1 is a release candidate that introduces one minor feature
and fixes one bug.

Release notes:
http://blog.clojurewerkz.org/blog/2013/11/20/elastisch-1-dot-3-0-rc1-is-released/

1. http://clojureelasticsearch.info
-- 
MK

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

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


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Andrey Antukh
Hi Sean.


2013/11/19 Sean Corfield 

> To Michael: It is fairly up to date - there have only been a few small
> changes to java.jdbc since the last updates to that part of
> clojure-doc.org. Now that java.jdbc 0.3.0 has hit beta and has a
> stable API for release, I feel more comfortable about updating the
> clojure-doc.org pages to include the handful of changes that are
> missing. It has been expanded quite a bit from the original version
> that was part of the clojure.java.jdbc repo.
>
> I'm a little disappointed that after moving it to clojure-doc.org
> specifically to remove the CA barrier to entry, none of java.jdbc's
> users have taken the time to provide updates to the documentation
> site. The whole point of moving it to clojure-doc.org was to enable
> community contribution.
>
> To Andrey: I'm a bit disappointed you didn't offer to contribute to
> java.jdbc's documentation since you found it lacking, and that you
> didn't raise your concerns about either the documentation or the API
> with me, rather than creating your own library based on the old API.
> Open source projects improve through collaboration.
>
> That said, there's always room for more libraries and alternative
> approaches. I'll be a lot happier with java.jdbc when I'm able to
> strip the old API out after it has been deprecated for a few releases
> - and I'll point out that the API changes from 0.2.x to 0.3.0 are
> primarily in response to feedback from Clojure/core. java.jdbc is in
> fairly heavy production use these days so I'm having to be more
> conservative about changing it than I would if it were just "my"
> project and not a Clojure contrib library :)
>

I have not  proposed the api changes because java.jdbc 0.3 is ready to be
released and the probability of include a significant change in the near
future, it was very remote.
And I was pretty frustrated with the current implementation.

Also, I did not want start documenting a library that I do not like how it
behaves.

On the other hand, if the situation is different, I would love to
collaborate and join forces in a single library.

About license question: if these functions had not copied, but written from
scratch, them would be the same functions with minimal differences or
none...

You're totally right in that would be nice to put in the documentation that
is based in parts of clojure.java.jdbc and I will gladly put it.

;)
Andrey

-- 
Andrey Antukh - Андрей Антух - 
http://www.niwi.be/about.html
http://www.kaleidos.net/A5694F/

"Linux is for people who hate Windows, BSD is for people who love UNIX"
"Social Engineer -> Because there is no patch for human stupidity"

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Super-simple recursive-descent parser in Clojure?

2013-11-19 Thread James Reeves
If anything, parsing is easier to do with immutable structures, as
backtracing is trivial.

You don't need a mutable stream of symbols, you just need to have parsing
functions with a type signature like:

tokens -> [ast tokens]

Rather than the function parsing a stream of tokens and returning just the
resulting AST, you also return the remaining tokens that were not parsed.

It's actually a lot easier to use this than a mutable structure, as you
don't have to worry about pushing tokens back onto the stream if parsing of
a group fails.

- James


On 19 November 2013 21:05, markjszy  wrote:

> Hi everyone,
>
> I have been learning Clojure for a little bit now and had thought about
> using the language to try to explore compilation/language parsing. I had a
> lot of trouble getting a recursive-descent parser implementation
> implemented in the language, and was hoping someone might be able to shed
> some light on what I'm missing.
>
> So, from what I understand, the simplest of the recursive descent
> implementations just has you define a bunch of functions, each of which is
> capable of yielding a production for the left side of a simple (say, LL1
> grammar). And then you kick off the parsing process by calling one of the
> functions, which ends up having all the others called like a domino effect
> until parsing is complete.
>
> Here's the crux of my problem: in an immutable world, is there any simple
> manageable way to get that model to work? It seems to me that you can't get
> around the need for a global, mutable stream that every function is capable
> of popping items off of. I have this impression because I don't see how
> else the recursion would work - if my top-level function, A, says "grab the
> first element and compile program", I expect that by the time it gets
> execution control back, it should not see anything really left in the
> stream of parsable tokens - the stream should have been consumed by the
> cascade of other functions that were called.
>
> I gave up on using refs/atoms, and ended up looking at parser combinators
> like Parsatron, but in all honesty, they are a little over my head at the
> moment.
>
> Thanks for any advice on this matter, or any other insight about getting
> started with topics in compilation!
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Softaddicts
Gaz, excuse me if I misunderstood you, I reread your reply and it was not clear
to me to whom you were referring in your comment.

I still stand by what I said toward the op. Saying that if rewritten the code
would be the same as the original is a lame excuse, it's the same as all that 
internet cheating thing in schools. Unexcusable.

Luc P.

> You have the typical profile of people who do not understand open source.
> To you, open source is the same thing has a side hobby, ...
> with lack of commitment and seriousness.
> 
> How do you expect open source software quality to improve if each of us
> starts to spin off our own flavor of the same lib ?
> How is this a constructive cooperating effort ?
> How can open source software be used in production in this context ?
> 
> Some people are using this stuff to build serious solutions to hard problems.
> 
> I will not even rant about copying without the copyright.
> 
> It's the overall lack of logic and self centric egoism that you exhibit that 
> makes 
> me rant.
> 
> You should apply the maxim you have thrown in this thread to yourself.
> You are much more representative of it than anyone else I saw
> on this mailing list in 5 years.
> 
> Punk.
> 
> Luc P.
> 
> > "Because there is no patch for human stupidity"?
> > 
> > 
> > On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield 
> > wrote:
> > 
> > > On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> > > > Additionally I have
> > > > copied some useful functions like parsing dbspec to URI or a map of
> > > > protocol->cases
> > > > and the rest are written from scratch.
> > >
> > > Looking through the source code, there are quite a few functions
> > > copied directly from parts of java.jdbc - even maintaining docstrings,
> > > making it clear you copied and pasted them - but I notice that you
> > > have not maintained the copyright or license from java.jdbc.
> > >
> > > Would you like to explain why you have copied open source software
> > > without respecting the license and contributors?
> > > --
> > > Sean A Corfield -- (904) 302-SEAN
> > > An Architect's View -- http://corfield.org/
> > > World Singles, LLC. -- http://worldsingles.com/
> > >
> > > "Perfection is the enemy of the good."
> > > -- Gustave Flaubert, French realist novelist (1821-1880)
> > >
> > > --
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Clojure" group.
> > > To post to this group, send email to clojure@googlegroups.com
> > > Note that posts from new members are moderated - please be patient with
> > > your first post.
> > > To unsubscribe from this group, send email to
> > > clojure+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > > http://groups.google.com/group/clojure?hl=en
> > > ---
> > > You received this message because you are subscribed to the Google Groups
> > > "Clojure" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an
> > > email to clojure+unsubscr...@googlegroups.com.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > 
> > -- 
> > -- 
> > 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 unsubscribe from this group and stop receiving emails from it, send an 
> > email to clojure+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
> > 
> --
> Softaddicts sent by ibisMail from my ipad!
> 
> -- 
> -- 
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
> 
--
Softaddicts sent by ibisMail from my ipad!

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

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Michael Klishin
2013/11/20 Softaddicts 

> How do you expect open source software quality to improve if each of us
> starts to spin off our own flavor of the same lib ?
>

Sometimes creating a new library is the right thing to do.

I'll give you one example.

When I started Langohr and Monger in 2011, there were WabbitMQ and
congomongo.
I could have contributed to both but what I wanted those clients to be was
quite far away from
their established public API's. In other words, I could improve them only
up to a point and
probably fail at that since I'm not great at convincing other people their
API's need to seriously
change. So I did my own thing, which does exactly what I wanted developed
and documented
up to my standards. Some developers apparently like them, too.

In clojure.java.jdbc's case, the development process is just too slow. If
you want to contribute
anything substantial or incompatible or simply opinionated, chances are,
you will have to waste
*many* months convincing people, running after people to screen your
patches, etc.

Or you can take another route: write code, document it, promote your
library, without waiting
for anybody. And get a great feedback loop for yourself and the rest of the
community.

Needless to say, if you reuse some code from the original project you
should respect the license
in give credit when its due. In Monger's case, we've borrowed one function
which was subsequently
slightly modified and we still have a mention for that [1].

1.
https://github.com/michaelklishin/monger/blob/master/src/clojure/monger/conversion.clj#L1-3
-- 
MK

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

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


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Michael Klishin
2013/11/20 Andrey Antukh 

>
> About license question: if these functions had not copied, but written
> from scratch, them would be the same functions with minimal differences or
> none...
>

Sorry but that's a ridiculous argument. You must respect and obey by the
license of the project you take code
from.
-- 
MK

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

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


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread gaz jones
Whoops, sorry looks like my intended light-hearted sarcasm based on one of
the email signatures in the thread got mis-interpreted. Hard to express in
an email, perhaps a cheeky :P after would have let you know I wasn't being
particularly serious!

No offense intended, or taken :)


On Tue, Nov 19, 2013 at 4:25 PM, Softaddicts wrote:

> Gaz, excuse me if I misunderstood you, I reread your reply and it was not
> clear
> to me to whom you were referring in your comment.
>
> I still stand by what I said toward the op. Saying that if rewritten the
> code
> would be the same as the original is a lame excuse, it's the same as all
> that
> internet cheating thing in schools. Unexcusable.
>
> Luc P.
>
> > You have the typical profile of people who do not understand open source.
> > To you, open source is the same thing has a side hobby, ...
> > with lack of commitment and seriousness.
> >
> > How do you expect open source software quality to improve if each of us
> > starts to spin off our own flavor of the same lib ?
> > How is this a constructive cooperating effort ?
> > How can open source software be used in production in this context ?
> >
> > Some people are using this stuff to build serious solutions to hard
> problems.
> >
> > I will not even rant about copying without the copyright.
> >
> > It's the overall lack of logic and self centric egoism that you exhibit
> that makes
> > me rant.
> >
> > You should apply the maxim you have thrown in this thread to yourself.
> > You are much more representative of it than anyone else I saw
> > on this mailing list in 5 years.
> >
> > Punk.
> >
> > Luc P.
> >
> > > "Because there is no patch for human stupidity"?
> > >
> > >
> > > On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield  >wrote:
> > >
> > > > On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> > > > > Additionally I have
> > > > > copied some useful functions like parsing dbspec to URI or a map of
> > > > > protocol->cases
> > > > > and the rest are written from scratch.
> > > >
> > > > Looking through the source code, there are quite a few functions
> > > > copied directly from parts of java.jdbc - even maintaining
> docstrings,
> > > > making it clear you copied and pasted them - but I notice that you
> > > > have not maintained the copyright or license from java.jdbc.
> > > >
> > > > Would you like to explain why you have copied open source software
> > > > without respecting the license and contributors?
> > > > --
> > > > Sean A Corfield -- (904) 302-SEAN
> > > > An Architect's View -- http://corfield.org/
> > > > World Singles, LLC. -- http://worldsingles.com/
> > > >
> > > > "Perfection is the enemy of the good."
> > > > -- Gustave Flaubert, French realist novelist (1821-1880)
> > > >
> > > > --
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Clojure" group.
> > > > To post to this group, send email to clojure@googlegroups.com
> > > > Note that posts from new members are moderated - please be patient
> with
> > > > your first post.
> > > > To unsubscribe from this group, send email to
> > > > clojure+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > > http://groups.google.com/group/clojure?hl=en
> > > > ---
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Clojure" group.
> > > > To unsubscribe from this group and stop receiving emails from it,
> send an
> > > > email to clojure+unsubscr...@googlegroups.com.
> > > > For more options, visit https://groups.google.com/groups/opt_out.
> > > >
> > >
> > > --
> > > --
> > > 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 unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > --
> > Softaddicts sent by ibisMail from my ipad!
> >
> > --
> > --
> > 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" gr

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Andrey Antukh
Is not an excuse, is only a opinion, nothing more. This opinion can not
change that, mention the original author is right and I've done it. I have
no way intend to belittle anyone.

;)
Andrey




2013/11/19 Softaddicts 

> Gaz, excuse me if I misunderstood you, I reread your reply and it was not
> clear
> to me to whom you were referring in your comment.
>
> I still stand by what I said toward the op. Saying that if rewritten the
> code
> would be the same as the original is a lame excuse, it's the same as all
> that
> internet cheating thing in schools. Unexcusable.
>
> Luc P.
>
> > You have the typical profile of people who do not understand open source.
> > To you, open source is the same thing has a side hobby, ...
> > with lack of commitment and seriousness.
> >
> > How do you expect open source software quality to improve if each of us
> > starts to spin off our own flavor of the same lib ?
> > How is this a constructive cooperating effort ?
> > How can open source software be used in production in this context ?
> >
> > Some people are using this stuff to build serious solutions to hard
> problems.
> >
> > I will not even rant about copying without the copyright.
> >
> > It's the overall lack of logic and self centric egoism that you exhibit
> that makes
> > me rant.
> >
> > You should apply the maxim you have thrown in this thread to yourself.
> > You are much more representative of it than anyone else I saw
> > on this mailing list in 5 years.
> >
> > Punk.
> >
> > Luc P.
> >
> > > "Because there is no patch for human stupidity"?
> > >
> > >
> > > On Tue, Nov 19, 2013 at 1:35 PM, Sean Corfield  >wrote:
> > >
> > > > On Sun, Nov 17, 2013 at 1:57 AM, Andrey Antukh  wrote:
> > > > > Additionally I have
> > > > > copied some useful functions like parsing dbspec to URI or a map of
> > > > > protocol->cases
> > > > > and the rest are written from scratch.
> > > >
> > > > Looking through the source code, there are quite a few functions
> > > > copied directly from parts of java.jdbc - even maintaining
> docstrings,
> > > > making it clear you copied and pasted them - but I notice that you
> > > > have not maintained the copyright or license from java.jdbc.
> > > >
> > > > Would you like to explain why you have copied open source software
> > > > without respecting the license and contributors?
> > > > --
> > > > Sean A Corfield -- (904) 302-SEAN
> > > > An Architect's View -- http://corfield.org/
> > > > World Singles, LLC. -- http://worldsingles.com/
> > > >
> > > > "Perfection is the enemy of the good."
> > > > -- Gustave Flaubert, French realist novelist (1821-1880)
> > > >
> > > > --
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Clojure" group.
> > > > To post to this group, send email to clojure@googlegroups.com
> > > > Note that posts from new members are moderated - please be patient
> with
> > > > your first post.
> > > > To unsubscribe from this group, send email to
> > > > clojure+unsubscr...@googlegroups.com
> > > > For more options, visit this group at
> > > > http://groups.google.com/group/clojure?hl=en
> > > > ---
> > > > You received this message because you are subscribed to the Google
> Groups
> > > > "Clojure" group.
> > > > To unsubscribe from this group and stop receiving emails from it,
> send an
> > > > email to clojure+unsubscr...@googlegroups.com.
> > > > For more options, visit https://groups.google.com/groups/opt_out.
> > > >
> > >
> > > --
> > > --
> > > 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 unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@googlegroups.com.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >
> > --
> > Softaddicts sent by ibisMail from my ipad!
> >
> > --
> > --
> > 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 unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+unsubscr...@g

ANN 2 years of ClojureWerkz

2013-11-19 Thread Michael Klishin
A couple of weeks ago ClojureWerkz [1] turned two years old.
We are at 29 projects (not including failed experiments) and kicking.

There have been dozens of contributors, entire major releases
brilliantly managed by people outside of our tiny core team,
and a pretty high bar in project quality sustained [2] [3]. I think it's
fair to say that there have been positive changes in the overall
Clojure library ecosystem, hopefully in part due to how vocal we've
been (102 blog posts on blog.clojurewerkz.org this year alone).

These days many world famous institutions
and companies we respect use various ClojureWerkz projects
to power their products and internal tools. Needless to say,
we did not plan for it in 2011.

So thank you, both users and contributors. There are some new
projects in the pipeline and our values do not change: documentation, sane
release practices,
ease of contributing and backwards compatibility. We love all that boring
stuff.

Here's to another few years!

1. http://clojurewerkz.org
2.
http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
3. http://www.slideshare.net/michaelklishin/open-source-responsibly
-- 
MK

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

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


Re: ANN 2 years of ClojureWerkz

2013-11-19 Thread Andrey Antukh
Congrats!
clojurewerkz is now my reference for search a good and well documented
clojure libraries.

Thanks for all efforts!

;)
Andrey



2013/11/20 Michael Klishin 

> A couple of weeks ago ClojureWerkz [1] turned two years old.
> We are at 29 projects (not including failed experiments) and kicking.
>
> There have been dozens of contributors, entire major releases
> brilliantly managed by people outside of our tiny core team,
> and a pretty high bar in project quality sustained [2] [3]. I think it's
> fair to say that there have been positive changes in the overall
> Clojure library ecosystem, hopefully in part due to how vocal we've
> been (102 blog posts on blog.clojurewerkz.org this year alone).
>
> These days many world famous institutions
> and companies we respect use various ClojureWerkz projects
> to power their products and internal tools. Needless to say,
> we did not plan for it in 2011.
>
> So thank you, both users and contributors. There are some new
> projects in the pipeline and our values do not change: documentation, sane
> release practices,
> ease of contributing and backwards compatibility. We love all that boring
> stuff.
>
> Here's to another few years!
>
> 1. http://clojurewerkz.org
> 2.
> http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
> 3. http://www.slideshare.net/michaelklishin/open-source-responsibly
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Andrey Antukh - Андрей Антух - 
http://www.niwi.be/about.html
http://www.kaleidos.net/A5694F/

"Linux is for people who hate Windows, BSD is for people who love UNIX"
"Social Engineer -> Because there is no patch for human stupidity"

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: ANN 2 years of ClojureWerkz

2013-11-19 Thread Bruce Durling
Michael,

Congrats and keep on going. I love using your libraries.

cheers,
Bruce

On Tue, Nov 19, 2013 at 11:05 PM, Michael Klishin
 wrote:
> A couple of weeks ago ClojureWerkz [1] turned two years old.
> We are at 29 projects (not including failed experiments) and kicking.
>
> There have been dozens of contributors, entire major releases
> brilliantly managed by people outside of our tiny core team,
> and a pretty high bar in project quality sustained [2] [3]. I think it's
> fair to say that there have been positive changes in the overall
> Clojure library ecosystem, hopefully in part due to how vocal we've
> been (102 blog posts on blog.clojurewerkz.org this year alone).
>
> These days many world famous institutions
> and companies we respect use various ClojureWerkz projects
> to power their products and internal tools. Needless to say,
> we did not plan for it in 2011.
>
> So thank you, both users and contributors. There are some new
> projects in the pipeline and our values do not change: documentation, sane
> release practices,
> ease of contributing and backwards compatibility. We love all that boring
> stuff.
>
> Here's to another few years!
>
> 1. http://clojurewerkz.org
> 2.
> http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
> 3. http://www.slideshare.net/michaelklishin/open-source-responsibly
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
@otfrom | CTO & co-founder @MastodonC | mastodonc.com
See recent coverage of us in the Economist http://econ.st/WeTd2i and
the Financial Times http://on.ft.com/T154BA

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: instaparse: composing smaller rules into a bigger one

2013-11-19 Thread Mark Engelberg
On Tue, Nov 19, 2013 at 3:12 AM, Jim - FooBar(); wrote:

>
> Shouldn't the EFF rule have caught the [:SIGN [:ADV "significantly"]] tag?
> Why did it start a new PHRASE ? The same thing happens with XFOLD. iF the
> 'x-fold' is before the adverb (2-fold increases) it shows in the DDIPK tag
> otherwise (increases 2-fold)  it appears after it in a new PHRASE tag. I'm
> pretty sure the rule covers both cases and in fact it reaches the EFF rule
> but it never mathes the * (ADV | XFOLD)? *rule. I am presuming this is
> something quite simple...
>

Your EFF rule does not end with a SPACE.  So if it chooses the adverb
interpretation of "significantly", it's then looking to start a new PHRASE
with a space, which your rules don't allow for.  The fix is to put SPACE at
the end of your EFF rule.  Some of your other rules (e.g., DDIPK) have
similar issues.

Your grammar is highly ambiguous.  You can see all the possible parses with
the command:
=> (insta/parses parsePK "Exposure to oral didanosine is increased
significantly when coadministered with tenofovir disoproxil fumarate.")

but that's a lot of possibilities to comb through.

=> (count (insta/parses parsePK "Exposure to oral didanosine is increased
significantly when coadministered with tenofovir disoproxil fumarate."))
228

That's in large part because each possible special word can be interepreted
both as its special meaning and just simply as an ordinary word.  Also
there are multiple valid places to end a phrase and begin a new one.

To help troubleshoot this particular problem, I used:
(clojure.pprint/pprint (distinct (map second (insta/parses parsePK
"Exposure to oral didanosine is increased significantly when coadministered
with tenofovir disoproxil fumarate."
Since you were mainly concerned with what ended up in the first phrase,
this was an easy way to look specifically at that behavior.

Instaparse allows you to have ambiguity and to prioritize certain
interpretations with the ordered choice operator, but there might be a more
elegant way to express the grammar.  There may be some people on the
instaparse group who would find it a fun exercise to figure out how to make
your grammar more elegant.  If you continue to have issues, perhaps you
could post some example sentences and how you'd like them to be parsed, and
see if anyone wants to help out.

Also, if the whitespace continues to be a complicating factor, try out the
auto-whitespace feature I mentioned in my last message.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [Job spam] Write Clojure in your pajamas, for decent money in a pleasant company, remote pairing all the time

2013-11-19 Thread Alexey Verkhovsky
On Monday, 18 November 2013 16:45:40 UTC-7, Tony Tam wrote:
>
> If I sent you a like to a github profile that looked like yours (
> https://github.com/alexeyv?tab=repositories), would I ever get an answer? 
> I mean, it's very probable that all your activity is going into private 
> repos.
>

I'd probably send you this link instead: 
https://github.com/thoughtworks/cruisecontrol.rb and explain that the peak 
of my open source activity happened before there was Github. And maybe 
mention the whole "wife/family/kids" thing :)

Besides, I didn't say that stellar resume stands for nothing at all.
So, in short, the answer is "yes". By the way, Tony, your Github looks a 
heck of a lot better than mine.

Back to the original subject of the thread, it looks like either there is 
more Clojure work than people with platform expertise, or Clojure is a 
mostly South American phenomenon. One way or the other, South America is 
the only place I've got any responses from so far. {puzzled}

--Alex

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Alexander Hudek
Sean, for what it's worth many of us do appreciate the slow and careful 
development of java.jdbc. When it's used so widely in production code 
frequent breaking changes are very costly. The new 0.3.0 API is pretty 
nice, though I have found documentation for it somewhat lacking. That said, 
I haven't found time to contribute to it either.

Perhaps this thread isn't the right place, but I am curious about the 
rational and plans for the sql namespace. Is this going to be fleshed out 
to be more fully featured over time? Why choose to integrate it rather than 
have it as a separate add-on? 

Thanks for the work on jdbc. :-)

Alex


On Tuesday, November 19, 2013 2:28:16 PM UTC-5, Sean Corfield wrote:
>
> To Michael: It is fairly up to date - there have only been a few small 
> changes to java.jdbc since the last updates to that part of 
> clojure-doc.org. Now that java.jdbc 0.3.0 has hit beta and has a 
> stable API for release, I feel more comfortable about updating the 
> clojure-doc.org pages to include the handful of changes that are 
> missing. It has been expanded quite a bit from the original version 
> that was part of the clojure.java.jdbc repo. 
>
> I'm a little disappointed that after moving it to clojure-doc.org 
> specifically to remove the CA barrier to entry, none of java.jdbc's 
> users have taken the time to provide updates to the documentation 
> site. The whole point of moving it to clojure-doc.org was to enable 
> community contribution. 
>
> To Andrey: I'm a bit disappointed you didn't offer to contribute to 
> java.jdbc's documentation since you found it lacking, and that you 
> didn't raise your concerns about either the documentation or the API 
> with me, rather than creating your own library based on the old API. 
> Open source projects improve through collaboration. 
>
> That said, there's always room for more libraries and alternative 
> approaches. I'll be a lot happier with java.jdbc when I'm able to 
> strip the old API out after it has been deprecated for a few releases 
> - and I'll point out that the API changes from 0.2.x to 0.3.0 are 
> primarily in response to feedback from Clojure/core. java.jdbc is in 
> fairly heavy production use these days so I'm having to be more 
> conservative about changing it than I would if it were just "my" 
> project and not a Clojure contrib library :) 
>
> Sean 
>
>
> On Sat, Nov 16, 2013 at 9:02 AM, Michael Klishin 
> > wrote: 
> > 
> > 2013/11/16 Andrey Antukh > 
> >> 
> >> 
> >> - Lack of documentation. 
> > 
> > 
> > FTR, there is some documentation for java.jdbc, but it certainly 
> > isn't being actively worked on (despite not being covered by the CA) and 
> may 
> > already be out of date. 
> > 
> > http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html 
> > 
> > If you'd like to contribute: 
> > http://github.com/clojuredocs/guides 
> > -- 
> > MK 
> > 
> > http://github.com/michaelklishin 
> > http://twitter.com/michaelklishin 
> > 
> > -- 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to clojure+u...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>
>
>
> -- 
> Sean A Corfield -- (904) 302-SEAN 
> An Architect's View -- http://corfield.org/ 
> World Singles, LLC. -- http://worldsingles.com/ 
>
> "Perfection is the enemy of the good." 
> -- Gustave Flaubert, French realist novelist (1821-1880) 
>

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


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Joshua Ballanco
In an attempt to be slightly more "elegant" (whatever that means ;-) ):

-8<-8<-

(def start [{:key 3 :value 10} {:key 6 :value 30}])

(into [] (map (fn [[k v]] {:key k :value v})
(merge
(into {} (for [x (range 6)] {x nil}))
(into {} (map (juxt :key :value) start)


;;=> [{:key 6, :value 30} {:key 0, :value nil} {:key 1, :value nil} {:key 2, 
:value nil} {:key 3, :value 10} {:key 4, :value nil} {:key 5, :value nil}]

-8<-8<-

Cheers,

Josh 


On Tuesday, November 19, 2013 at 2:00 PM, Jim - FooBar(); wrote:

> On 19/11/13 11:29, Colin Yates wrote:
> > In Java I would do something like:
> > 
> > // create a convenient look up to avoid nasty N^2 lookups
> > Map keyToValue = new HashMap
> > for (Map kvMap: kvSequence)
> > keyToValue.put(kvMap.get("key"), kvMap.put("value"));
> > 
> > List allKeys = calculateAllKeys();
> > 
> > List> results = new Array
> > for (Object key: allKeys)
> > Object result = keyToValue.get(key); // null is fine for missing keys
> > results.put(key, result);
> > 
> > return results;
> 
> 
> this code doesn't do any sorting of keys so I'm not sure it would give 
> you the exact desired result you posted...
> 
> Jim
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com 
> (mailto:clojure@googlegroups.com)
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com 
> (mailto:clojure+unsubscr...@googlegroups.com)
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> (mailto:clojure+unsubscr...@googlegroups.com).
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread John Mastro
This was my first thought (quite close to Jim's):

(def the-maps [{:key 3 :value 30} {:key 4 :value 40}])

(def mandatory-keys [1 2 3 4 5])

(defn find-missing-keys [maps keys]
  (let [found (into #{} (map :key maps))]
(remove #(contains? found %) keys)))

(defn ensure-mandatory-keys [maps]
  (let [missing (find-missing-keys maps mandatory-keys)]
(sort-by :key (reduce (fn [result key]
(conj result {:key key :value nil}))
  maps
  missing

(ensure-mandatory-keys the-maps)
;; ({:key 1, :value nil}
;;  {:key 2, :value nil}
;;  {:key 3, :value 30}
;;  {:key 4, :value 40}
;;  {:key 5, :value nil})

- John

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Sean Corfield
I'll address the java.jdbc.sql question in a separate thread (I've
actually addressed it before so I'll search the archives and elaborate
on my previous responses). Give me an hour or so...

On Tue, Nov 19, 2013 at 5:03 PM, Alexander Hudek
 wrote:
> Sean, for what it's worth many of us do appreciate the slow and careful
> development of java.jdbc. When it's used so widely in production code
> frequent breaking changes are very costly. The new 0.3.0 API is pretty nice,
> though I have found documentation for it somewhat lacking. That said, I
> haven't found time to contribute to it either.
>
> Perhaps this thread isn't the right place, but I am curious about the
> rational and plans for the sql namespace. Is this going to be fleshed out to
> be more fully featured over time? Why choose to integrate it rather than
> have it as a separate add-on?
>
> Thanks for the work on jdbc. :-)
>
> Alex
>
>
> On Tuesday, November 19, 2013 2:28:16 PM UTC-5, Sean Corfield wrote:
>>
>> To Michael: It is fairly up to date - there have only been a few small
>> changes to java.jdbc since the last updates to that part of
>> clojure-doc.org. Now that java.jdbc 0.3.0 has hit beta and has a
>> stable API for release, I feel more comfortable about updating the
>> clojure-doc.org pages to include the handful of changes that are
>> missing. It has been expanded quite a bit from the original version
>> that was part of the clojure.java.jdbc repo.
>>
>> I'm a little disappointed that after moving it to clojure-doc.org
>> specifically to remove the CA barrier to entry, none of java.jdbc's
>> users have taken the time to provide updates to the documentation
>> site. The whole point of moving it to clojure-doc.org was to enable
>> community contribution.
>>
>> To Andrey: I'm a bit disappointed you didn't offer to contribute to
>> java.jdbc's documentation since you found it lacking, and that you
>> didn't raise your concerns about either the documentation or the API
>> with me, rather than creating your own library based on the old API.
>> Open source projects improve through collaboration.
>>
>> That said, there's always room for more libraries and alternative
>> approaches. I'll be a lot happier with java.jdbc when I'm able to
>> strip the old API out after it has been deprecated for a few releases
>> - and I'll point out that the API changes from 0.2.x to 0.3.0 are
>> primarily in response to feedback from Clojure/core. java.jdbc is in
>> fairly heavy production use these days so I'm having to be more
>> conservative about changing it than I would if it were just "my"
>> project and not a Clojure contrib library :)
>>
>> Sean
>>
>>
>> On Sat, Nov 16, 2013 at 9:02 AM, Michael Klishin
>>  wrote:
>> >
>> > 2013/11/16 Andrey Antukh 
>> >>
>> >>
>> >> - Lack of documentation.
>> >
>> >
>> > FTR, there is some documentation for java.jdbc, but it certainly
>> > isn't being actively worked on (despite not being covered by the CA) and
>> > may
>> > already be out of date.
>> >
>> > http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html
>> >
>> > If you'd like to contribute:
>> > http://github.com/clojuredocs/guides
>> > --
>> > MK
>> >
>> > http://github.com/michaelklishin
>> > http://twitter.com/michaelklishin
>> >
>> > --
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Clojure" group.
>> > To post to this group, send email to clo...@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+u...@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 unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to clojure+u...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>> --
>> Sean A Corfield -- (904) 302-SEAN
>> An Architect's View -- http://corfield.org/
>> World Singles, LLC. -- http://worldsingles.com/
>>
>> "Perfection is the enemy of the good."
>> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/gro

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Sean Corfield
On Tue, Nov 19, 2013 at 2:28 PM, Michael Klishin
 wrote:
> 2013/11/20 Andrey Antukh 
>> About license question: if these functions had not copied, but written
>> from scratch, them would be the same functions with minimal differences or
>> none...
> Sorry but that's a ridiculous argument. You must respect and obey by the
> license of the project you take code
> from.

Thank you Michael.

Any company that uses Andrey's library at this point is immediately in
a difficult position from a legal standpoint...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Cedric Greevey
On Tue, Nov 19, 2013 at 10:02 AM, James Reeves wrote:
>
>
> I think in this case it's more a problem with the Java API, which the fs
> library wraps. Until Java 7, I don't think relative path normalisation
> existed in the core Java libraries.
>
>
It didn't, and .toPath isn't in the 1.6 java.io.File class in particular.
1.6 gives you these options:

user=> (reduce #(File. %1 %2) ["one" "two" ".." "three"])
#

user=> (.getCanonicalFile (reduce #(File. %1 %2) ["one" "two" ".."
"three"]))
#

user=> (.getPath (reduce #(File. %1 %2) ["one" "two" ".." "three"]))
"one\\two\\..\\three"

Of these only getCanonicalFile normalizes, but it also makes it absolute,
treating it as having been relative to (on the Win32 box I tested it on)
the OS system directory of all places.

It *is* interesting that Ruby Pathname objects and Java File objects get
printed very similarly by Ruby and Clojure, respectively.

I assume that / will replace \ as the separator (and the base directory
used by getCanonicalFile will vary) if the above is used on other operating
systems' JVMs.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


java.jdbc DSLs (java.jdbc.sql / java.jdbc.ddl)

2013-11-19 Thread Sean Corfield
In response to the (very reasonable) question from Alex Hudek in a
recent thread, here are some of my responses to questions that have
arisen about the inclusion of the minimal DSLs in the java.jdbc
contrib library:

> Just wondering if the intention is to make the DSL the primary way to work
> with the API or if clojure.java.jdbc.sql will be completely optional?

Completely optional.

The idea is just to provide some (optional) sugar for common
operations. I have no intention of going particularly deep on the DSL.

If folks want a full DSL for SQL in Clojure, I'd suggest
https://github.com/jkk/honeysql or http://sqlkorma.com - the former is
a DSL to generate SQL that is compatible with clojure.java.jdbc, the
latter is a DSL that wraps clojure.java.jdbc.

> Using the latest release of java.jdbc, does anybody know how I can
> construct a where clause when I want to check if the value is one of many 
> values?

clojure.java.jdbc.sql is a deliberately minimal DSL - Justin Kramer's
HoneySQL is what I recommend for more expressive SQL construction
(that's the "official" recommendation based on discussions Justin and
I had about java.jdbc and HoneySQL at Clojure/conj 2012).

> I want to generate sql string using clojure.java.jdbc.sql   for   eg.
>
> "SELECT  B.ID , B.TITLE ,B.AUTHOR , C.CATEGORY , S.STATUS
> FROM  BOOK B ,CATEGORY C , STATUS S
> WHERE (B.CATEGORY_ID=C.ID) AND
>  (B.STATUS_ID = B.ID) AND
>  (B.TITLE LIKE "%TOM%")"
>
> How to do this using clojure.java.jdbc.sql   dsl functions?

The basic DSL cannot do 'like' so you probably want to look at
HoneySQL which is the recommended way to extend clojure.java.jdbc.

===

The justification for the DSL at all is that it provides some sugar
for simple, common usage and also provides a template for other more
expansive DSLs that the community might write, by showing what the
primary API expects in terms of SQL strings and parameter vectors.

At World Singles, we use the basic DSL to support a lot of "CRUD"
operations that are doing simple lookups, basic joins, and so on - and
we rely on HoneySQL for our reporting queries and anything that is
substantially more complex than the basic DSL offers.

Will the DSL be expanded to support some additional common SQL operations?

Perhaps, based on user feedback - assuming people want something
between raw strings and the sophistication of HoneySQL (or any other
DSL that the community may produce).
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-19 Thread Sean Corfield
Yes, the path separator is O/S dependent:

user> (import '(java.io File))
java.io.File
user> (reduce #(File. %1 %2) ["one" "two" ".." "three"])
#
user>  (.getCanonicalFile (reduce #(File. %1 %2) ["one" "two" ".." "three"]))
#
user> (.getPath (reduce #(File. %1 %2) ["one" "two" ".." "three"]))
"one/two/../three"

Note that .getCanonicalFile renders the file path relative to the
directory in which the REPL's JVM instance was started.

Sean

On Tue, Nov 19, 2013 at 7:02 PM, Cedric Greevey  wrote:
> On Tue, Nov 19, 2013 at 10:02 AM, James Reeves 
> wrote:
>>
>>
>> I think in this case it's more a problem with the Java API, which the fs
>> library wraps. Until Java 7, I don't think relative path normalisation
>> existed in the core Java libraries.
>>
>
> It didn't, and .toPath isn't in the 1.6 java.io.File class in particular.
> 1.6 gives you these options:
>
> user=> (reduce #(File. %1 %2) ["one" "two" ".." "three"])
> #
>
> user=> (.getCanonicalFile (reduce #(File. %1 %2) ["one" "two" ".."
> "three"]))
> #
>
> user=> (.getPath (reduce #(File. %1 %2) ["one" "two" ".." "three"]))
> "one\\two\\..\\three"
>
> Of these only getCanonicalFile normalizes, but it also makes it absolute,
> treating it as having been relative to (on the Win32 box I tested it on) the
> OS system directory of all places.
>
> It *is* interesting that Ruby Pathname objects and Java File objects get
> printed very similarly by Ruby and Clojure, respectively.
>
> I assume that / will replace \ as the separator (and the base directory used
> by getCanonicalFile will vary) if the above is used on other operating
> systems' JVMs.
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

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

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


Get "OutOfMemoryError Java heap space" when parsing big log file

2013-11-19 Thread Jiaqi Liu
Hi,all
I want to parse big log files using Clojure.
And the structure of each line record is
"UserID,Lantitude,Lontitude,Timestamp".
My implemented steps are:
> Read log file & Get top-n user list
> Find each top-n user's records and store in separate log file
(UserID.log) .

The implement source code :
;==
(defn parse-file
  ""
  [file n]
  (with-open [rdr (io/reader file)]
(println "001 begin with open ")
(let [lines (line-seq rdr)
  res (parse-recur lines)
  sorted
  (into (sorted-map-by (fn [key1 key2]
 (compare [(get res key2) key2]
  [(get res key1) key1])))
res)]
  (println "Statistic result : " res)
  (println "Top-N User List : " sorted)
  (find-write-recur lines sorted n)
  )))

(defn parse-recur
  ""
  [lines]
  (loop [ls  lines
 res {}]
(if ls
  (recur (next ls)
   (update-res res (first ls)))
  res)))

(defn update-res
  ""
  [res line]
  (let [params (string/split line #",")
id (if (> (count params) 1) (params 0) "0")]
(if (res id)
  (update-in res [id] inc)
  (assoc res id 1

(defn find-write-recur
  "Get each users' records and store into separate log file"
  [lines sorted n]
  (loop [x n
 sd sorted
 id (first (keys sd))]
(if (and (> x 0) sd)
  (do (create-write-file id
 (find-recur lines id))
  (recur (dec x)
 (rest sd)
 (nth (keys sd) 1))

(defn find-recur
  ""
  [lines id]
  (loop [ls lines
   res []]
(if ls
  (recur (next ls)
   (update-vec res id (first ls)))
  res)))

(defn update-vec
  ""
  [res id line]
  (let [params (string/split line #",")
id_(if (> (count params) 1) (params 0) "0")]
(if (= id id_ )
  (conj res line)
  res)))

(defn create-write-file
  "Create a new file and write information into the file."
  ([file info-lines]
   (with-open [wr (io/writer (str MAIN-PATH file))]
 (doseq [line info-lines] (.write wr (str line "\n")))
 ))
  ([file info-lines append?]
   (with-open [wr (io/writer (str MAIN-PATH file) :append append?)]
 (doseq [line info-lines] (.write wr (str line "\n"
   ))
;==

I tested this clj in REPL with command (parse-file "./DATA/log.log" 3), and
get the results:

Records Size  Time  Result
1,000 42KB <1s OK
10,000   420KB   <1s OK
100,000  4.3MB3s  OK
1,000,000   43MB 15s OK
6,000,000   258MB   >20M  "OutOfMemoryError Java heap space
 java.lang.String.substring (String.java:1913)"

==
Here is the question:
1. how can i fix the error when i try to parse big log file , like > 200MB
2. how can i optimize the function to run faster ?
3. there are logs more than 1G size , how can the function deal with it.

I am still new to Clojure, any suggestion or solution will be appreciate~
Thanks

BR



刘家齐 (Jacky Liu)



手机:15201091195邮箱:liujiaq...@gmail.com

Skype:jacky_liu_1987   QQ:406229156

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Get "OutOfMemoryError Java heap space" when parsing big log file

2013-11-19 Thread Mark Engelberg
Looks like you're "holding on to the head" by giving a name (lines) to the
result of line-seq.  Don't do that.  Try:
(parse-recur (line-seq rdr))


On Tue, Nov 19, 2013 at 7:27 PM, Jiaqi Liu  wrote:

> Hi,all
> I want to parse big log files using Clojure.
> And the structure of each line record is
> "UserID,Lantitude,Lontitude,Timestamp".
> My implemented steps are:
> > Read log file & Get top-n user list
> > Find each top-n user's records and store in separate log file
> (UserID.log) .
>
> The implement source code :
> ;==
> (defn parse-file
>   ""
>   [file n]
>   (with-open [rdr (io/reader file)]
> (println "001 begin with open ")
> (let [lines (line-seq rdr)
>   res (parse-recur lines)
>   sorted
>   (into (sorted-map-by (fn [key1 key2]
>  (compare [(get res key2) key2]
>   [(get res key1) key1])))
> res)]
>   (println "Statistic result : " res)
>   (println "Top-N User List : " sorted)
>   (find-write-recur lines sorted n)
>   )))
>
> (defn parse-recur
>   ""
>   [lines]
>   (loop [ls  lines
>  res {}]
> (if ls
>   (recur (next ls)
>(update-res res (first ls)))
>   res)))
>
> (defn update-res
>   ""
>   [res line]
>   (let [params (string/split line #",")
> id (if (> (count params) 1) (params 0) "0")]
> (if (res id)
>   (update-in res [id] inc)
>   (assoc res id 1
>
> (defn find-write-recur
>   "Get each users' records and store into separate log file"
>   [lines sorted n]
>   (loop [x n
>  sd sorted
>  id (first (keys sd))]
> (if (and (> x 0) sd)
>   (do (create-write-file id
>  (find-recur lines id))
>   (recur (dec x)
>  (rest sd)
>  (nth (keys sd) 1))
>
> (defn find-recur
>   ""
>   [lines id]
>   (loop [ls lines
>res []]
> (if ls
>   (recur (next ls)
>(update-vec res id (first ls)))
>   res)))
>
> (defn update-vec
>   ""
>   [res id line]
>   (let [params (string/split line #",")
> id_(if (> (count params) 1) (params 0) "0")]
> (if (= id id_ )
>   (conj res line)
>   res)))
>
> (defn create-write-file
>   "Create a new file and write information into the file."
>   ([file info-lines]
>(with-open [wr (io/writer (str MAIN-PATH file))]
>  (doseq [line info-lines] (.write wr (str line "\n")))
>  ))
>   ([file info-lines append?]
>(with-open [wr (io/writer (str MAIN-PATH file) :append append?)]
>  (doseq [line info-lines] (.write wr (str line "\n"
>))
> ;==
>
> I tested this clj in REPL with command (parse-file "./DATA/log.log" 3),
> and get the results:
>
> Records Size  Time  Result
> 1,000 42KB <1s OK
> 10,000   420KB   <1s OK
> 100,000  4.3MB3s  OK
> 1,000,000   43MB 15s OK
> 6,000,000   258MB   >20M  "OutOfMemoryError Java heap space
>  java.lang.String.substring (String.java:1913)"
>
> ==
> Here is the question:
> 1. how can i fix the error when i try to parse big log file , like > 200MB
> 2. how can i optimize the function to run faster ?
> 3. there are logs more than 1G size , how can the function deal with it.
>
> I am still new to Clojure, any suggestion or solution will be appreciate~
> Thanks
>
> BR
>
> 
>
> 刘家齐 (Jacky Liu)
>
>
>
> 手机:15201091195邮箱:liujiaq...@gmail.com
>
> Skype:jacky_liu_1987   QQ:406229156
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

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

Re: parse a text file that has some binary characters

2013-11-19 Thread John Mastro
On Tue, Nov 19, 2013 at 6:24 AM, smk  wrote:

> Hi
> I am trying to parse a text file that has some binary characters(such as
> 0x001 or 0x002) and replace them with text characters.
> How to do it in clojure?
>

Would something like this work?

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

(def replace-chars
  "A map of characters to their replacements."
  (let [m {0x01 \X, 0x02 \Y, 0x03 \Z}]
(into {} (map (fn [[k v]] [(char k) v])
  m

(defn read-lines [filename]
  (with-open [rdr (io/reader filename)]
(doall (line-seq rdr

(defn read-and-replace [filename]
  (for [line (read-lines filename)]
(apply str (map #(get replace-chars % %) line

I tried it like this:

(def test-file "/home/jbm/text-and-binary.txt")

(defn create-test-file [filename]
  (with-open [wtr (io/writer filename)]
(.write wtr "foo")
(.write wtr 0x01)
(.write wtr "bar")
(.write wtr 0x02)
(.write wtr "baz")))

(create-test-file test-file)

(read-lines test-file)   ;=> ("foo^Abar^Bbaz")
(read-and-replace test-file) ;=> ("fooXbarYbaz")

- John

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Get "OutOfMemoryError Java heap space" when parsing big log file

2013-11-19 Thread Jiaqi Liu
hi,Mark ,thanks for your suggestion.
I modified the main function  to :
;
(defn parse-file
  ""
  [file n]
  (with-open [rdr (io/reader file)]
(println "001 begin with open " (type rdr))
(let [;lines (line-seq rdr)
  *res (parse-recur (line-seq rdr))*;lines)
  sorted
  (into (sorted-map-by (fn [key1 key2]
 (compare [(get res key2) key2]
  [(get res key1) key1])))
res)]
  (println "Statistic result : " res)
  (println "Sorted result : " sorted)
  ;(println "..." (type rdr))
  ;(find-write-recur lines sorted n)
  *(find-write-recur (line-seq rdr) sorted n)*
  )))
;
But it's wired , i got this error:

com.util=> (parse-file "./log600w.log" 3)

001 begin with open  java.io.BufferedReader


com.util=> *OutOfMemoryError GC overhead limit exceeded
 java.util.regex.Pattern.matcher (Pattern.java:1088)*





2013/11/20 Mark Engelberg 

> Looks like you're "holding on to the head" by giving a name (lines) to the
> result of line-seq.  Don't do that.  Try:
> (parse-recur (line-seq rdr))
>
>
> On Tue, Nov 19, 2013 at 7:27 PM, Jiaqi Liu  wrote:
>
>> Hi,all
>> I want to parse big log files using Clojure.
>> And the structure of each line record is
>> "UserID,Lantitude,Lontitude,Timestamp".
>> My implemented steps are:
>> > Read log file & Get top-n user list
>> > Find each top-n user's records and store in separate log file
>> (UserID.log) .
>>
>> The implement source code :
>> ;==
>> (defn parse-file
>>   ""
>>   [file n]
>>   (with-open [rdr (io/reader file)]
>> (println "001 begin with open ")
>> (let [lines (line-seq rdr)
>>   res (parse-recur lines)
>>   sorted
>>   (into (sorted-map-by (fn [key1 key2]
>>  (compare [(get res key2) key2]
>>   [(get res key1) key1])))
>> res)]
>>   (println "Statistic result : " res)
>>   (println "Top-N User List : " sorted)
>>   (find-write-recur lines sorted n)
>>   )))
>>
>> (defn parse-recur
>>   ""
>>   [lines]
>>   (loop [ls  lines
>>  res {}]
>> (if ls
>>   (recur (next ls)
>>(update-res res (first ls)))
>>   res)))
>>
>> (defn update-res
>>   ""
>>   [res line]
>>   (let [params (string/split line #",")
>> id (if (> (count params) 1) (params 0) "0")]
>> (if (res id)
>>   (update-in res [id] inc)
>>   (assoc res id 1
>>
>> (defn find-write-recur
>>   "Get each users' records and store into separate log file"
>>   [lines sorted n]
>>   (loop [x n
>>  sd sorted
>>  id (first (keys sd))]
>> (if (and (> x 0) sd)
>>   (do (create-write-file id
>>  (find-recur lines id))
>>   (recur (dec x)
>>  (rest sd)
>>  (nth (keys sd) 1))
>>
>> (defn find-recur
>>   ""
>>   [lines id]
>>   (loop [ls lines
>>res []]
>> (if ls
>>   (recur (next ls)
>>(update-vec res id (first ls)))
>>   res)))
>>
>> (defn update-vec
>>   ""
>>   [res id line]
>>   (let [params (string/split line #",")
>> id_(if (> (count params) 1) (params 0) "0")]
>> (if (= id id_ )
>>   (conj res line)
>>   res)))
>>
>> (defn create-write-file
>>   "Create a new file and write information into the file."
>>   ([file info-lines]
>>(with-open [wr (io/writer (str MAIN-PATH file))]
>>  (doseq [line info-lines] (.write wr (str line "\n")))
>>  ))
>>   ([file info-lines append?]
>>(with-open [wr (io/writer (str MAIN-PATH file) :append append?)]
>>  (doseq [line info-lines] (.write wr (str line "\n"
>>))
>> ;==
>>
>> I tested this clj in REPL with command (parse-file "./DATA/log.log" 3),
>> and get the results:
>>
>> Records Size  Time  Result
>> 1,000 42KB <1s OK
>> 10,000   420KB   <1s OK
>> 100,000  4.3MB3s  OK
>> 1,000,000   43MB 15s OK
>> 6,000,000   258MB   >20M  "OutOfMemoryError Java heap space
>>  java.lang.String.substring (String.java:1913)"
>>
>> ==
>> Here is the question:
>> 1. how can i fix the error when i try to parse big log file , like > 200MB
>> 2. how can i optimize the function to run faster ?
>> 3. there are logs more than 1G size , how can the function deal with it.
>>
>> I am still new to Clojure, any suggestion or solution will be appreciate~
>> Thanks
>>
>> BR
>>
>> 
>>
>> 刘家齐 (Jacky Liu)
>>
>>
>>
>> 手机:15201091195邮箱:liujiaq...@gmail.com
>>
>> Skype:jacky_liu_1987   QQ:406229156
>>

Re: Get "OutOfMemoryError Java heap space" when parsing big log file

2013-11-19 Thread Jiaqi Liu
sorry, i mean "weird"...


2013/11/20 Jiaqi Liu 

> hi,Mark ,thanks for your suggestion.
> I modified the main function  to :
> ;
> (defn parse-file
>   ""
>   [file n]
>   (with-open [rdr (io/reader file)]
> (println "001 begin with open " (type rdr))
> (let [;lines (line-seq rdr)
>   *res (parse-recur (line-seq rdr))*;lines)
>   sorted
>   (into (sorted-map-by (fn [key1 key2]
>  (compare [(get res key2) key2]
>   [(get res key1) key1])))
> res)]
>   (println "Statistic result : " res)
>   (println "Sorted result : " sorted)
>   ;(println "..." (type rdr))
>   ;(find-write-recur lines sorted n)
>   *(find-write-recur (line-seq rdr) sorted n)*
>   )))
> ;
> But it's wired , i got this error:
>
> com.util=> (parse-file "./log600w.log" 3)
>
> 001 begin with open  java.io.BufferedReader
>
>
> com.util=> *OutOfMemoryError GC overhead limit exceeded
>  java.util.regex.Pattern.matcher (Pattern.java:1088)*
>
>
>
>
>
> 2013/11/20 Mark Engelberg 
>
>> Looks like you're "holding on to the head" by giving a name (lines) to
>> the result of line-seq.  Don't do that.  Try:
>> (parse-recur (line-seq rdr))
>>
>>
>> On Tue, Nov 19, 2013 at 7:27 PM, Jiaqi Liu  wrote:
>>
>>> Hi,all
>>> I want to parse big log files using Clojure.
>>> And the structure of each line record is
>>> "UserID,Lantitude,Lontitude,Timestamp".
>>> My implemented steps are:
>>> > Read log file & Get top-n user list
>>> > Find each top-n user's records and store in separate log file
>>> (UserID.log) .
>>>
>>> The implement source code :
>>> ;==
>>> (defn parse-file
>>>   ""
>>>   [file n]
>>>   (with-open [rdr (io/reader file)]
>>> (println "001 begin with open ")
>>> (let [lines (line-seq rdr)
>>>   res (parse-recur lines)
>>>   sorted
>>>   (into (sorted-map-by (fn [key1 key2]
>>>  (compare [(get res key2) key2]
>>>   [(get res key1) key1])))
>>> res)]
>>>   (println "Statistic result : " res)
>>>   (println "Top-N User List : " sorted)
>>>   (find-write-recur lines sorted n)
>>>   )))
>>>
>>> (defn parse-recur
>>>   ""
>>>   [lines]
>>>   (loop [ls  lines
>>>  res {}]
>>> (if ls
>>>   (recur (next ls)
>>>(update-res res (first ls)))
>>>   res)))
>>>
>>> (defn update-res
>>>   ""
>>>   [res line]
>>>   (let [params (string/split line #",")
>>> id (if (> (count params) 1) (params 0) "0")]
>>> (if (res id)
>>>   (update-in res [id] inc)
>>>   (assoc res id 1
>>>
>>> (defn find-write-recur
>>>   "Get each users' records and store into separate log file"
>>>   [lines sorted n]
>>>   (loop [x n
>>>  sd sorted
>>>  id (first (keys sd))]
>>> (if (and (> x 0) sd)
>>>   (do (create-write-file id
>>>  (find-recur lines id))
>>>   (recur (dec x)
>>>  (rest sd)
>>>  (nth (keys sd) 1))
>>>
>>> (defn find-recur
>>>   ""
>>>   [lines id]
>>>   (loop [ls lines
>>>res []]
>>> (if ls
>>>   (recur (next ls)
>>>(update-vec res id (first ls)))
>>>   res)))
>>>
>>> (defn update-vec
>>>   ""
>>>   [res id line]
>>>   (let [params (string/split line #",")
>>> id_(if (> (count params) 1) (params 0) "0")]
>>> (if (= id id_ )
>>>   (conj res line)
>>>   res)))
>>>
>>> (defn create-write-file
>>>   "Create a new file and write information into the file."
>>>   ([file info-lines]
>>>(with-open [wr (io/writer (str MAIN-PATH file))]
>>>  (doseq [line info-lines] (.write wr (str line "\n")))
>>>  ))
>>>   ([file info-lines append?]
>>>(with-open [wr (io/writer (str MAIN-PATH file) :append append?)]
>>>  (doseq [line info-lines] (.write wr (str line "\n"
>>>))
>>> ;==
>>>
>>> I tested this clj in REPL with command (parse-file "./DATA/log.log" 3),
>>> and get the results:
>>>
>>> Records Size  Time  Result
>>> 1,000 42KB <1s OK
>>> 10,000   420KB   <1s OK
>>> 100,000  4.3MB3s  OK
>>> 1,000,000   43MB 15s OK
>>> 6,000,000   258MB   >20M  "OutOfMemoryError Java heap space
>>>  java.lang.String.substring (String.java:1913)"
>>>
>>> ==
>>> Here is the question:
>>> 1. how can i fix the error when i try to parse big log file , like >
>>> 200MB
>>> 2. how can i optimize the function to run faster ?
>>> 3. there are logs more than 1G size , how can the function deal with it.
>>>
>>> I am still new to Clojure

Re: Question regarding core.async

2013-11-19 Thread bob
I write a test to produce it,just run the fact several times quickly, and 
we can see that (println "3" v (java.util.Date.) only be executed one time.

(defn handler [c]
  (go
   (let []
 (loop []
   (when-let [v (! c "hello"))
(alts!! [c (timeout 3000)])
(println "4" (java.util.Date.))
""
=> nil?))

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Kelker Ryan
Maybe this?

user> (defn ensure-mandatory 
" coll - keys of required maps
  maps - collection of maps"
[coll maps]
(loop [adding (clojure.set/difference
   (set coll)
   (->> maps (map keys) flatten set))
   all maps]
  (if-let [k (first adding)]
(recur
 (rest adding)
 (conj all (hash-map k nil)))
all)))

'user/ensure-mandatory#

user> (def my-map
[{:3 true} 
 {:4 true} 
 {"c" :c-value} 
 {"d" :d-value}])
'user/my-map#

user> (def mandatory [:1 "2" "c"])
'user/mandatory#

user> (ensure-mandatory mandatory my-map)
[{:3 true} {:4 true} {"c" :c-value} {"d" :d-value} {:1 nil} {"2" nil}]


20.11.2013, 11:33, "John Mastro" :
> This was my first thought (quite close to Jim's):
>
> (def the-maps [{:key 3 :value 30} {:key 4 :value 40}])
>
> (def mandatory-keys [1 2 3 4 5])
>
> (defn find-missing-keys [maps keys]
>   (let [found (into #{} (map :key maps))]
>     (remove #(contains? found %) keys)))
>
> (defn ensure-mandatory-keys [maps]
>   (let [missing (find-missing-keys maps mandatory-keys)]
>     (sort-by :key (reduce (fn [result key]
>                             (conj result {:key key :value nil}))
>                           maps
>                           missing
>
> (ensure-mandatory-keys the-maps)
> ;; ({:key 1, :value nil}
> ;;  {:key 2, :value nil}
> ;;  {:key 3, :value 30}
> ;;  {:key 4, :value 40}
> ;;  {:key 5, :value nil})
>
> - John
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Padding missing elements in a sequence of identical K/V maps

2013-11-19 Thread Kelker Ryan
Maybe this?

user> (defn ensure-mandatory
" coll - keys of required maps
  maps - collection of maps"
[coll maps]
(loop [adding (clojure.set/difference
   (set coll)
   (->> maps (map keys) flatten set))
   all maps]
  (if-let [k (first adding)]
(recur
 (rest adding)
 (conj all (hash-map k nil)))
all)))

'user/ensure-mandatory#

user> (def my-map
[{:3 true}
 {:4 true}
 {"c" :c-value}
 {"d" :d-value}])
'user/my-map#

user> (def mandatory [:1 "2" "c"])
'user/mandatory#

user> (ensure-mandatory mandatory my-map)
[{:3 true} {:4 true} {"c" :c-value} {"d" :d-value} {:1 nil} {"2" nil}]

20.11.2013, 11:33, "John Mastro" :
> This was my first thought (quite close to Jim's):
>
> (def the-maps [{:key 3 :value 30} {:key 4 :value 40}])
>
> (def mandatory-keys [1 2 3 4 5])
>
> (defn find-missing-keys [maps keys]
>   (let [found (into #{} (map :key maps))]
>     (remove #(contains? found %) keys)))
>
> (defn ensure-mandatory-keys [maps]
>   (let [missing (find-missing-keys maps mandatory-keys)]
>     (sort-by :key (reduce (fn [result key]
>                             (conj result {:key key :value nil}))
>                           maps
>                           missing
>
> (ensure-mandatory-keys the-maps)
> ;; ({:key 1, :value nil}
> ;;  {:key 2, :value nil}
> ;;  {:key 3, :value 30}
> ;;  {:key 4, :value 40}
> ;;  {:key 5, :value nil})
>
> - John
>
> --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Compojure session handling across concurrent requests

2013-11-19 Thread Binita
Hello everyone,

I have a long running POST request which updates the session with the 
requested result.

Now, when such concurrent POST requests are made from the same session, the 
updates done
in concurrent request don't get visibility across each other.

The effect is that, the session updates done in few concurrent request are 
eventually lost.

How is such a scenario supposed to be handled ?

Thanks
Binita

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Get "OutOfMemoryError Java heap space" when parsing big log file

2013-11-19 Thread Mark Engelberg
Yeah, I see now that you're still holding on to the head because a name is
given to the line sequence in the functions that you call.
One option would be making parse-recur and related functions that take
lines as an input into a macro.

You could also try:

(defn parse-recur
  ""
  [ls res]
(if ls
  (recur (next ls)
   (update-res res (first ls)))
  res))

and calling (parse-recur (line-seq rdr) {})

This way, the recur goes back to the main function entry point and ls is
overwritten, so nothing is holding on to the head.  Make similar changes to
the other functions.



On Tue, Nov 19, 2013 at 8:07 PM, Jiaqi Liu  wrote:

> sorry, i mean "weird"...
>
>
> 2013/11/20 Jiaqi Liu 
>
>> hi,Mark ,thanks for your suggestion.
>> I modified the main function  to :
>> ;
>> (defn parse-file
>>   ""
>>   [file n]
>>   (with-open [rdr (io/reader file)]
>> (println "001 begin with open " (type rdr))
>> (let [;lines (line-seq rdr)
>>   *res (parse-recur (line-seq rdr))*;lines)
>>sorted
>>   (into (sorted-map-by (fn [key1 key2]
>>  (compare [(get res key2) key2]
>>   [(get res key1) key1])))
>> res)]
>>   (println "Statistic result : " res)
>>   (println "Sorted result : " sorted)
>>   ;(println "..." (type rdr))
>>   ;(find-write-recur lines sorted n)
>>   *(find-write-recur (line-seq rdr) sorted n)*
>>   )))
>> ;
>> But it's wired , i got this error:
>>
>> com.util=> (parse-file "./log600w.log" 3)
>>
>> 001 begin with open  java.io.BufferedReader
>>
>>
>> com.util=> *OutOfMemoryError GC overhead limit exceeded
>>  java.util.regex.Pattern.matcher (Pattern.java:1088)*
>>
>>
>>
>>
>>
>> 2013/11/20 Mark Engelberg 
>>
>>> Looks like you're "holding on to the head" by giving a name (lines) to
>>> the result of line-seq.  Don't do that.  Try:
>>> (parse-recur (line-seq rdr))
>>>
>>>
>>> On Tue, Nov 19, 2013 at 7:27 PM, Jiaqi Liu  wrote:
>>>
 Hi,all
 I want to parse big log files using Clojure.
 And the structure of each line record is
 "UserID,Lantitude,Lontitude,Timestamp".
 My implemented steps are:
 > Read log file & Get top-n user list
 > Find each top-n user's records and store in separate log file
 (UserID.log) .

 The implement source code :
 ;==
 (defn parse-file
   ""
   [file n]
   (with-open [rdr (io/reader file)]
 (println "001 begin with open ")
 (let [lines (line-seq rdr)
   res (parse-recur lines)
   sorted
   (into (sorted-map-by (fn [key1 key2]
  (compare [(get res key2) key2]
   [(get res key1) key1])))
 res)]
   (println "Statistic result : " res)
   (println "Top-N User List : " sorted)
   (find-write-recur lines sorted n)
   )))

 (defn parse-recur
   ""
   [lines]
   (loop [ls  lines
  res {}]
 (if ls
   (recur (next ls)
(update-res res (first ls)))
   res)))

 (defn update-res
   ""
   [res line]
   (let [params (string/split line #",")
 id (if (> (count params) 1) (params 0) "0")]
 (if (res id)
   (update-in res [id] inc)
   (assoc res id 1

 (defn find-write-recur
   "Get each users' records and store into separate log file"
   [lines sorted n]
   (loop [x n
  sd sorted
  id (first (keys sd))]
 (if (and (> x 0) sd)
   (do (create-write-file id
  (find-recur lines id))
   (recur (dec x)
  (rest sd)
  (nth (keys sd) 1))

 (defn find-recur
   ""
   [lines id]
   (loop [ls lines
res []]
 (if ls
   (recur (next ls)
(update-vec res id (first ls)))
   res)))

 (defn update-vec
   ""
   [res id line]
   (let [params (string/split line #",")
 id_(if (> (count params) 1) (params 0) "0")]
 (if (= id id_ )
   (conj res line)
   res)))

 (defn create-write-file
   "Create a new file and write information into the file."
   ([file info-lines]
(with-open [wr (io/writer (str MAIN-PATH file))]
  (doseq [line info-lines] (.write wr (str line "\n")))
  ))
   ([file info-lines append?]
(with-open [wr (io/writer (str MAIN-PATH file) :append append?)]
  (doseq [line info-lines] (.write wr (str line "\n"
))
 ;==

 I tested this

Re: Question regarding core.async

2013-11-19 Thread Timothy Baldridge
This took me a few minutes to figure out, but it's a race condition in your
code. There are two things attempting to read from the channel, and one
attempting to write. This means sometimes the "hello" put into the channel
will be read out right away by the alts!!. If the handler is sleeping, then
this will happen every time.

Instead of using a single channel, have the handler accept a in channel and
an out channel. Then put "hello" into the input and alts!! will take from
the output.

Also, (put! c "hello") is exactly like (go (>! c "hello")) but it is much
faster.

Timothy Baldridge


On Tue, Nov 19, 2013 at 9:58 PM, bob  wrote:

> I write a test to produce it,just run the fact several times quickly, and
> we can see that (println "3" v (java.util.Date.) only be executed one time.
>
> (defn handler [c]
>   (go
>(let []
>  (loop []
>(when-let [v (  (println "2" (java.util.Date.))
>  (Thread/sleep 4000)
>  (println "3" v (java.util.Date.))
>  (recur))
>(println "existing...")
>
> (def c (chan))
>  (handler c)
>
> (fact "test timeout"
>   (let []
> (println "1" (java.util.Date.))
> (go (>! c "hello"))
> (alts!! [c (timeout 3000)])
> (println "4" (java.util.Date.))
> ""
> => nil?))
>
>  --
> --
> 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 unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
“One of the main causes of the fall of the Roman Empire was that–lacking
zero–they had no way to indicate successful termination of their C
programs.”
(Robert Firth)

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ClojureCLR] Clojure.Compile.exe

2013-11-19 Thread Joshua Ballanco
…and just yesterday a ticket was opened to address at the very least warning 
when this happens: http://dev.clojure.org/jira/browse/CLJ-1297 . If you've 
wasted valuable development hours on this, up votes would be appreciated ;-)

- Josh



On Tuesday, November 19, 2013 at 10:10 PM, dmiller wrote:

> ClojureCLR follows ClojureJVM in translating hyphens in namespace names to 
> underscores in filenames.
>  
> -David
>  
>  
> On Tuesday, November 19, 2013 11:00:37 AM UTC-6, Frank Hale wrote:
> > Thanks Shantanu, I will look into lein-clr.
> >  
> >  
> > On Tue, Nov 19, 2013 at 11:57 AM, Frank Hale  > (javascript:)> wrote:
> > > Ugh, as it always goes right after posting to a mailing list you find out 
> > > what the problem is. My clojure source file name was the problem. I had a 
> > > dash in the filename and apparently that is a problem. All is well. LOL!
> > >  
> > >  
> > > On Tue, Nov 19, 2013 at 11:54 AM, Shantanu Kumar  > > (javascript:)> wrote:
> > > > Hi Frank,
> > > >  
> > > > (Saw your post shared on ClojureCLR Google+ but was unable to comment.) 
> > > >  
> > > >  
> > > > This may be slightly tangential but you might want to look at lein-clr: 
> > > > https://github.com/kumarshantanu/lein-clr  
> > > >  
> > > > It makes these things easier to do on the command-line. You need to 
> > > > install Java and Leiningen to run lein-clr. It automatically takes care 
> > > > of setting CLOJURE_LOAD_PATH and CLOJURE_COMPILE_PATH environment 
> > > > variables.
> > > >  
> > > > Shantanu
> > > >  
> > > >  
> > > > On Tuesday, 19 November 2013 22:18:07 UTC+5:30, Frank Hale wrote:
> > > > > I'm using Clojure-CLR 1.5 and cannot get a simple hello,world to 
> > > > > compile into an executable using Clojure.Compile.exe.
> > > > >  
> > > > > Code:
> > > > >  
> > > > > (ns clojureclr-test
> > > > > (:gen-class))
> > > > >  
> > > > > (defn -main []
> > > > > (println "Hello, World))
> > > > >  
> > > > > When I attempt to compile the code using Clojure.Compile.exe I get 
> > > > > the following error:
> > > > >  
> > > > > C:\Users\fhale\Desktop\sandbox>clojure.compile.exe clojureclr-test
> > > > > Compiling clojureclr-test to .System.IO.FileNotFoundException: Could 
> > > > > not locate
> > > > > clojureclr_test.clj.dll or clojureclr_test.clj on load path.
> > > > > at clojure.lang.RT.load(String relativePath, Boolean failIfNotFound) 
> > > > > in d:\wo
> > > > > rk\clojure-clr\Clojure\Clojure\Lib\RT.cs:line 3307
> > > > > at clojure/core$load$fn__17179__17183.invoke() in :line 0
> > > > > at clojure/core$load__17186.doInvoke(Object ) in :line 0
> > > > > at clojure/core$load_one__17059.invoke(Object , Object , Object ) in 
> > > > > :line 0
> > > > > at clojure/core$compile$fn__17193__17197.invoke() in :line 0
> > > > > at clojure/core$compile__17200.invoke(Object ) in :line 0
> > > > > at BootstrapCompile.Compile.Main(String[] args) in 
> > > > > d:\work\clojure-clr\Clojur
> > > > > e\Clojure.Compile\Compile.cs:line 78
> > > > >  
> > > > > Additionally I thought perhaps I should set the CLOJURE_LOAD_PATH but 
> > > > > that did not resolve this compilation issue. Is there anything 
> > > > > special I need to do in order to set up the Clojure compiler in order 
> > > > > to produce executables or DLLs?
> > > > --  
> > > > --  
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Clojure" group.
> > > > To post to this group, send email to clo...@googlegroups.com 
> > > > (javascript:)
> > > > Note that posts from new members are moderated - please be patient with 
> > > > your first post.
> > > > To unsubscribe from this group, send email to
> > > > clojure+u...@googlegroups.com (javascript:)
> > > > 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 unsubscribe from this group and stop receiving emails from it, send 
> > > > an email to clojure+u...@googlegroups.com (javascript:).
> > > > For more options, visit https://groups.google.com/groups/opt_out.
> > >  
> >  
>  
> --  
> --  
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com 
> (mailto:clojure@googlegroups.com)
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com 
> (mailto:clojure+unsubscr...@googlegroups.com)
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---  
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com 
> (mailto:clojure+unsubscr...@googlegroups.com).
> For more options, visit h

Re: [ANN]: clj.jdbc 0.1-beta1 - Alternative implementation of jdbc wrapper for clojure.

2013-11-19 Thread Andrey Antukh
Hi agai Soan.

Repeating now: as I said previously, copyright notice of taken code should
to be present. And is my mistake from the start not incluide it, I don't
have any problem for it. Now I have added a copyright notice.

Yo can explain me that is a current legal problem has my library. I would
fix it.

We are all human here, and we make mistakes. It would be better to help fix
it instead attempts to discredit...

Andrey.

Sent from my Nexus 4
On Nov 20, 2013 3:51 AM, "Sean Corfield"  wrote:

> On Tue, Nov 19, 2013 at 2:28 PM, Michael Klishin
>  wrote:
> > 2013/11/20 Andrey Antukh 
> >> About license question: if these functions had not copied, but written
> >> from scratch, them would be the same functions with minimal differences
> or
> >> none...
> > Sorry but that's a ridiculous argument. You must respect and obey by the
> > license of the project you take code
> > from.
>
> Thank you Michael.
>
> Any company that uses Andrey's library at this point is immediately in
> a difficult position from a legal standpoint...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View -- http://corfield.org/
> World Singles, LLC. -- http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.