Re: Comments on first function

2013-11-18 Thread Leonardo Borges
Hi,

Good inital effort. Only a couple of things to comment on:

- You're not closing the stream after you're done with it

This is a very common bug and for that reason clojure provides a macro
- with-open - that takes care of closing the resource for you.

- As you're using a string as the accumulator, you're creating a new
string object at each iteration:

A better approach might be using a StringBuffer to accumulate the
result without wasteful object allocation.

In fact, both of these points are addressed by a core clojure function
called 'slurp'. Here's its source and sample usage:

(defn slurp
  ([f & opts]
 (let [opts (normalize-slurp-opts opts)
   sb (StringBuilder.)]
   (with-open [#^java.io.Reader r (apply jio/reader f opts)]
 (loop [c (.read r)]
   (if (neg? c)
 (str sb)
 (do
   (.append sb (char c))
   (recur (.read r)


(println (slurp "http://google.com";))


You can read more about with-open in this link:
http://clojuredocs.org/clojure_core/clojure.core/with-open

Cheers,
Leonardo Borges
www.leonardoborges.com


On Mon, Nov 18, 2013 at 2:00 PM,   wrote:
> Hi everyone,
>
> I'm new to Clojure, and after a lot of reading I wrote a couple of
> functions.
> They are working and doing what they are supposed to, but I was wondering if
> the way I wrote the functions was optimal and if I made any conceptual
> errors which advanced programmers avoid.
> Basically: Are they what they call the "clojure" way?
>
> (defn download-source [url]
>   (let [stream (java.io.BufferedReader. (java.io.InputStreamReader. (..
> (java.net.URL. url) openStream)))]
> (loop [b (.readLine stream), acc ""]
>   (if (= b nil) acc
> (recur (.readLine stream) (str acc b))
>
> (println (download-source "http://google.com";))
>
> This function for example downloads the source of a webpage and returns it
> as a string.
> Could this have been written in a better way?
> I want to get a feeling of what is considered good practice/design in
> clojure.
>
> Nice Regards
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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-18 Thread David Simmons
Hi Ryan

If I create a model "Customer" - will Caribou create a specific table 
Customer. I ask because using H2 Console I can't find any of the tables I'd 
have expected to find having created my model. (This may be user error as 
I'm not used to using H2). 

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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread Ryan Spangler
Mark,

Yes, you can do nested loops.  Say you have a structure like this:

{:title "Hello" 
 :slides 
 [{:caption "World"
   :images 
   [{:path "/img/world.png"}
{:path "/img/space.png"}]}
  {:caption "Jupiter"
   :images
   [{:path "/img/callisto.png"}
{:path "/img/ganymede.png"}]}]}

You can render this using the following template:

{{title}}
{{#slides}}
  {{caption}}
  {{#images}}

  {{/images}}
{{/slides}}

to produce this output:

Hello
  World


  Jupiter



There are even loop vars to reference the item and outer items from inside 
the loop:

{{loop.item}}
{{loop.outer.item}}
{{loop.outer.outer.item}}

You can also bind each item in the loop if you don't like the implicit 
context:

{{title}}
{{#slides:slide}}
  {{slide.caption}}
  {{#slide.images:image}}

  {{/images}}
{{/slides}}

For the full list of loop variables available from inside a loop check out 
the template docs:  http://caribou.github.io/caribou/docs/templates.html


On Sunday, November 17, 2013 11:47:12 PM UTC-8, puzzler wrote:
>
> The template example shows a notation for doing something special on the 
> last iteration of a loop, but it doesn't look like this syntax can handle 
> nested loops.  Is there any mechanism for nested loops?
>  

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Ryan Spangler
David,

Yes, if you created a Customer model there will be a "customer" table
inside the h2 db (lowercase).  Can you create customer instances?  If so it
is all working as it should, and you might just be missing the tables
somewhere.


On Mon, Nov 18, 2013 at 12:04 AM, David Simmons wrote:

> Hi Ryan
>
> If I create a model "Customer" - will Caribou create a specific table
> Customer. I ask because using H2 Console I can't find any of the tables I'd
> have expected to find having created my model. (This may be user error as
> I'm not used to using H2).
>
> 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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread Mark Engelberg
The docs say something about being ready by default to deploy to Heroku.
But the default H2 database won't work on Heroku, will it?  I was under the
impression that on Heroku, you can't use a database that just saves to the
local filesystem, but need to "provision" a postgresql database.  Is that
correct?

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread David Simmons
Hi Ryan

I'm probably doing something daft but I'm using H2 Console and connecting 
to taiga_development.h2.db (user: sa). running select * from wibble (the 
name of my model) returns "table wibble not found". I can create instances 
of wibble via the Admin UI.

Like I've said I'm pretty sure this is user error but any pointers as to 
what I'm doing wrong would be really helpful.

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.


instaparse questions

2013-11-18 Thread eliassonaand
 

Hi, 

I'm trying to use instaparse to differentiate between identifiers and 
keywords.

The following code is from the tutorial.

(def unambiguous-tokenizer
  (insta/parser
"sentence = token ( token)*
  = keyword | !keyword identifier
 whitespace = #'\\s+'
 identifier = #'[a-zA-Z]+'
 keyword = 'cond' | 'defn'"))

The above parser works fine for: 

(insta/parse unambiguous-tokenizer "cond id defn")

It recognizes cond and defn as keywords and id as identifier.

But if an identifier starts with a keyword such as condid:

(insta/parse unambiguous-tokenizer "condid id defn")

It doesn't work anymore. (I want it to recognize condid as an identifier 
not a misspelled keyword)

Does anybody know how to make that work?

Thanks

--anders

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Reactive Programming in Clojure

2013-11-18 Thread Sam Ritchie

Nice! Here are my Scala assignments, if you want to follow along:

https://github.com/sritchie/rx-scala-class

Doing the second one tomorrow.

Marco Manzi wrote:
Hi all, I'm a young clojure developer. I work as Java developer, but 
I've falled in love with this fantastic language and I would like to 
help in some way.
Actually I'm following Principles of Reactive Programming 
 on Coursera. It is all 
written in Scala, but I'm not that proficent on Scala, so I'm 
following it in Clojure, I'm writing some posts on how I'll following it.
If anyone has the same need can follow me at 
http://reactiveclojure.blogspot.it 
, there is also a github 
repository where I'm posting the code to make the same assigment as in 
the coursera.

I appreciate any hint you can give.
See you :)
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient 
with your first post.

To unsubscribe from 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.


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com 
Twitter // Facebook 



--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Reactive Programming in Clojure

2013-11-18 Thread Alexandru Nedelcu
Hi Sam,

You are not supposed to publish your solutions to the Reactive 
Programming Coursera course. It says so in the honour code you agreed 
to when you joined the class.

I would advise you to take that code off GitHub, as I distinctly 
remember the staff complaining and warning people about posting code on 
GitHub during the Functional Programming course, which I also followed.

Cheers,


On Lu 18 nov 2013 11:30:13 +0200, Sam Ritchie wrote:
> Nice! Here are my Scala assignments, if you want to follow along:
>
> https://github.com/sritchie/rx-scala-class
>
> Doing the second one tomorrow.
>
> Marco Manzi wrote:
>> Hi all, I'm a young clojure developer. I work as Java developer, but
>> I've falled in love with this fantastic language and I would like to
>> help in some way.
>> Actually I'm following Principles of Reactive Programming
>>  on Coursera. It is all
>> written in Scala, but I'm not that proficent on Scala, so I'm
>> following it in Clojure, I'm writing some posts on how I'll following it.
>> If anyone has the same need can follow me
>> at http://reactiveclojure.blogspot.it
>> , there is also a github
>> repository where I'm posting the code to make the same assigment as
>> in the coursera.
>> I appreciate any hint you can give.
>> See you :)
>> --
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient
>> with your first post.
>> To unsubscribe from 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.
>
> --
> Sam Ritchie (@sritchie)
> Paddleguru Co-Founder
> 703.863.8561
> www.paddleguru.com 
> Twitter // Facebook
> 
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from 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.

--
Alexandru Nedelcu
www.bionicspirit.com

PGP Public Key:
https://bionicspirit.com/key.aexpk



signature.asc
Description: OpenPGP digital signature


Re: [ANN] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Kris Jenkins
Hi Gary,

Yeah, you're not the only one to say it, and I think you're all right. 
Thanks for the link to sql-phrasebook. I'm going to take it to the hammock 
and consider v0.3.0. :-)

Cheers,
Kris

On Friday, 15 November 2013 23:55:46 UTC, Gary Johnson wrote:
>
> Hi Kris,
>
>   I really like your approach, but I've also been feeling the burn a bit 
> with having to store each SQL query in its own file (especially since my 
> data exploration frequently leaves me cataloging hundreds of them). Take a 
> look at the approach used in sql-phrasebook:
>
>   https://github.com/ray1729/sql-phrasebook
>
>   I'm hoping it will give you some ideas to extend Yesql to address this 
> particular issue, ideally with a nicer syntax than that used in 
> sql-phrasebook. Otherwise, I think Yesql is bound for great things!
>
>   Cheers,
> ~Gary
>
> On Tuesday, November 12, 2013 5:14:14 AM UTC-5, Kris Jenkins wrote:
>>
>> It depends on which kind of composability you mean. If we're talking 
>> about a "SELECT ... FROM ..." here with a "WHERE ..." there, I don't see 
>> why not. It's a down-the-road feature, but I'm open to it.
>>
>> But the kind of composability that would get me excited is the 
>> cascalog/datalog kind. Where you could say, "SELECT * FROM employee" and 
>> mix that with "SELECT * FROM deparment" and get an automatic, 
>> sensibly-optimised join. That's real composibility, beyond mere string 
>> concatenation. No, I don't see Yesql ever supporting that. (There again, I 
>> haven't seen it from any of the Clojure-SQL-DSLs either. If you have, 
>> please point me to them. I'd be interested!)
>>
>> Cheers,
>> Kris
>>
>> On Tuesday, 12 November 2013 03:35:46 UTC, John Hume wrote:
>>>
>>> For me, the one feature that can justify an internal DSL for generating 
>>> SQL is the ability to compose queries. I assume that's not on the Yesql 
>>> roadmap. 
>>> On Nov 11, 2013 5:10 AM, "Kris Jenkins"  wrote:
>>>
 https://github.com/krisajenkins/yesql

 Yesql is a simple library for blending SQL & Clojure together, cleanly. 
 Here's how it works , 
 and how to use it 
 .

 Feedback welcomed,
 Kris

 -- 
 -- 
 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: instaparse questions

2013-11-18 Thread Mark Engelberg
Simplest way is to make the keywords regular expressions that look for a
"word boundary" after the keyword:

(def unambiguous-tokenizer-improved
  (insta/parser
"sentence = token ( token)*
  = keyword | !keyword identifier
 whitespace = #'\\s+'
 identifier = #'[a-zA-Z]+'
 keyword = #'cond\\b' | #'defn\\b'"))



On Mon, Nov 18, 2013 at 1:20 AM,  wrote:

> Hi,
>
> I'm trying to use instaparse to differentiate between identifiers and
> keywords.
>
> The following code is from the tutorial.
>
> (def unambiguous-tokenizer
>   (insta/parser
> "sentence = token ( token)*
>   = keyword | !keyword identifier
>  whitespace = #'\\s+'
>  identifier = #'[a-zA-Z]+'
>  keyword = 'cond' | 'defn'"))
>
> The above parser works fine for:
>
> (insta/parse unambiguous-tokenizer "cond id defn")
>
> It recognizes cond and defn as keywords and id as identifier.
>
> But if an identifier starts with a keyword such as condid:
>
> (insta/parse unambiguous-tokenizer "condid id defn")
>
> It doesn't work anymore. (I want it to recognize condid as an identifier
> not a misspelled keyword)
>
> Does anybody know how to make that work?
>
> Thanks
>
> --anders
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Kris Jenkins


On Monday, 18 November 2013 03:21:12 UTC, Jeremy Heiler wrote:
>
> On Mon, Nov 11, 2013 at 6:10 AM, Kris Jenkins 
> 
> > wrote:
>
>> https://github.com/krisajenkins/yesql
>>
>> Yesql is a simple library for blending SQL & Clojure together, cleanly. 
>> Here's how it works , 
>> and how to use it .
>>
>
> Very cool. Do you have any thoughts on a caching strategy?
>

Yes, for the next version. At the moment it's only changing when the 
defquery is re-eval'd. That's right for production, but a bit of a pain for 
development. In development you want any change to the underlying sql file 
to be picked up immediately. So I plan to do that, picking up the dev/prod 
switch via leiningen, I think.

(That's caching the definition, of course. I've no plan to cache the 
results of the queries. That's a job for memoize/core.cache.)

Cheers,
Kris

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Josh Kamau
Can i put more than one sql statement in a file?

Josh


On Mon, Nov 18, 2013 at 2:01 PM, Kris Jenkins wrote:

>
>
> On Monday, 18 November 2013 03:21:12 UTC, Jeremy Heiler wrote:
>
>> On Mon, Nov 11, 2013 at 6:10 AM, Kris Jenkins wrote:
>>
>>> https://github.com/krisajenkins/yesql
>>>
>>> Yesql is a simple library for blending SQL & Clojure together, cleanly.
>>> Here's how it works ,
>>> and how to use it .
>>>
>>
>> Very cool. Do you have any thoughts on a caching strategy?
>>
>
> Yes, for the next version. At the moment it's only changing when the
> defquery is re-eval'd. That's right for production, but a bit of a pain for
> development. In development you want any change to the underlying sql file
> to be picked up immediately. So I plan to do that, picking up the dev/prod
> switch via leiningen, I think.
>
> (That's caching the definition, of course. I've no plan to cache the
> results of the queries. That's a job for memoize/core.cache.)
>
> Cheers,
> Kris
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Kris Jenkins
Not yet. That's in the works for the next version. :-)

On Monday, 18 November 2013 11:02:07 UTC, Josh Kamau wrote:
>
> Can i put more than one sql statement in a file? 
>
> Josh
>
>
> On Mon, Nov 18, 2013 at 2:01 PM, Kris Jenkins 
> 
> > wrote:
>
>>
>>
>> On Monday, 18 November 2013 03:21:12 UTC, Jeremy Heiler wrote:
>>
>>> On Mon, Nov 11, 2013 at 6:10 AM, Kris Jenkins wrote:
>>>
 https://github.com/krisajenkins/yesql

 Yesql is a simple library for blending SQL & Clojure together, cleanly. 
 Here's how it works , 
 and how to use it 
 .

>>>
>>> Very cool. Do you have any thoughts on a caching strategy?
>>>
>>
>> Yes, for the next version. At the moment it's only changing when the 
>> defquery is re-eval'd. That's right for production, but a bit of a pain for 
>> development. In development you want any change to the underlying sql file 
>> to be picked up immediately. So I plan to do that, picking up the dev/prod 
>> switch via leiningen, I think.
>>
>> (That's caching the definition, of course. I've no plan to cache the 
>> results of the queries. That's a job for memoize/core.cache.)
>>
>> Cheers,
>> Kris
>>  
>> -- 
>> -- 
>> 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Ray Miller
Hi Gary et al,

On 15 November 2013 23:55, Gary Johnson  wrote:

> I really like your approach, but I've also been feeling the burn a bit
> with having to store each SQL query in its own file (especially since my
> data exploration frequently leaves me cataloging hundreds of them). Take a
> look at the approach used in sql-phrasebook:
>
>   https://github.com/ray1729/sql-phrasebook
>
>   I'm hoping it will give you some ideas to extend Yesql to address this
> particular issue, ideally with a nicer syntax than that used in
> sql-phrasebook. Otherwise, I think Yesql is bound for great things!
>
>
Is it the syntax of the phrasebook you don't like, or the API for the
library?

This was just something I put together quickly, so there's a lot of room
for improvement. The phrasebook parser is very simplistic and, although it
works for the simple cases where I've used it, I'm concerned it's not
robust. It's trivial to change the place-holder syntax from ${var-name} if
that's the problem.

My biggest concern is more philosophical. Although there are advantages to
defining the queries in an SQL file, the code where you use them needs to
know the details of the query (what columns does it return? what bind
parameters are needed? is any post-processing aggregation needed?) So I
don't like the distance between the Clojure and SQL implied by a
phrasebook-based approach.

My current thinking is to do something like:

(defselect select-user
  "SELECT user.* FROM user
   WHERE user_id = {{user_id}}")

with appropriate syntactic sugar. This would return a function of a
database connection, which would return the rows. The next step would be to
support a post-processing option for the cases where you modify the
returned results in some way:

(defselect select-user-roles
  "SELECT user.*, role.name AS role_name
   FROM user
   LEFT OUTER JOIN user_role USING(user_id)
   LEFT OUTER JOIN role USING(role_id)
   ORDER BY user.user_id"
  :post-process (fn [rows] (map (fn [user-rows]
 (assoc (select-keys (first
user-rows) [:user_id :user_name])
   :roles (map
:role_name user-rows))
(partition-by :user_id rows)))

That way, the post-processing of the results is kept close to the query.

Just some food for thought...

Ray.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Using xlisp assoc-lists in clojure

2013-11-18 Thread Justin Smith
Typically in clojure we use hash-maps (represented literally as {}) where 
other lisps would use an alist.

Regarding reading assoc list literals, I wouldn't be surprised if someone 
had written this function already, but I doubt it is in the core language. 
I also don't think it would be hard to implement. It would probably be best 
to write a function that reads in nested xlisp alists and returns nested 
maps.

To add a key to a map in clojure (acons in xlisp) we use assoc. It is 
likely that xlisp allows multiple bindings to the same key in an alist - 
maps do not work that way and you would need something slightly more 
complex than just a map if you need that behavior.

To find a key in a map in clojure (assoc in xplisp) we use get. get is the 
function used if a map or keyword is used in the calling position.

On Sunday, November 17, 2013 11:09:56 PM UTC-8, hpw...@googlemail.com wrote:
>
> Hello,
>
> As a newbie coming from a autolisp/newLISP background I have a question 
> about using xlisp assoc-lists in clojure.
>
> I have huge databases form autolisp (from an autocad enviroment) in the 
> form of nested assoc-lists.
>
> Can I stay with that format and read them from clojure?
>
> The first would be to emulate 'setq' 
> This could be done with 'def' (with a single pair of symbol/expression)
> (By the way: Can a multiform of def be done like (defm symbol1 expression1 
> symboln expressionn) by a macro)
>
> The scond is the use of assoc-lists in clojure:
>
> Is it wise to use them in clojure for huge data-lists?
> How can I access them like I do in autolisp with it's 'assoc'.
> Finding the sublist by its first member.
> I do not see a equivalent command for lists in clojure.
> clojures assoc command is completly different.
> Can it be done with a macro?
>
>
> Regards
>
> Hans-Peter
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Justin Smith
Check out resources/config/*.clj. production.clj includes a postgres config 
that you can customize (I notice now that we should include an example 
mysql config in there too actually). Once you have a config set up and 
pointing to an empty db in the appropriate environment, you can use the 
"lein caribou migrate " step to prepare it for caribou usage.

On Monday, November 18, 2013 12:29:44 AM UTC-8, puzzler wrote:
>
> The docs say something about being ready by default to deploy to Heroku.  
> But the default H2 database won't work on Heroku, will it?  I was under the 
> impression that on Heroku, you can't use a database that just saves to the 
> local filesystem, but need to "provision" a postgresql database.  Is that 
> correct?
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Justin Smith
We only include the h2 db to lower friction for creating a project and 
trying it out - I have never used h2 in an actual production app.

On Monday, November 18, 2013 5:23:16 AM UTC-8, Justin Smith wrote:
>
> Check out resources/config/*.clj. production.clj includes a postgres 
> config that you can customize (I notice now that we should include an 
> example mysql config in there too actually). Once you have a config set up 
> and pointing to an empty db in the appropriate environment, you can use the 
> "lein caribou migrate " step to prepare it for caribou usage.
>
> On Monday, November 18, 2013 12:29:44 AM UTC-8, puzzler wrote:
>>
>> The docs say something about being ready by default to deploy to Heroku.  
>> But the default H2 database won't work on Heroku, will it?  I was under the 
>> impression that on Heroku, you can't use a database that just saves to the 
>> local filesystem, but need to "provision" a postgresql database.  Is that 
>> correct?
>>
>>
>>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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.


instaparse: composing smaller rules into a bigger one

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

Hi all,

I'm having a small problem composing smaller matches in instaparse. Here 
is what I'm trying...just observe the bold bits:


(def parsePK
  (insta/parser
   "S  = TOKEN (SPACE TOKEN PUNCT?)* END
   TOKEN = (NUM | DRUG | PK | DRUGPK | MECH | SIGN | EFF | ENCLOSED) / 
WORD

= #'\\w+' | PUNCT
= #'\\p{Punct}'
   ENCLOSED = PAREN | SQBR
= #'\\[.*\\]'
=  #'\\(.*\\)'
NUM =  #'[0-9]+'
ADV =   #'[a-z]+ly'
= #'\\s+'
DRUG =  #'(?i)didanosine|quinidine|tenofovir'
PK = #'(?i)exposure|bioavailability|lower?[\\s|\\-]?clearance'
*DRUGPK =  PK SPACE TO SPACE DRUG SPACE EFF? SPACE *
MECH =  #'[a-z]+e(s|d)'
*EFF = BE? SPACE SIGN? SPACE MECH | BE? SPACE MECH SPACE ADV? *
SIGN =  ADV | NEG
NEG = 'not'
 = 'to' | 'of'
 = 'is' | 'are' | 'was' | 'were'
END =  '.' " ))

Running the parser returns the following. It seems that the 2 bigger 
composite rules DRUGPK & EFF are not recognised at all. Only the smaller 
pieces are actually shown. I would expect [:TOKEN [:DRUGPK "Exposure to 
didanosine is increased"]] and  [:TOKEN [:EFF "is increased"]] entries.

(pprint
(parsePK "Exposure to didanosine is increased when coadministered with 
tenofovir disoproxil fumarate [Table 5 and see Clinical Pharmacokinetics 
(12.3, Tables 9 and 10)]."))



[:S
 [:TOKEN [:PK "Exposure"]]
 " "
 [:TOKEN "to"]
 " "
 [:TOKEN [:DRUG "didanosine"]]
 " "
 [:TOKEN "is"]
 " "
 [:TOKEN [:MECH "increased"]]
 " "
 [:TOKEN "when"]
 " "
 [:TOKEN [:MECH "coadministered"]]
 " "
 [:TOKEN "with"]
 " "
 [:TOKEN [:DRUG "tenofovir"]]
 ","
 " "
 [:TOKEN "disoproxil"]
 " "
 [:TOKEN "fumarate"]
 [:END "."]]

 Am I thinking about it the wrong way? Can ayone shed some light?

many thanks in advance,

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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread David Simmons
Hi Ryan

please ignore my previous email - it was definitely a user error - looking 
at the wrong database (doh!).

Look forward to getting to grips with the framework over the next few days.

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-18 Thread gianluca torta
I am not familiar with instaparse, but the parser may be reasoning as 
follows:

- "Exposure" matches a "PK" TOKEN that is preferred over "WORD" TOKEN, so 
it is parsed as "PK" TOKEN
- "to" matches a "WORD" TOKEN that is not preferred, but there's no other 
choice, so it is parsed as a "WORD" TOKEN
- ...

I don't think that instaparse will consider aggregating more complex TOKENS 
when it can parse each word as a TOKEN (at worst a "WORD" token if none of 
the preferred one-word TOKENs match)

I'd say you have to rework your grammar to be less ambiguous (i.e., only 
one way to decompose a sentence) but unfortunately I don't know how exactly 
you should fix it for instaparse

HTH
-Gianluca

On Monday, November 18, 2013 2:47:22 PM UTC+1, Jim foo.bar wrote:
>
>  Hi all,
>
> I'm having a small problem composing smaller matches in instaparse. Here 
> is what I'm trying...just observe the bold bits:
>
> (def parsePK
>   (insta/parser
>"S  = TOKEN (SPACE TOKEN PUNCT?)* END
>TOKEN = (NUM | DRUG | PK | DRUGPK | MECH | SIGN | EFF | ENCLOSED) / 
> WORD 
> = #'\\w+' | PUNCT 
> = #'\\p{Punct}'
>ENCLOSED = PAREN | SQBR
> = #'\\[.*\\]'
> =  #'\\(.*\\)'
> NUM =  #'[0-9]+'
> ADV =   #'[a-z]+ly'
> = #'\\s+'
> DRUG =  #'(?i)didanosine|quinidine|tenofovir'
> PK =#'(?i)exposure|bioavailability|lower?[\\s|\\-]?clearance'
> *DRUGPK =  PK SPACE TO SPACE DRUG SPACE EFF? SPACE *
> MECH =  #'[a-z]+e(s|d)'
> *EFF = BE? SPACE SIGN? SPACE MECH | BE? SPACE MECH SPACE ADV? *
> SIGN =  ADV | NEG
> NEG = 'not'
>  = 'to' | 'of'
>  = 'is' | 'are' | 'was' | 'were'
> END =  '.' " ))
>
> Running the parser returns the following. It seems that the 2 bigger 
> composite rules DRUGPK & EFF are not recognised at all. Only the smaller 
> pieces are actually shown. I would expect [:TOKEN [:DRUGPK "Exposure to 
> didanosine is increased"]] and  [:TOKEN [:EFF "is increased"]] entries.
> (pprint   
> (parsePK "Exposure to didanosine is increased when coadministered with 
> tenofovir disoproxil fumarate [Table 5 and see Clinical Pharmacokinetics 
> (12.3, Tables 9 and 10)].")) 
>  
>
> [:S
>  [:TOKEN [:PK "Exposure"]]
>  " "
>  [:TOKEN "to"]
>  " "
>  [:TOKEN [:DRUG "didanosine"]]
>  " "
>  [:TOKEN "is"]
>  " "
>  [:TOKEN [:MECH "increased"]]
>  " "
>  [:TOKEN "when"]
>  " "
>  [:TOKEN [:MECH "coadministered"]]
>  " "
>  [:TOKEN "with"]
>  " "
>  [:TOKEN [:DRUG "tenofovir"]]
>  ","
>  " "
>  [:TOKEN "disoproxil"]
>  " "
>  [:TOKEN "fumarate"]
>  [:END "."]]
>
>  Am I thinking about it the wrong way? Can ayone shed some light? 
>
> many thanks in advance,
>
> 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: Releasing Caribou today: Open Source Clojure Web Ecosystem

2013-11-18 Thread Oskar Boethius Lissheim
Seriously impressive stuff. Great to have two super interesting takes on 
clojure web frameworks (pedestal and now caribou).

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Jeremy Heiler
On Mon, Nov 18, 2013 at 6:01 AM, Kris Jenkins wrote:

> On Monday, 18 November 2013 03:21:12 UTC, Jeremy Heiler wrote:
>
>> Very cool. Do you have any thoughts on a caching strategy?
>>
>
> Yes, for the next version. At the moment it's only changing when the
> defquery is re-eval'd. That's right for production, but a bit of a pain for
> development. In development you want any change to the underlying sql file
> to be picked up immediately. So I plan to do that, picking up the dev/prod
> switch via leiningen, I think.
>

Great!

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Using xlisp assoc-lists in clojure

2013-11-18 Thread Tassilo Horn
Justin Smith  writes:

Hi Justin & Hans-Peter,

> Typically in clojure we use hash-maps (represented literally as {})
> where other lisps would use an alist.

One difference between alists and maps is that in alists a "key" can
occur multiple times, and then the first entry with that key shadows all
following entries with that key (with respect to retrieval with
`assoc`).

Well, that feature is probably not used very often, but if you can't
rule out its usage, you also can't convert alists to maps and expect
they're equivalent.

> Regarding reading assoc list literals, I wouldn't be surprised if
> someone had written this function already, but I doubt it is in the
> core language.

This should do the trick:

  (defn alist-assoc [key alist]
(first (filter #(= key (first %)) alist)))

And to add a list to an alist one would use `cons` in Clojure just like
one would use `cons` in CL, Scheme, or Elisp, too.

Bye,
Tassilo

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

2013-11-18 Thread Marcus Blankenship
Brian, I certainly will.  I’ll type up something later this week as we 
progress.  The current pain point is Korma, and generally learning clojure.




On Nov 16, 2013, at 10:25 AM, Brian Craft  wrote:

> Marcus -- I hope you will post updates to the list with your experiences. It 
> would be very interesting.
> 
> This thread has drifted a bit from (roughly) "What can you do with clojure 
> web tooling?" toward "What can you imagine some day doing with the clojure 
> web tooling of the future?", which are both interesting questions, but have 
> somewhat different audiences. And the answers inform each other.
>  
> 
> On Friday, November 15, 2013 8:20:32 AM UTC-8, Marcus Blankenship wrote:
> Me too!  Thanks to everyone who’s contributed, it’s been *very* helpful!
> 
> On Nov 14, 2013, at 10:43 AM, Waldemar Schwan  
> wrote:
> 
>> I just want to say that this is one of the most interesting discussions I 
>> followed on this mailing list.
>> 
>> Thanks to all participants.
>> 
>> Am 14.11.2013 um 19:24 schrieb Brian Craft :
>> 
>>> 
>>> 
>>> On Thursday, November 14, 2013 9:42:52 AM UTC-8, Jonathan Irving wrote:
>>> I agree with much of what you write James - I'm paid to write rails and 
>>> node.js code, and I'm finding that node is encouraging me to compose 
>>> small components and basically sidestep a lot of the issues that rails 
>>> is designed to address. 
>>> 
>>> Can you give a concrete example? 
>>> 
>>> -- 
>>> -- 
>>> 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 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.
> 
> marcus blankenship
> \\\ Partner, Problem Solver, Linear Thinker
> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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.

marcus blankenship
\\\ Partner, Problem Solver, Linear Thinker
\\\ 541.805.2736 \ @justzeros \ skype:marcuscreo

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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.


Take the FLOSS 2013 Survey

2013-11-18 Thread Tom Marble
All:

If you participate in Open Source please take the survey
to make sure YOU are represented.

In particular the 2002 survey numbers show very low participation
of women in Open Source.  Has that changed?

http://floss2013.libresoft.es/index.en.html

Please forward!

--Tom

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] Yesql 0.2.1 - Clojure & SQL queries rethought.

2013-11-18 Thread Gary Johnson
Hi Ray,

  Although the sql-phrasebook does capture much of the same philosophy 
behind Yesql (and has the excellent feature that we can store multiple SQL 
queries in the same file), its syntax is somewhat more unpleasant to my 
eyes than Yesql's macro api.

yesql

-
(defquery users-by-country "some/where/users_by_country.sql")
(users-by-country db-spec "GB")

sql-phrasebook
-
(def pb (sql-phrasebook "test/phrasebook.sql"))
(jdbc/query my-db (pb "select-users-by-id" {:user-ids [123 456 789]}))



I actually do really appreciate having the SQL queries in their own file 
because I do a lot of Literate Programming, and being able to simply tangle 
all my SQL code blocks into a single SQL file and then repurpose them from 
my Clojure app is extremely inviting.

This ability to separate out the SQL from my Clojure and pull it in a la 
carte to manipulate in my running app is one of those great breakthrough 
features that I think makes Enlive and Enfocus such awesome tools for 
collaborating with a team of non-Clojure developers.

  My 2c,
~Gary

P.S. Kris, perhaps you could adjust the defquery syntax to take a key for 
the SQL query you want to load from your external file. This could be part 
of the comment line prepended to the queries that you already use to 
autogenerate docstrings.

(defquery users-by-country "some/where/users_by_country.sql" :that-cool-query)




On Monday, November 18, 2013 6:26:05 AM UTC-5, Ray Miller wrote:
>
> Hi Gary et al,
>
> On 15 November 2013 23:55, Gary Johnson >wrote:
>
>> I really like your approach, but I've also been feeling the burn a bit 
>> with having to store each SQL query in its own file (especially since my 
>> data exploration frequently leaves me cataloging hundreds of them). Take a 
>> look at the approach used in sql-phrasebook:
>>
>>   https://github.com/ray1729/sql-phrasebook
>>
>>   I'm hoping it will give you some ideas to extend Yesql to address this 
>> particular issue, ideally with a nicer syntax than that used in 
>> sql-phrasebook. Otherwise, I think Yesql is bound for great things!
>>
>>
> Is it the syntax of the phrasebook you don't like, or the API for the 
> library?
>
> This was just something I put together quickly, so there's a lot of room 
> for improvement. The phrasebook parser is very simplistic and, although it 
> works for the simple cases where I've used it, I'm concerned it's not 
> robust. It's trivial to change the place-holder syntax from ${var-name} if 
> that's the problem.
>
> My biggest concern is more philosophical. Although there are advantages to 
> defining the queries in an SQL file, the code where you use them needs to 
> know the details of the query (what columns does it return? what bind 
> parameters are needed? is any post-processing aggregation needed?) So I 
> don't like the distance between the Clojure and SQL implied by a 
> phrasebook-based approach.
>
> My current thinking is to do something like:
>
> (defselect select-user
>   "SELECT user.* FROM user
>WHERE user_id = {{user_id}}")
>
> with appropriate syntactic sugar. This would return a function of a 
> database connection, which would return the rows. The next step would be to 
> support a post-processing option for the cases where you modify the 
> returned results in some way:
>
> (defselect select-user-roles
>   "SELECT user.*, role.name AS role_name
>FROM user
>LEFT OUTER JOIN user_role USING(user_id)
>LEFT OUTER JOIN role USING(role_id)
>ORDER BY user.user_id"
>   :post-process (fn [rows] (map (fn [user-rows]
>  (assoc (select-keys 
> (first user-rows) [:user_id :user_name]) 
>:roles (map 
> :role_name user-rows)) 
> (partition-by :user_id rows)))
>
> That way, the post-processing of the results is kept close to the query.
>
> Just some food for thought...
>
> Ray.
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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.


Creating a CMS with Clojure(Script)

2013-11-18 Thread Eduardo Lávaque
With the announcement of Caribou I realized that it is possible to do CMSs 
in Clojure, so I thought I would give it a try even if it's just as an 
exercise.

I considered between using a Leiningen template like Caribou and using a 
.jar file that will detect the files that relate to it and do it's thing 
with those files, sorta like DocPad . I decided to go 
with a Leiningen template since it seems to be better, but if you think it 
isn't the best way to do it I'm open to suggestions.

The idea is to make it something like Statamic , 
where the database is found in normal files the users modify with a text 
editor, like with a normal static website generator, but they get rendered 
and then shown to the user every time the use visits a URL. Statamic stands 
for *Stat*ic Dyn*amic*.

The way I'll achieve it I don't really need suggestions, since I want to 
figure that stuff out myself. I need help figuring out which method of 
distribution would be the better method for this?

If it turns out going with templates is the correct way to do it for 
something like this please share the testing process you have used while 
making a Leiningen template of this kind. :)

One last thing. Would you say it's better for me to make a static website 
generator first?

--
Eduan

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Do web apps need Clojure?

2013-11-18 Thread Brian Craft
Re: korma, and sql dsls, I've been moving between korma, honeysql, and raw 
sql, without being satisfied with any of them. Desirable traits of the db 
layer in my problem domain are 1) eliminating boilerplate (e.g. setting up 
default keys, and indexes, and performing standard joins across relations), 
2) isolating view layers from data access layers (so the view doesn't need 
to know if a subselect or a join is required to span some relation, for 
example), 3) ability to progressively optimize by dropping back to sql when 
required, 4) ability to safely expose a general purpose query API over the 
data.

korma eliminates a very, very small part of the boilerplate. It's almost 
not worth the effort. Falling back to raw sql smoothly is difficult in 
korma, and I've had to drop it entirely in places where I need performance. 
Honeysql eliminates no boilerplate, but representing queries with data 
structures does make it easy to expose a sql-like query API with db 
firewalling (by matching on the incoming structure). Korma appears to also 
represent queries as data structures, but it's not part of the documented 
API. You have to reverse-engineer it, and I expect it's subject to change.


On Monday, November 18, 2013 8:19:28 AM UTC-8, Marcus Blankenship wrote:
>
> Brian, I certainly will.  I’ll type up something later this week as we 
> progress.  The current pain point is Korma, and generally learning clojure.
>
>
>
>
> On Nov 16, 2013, at 10:25 AM, Brian Craft > 
> wrote:
>
> Marcus -- I hope you will post updates to the list with your experiences. 
> It would be very interesting.
>
> This thread has drifted a bit from (roughly) "What can you do with clojure 
> web tooling?" toward "What can you imagine some day doing with the clojure 
> web tooling of the future?", which are both interesting questions, but have 
> somewhat different audiences. And the answers inform each other.
>  
>
> On Friday, November 15, 2013 8:20:32 AM UTC-8, Marcus Blankenship wrote:
>>
>> Me too!  Thanks to everyone who’s contributed, it’s been *very* helpful!
>>
>> On Nov 14, 2013, at 10:43 AM, Waldemar Schwan  
>> wrote:
>>
>> I just want to say that this is one of the most interesting discussions I 
>> followed on this mailing list.
>>
>> Thanks to all participants.
>>
>> Am 14.11.2013 um 19:24 schrieb Brian Craft :
>>
>>
>>
>> On Thursday, November 14, 2013 9:42:52 AM UTC-8, Jonathan Irving wrote:
>>>
>>> I agree with much of what you write James - I'm paid to write rails and 
>>> node.js code, and I'm finding that node is encouraging me to compose 
>>> small components and basically sidestep a lot of the issues that rails 
>>> is designed to address. 
>>>
>>
>> Can you give a concrete example? 
>>
>> -- 
>> -- 
>> 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 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.
>>
>>
>> marcus blankenship
>> \\\ Partner, Problem Solver, Linear Thinker
>> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
>>  
>>
> -- 
> -- 
> 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

Re: Do web apps need Clojure?

2013-11-18 Thread Marcus Blankenship
Brian,

Yeah, and I realize I’m going to take darts for this, but coming from Django’s 
ORM / Rails ActiveRecord makes Korma and these other tools feel like stone-age 
tools.  I’d rather do it all in SQL than fight something to get out of my way, 
or reveal it’s magic.

I know I’m probably not thinking about the problem right, but here’s an example 
of something that I still can’t get to work in Korma.  G….

lein-repl commands
(use [`advent2.models.db] :reload-all)
(get-unlocked-videos-for-campaign 1)



models/db.clj function
(defn format-todays-date []
  (let [date (java.util.Date.)]
(prn date)
(str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \' )))


(defn get-unlocked-videos-for-campaign [campaign]
  (let [c_id (:id campaign)]
(select videos (where {:unlock_date [<= (format-todays-date)] :campaign_id 
c_id}



output
user=> (get-unlocked-videos-for-campaign 1)
#inst "2013-11-18T19:06:09.595-00:00"
Failure to execute query with SQL:
SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND 
"videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
PSQLException:
 Message: ERROR: operator does not exist: date <= character varying
  Hint: No operator matches the given name and argument type(s). You might need 
to add explicit type casts.
  Position: 63
 SQLState: 42883
 Error Code: 0

PSQLException ERROR: operator does not exist: date <= character varying
  Hint: No operator matches the given name and argument type(s). You might need 
to add explicit type casts.
  Position: 63  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse 
(QueryExecutorImpl.java:2102)






On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:

> Re: korma, and sql dsls, I've been moving between korma, honeysql, and raw 
> sql, without being satisfied with any of them. Desirable traits of the db 
> layer in my problem domain are 1) eliminating boilerplate (e.g. setting up 
> default keys, and indexes, and performing standard joins across relations), 
> 2) isolating view layers from data access layers (so the view doesn't need to 
> know if a subselect or a join is required to span some relation, for 
> example), 3) ability to progressively optimize by dropping back to sql when 
> required, 4) ability to safely expose a general purpose query API over the 
> data.
> 
> korma eliminates a very, very small part of the boilerplate. It's almost not 
> worth the effort. Falling back to raw sql smoothly is difficult in korma, and 
> I've had to drop it entirely in places where I need performance. Honeysql 
> eliminates no boilerplate, but representing queries with data structures does 
> make it easy to expose a sql-like query API with db firewalling (by matching 
> on the incoming structure). Korma appears to also represent queries as data 
> structures, but it's not part of the documented API. You have to 
> reverse-engineer it, and I expect it's subject to change.
> 
> 
> On Monday, November 18, 2013 8:19:28 AM UTC-8, Marcus Blankenship wrote:
> Brian, I certainly will.  I’ll type up something later this week as we 
> progress.  The current pain point is Korma, and generally learning clojure.
> 
> 
> 
> 
> On Nov 16, 2013, at 10:25 AM, Brian Craft  wrote:
> 
>> Marcus -- I hope you will post updates to the list with your experiences. It 
>> would be very interesting.
>> 
>> This thread has drifted a bit from (roughly) "What can you do with clojure 
>> web tooling?" toward "What can you imagine some day doing with the clojure 
>> web tooling of the future?", which are both interesting questions, but have 
>> somewhat different audiences. And the answers inform each other.
>>  
>> 
>> On Friday, November 15, 2013 8:20:32 AM UTC-8, Marcus Blankenship wrote:
>> Me too!  Thanks to everyone who’s contributed, it’s been *very* helpful!
>> 
>> On Nov 14, 2013, at 10:43 AM, Waldemar Schwan  
>> wrote:
>> 
>>> I just want to say that this is one of the most interesting discussions I 
>>> followed on this mailing list.
>>> 
>>> Thanks to all participants.
>>> 
>>> Am 14.11.2013 um 19:24 schrieb Brian Craft :
>>> 
 
 
 On Thursday, November 14, 2013 9:42:52 AM UTC-8, Jonathan Irving wrote:
 I agree with much of what you write James - I'm paid to write rails and 
 node.js code, and I'm finding that node is encouraging me to compose 
 small components and basically sidestep a lot of the issues that rails 
 is designed to address. 
 
 Can you give a concrete example? 
 
 -- 
 -- 
 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 mess

Re: Do web apps need Clojure?

2013-11-18 Thread Marcus Blankenship
Do you have a link to the UncleBob talk, Jarrod?


On Nov 16, 2013, at 4:34 PM, Jarrod Swart  wrote:

> I think the more interesting question is: do web developers need Clojure?  If 
> performance were the sole concern then everyone would still code web apps in 
> C or assembler.  There is great power in abstraction.  I like this talk by 
> Uncle Bob: http://skillsmatter.com/podcast/agile-testing/bobs-last-language  
> If you don't have time to watch it I will summarize: every time we get a more 
> powerful programming environment (for developers) we reduce our programming 
> options (in the language).  
> C --> Java == no pointers
> Java --> Clojure == no immutability, etc.
> Every major advancement for developers has largely involved reducing our 
> options and choices.  Take away register manipulation, take away pointers, 
> take away variables, and so on.  I highly recommend the talk by Uncle Bob.
> 
> So I highly encourage you to investigate the benefits that Clojure provide to 
> the developer, over the benefits provided to the machine.
> 
> Good luck in your search!
> 
> Jarrod
> 
> On Wednesday, November 13, 2013 5:38:49 PM UTC-5, Marcus Blankenship wrote:
> Hi Folks,
> 
> We’re a Python / Django shop, and some folks are getting excited about using 
> Clojure for building web apps.  Certainly there are numerous open-source 
> options to assist us (Pedastal, Ring, Compojure, Caribou, etc), but I think 
> it begs a larger question: as a rule, do web applications need the power that 
> Clojure brings to the table?
> 
> Other folks on my team are telling me that solutions built with Python / 
> Django (or even RubyOnRails) fully satisfy the needs of 99% of the web apps 
> we have built, and that Clojure offers nothing new to this problem space.  
> 
> So, here’s the question: How are you are actually using Clojure, and why did 
> you choose to use it, particularly in the “web application” space?  
> 
> Thanks,
> Marcus
> 
> 
> 
> marcus blankenship
> \\\ Partner, Problem Solver, Linear Thinker
> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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.

marcus blankenship
\\\ Partner, Problem Solver, Linear Thinker
\\\ 541.805.2736 \ @justzeros \ skype:marcuscreo

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] clojure-sec

2013-11-18 Thread wm . mark . lee
This list seems somewhat inactive, which I find a bit surprising, but I am 
very interested in one particular aspect of security when I build Clojure 
apps.

Right now my interest is in building REST web services and web applications 
backed by a relational database with something like Angular or Backbone at 
the front-end. I'm therefore interested in applying best practices in 
securing web applications for the public internet.

I don't have a deep background in security, but as a seasoned Java 
developer I have a good idea of some of the security considerations for web 
applications, and I agree with another post here that OWASP is a very 
useful resource. My specific interests in security are mainly mitigations 
against:

1. SQL injection;
2. Cross-site scripting;
3. Request forgery.

When it comes to the many libraries available for Clojure I struggle to 
find good information on these topics, so I'm unsure what is my 
responsibility as an app developer and what is being provided by those 
libraries for me.

For example, based on Clojure tutorials I have built a Compojure web 
application that:

1. Accepts JSON from a client;
2. Inserts a database record based on the JSON (using the official JDBC 
wrappers).

This is implemented in the most simple way possible: the JSON map is 
basically passed directly to the function that inserts that map in the 
database. I don't even name database columns and I don't filter text to 
mitigate against attacks. 

In my equivalent Java web application, I'd know to white-list keys for my 
JSON unmarshalling, I'd name explicit columns in my database operations, 
and I'd run the submitted user text through filters to strip out any 
malicious scripts or whatever, or escape the text when reading data back.

I would have no confidence hosting this web application on the public 
internet in its current state.

Now, admittedly my Clojure experience is limited (at time of writing I have 
about three part-time days of experience!), so these things may be obvious 
to others here, but right now this is the sort of thing I simply don't know 
how to do with Clojure and the third party libraries I'm using.

By the way, I do use Friend already and I am finding it really useful.

On Friday, 14 December 2012 17:36:57 UTC, Chas Emerick wrote:
>
> Some recent discussions related to my development of Friend have prompted 
> me to create a new group: 
>
> https://groups.google.com/group/clojure-sec 
> "Dedicated to discussing security issues affecting those building 
> applications with Clojure and its variants." 
>
> I'm sure many of us are building applications that have security 
> considerations.  I think it would be helpful at this point if there were a 
> dedicated place for discussions around addressing those considerations; 
> thus, clojure-sec. 
>
> We'll see what people actually want to talk about, but I'd be happy if any 
> of these classes of topics become common: 
>
> * usage and design of particular security-related libraries and tools 
> * security-related tech available in the various host environments that we 
> can leverage from Clojure(Script/.CLR/-py/c/etc) 
> * Clojure-specific concerns (e.g. untrusted code evaluation / jailing) 
> * issues or weaknesses in particular Clojure implementations, libraries, 
> etc. 
> * discussion of more general-interest security topics that nevertheless 
> impinge upon our work in Clojure 
> * more, more, more 
>
> I'm looking forward to learning. 
>
> Cheers, 
>
> - Chas 
>
> -- 
> http://cemerick.com 
> [Clojure Programming from O'Reilly](http://www.clojurebook.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.


2013 State of Clojure & ClojureScript survey results

2013-11-18 Thread Chas Emerick

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.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-18 Thread kovas boguta
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.


ANN: thalia version 0.1.0 -- more detailed doc strings for (a small fraction of) Clojure

2013-11-18 Thread Andy Fingerhut
If you want complete, detailed doc strings for all of Clojure and its
libraries, I am sorry to say I do not have that for you.

I do have detailed doc strings for a small fraction of the Clojure symbols
(20 out of 591), and am planning to write more as I have time.

If you want to use them from a REPL, just add this dependency, either to
you project.clj, or to your ~/.lein/profiles.clj (:repl would be a decent
choice of profile for this), so either:

[[thalia "0.1.0"]]; in project.clj dependencies

   {:repl {:dependencies [[thalia "0.1.0"]]}}

The next time you start a REPL, do this:

(require 'thalia.doc)
(thalia.doc/add-extra-docs!)

See the project page for a sample of the more detailed doc string you will
get if you do (doc ==):

https://github.com/jafingerhut/thalia

If you want to help write documentation like this, let me know.

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: How could you solve this problem

2013-11-18 Thread Ray Miller
Just for contrast, here's a fairly succinct solution I put together:

https://gist.github.com/ray1729/7534528#file-ring_of_primes-clj

It uses a basic depth-first search.

Ray.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Do web apps need Clojure?

2013-11-18 Thread Ryan Spangler
I just ran this in the Caribou repl:

(caribou.model/gather :field {:where {:created-at {:<=
(java.util.Date.)} :model-id 1}})

And got a bunch of results.  No string coercion necessary!  (also, dashes
not underscores!)

We looked at Korma and found it lacking (similar problem as Compojure:
macros).  For that reason we built an entire query engine that works on
data directly, so that you can build up queries programmatically just like
you would any other data structure (!)

Check out the section on retrieving content here:
http://caribou.github.io/caribou/docs/content.html

You can do a bunch of cool stuff (logic operations, "in" queries,
conditions that span associations, selecting certain fields, seamless
queries over join tables etc).

Let me know if there is something you expect out of a query engine that
Caribou doesn't do, we will add it (if it makes sense!)

All this stuff is in caribou-core (which you can use independently of the
rest of Caribou): https://github.com/caribou/caribou-core

Maybe I should call it something else to emphasize it is a standalone
library... (and replacement for korma)


On Mon, Nov 18, 2013 at 11:07 AM, Marcus Blankenship
wrote:

> Brian,
>
> Yeah, and I realize I’m going to take darts for this, but coming from
> Django’s ORM / Rails ActiveRecord makes Korma and these other tools feel
> like stone-age tools.  I’d rather do it all in SQL than fight something to
> get out of my way, or reveal it’s magic.
>
> I know I’m probably not thinking about the problem right, but here’s an
> example of something that I still can’t get to work in Korma.  G….
>
> *lein-repl commands*
> (use [`advent2.models.db] :reload-all)
> (get-unlocked-videos-for-campaign 1)
>
>
>
> *models/db.clj function*
> (defn format-todays-date []
>   (let [date (java.util.Date.)]
> (prn date)
> (str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \'
> )))
>
>
> (defn get-unlocked-videos-for-campaign [campaign]
>   (let [c_id (:id campaign)]
> (select videos (where {:unlock_date [<= (format-todays-date)]
> :campaign_id c_id}
>
>
>
> *output*
> user=> (get-unlocked-videos-for-campaign 1)
> #inst "2013-11-18T19:06:09.595-00:00"
> Failure to execute query with SQL:
> SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND
> "videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
> PSQLException:
>  Message: ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>   Position: 63
>  SQLState: 42883
>  Error Code: 0
>
> PSQLException ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might
> need to add explicit type casts.
>   Position: 63
>  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
> (QueryExecutorImpl.java:2102)
>
>
>
>
>
>
> On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:
>
> Re: korma, and sql dsls, I've been moving between korma, honeysql, and raw
> sql, without being satisfied with any of them. Desirable traits of the db
> layer in my problem domain are 1) eliminating boilerplate (e.g. setting up
> default keys, and indexes, and performing standard joins across relations),
> 2) isolating view layers from data access layers (so the view doesn't need
> to know if a subselect or a join is required to span some relation, for
> example), 3) ability to progressively optimize by dropping back to sql when
> required, 4) ability to safely expose a general purpose query API over the
> data.
>
> korma eliminates a very, very small part of the boilerplate. It's almost
> not worth the effort. Falling back to raw sql smoothly is difficult in
> korma, and I've had to drop it entirely in places where I need performance.
> Honeysql eliminates no boilerplate, but representing queries with data
> structures does make it easy to expose a sql-like query API with db
> firewalling (by matching on the incoming structure). Korma appears to also
> represent queries as data structures, but it's not part of the documented
> API. You have to reverse-engineer it, and I expect it's subject to change.
>
>
> On Monday, November 18, 2013 8:19:28 AM UTC-8, Marcus Blankenship wrote:
>>
>> Brian, I certainly will.  I’ll type up something later this week as we
>> progress.  The current pain point is Korma, and generally learning clojure.
>>
>>
>>
>>
>> On Nov 16, 2013, at 10:25 AM, Brian Craft  wrote:
>>
>> Marcus -- I hope you will post updates to the list with your experiences.
>> It would be very interesting.
>>
>> This thread has drifted a bit from (roughly) "What can you do with
>> clojure web tooling?" toward "What can you imagine some day doing with the
>> clojure web tooling of the future?", which are both interesting questions,
>> but have somewhat different audiences. And the answers inform each other.
>>
>>
>> On Friday, November 15, 2013 8:20:32 AM UTC-8, Marcus Blankenship w

Re: Do web apps need Clojure?

2013-11-18 Thread Marcus Blankenship
Ryan,

Awesome!  We’re playing with Caribou now, and are loving it.  At first we 
thought “Oh, this is going to be like Drupal, with all it’s pseudo-tables and 
crap.  But it’s not, and we’re having fun with it!

I’ll try the query engine now.  Thanks!

On Nov 18, 2013, at 12:31 PM, Ryan Spangler  wrote:

> I just ran this in the Caribou repl:
> 
> (caribou.model/gather :field {:where {:created-at {:<= (java.util.Date.)} 
> :model-id 1}})
> 
> And got a bunch of results.  No string coercion necessary!  (also, dashes not 
> underscores!)
> 
> We looked at Korma and found it lacking (similar problem as Compojure: 
> macros).  For that reason we built an entire query engine that works on data 
> directly, so that you can build up queries programmatically just like you 
> would any other data structure (!)
> 
> Check out the section on retrieving content here:  
> http://caribou.github.io/caribou/docs/content.html
> 
> You can do a bunch of cool stuff (logic operations, "in" queries, conditions 
> that span associations, selecting certain fields, seamless queries over join 
> tables etc).  
> 
> Let me know if there is something you expect out of a query engine that 
> Caribou doesn't do, we will add it (if it makes sense!)
> 
> All this stuff is in caribou-core (which you can use independently of the 
> rest of Caribou): https://github.com/caribou/caribou-core
> 
> Maybe I should call it something else to emphasize it is a standalone 
> library... (and replacement for korma)
> 
> 
> On Mon, Nov 18, 2013 at 11:07 AM, Marcus Blankenship  
> wrote:
> Brian,
> 
> Yeah, and I realize I’m going to take darts for this, but coming from 
> Django’s ORM / Rails ActiveRecord makes Korma and these other tools feel like 
> stone-age tools.  I’d rather do it all in SQL than fight something to get out 
> of my way, or reveal it’s magic.
> 
> I know I’m probably not thinking about the problem right, but here’s an 
> example of something that I still can’t get to work in Korma.  G….
> 
> lein-repl commands
> (use [`advent2.models.db] :reload-all)
> (get-unlocked-videos-for-campaign 1)
> 
> 
> 
> models/db.clj function
> (defn format-todays-date []
>   (let [date (java.util.Date.)]
> (prn date)
> (str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \' )))
> 
> 
> (defn get-unlocked-videos-for-campaign [campaign]
>   (let [c_id (:id campaign)]
> (select videos (where {:unlock_date [<= (format-todays-date)] 
> :campaign_id c_id}
> 
> 
> 
> output
> user=> (get-unlocked-videos-for-campaign 1)
> #inst "2013-11-18T19:06:09.595-00:00"
> Failure to execute query with SQL:
> SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND 
> "videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
> PSQLException:
>  Message: ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might 
> need to add explicit type casts.
>   Position: 63
>  SQLState: 42883
>  Error Code: 0
> 
> PSQLException ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might 
> need to add explicit type casts.
>   Position: 63  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse 
> (QueryExecutorImpl.java:2102)
> 
> 
> 
> 
> 
> 
> On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:
> 
>> Re: korma, and sql dsls, I've been moving between korma, honeysql, and raw 
>> sql, without being satisfied with any of them. Desirable traits of the db 
>> layer in my problem domain are 1) eliminating boilerplate (e.g. setting up 
>> default keys, and indexes, and performing standard joins across relations), 
>> 2) isolating view layers from data access layers (so the view doesn't need 
>> to know if a subselect or a join is required to span some relation, for 
>> example), 3) ability to progressively optimize by dropping back to sql when 
>> required, 4) ability to safely expose a general purpose query API over the 
>> data.
>> 
>> korma eliminates a very, very small part of the boilerplate. It's almost not 
>> worth the effort. Falling back to raw sql smoothly is difficult in korma, 
>> and I've had to drop it entirely in places where I need performance. 
>> Honeysql eliminates no boilerplate, but representing queries with data 
>> structures does make it easy to expose a sql-like query API with db 
>> firewalling (by matching on the incoming structure). Korma appears to also 
>> represent queries as data structures, but it's not part of the documented 
>> API. You have to reverse-engineer it, and I expect it's subject to change.
>> 
>> 
>> On Monday, November 18, 2013 8:19:28 AM UTC-8, Marcus Blankenship wrote:
>> Brian, I certainly will.  I’ll type up something later this week as we 
>> progress.  The current pain point is Korma, and generally learning clojure.
>> 
>> 
>> 
>> 
>> On Nov 16, 2013, at 10:25 AM, Brian Craft  wrote:
>> 
>>> Marcus -- I hope you will post updates to 

Re: Question on Sequences

2013-11-18 Thread Alexandru Nedelcu
Thanks Leif, thanks folks, these are good tips.


On Mon, Nov 18, 2013 at 4:12 AM, Leif  wrote:

>
> Hi, Alexandru.
>
> If you just need more performance on vectors only, there are the core
> functions mapv, filterv, and subvec (O(1), which can be used to implement
> takev and dropv).  Also, looking at the source of mapv and filterv is
> instructive, because they use transients internally; you might do that in
> your solution to get a bit more speed.
>
> If you really need a generic solution where most clj.core functions are
> performant on your custom data structures, I don't have suggestions, but
> you can refer to what the experts do:
>
> https://github.com/clojure/data.priority-map
> https://github.com/ztellman?tab=repositories (potemkin, clj-tuple,
> immutable-bitset, et al)
>
> Hope that helps,
> Leif
>
>
> On Saturday, November 16, 2013 7:01:14 PM UTC-5, Alexandru Nedelcu wrote:
>>
>> Hi,
>>
>> I'm trying to understand the design of Clojure's collections and one
>> thing that I find odd is the return of functions operating on sequences.
>> Like for instance a call such as this will return a lazy-seq and not a
>> vector:
>>
>> (drop 2 [1 2 3 4])
>>
>> The reason why I find it odd is that data-structures have different
>> characteristics and one may want to use a vector because it supports
>> efficient indexing and appending to the end.
>>
>> Of course, dropping 2 elements like above from a vector is probably
>> going to have O(n) complexity and thus returning something lazy is more
>> appropriate. And while there are some operations, like "conj", "pop" and
>> "peek" that preserve the type, functions such as map and filter also
>> return lazy-seq. And I worry that the property of the collection you
>> start with is lost, given that this returns a "cons":
>>
>>  (conj (filter even? [1 2 3 4 5]) 6)
>>
>> So lets say that I want to write a generic function that preserves the
>> type of that collection. Is something like this idiomatic?
>>
>>  (defn only-evens [coll]
>>(into (empty coll) (filter even? coll)))
>>
>> Thanks,
>>
>> --
>> Alexandru Nedelcu
>> www.bionicspirit.com
>>
>> PGP Public Key:
>> https://bionicspirit.com/key.aexpk
>>
>>  --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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.
>



-- 
Alexandru Nedelcu
www.bionicspirit.com

PGP Public Key:
https://bionicspirit.com/key.aexpk

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Brian Craft
Wow, this result is shocking to me:

In short, Clojure libraries are easy to find, their maintainers are 
> receptive to feedback and patches, they are technically of high quality, 
> but they’re not always very well-documented.  None of that is surprising or 
> particularly different from last year.
>

This could not be more starkly different than my experience. I'm not sure 
I've used a clojure library that doesn't have quirky bugs like hanging at 
exit, blowing the heap by holding the heads of seqs, or just doing the 
wrong thing.

Also, I find it difficult to find libraries. When I do find libraries 
they're often deprecated, or moribund. What's the easy way to find clojure 
libraries?


On Monday, November 18, 2013 11:32:56 AM UTC-8, 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.


Re: Do web apps need Clojure?

2013-11-18 Thread Ryan Spangler
Marcus,

Good to hear!  I am have never used Drupal, what do you mean by
pseudo-table?

Also, looking into this I think the one caveat to using Caribou for your
query engine is that it requires that you have a table for both "model" and
"field" that contain the descriptions of the model you are querying.  If
you create the model using Caribou in the first place this will exist, but
it probably won't if you are trying to use it on a non-caribou db.

This could be mitigated by providing the model descriptions in some kind of
configuration step... that wouldn't be too hard.  I will ponder on how best
to support that.


On Mon, Nov 18, 2013 at 12:40 PM, Marcus Blankenship
wrote:

> Ryan,
>
> Awesome!  We’re playing with Caribou now, and are loving it.  At first we
> thought “Oh, this is going to be like Drupal, with all it’s pseudo-tables
> and crap.  But it’s not, and we’re having fun with it!
>
> I’ll try the query engine now.  Thanks!
>
> On Nov 18, 2013, at 12:31 PM, Ryan Spangler 
> wrote:
>
> I just ran this in the Caribou repl:
>
> (caribou.model/gather :field {:where {:created-at {:<=
> (java.util.Date.)} :model-id 1}})
>
> And got a bunch of results.  No string coercion necessary!  (also, dashes
> not underscores!)
>
> We looked at Korma and found it lacking (similar problem as Compojure:
> macros).  For that reason we built an entire query engine that works on
> data directly, so that you can build up queries programmatically just like
> you would any other data structure (!)
>
> Check out the section on retrieving content here:
> http://caribou.github.io/caribou/docs/content.html
>
> You can do a bunch of cool stuff (logic operations, "in" queries,
> conditions that span associations, selecting certain fields, seamless
> queries over join tables etc).
>
> Let me know if there is something you expect out of a query engine that
> Caribou doesn't do, we will add it (if it makes sense!)
>
> All this stuff is in caribou-core (which you can use independently of the
> rest of Caribou): https://github.com/caribou/caribou-core
>
> Maybe I should call it something else to emphasize it is a standalone
> library... (and replacement for korma)
>
>
> On Mon, Nov 18, 2013 at 11:07 AM, Marcus Blankenship <
> mar...@creoagency.com> wrote:
>
>> Brian,
>>
>> Yeah, and I realize I’m going to take darts for this, but coming from
>> Django’s ORM / Rails ActiveRecord makes Korma and these other tools feel
>> like stone-age tools.  I’d rather do it all in SQL than fight something to
>> get out of my way, or reveal it’s magic.
>>
>> I know I’m probably not thinking about the problem right, but here’s an
>> example of something that I still can’t get to work in Korma.  G….
>>
>> *lein-repl commands*
>> (use [`advent2.models.db] :reload-all)
>> (get-unlocked-videos-for-campaign 1)
>>
>>
>>
>> *models/db.clj function*
>> (defn format-todays-date []
>>   (let [date (java.util.Date.)]
>> (prn date)
>> (str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \'
>> )))
>>
>>
>> (defn get-unlocked-videos-for-campaign [campaign]
>>   (let [c_id (:id campaign)]
>> (select videos (where {:unlock_date [<= (format-todays-date)]
>> :campaign_id c_id}
>>
>>
>>
>> *output*
>> user=> (get-unlocked-videos-for-campaign 1)
>> #inst "2013-11-18T19:06:09.595-00:00"
>> Failure to execute query with SQL:
>> SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND
>> "videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
>> PSQLException:
>>  Message: ERROR: operator does not exist: date <= character varying
>>   Hint: No operator matches the given name and argument type(s). You
>> might need to add explicit type casts.
>>   Position: 63
>>  SQLState: 42883
>>  Error Code: 0
>>
>> PSQLException ERROR: operator does not exist: date <= character varying
>>   Hint: No operator matches the given name and argument type(s). You
>> might need to add explicit type casts.
>>   Position: 63
>>  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
>> (QueryExecutorImpl.java:2102)
>>
>>
>>
>>
>>
>>
>> On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:
>>
>> Re: korma, and sql dsls, I've been moving between korma, honeysql, and
>> raw sql, without being satisfied with any of them. Desirable traits of the
>> db layer in my problem domain are 1) eliminating boilerplate (e.g. setting
>> up default keys, and indexes, and performing standard joins across
>> relations), 2) isolating view layers from data access layers (so the view
>> doesn't need to know if a subselect or a join is required to span some
>> relation, for example), 3) ability to progressively optimize by dropping
>> back to sql when required, 4) ability to safely expose a general purpose
>> query API over the data.
>>
>> korma eliminates a very, very small part of the boilerplate. It's almost
>> not worth the effort. Falling back to raw sql smoothly is difficult in
>> korma, and I've had to drop it entirely in places where I need performance.
>> Honey

Re: Reactive Programming in Clojure

2013-11-18 Thread Marco Manzi
Hi, Txs for support, I haven't readed the forum because I thougth no one 
was reading it (I didn't receive any email).
Actually I have released the first assignment and you can try it in clojure 
if you like. I'm trying to do the assignment 2 but actually It is full of 
mutable states... Martin didn't do the assignment in a very functional way 
unfortunately... I could have done it fast with atoms but I think it isn't 
the right way...
Actually I'm redesigning it trying to make an immutable simulator, I'll let 
you know as soon as is ready :)

Il giorno lunedì 18 novembre 2013 10:35:28 UTC+1, Alexandru Nedelcu ha 
scritto:
>
> Hi Sam, 
>
> You are not supposed to publish your solutions to the Reactive 
> Programming Coursera course. It says so in the honour code you agreed 
> to when you joined the class. 
>
> I would advise you to take that code off GitHub, as I distinctly 
> remember the staff complaining and warning people about posting code on 
> GitHub during the Functional Programming course, which I also followed. 
>
> Cheers, 
>
>
> On Lu 18 nov 2013 11:30:13 +0200, Sam Ritchie wrote: 
> > Nice! Here are my Scala assignments, if you want to follow along: 
> > 
> > https://github.com/sritchie/rx-scala-class 
> > 
> > Doing the second one tomorrow. 
> > 
> > Marco Manzi wrote: 
> >> Hi all, I'm a young clojure developer. I work as Java developer, but 
> >> I've falled in love with this fantastic language and I would like to 
> >> help in some way. 
> >> Actually I'm following Principles of Reactive Programming 
> >>  on Coursera. It is all 
> >> written in Scala, but I'm not that proficent on Scala, so I'm 
> >> following it in Clojure, I'm writing some posts on how I'll following 
> it. 
> >> If anyone has the same need can follow me 
> >> at http://reactiveclojure.blogspot.it 
> >> , there is also a github 
> >> repository where I'm posting the code to make the same assigment as 
> >> in the coursera. 
> >> I appreciate any hint you can give. 
> >> See you :) 
> >> -- 
> >> -- 
> >> 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. 
> > 
> > -- 
> > Sam Ritchie (@sritchie) 
> > Paddleguru Co-Founder 
> > 703.863.8561 
> > www.paddleguru.com  
> > Twitter // Facebook 
> >  
> > 
> > -- 
> > -- 
> > 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. 
>
> -- 
> Alexandru Nedelcu 
> www.bionicspirit.com 
>
> PGP Public Key: 
> https://bionicspirit.com/key.aexpk 
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] cljs-start with batteries included

2013-11-18 Thread Mimmo Cosenza
Hi, I just updated the cljs-start lein-template to create a cljs lib with 
batteries included:

- directories layout of a cljs lib project
- cljsbuild configurations
- clojurescript.test configuration and setup
- brepl connection 

The most significant update regards the substitution of the piggieback lib with 
the austin plugins from Chas Emerick. 

All the Austin use cases should work as expected (but I did not test them 
intensively). 

To create a new cljs lib with batteries included:

lein new cljs-start wonderful-lib
cd wonderful-lib
lein compile
lein test

To connect the be repl:

lein repl
Compiling ClojureScript.
nREPL server started on port 55101 on host 127.0.0.1
REPL-y 0.2.1
Clojure 1.5.1
Docs: (doc function-name-here)
  (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

ring.server=>


Then run the http-server

ring.server=> (run)
2013-11-18 22:54:42.997:INFO:oejs.Server:jetty-7.6.8.v20121106
2013-11-18 22:54:43.026:INFO:oejs.AbstractConnector:Started 
SelectChannelConnector@0.0.0.0:3000
#
ring.server=>

Next create the brepl environment and launch it

ring.server=> (def repl-env (reset! cemerick.austin.repls/browser-repl-env
(cemerick.austin/repl-env)))
Browser-REPL ready @ http://localhost:55146/5840/repl/start
#'ring.server/repl-env
ring.server=> (cemerick.austin.repls/cljs-repl repl-env)
Type `:cljs/quit` to stop the ClojureScript REPL
nil
cljs.user=>

Finally, just visit the localhost:3000 url, wait a moment and then you can go 
back to brepl in clojurescript for supporting the development of your wonderful 
cljs lib.

HIH

Mimmo


On Oct 31, 2013, at 11:33 PM, Mimmo Cosenza  wrote:

> Hi all,
> I just create a simple leon-template to create CLJS libs with batteries 
> included:
> 
> - separation of concerns between the user view and the dev view of the 
> created lib (obtained by using the profiles.clj local to the project
> - http server and brepl (with piggieback by Chas) to bREPLing with the 
> project (everything is kept separated in the profiles.clj)
> - unit test lib included (clojurescript.test by Chas)
> - compilatation included of each build optimisation
> - test-command already defined for phantoms
> - and few other minutiae
> 
> I also started to write a quick README to use it.
> 
> https://github.com/magomimmo/cljs-start
> 
> Here is a very quick start
> 
> lein new cljs-start your-project
> cd your-project
> lein compile
> lein test
> 
> To connect with the browser
> 
> lein repl
> >(require '[ring.server :as http])
> > (http/run)
> > (browser-repl)
> 
> Now visit localhost:3000 and wait a moment to go back to repl
> 
> cljs.user> (cemerick.cljs.test/run-all-tests)
> 
> To generate the jar
> 
> lein jar
> 
> Everything is just started, so be benevolent with me. 
> 
> Feedback are appreciated, even the bad ones.
> 
> HIH 
> 
> mimmo



signature.asc
Description: Message signed with OpenPGP using GPGMail


Design question - dependencies and function discovery

2013-11-18 Thread dm3
Hello,

Looking for opinions :)

I'm currently building an event-driven service which consumes events using 
handlers. Now, the idea is to define a set of handlers (functions of type 
Event->Unit) in different parts of the service,  which are then invoked 
when an event comes into the system. The dependencies are in the following 
order:

[ns.event-processor] -> [ns.handlers] <- [ns.handler-1], [ns.handler-2]

Definition of a handler in *ns.handler-1* looks like this:

(ns.handlers/defhandler Handler1
  (on :EventA [event] (do something))
  (on :EventB [event] (do something else)))

The *defhandler* macro registers the handler in an atom, which is then 
queried when the *ns.event-processor* receives an event.
You might have already figured out that I run into problems when the event 
processor is invoked and not all of the handler namespaces have been loaded 
yet.
Currently I resolve this by explicitly requiring all of the namespaces 
which invoke *defhandler* from the main application namespace which 
constructs the running system.

It seems that I'm looking for some cross-ns var discovery mechanism, 
something like classpath scanning in Java (which smells like an 
anti-pattern in Clojure).
I was wandering whether I'm missing some cleaner/better approach?

Thanks,
Vadim

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Do web apps need Clojure?

2013-11-18 Thread Marcus Blankenship
Ryan,

FYI - The date comparison syntax appears to work fine under h2, but throws a 
exception on PSQL.  

Here’s my function

(defn calendar
  [request]
  (controller/render
(assoc request
  :currentdate (java.util.Date.)
  :videos (model/gather :video {:where {:unlock-date {:<= 
(java.util.Date.)} :campaign_id 1}}


Here’ the error message:

PSQLException Can't infer the SQL type to use for an instance of 
org.joda.time.DateTime. Use setObject() with an explicit Types value to specify 
the type to use.  org.postgresql.jdbc2.AbstractJdbc2Statement.setObject 
(AbstractJdbc2Statement.java:1801)

Any ideas?

Thanks!
Marcus



On Nov 18, 2013, at 12:31 PM, Ryan Spangler  wrote:

> I just ran this in the Caribou repl:
> 
> (caribou.model/gather :field {:where {:created-at {:<= (java.util.Date.)} 
> :model-id 1}})
> 
> And got a bunch of results.  No string coercion necessary!  (also, dashes not 
> underscores!)
> 
> We looked at Korma and found it lacking (similar problem as Compojure: 
> macros).  For that reason we built an entire query engine that works on data 
> directly, so that you can build up queries programmatically just like you 
> would any other data structure (!)
> 
> Check out the section on retrieving content here:  
> http://caribou.github.io/caribou/docs/content.html
> 
> You can do a bunch of cool stuff (logic operations, "in" queries, conditions 
> that span associations, selecting certain fields, seamless queries over join 
> tables etc).  
> 
> Let me know if there is something you expect out of a query engine that 
> Caribou doesn't do, we will add it (if it makes sense!)
> 
> All this stuff is in caribou-core (which you can use independently of the 
> rest of Caribou): https://github.com/caribou/caribou-core
> 
> Maybe I should call it something else to emphasize it is a standalone 
> library... (and replacement for korma)
> 
> 
> On Mon, Nov 18, 2013 at 11:07 AM, Marcus Blankenship  
> wrote:
> Brian,
> 
> Yeah, and I realize I’m going to take darts for this, but coming from 
> Django’s ORM / Rails ActiveRecord makes Korma and these other tools feel like 
> stone-age tools.  I’d rather do it all in SQL than fight something to get out 
> of my way, or reveal it’s magic.
> 
> I know I’m probably not thinking about the problem right, but here’s an 
> example of something that I still can’t get to work in Korma.  G….
> 
> lein-repl commands
> (use [`advent2.models.db] :reload-all)
> (get-unlocked-videos-for-campaign 1)
> 
> 
> 
> models/db.clj function
> (defn format-todays-date []
>   (let [date (java.util.Date.)]
> (prn date)
> (str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \' )))
> 
> 
> (defn get-unlocked-videos-for-campaign [campaign]
>   (let [c_id (:id campaign)]
> (select videos (where {:unlock_date [<= (format-todays-date)] 
> :campaign_id c_id}
> 
> 
> 
> output
> user=> (get-unlocked-videos-for-campaign 1)
> #inst "2013-11-18T19:06:09.595-00:00"
> Failure to execute query with SQL:
> SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND 
> "videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
> PSQLException:
>  Message: ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might 
> need to add explicit type casts.
>   Position: 63
>  SQLState: 42883
>  Error Code: 0
> 
> PSQLException ERROR: operator does not exist: date <= character varying
>   Hint: No operator matches the given name and argument type(s). You might 
> need to add explicit type casts.
>   Position: 63  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse 
> (QueryExecutorImpl.java:2102)
> 
> 
> 
> 
> 
> 
> On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:
> 
>> Re: korma, and sql dsls, I've been moving between korma, honeysql, and raw 
>> sql, without being satisfied with any of them. Desirable traits of the db 
>> layer in my problem domain are 1) eliminating boilerplate (e.g. setting up 
>> default keys, and indexes, and performing standard joins across relations), 
>> 2) isolating view layers from data access layers (so the view doesn't need 
>> to know if a subselect or a join is required to span some relation, for 
>> example), 3) ability to progressively optimize by dropping back to sql when 
>> required, 4) ability to safely expose a general purpose query API over the 
>> data.
>> 
>> korma eliminates a very, very small part of the boilerplate. It's almost not 
>> worth the effort. Falling back to raw sql smoothly is difficult in korma, 
>> and I've had to drop it entirely in places where I need performance. 
>> Honeysql eliminates no boilerplate, but representing queries with data 
>> structures does make it easy to expose a sql-like query API with db 
>> firewalling (by matching on the incoming structure). Korma appears to also 
>> represent queries as data structures, but it's not part of the documented 
>> API. You have to reverse-engineer it, 

Re: Do web apps need Clojure?

2013-11-18 Thread Ben Wolfson
try (java.sql.Timestamp (.getDate (java.util.Date.)))


On Mon, Nov 18, 2013 at 3:42 PM, Marcus Blankenship
wrote:

> Ryan,
>
> FYI - The date comparison syntax appears to work fine under h2, but throws
> a exception on PSQL.
>
> *Here’s my function*
>
> (defn calendar
>   [request]
>   (controller/render
> (assoc request
>   :currentdate (java.util.Date.)
>   :videos (model/gather :video {:where {:unlock-date {:<=
> (java.util.Date.)} :campaign_id 1}}
>
>
> *Here’ the error message:*
>
> PSQLException Can't infer the SQL type to use for an instance of
> org.joda.time.DateTime. Use setObject() with an explicit Types value to
> specify the type to use.
>  org.postgresql.jdbc2.AbstractJdbc2Statement.setObject
> (AbstractJdbc2Statement.java:1801)
>
> Any ideas?
>
> Thanks!
> Marcus
>
>
>
> On Nov 18, 2013, at 12:31 PM, Ryan Spangler 
> wrote:
>
> I just ran this in the Caribou repl:
>
> (caribou.model/gather :field {:where {:created-at {:<=
> (java.util.Date.)} :model-id 1}})
>
> And got a bunch of results.  No string coercion necessary!  (also, dashes
> not underscores!)
>
> We looked at Korma and found it lacking (similar problem as Compojure:
> macros).  For that reason we built an entire query engine that works on
> data directly, so that you can build up queries programmatically just like
> you would any other data structure (!)
>
> Check out the section on retrieving content here:
> http://caribou.github.io/caribou/docs/content.html
>
> You can do a bunch of cool stuff (logic operations, "in" queries,
> conditions that span associations, selecting certain fields, seamless
> queries over join tables etc).
>
> Let me know if there is something you expect out of a query engine that
> Caribou doesn't do, we will add it (if it makes sense!)
>
> All this stuff is in caribou-core (which you can use independently of the
> rest of Caribou): https://github.com/caribou/caribou-core
>
> Maybe I should call it something else to emphasize it is a standalone
> library... (and replacement for korma)
>
>
> On Mon, Nov 18, 2013 at 11:07 AM, Marcus Blankenship <
> mar...@creoagency.com> wrote:
>
>> Brian,
>>
>> Yeah, and I realize I’m going to take darts for this, but coming from
>> Django’s ORM / Rails ActiveRecord makes Korma and these other tools feel
>> like stone-age tools.  I’d rather do it all in SQL than fight something to
>> get out of my way, or reveal it’s magic.
>>
>> I know I’m probably not thinking about the problem right, but here’s an
>> example of something that I still can’t get to work in Korma.  G….
>>
>> *lein-repl commands*
>> (use [`advent2.models.db] :reload-all)
>> (get-unlocked-videos-for-campaign 1)
>>
>>
>>
>> *models/db.clj function*
>> (defn format-todays-date []
>>   (let [date (java.util.Date.)]
>> (prn date)
>> (str \' (.format (java.text.SimpleDateFormat. "-MM-dd") date) \'
>> )))
>>
>>
>> (defn get-unlocked-videos-for-campaign [campaign]
>>   (let [c_id (:id campaign)]
>> (select videos (where {:unlock_date [<= (format-todays-date)]
>> :campaign_id c_id}
>>
>>
>>
>> *output*
>> user=> (get-unlocked-videos-for-campaign 1)
>> #inst "2013-11-18T19:06:09.595-00:00"
>> Failure to execute query with SQL:
>> SELECT "videos".* FROM "videos" WHERE ("videos"."unlock_date" <= ? AND
>> "videos"."campaign_id" IS NULL)  ::  ['2013-11-18']
>> PSQLException:
>>  Message: ERROR: operator does not exist: date <= character varying
>>   Hint: No operator matches the given name and argument type(s). You
>> might need to add explicit type casts.
>>   Position: 63
>>  SQLState: 42883
>>  Error Code: 0
>>
>> PSQLException ERROR: operator does not exist: date <= character varying
>>   Hint: No operator matches the given name and argument type(s). You
>> might need to add explicit type casts.
>>   Position: 63
>>  org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
>> (QueryExecutorImpl.java:2102)
>>
>>
>>
>>
>>
>>
>> On Nov 18, 2013, at 10:23 AM, Brian Craft  wrote:
>>
>> Re: korma, and sql dsls, I've been moving between korma, honeysql, and
>> raw sql, without being satisfied with any of them. Desirable traits of the
>> db layer in my problem domain are 1) eliminating boilerplate (e.g. setting
>> up default keys, and indexes, and performing standard joins across
>> relations), 2) isolating view layers from data access layers (so the view
>> doesn't need to know if a subselect or a join is required to span some
>> relation, for example), 3) ability to progressively optimize by dropping
>> back to sql when required, 4) ability to safely expose a general purpose
>> query API over the data.
>>
>> korma eliminates a very, very small part of the boilerplate. It's almost
>> not worth the effort. Falling back to raw sql smoothly is difficult in
>> korma, and I've had to drop it entirely in places where I need performance.
>> Honeysql eliminates no boilerplate, but representing queries with data
>> structures does make it easy to expose a sql-like query API with db
>

Re: Using xlisp assoc-lists in clojure

2013-11-18 Thread Cedric Greevey
It would probably be better to convert to/from normal Clojure maps at the
edges of the Clojure code. If the input is '((k1 v1) (k2 v2) (k3 v3) (k1
v4)) and we want the earliest occurrence of k1 to "win", then that suggests
(into {} (reverse alist)). If the input's flattened that would be (into {}
(reverse (partition 2 alist))). The reverse makes sure that into assoces
{k1 v4} first and then overwrites it with {k1 v1}, so the earliest
occurrence of k1 "wins". If conj onto a map rejects two-element lists (as
opposed to vectors; I don't have the docs or a repl in front of me where I
am right now) then you'll need a (map vec) in there or something as well.

Output is simpler; (seq amap) alone might suffice, but (map seq amap)
should give you the '((k1 v1) (k2 v2) ...) form from prn, and (mapcat seq
amap) '(k1 v1 k2 v2 ...).

Of course, if you want the key-shadowing behavior not as a cheap overwrite
but as a kind of "stack", so that (drop 1) on the original example would
result in (k1 v4) being a mapping, then you need something beyond a normal
Clojure map -- possibly a map of keys to stacks of values (maintained in
vectors, say), or a stack of maps, depending on the exact use case.


On Mon, Nov 18, 2013 at 10:54 AM, Tassilo Horn  wrote:

> Justin Smith  writes:
>
> Hi Justin & Hans-Peter,
>
> > Typically in clojure we use hash-maps (represented literally as {})
> > where other lisps would use an alist.
>
> One difference between alists and maps is that in alists a "key" can
> occur multiple times, and then the first entry with that key shadows all
> following entries with that key (with respect to retrieval with
> `assoc`).
>
> Well, that feature is probably not used very often, but if you can't
> rule out its usage, you also can't convert alists to maps and expect
> they're equivalent.
>
> > Regarding reading assoc list literals, I wouldn't be surprised if
> > someone had written this function already, but I doubt it is in the
> > core language.
>
> This should do the trick:
>
>   (defn alist-assoc [key alist]
> (first (filter #(= key (first %)) alist)))
>
> And to add a list to an alist one would use `cons` in Clojure just like
> one would use `cons` in CL, Scheme, or Elisp, too.
>
> Bye,
> Tassilo
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> 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: Design question - dependencies and function discovery

2013-11-18 Thread John D. Hume
Rather than having hidden mutable state for wiring events to handlers,
would it be clearer if the main namespace just passed an :event->[handlers]
map to the event processor?

If that would create a huge, frequently changing data structure, each
namespace with handlers could expose an :event->[handlers] map of its own,
and the main ns could merge-with concat. That would at least make explicit
what's currently implied by the main ns requiring all the handler
namespaces.


On Mon, Nov 18, 2013 at 4:07 PM, dm3  wrote:

> Hello,
>
> Looking for opinions :)
>
> I'm currently building an event-driven service which consumes events using
> handlers. Now, the idea is to define a set of handlers (functions of type
> Event->Unit) in different parts of the service,  which are then invoked
> when an event comes into the system. The dependencies are in the following
> order:
>
> [ns.event-processor] -> [ns.handlers] <- [ns.handler-1], [ns.handler-2]
>
> Definition of a handler in *ns.handler-1* looks like this:
>
> (ns.handlers/defhandler Handler1
>   (on :EventA [event] (do something))
>   (on :EventB [event] (do something else)))
>
> The *defhandler* macro registers the handler in an atom, which is then
> queried when the *ns.event-processor* receives an event.
> You might have already figured out that I run into problems when the event
> processor is invoked and not all of the handler namespaces have been loaded
> yet.
> Currently I resolve this by explicitly requiring all of the namespaces
> which invoke *defhandler* from the main application namespace which
> constructs the running system.
>
> It seems that I'm looking for some cross-ns var discovery mechanism,
> something like classpath scanning in Java (which smells like an
> anti-pattern in Clojure).
> I was wandering whether I'm missing some cleaner/better approach?
>
> Thanks,
> Vadim
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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.


Re: instaparse questions

2013-11-18 Thread Mark Engelberg
Also, the version in the tutorial called "preferential-tokenizer" behaves
the way you would like.  This is actually a really good illustration of the
difference between the two approaches of negative lookahead versus ordered
choice.

The unambiguous-tokenizer, by saying " = keyword | !keyword
identifier", rigidly specifies that it's not a valid identifier if it
starts with a keyword.  The preferential-tokenizer simply says: " =
keyword / identifier", i.e., keyword interpretation is *preferred* over
identifier.  The preference approach is more flexible, allowing the parser
to begin by interpreting the "cond" in "condid" as a keyword, but when this
doesn't lead to a valid parse (because there's no whitespace after "cond"),
it backtracks and tries interpreting it as an identifier.

As I pointed out in the last post, you can "fix" the unambiguous-tokenizer
by clearly specifying with regexes that the tokens must end at word
boundaries, but the preferential-tokenizer example is another way to get
the behavior you're looking for.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread kovas boguta
I used to find libraries using github's
now-modified-to-the-point-of-uselessness explore feature. Its probably
still possible to set up a decent search though.

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.




On Mon, Nov 18, 2013 at 4:01 PM, Brian Craft  wrote:
> Wow, this result is shocking to me:
>
>> In short, Clojure libraries are easy to find, their maintainers are
>> receptive to feedback and patches, they are technically of high quality, but
>> they’re not always very well-documented.  None of that is surprising or
>> particularly different from last year.
>
>
> This could not be more starkly different than my experience. I'm not sure
> I've used a clojure library that doesn't have quirky bugs like hanging at
> exit, blowing the heap by holding the heads of seqs, or just doing the wrong
> thing.
>
> Also, I find it difficult to find libraries. When I do find libraries
> they're often deprecated, or moribund. What's the easy way to find clojure
> libraries?
>
>
> On Monday, November 18, 2013 11:32:56 AM UTC-8, 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: core.logic merge substitutions map?

2013-11-18 Thread Kevin Downey
https://github.com/sonian/Greenmail/blob/master/src/clj/greenmail/db.clj#L98-L126
has an example, using clojure.core.logic/all to make a goal which is a
conjunction of the clojure.core.logic/== goals

On 11/16/13, 5:04 PM, Mark wrote:
> d'oh!  Answering my own question:  Just compose the unify functions a la 
> (unify (unify a v1 (:v1 r) v2 (:v2 r))
> 
> I have a feeling there is a library function/macro that would make this 
> less messy but I can't find it from the cheatsheet.
> 
> On Saturday, November 16, 2013 10:31:50 AM UTC-8, Mark wrote:
>>
>> I stumbled across Timothy Baldridge's excellent video 
>> explaining how to incorporate 
>> data sources into core.logic.  It reinvigorated my interest in using 
>> core.logic to query SQL RDBMS.  I'm stumbling on a pretty simple thing, I 
>> think.  I've got a table that has three columns, a single primary key 
>> column and two value columns.  Using the pattern Tim outlines in his video, 
>> I've got a relation function that takes three parameters, one for each 
>> column and I'm trying to work through the case where the primary key is 
>> ground and the value columns are lvars.  This translates to a query of the 
>> form SELECT v1, v2 FROM t WHERE pkey=?.  Of course, this returns two values 
>> that must be unified.  That's where I'm stuck.
>>
>> I know I want to return a substitution map, but I have two lvars to 
>> unify.  How do I merge the two substitution maps?
>>
>> Sample code:
>> (defn pkey-v1-v2-o [pkey v1 v2]
>>   (fn [a]
>> (let [pkey (walk a pkey)
>>   v1 (walk a v1)
>>   v2(walk a v2)]
>>   (condp = [(not (lvar? pkey))
>> (not (lvar? v1))
>> (not (lvar? v2))]
>> [true false false ] (to-stream 
>>   (let [r (first (query ["SELECT v1, v2 FROM T 
>> WHERE pkey=?" pkey]))]
>> (some-merge-fn (unify a v1 (:v1 r))
>>(unify a v2 (:v2 r)
>>
> 


-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?



signature.asc
Description: OpenPGP digital signature


Re: instaparse: composing smaller rules into a bigger one

2013-11-18 Thread Mark Engelberg
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 and 10)].")
[:S [:TOKEN [:DRUGPK [:PK "Exposure"] "to" [:DRUG "didanosine"] [:EFF "is"
[:MECH "increased" [:TOKEN "when"] [:TOKEN [:EFF [:MECH
"coadministered"]]] [:TOKEN "with"] [:TOKEN [:DRUG "tenofovir"]] [:TOKEN
"disoproxil"] [:TOKEN "fumarate"] [:TOKEN [:ENCLOSED "[Table 5 and see
Clinical Pharmacokinetics (12.3, Tables 9 and 10)]"]] [:END "."]]

which I think is what you want.

If you have follow-up questions, I recommend posting to the instaparse
google group:
https://groups.google.com/forum/#!forum/instaparse

--Mark

P.S.  I've been experimenting with a feature to make it easier to express
grammars where you find yourself inserting an optional whitespace rule
everywhere, documented here under:
https://github.com/Engelberg/instaparse/blob/master/docs/ExperimentalFeatures.md#auto-whitespace


On Mon, Nov 18, 2013 at 5:47 AM, Jim - FooBar(); wrote:

>  Hi all,
>
> I'm having a small problem composing smaller matches in instaparse. Here
> is what I'm trying...just observe the bold bits:
>
> (def parsePK
>   (insta/parser
>"S  = TOKEN (SPACE TOKEN PUNCT?)* END
>TOKEN = (NUM | DRUG | PK | DRUGPK | MECH | SIGN | EFF | ENCLOSED) /
> WORD
> = #'\\w+' | PUNCT
> = #'\\p{Punct}'
>ENCLOSED = PAREN | SQBR
> = #'\\[.*\\]'
> =  #'\\(.*\\)'
> NUM =  #'[0-9]+'
> ADV =   #'[a-z]+ly'
> = #'\\s+'
> DRUG =  #'(?i)didanosine|quinidine|tenofovir'
> PK =#'(?i)exposure|bioavailability|lower?[\\s|\\-]?clearance'
> *DRUGPK =  PK SPACE TO SPACE DRUG SPACE EFF? SPACE *
> MECH =  #'[a-z]+e(s|d)'
> *EFF = BE? SPACE SIGN? SPACE MECH | BE? SPACE MECH SPACE ADV? *
> SIGN =  ADV | NEG
> NEG = 'not'
>  = 'to' | 'of'
>  = 'is' | 'are' | 'was' | 'were'
> END =  '.' " ))
>
> Running the parser returns the following. It seems that the 2 bigger
> composite rules DRUGPK & EFF are not recognised at all. Only the smaller
> pieces are actually shown. I would expect [:TOKEN [:DRUGPK "Exposure to
> didanosine is increased"]] and  [:TOKEN [:EFF "is increased"]] entries.
> (pprint
> (parsePK "Exposure to didanosine is increased when coadministered with
> tenofovir disoproxil fumarate [Table 5 and see Clinical Pharmacokinetics
> (12.3, Tables 9 and 10)]."))
>
>
> [:S
>  [:TOKEN [:PK "Exposure"]]
>  " "
>  [:TOKEN "to"]
>  " "
>  [:TOKEN [:DRUG "didanosine"]]
>  " "
>  [:TOKEN "is"]
>  " "
>  [:TOKEN [:MECH "increased"]]
>  " "
>  [:TOKEN "when"]
>  " "
>  [:TOKEN [:MECH "coadministered"]]
>  " "
>  [:TOKEN "with"]
>  " "
>  [:TOKEN [:DRUG "tenofovir"]]
>  ","
>  " "
>  [:TOKEN "disoproxil"]
>  " "
>  [:TOKEN "fumarate"]
>  [:END "."]]
>
>  Am I thinking about it the wrong way? Can ayone shed some light?
>
> many thanks in advance,
>
> 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.
>

-- 
-- 
You r

Re: gemacl: Scientific computing application written in Clojure

2013-11-18 Thread Jose M. Perez Sanchez
Hi Andy, cej38, kovas:

Thanks for the replies. I plan to release the whole code soon (waiting for 
institutional authorization).

I do use lazyness both within the move function to select the allowed 
random displacements and when iterating the move function to generate the 
trajectory. Lazy structures are only consumed within the thread in which 
they are created.

Here is the core code where the computations happens:

(defn step-particle
  "Returns a new value for particle after moving particle once to a new 
position from the current one"
  [pdf-get-fn step-condition-fn calc-value-fns particle]
  (let [pos (particle :pos)
disp (first (filter (fn [x] (step-condition-fn (particle :pos) x)) 
(repeatedly (fn [] (pdf-get-fn)
new-pos (mapv + pos disp)
new-base-particle {:pos new-pos :steps (inc (particle :steps))}
new-trackers-results (if (seq calc-value-fns)
   (zipmap
 (keys calc-value-fns)
 ((apply juxt (vals calc-value-fns)) 
particle new-base-particle))
   {})]
(merge new-trackers-results new-base-particle)))

(defn walk-particles
  "While there is work to do, create new particles, move them n-steps, then 
send them to particle container (agent)"
  [todo particles simul-info init-get-fn init-condition step-get-fn 
step-condition trackers-maps step-extract-fn]
  (let [init-value-fns (zipmap
 (keys trackers-maps)
 (map :create-fn (vals trackers-maps)))
calc-value-fns (zipmap
 (keys trackers-maps)
 (map :compute-fn (vals trackers-maps)))
move (partial step-particle step-get-fn step-condition 
calc-value-fns)]

(while (> @todo 0)
  (swap! todo dec)
  (let [p (last (create-particle init-get-fn init-condition 
init-value-fns))
lazy-steps (iterate move p)
result (step-extract-fn lazy-steps)]
 (send-off particles (fn [x] (conj x result)))


Each worker is created launching a future that executes walk-particles, 
each worker has a separate Mersenne Twister random number generator 
embedded into the pdf-get-fn (using partial on a common pdf-get function 
and different MT generators). In real calculations both number of particles 
and steps are at least 1e4. In the benchmarks I'm posting particles are 
1000, steps are 5000.

As expected conjoining to a single global vector poses no problem, I tested 
both conjoining to a single global vector and to separate global vectors 
(one per worker) and the computing time is the same.

I could test in another system with 16 cores. See the results attached for 
the 8 and 16 core systems.

Best,

Jose.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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.


benchmark.pdf
Description: Adobe PDF document


Generating functions from data

2013-11-18 Thread Jeremy Heiler
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?

Thanks,
;; Jeremy

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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] clojure-sec

2013-11-18 Thread ronen
First note that Im not a security expert so take my advice with a grain of 
salt, 

There are couple of middlewares that are worth checking out (in addition to 
friend):

* https://github.com/weavejester/ring-anti-forgery
* https://github.com/myfreeweb/ring-ratelimit

Regarding SQL injection quoting 
OWSAP
:

   - All queries should be parametrized.
   - All dynamic data should be explicitly bound to parametrized queries.
   - String concatenation should never be used to create dynamic SQL.

It looks like https://github.com/clojure/java.jdbc there is such 
separation, 

Regarding XSS you can escape html 
on
 
the server side but following 
OWSAP
 is 
recommended

It would be nice to have a website dedicated for security best practices in 
Clojure webapps, 

Thanks

On Monday, November 18, 2013 9:19:56 PM UTC+2, wm.ma...@gmail.com wrote:
>
> This list seems somewhat inactive, which I find a bit surprising, but I am 
> very interested in one particular aspect of security when I build Clojure 
> apps.
>
> Right now my interest is in building REST web services and web 
> applications backed by a relational database with something like Angular or 
> Backbone at the front-end. I'm therefore interested in applying best 
> practices in securing web applications for the public internet.
>
> I don't have a deep background in security, but as a seasoned Java 
> developer I have a good idea of some of the security considerations for web 
> applications, and I agree with another post here that OWASP is a very 
> useful resource. My specific interests in security are mainly mitigations 
> against:
>
> 1. SQL injection;
> 2. Cross-site scripting;
> 3. Request forgery.
>
> When it comes to the many libraries available for Clojure I struggle to 
> find good information on these topics, so I'm unsure what is my 
> responsibility as an app developer and what is being provided by those 
> libraries for me.
>
> For example, based on Clojure tutorials I have built a Compojure web 
> application that:
>
> 1. Accepts JSON from a client;
> 2. Inserts a database record based on the JSON (using the official JDBC 
> wrappers).
>
> This is implemented in the most simple way possible: the JSON map is 
> basically passed directly to the function that inserts that map in the 
> database. I don't even name database columns and I don't filter text to 
> mitigate against attacks. 
>
> In my equivalent Java web application, I'd know to white-list keys for my 
> JSON unmarshalling, I'd name explicit columns in my database operations, 
> and I'd run the submitted user text through filters to strip out any 
> malicious scripts or whatever, or escape the text when reading data back.
>
> I would have no confidence hosting this web application on the public 
> internet in its current state.
>
> Now, admittedly my Clojure experience is limited (at time of writing I 
> have about three part-time days of experience!), so these things may be 
> obvious to others here, but right now this is the sort of thing I simply 
> don't know how to do with Clojure and the third party libraries I'm using.
>
> By the way, I do use Friend already and I am finding it really useful.
>
> On Friday, 14 December 2012 17:36:57 UTC, Chas Emerick wrote:
>>
>> Some recent discussions related to my development of Friend have prompted 
>> me to create a new group: 
>>
>> https://groups.google.com/group/clojure-sec 
>> "Dedicated to discussing security issues affecting those building 
>> applications with Clojure and its variants." 
>>
>> I'm sure many of us are building applications that have security 
>> considerations.  I think it would be helpful at this point if there were a 
>> dedicated place for discussions around addressing those considerations; 
>> thus, clojure-sec. 
>>
>> We'll see what people actually want to talk about, but I'd be happy if 
>> any of these classes of topics become common: 
>>
>> * usage and design of particular security-related libraries and tools 
>> * security-related tech available in the various host environments that 
>> we can leverage from Clojure(Script/.CLR/-py/c/etc) 
>> * Clojure-specific concerns (e.g. untrusted code evaluation / jailing) 
>> * issues or weaknesses in particular Clojure implementations, libraries, 
>> etc. 
>> * discussion of more general-interest security topics that nevertheless 
>> impinge upon our work in Clojure 
>> * more, more, more 
>>
>> I'm looking forward to learning. 
>>
>> Cheers, 
>>
>> - Chas 
>>
>> -- 
>> http://cemerick.com 
>> [Clojure Programming from O'Reilly](http://www.clojurebook.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

Re: 2013 State of Clojure & ClojureScript survey results

2013-11-18 Thread Jeremy Heiler
On Mon, Nov 18, 2013 at 4:01 PM, Brian Craft  wrote:

> Also, I find it difficult to find libraries. When I do find libraries
> they're often deprecated, or moribund. What's the easy way to find clojure
> libraries?
>

There's http://www.clojure-toolbox.com, but your mileage may vary.

Viewing the commit log on GitHub shows that it's still being updated.

https://github.com/weavejester/clojure-toolbox.com/commits/master

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Tony Tam
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.


Re: Do web apps need Clojure?

2013-11-18 Thread Jarrod Swart
The talk is linked in my initial post, and again 
here: http://skillsmatter.com/podcast/agile-testing/bobs-last-language its 
very interesting!

On Monday, November 18, 2013 2:00:06 PM UTC-5, Marcus Blankenship wrote:
>
> Do you have a link to the UncleBob talk, Jarrod?
>
>
> On Nov 16, 2013, at 4:34 PM, Jarrod Swart > 
> wrote:
>
> I think the more interesting question is: *do web developers need 
> Clojure?  *If performance were the sole concern then everyone would still 
> code web apps in C or assembler.  There is great power in abstraction.  I 
> like this talk by Uncle Bob: 
> http://skillsmatter.com/podcast/agile-testing/bobs-last-language  If you 
> don't have time to watch it I will summarize: every time we *get a more 
> powerful programming environment* (for developers) we *reduce* our 
> programming options (in the language).  
>
>- C --> Java == no pointers
>- Java --> Clojure == no immutability, etc.
>
> Every major advancement for developers has largely involved reducing our 
> options and choices.  Take away register manipulation, take away pointers, 
> take away variables, and so on.  I highly recommend the talk by Uncle Bob.
>
> So I highly encourage you to investigate the benefits that Clojure provide 
> to the developer, over the benefits provided to the machine.
>
> Good luck in your search!
>
> Jarrod
>
> On Wednesday, November 13, 2013 5:38:49 PM UTC-5, Marcus Blankenship wrote:
>>
>> Hi Folks,
>>
>> We’re a Python / Django shop, and some folks are getting excited about 
>> using Clojure for building web apps.  Certainly there are numerous 
>> open-source options to assist us (Pedastal, Ring, Compojure, Caribou, etc), 
>> but I think it begs a larger question: *as a rule, do web applications 
>> need the power that Clojure brings to the table?*
>>
>> Other folks on my team are telling me that solutions built with Python / 
>> Django (or even RubyOnRails) fully satisfy the needs of 99% of the web apps 
>> we have built, and that Clojure offers nothing new to this problem space.  
>>
>> So, here’s the question: *How are you are actually using Clojure, and 
>> why did you choose to use it, particularly in the “web application” space? *
>>  
>>
>> Thanks,
>> Marcus
>>
>>
>>
>> marcus blankenship
>> \\\ Partner, Problem Solver, Linear Thinker
>> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
>>  
>>
> -- 
> -- 
> 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.
>
>
> marcus blankenship
> \\\ Partner, Problem Solver, Linear Thinker
> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
>  
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Do web apps need Clojure?

2013-11-18 Thread Marcus Blankenship
Thanks!

On Nov 18, 2013, at 6:03 PM, Jarrod Swart  wrote:

> The talk is linked in my initial post, and again here: 
> http://skillsmatter.com/podcast/agile-testing/bobs-last-language its very 
> interesting!
> 
> On Monday, November 18, 2013 2:00:06 PM UTC-5, Marcus Blankenship wrote:
> Do you have a link to the UncleBob talk, Jarrod?
> 
> 
> On Nov 16, 2013, at 4:34 PM, Jarrod Swart  wrote:
> 
>> I think the more interesting question is: do web developers need Clojure?  
>> If performance were the sole concern then everyone would still code web apps 
>> in C or assembler.  There is great power in abstraction.  I like this talk 
>> by Uncle Bob: 
>> http://skillsmatter.com/podcast/agile-testing/bobs-last-language  If you 
>> don't have time to watch it I will summarize: every time we get a more 
>> powerful programming environment (for developers) we reduce our programming 
>> options (in the language).  
>> C --> Java == no pointers
>> Java --> Clojure == no immutability, etc.
>> Every major advancement for developers has largely involved reducing our 
>> options and choices.  Take away register manipulation, take away pointers, 
>> take away variables, and so on.  I highly recommend the talk by Uncle Bob.
>> 
>> So I highly encourage you to investigate the benefits that Clojure provide 
>> to the developer, over the benefits provided to the machine.
>> 
>> Good luck in your search!
>> 
>> Jarrod
>> 
>> On Wednesday, November 13, 2013 5:38:49 PM UTC-5, Marcus Blankenship wrote:
>> Hi Folks,
>> 
>> We’re a Python / Django shop, and some folks are getting excited about using 
>> Clojure for building web apps.  Certainly there are numerous open-source 
>> options to assist us (Pedastal, Ring, Compojure, Caribou, etc), but I think 
>> it begs a larger question: as a rule, do web applications need the power 
>> that Clojure brings to the table?
>> 
>> Other folks on my team are telling me that solutions built with Python / 
>> Django (or even RubyOnRails) fully satisfy the needs of 99% of the web apps 
>> we have built, and that Clojure offers nothing new to this problem space.  
>> 
>> So, here’s the question: How are you are actually using Clojure, and why did 
>> you choose to use it, particularly in the “web application” space?  
>> 
>> Thanks,
>> Marcus
>> 
>> 
>> 
>> marcus blankenship
>> \\\ Partner, Problem Solver, Linear Thinker
>> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
>> 
>> 
>> -- 
>> -- 
>> 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.
> 
> marcus blankenship
> \\\ Partner, Problem Solver, Linear Thinker
> \\\ 541.805.2736 \ @justzeros \ skype:marcuscreo
> 
> 
> -- 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from 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.

marcus blankenship
\\\ Partner, Problem Solver, Linear Thinker
\\\ 541.805.2736 \ @justzeros \ skype:marcuscreo

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: gemacl: Scientific computing application written in Clojure

2013-11-18 Thread kovas boguta
Hi Jose,

I think you should try making the core iteration purely functional,
meaning no agents, atoms, or side effecting functions like the random
generator.

I assume the number of steps you evolve the particle is encoded in
step-extract-fn?

What you probably want is something like

(loop [i 0  pos  initial-position]
  (if (< i num-of-steps)
  (recur (+ i 1) (move pos)) ;; iterate
  pos  ;; if done, return final position
   ))

This will make it easier to benchmark the iteration step, which is an
important number to know. I'm sure you can make it much faster, if
perf is the ultimate goal its worth tuning a little.

In terms of distributing the work, I would not use atoms or agents.
They are not meant for parallelism or for work queues. With agents and
futures you need to be aware of the various thread pools involved
under the hood and make sure you are not saturating them. And combined
with laziness, it takes care to ensure work is getting done where you
are expecting it.

It would be easier to reason about what is going on by using threads
and queues directly. Enqueue a bunch of work on a queue, and directly
set up a bunch of threads that read batches of work from the queue
until its empty.

If the initial condition / other parameters are the same across
workers, you could even skip the work queue, and just set up a bunch
of threads that just do the iterations and then dump their result
somewhere.

I also definitely recommend making friends with loop/recur:

(time
 (loop [i 0]
   (if (< i 100)
 (recur (+ 1 i))
 true)))
=> "Elapsed time: 2.441 msecs"

(def i (atom 0))

(time
 (while (< @i 100)
   (swap! i + 1)))
=> "Elapsed time: 52.767 msecs"

loop/recur is both simpler and faster, and the best way to rapidly iterate.





On Mon, Nov 18, 2013 at 7:47 PM, Jose M. Perez Sanchez
 wrote:
> Hi Andy, cej38, kovas:
>
> Thanks for the replies. I plan to release the whole code soon (waiting for
> institutional authorization).
>
> I do use lazyness both within the move function to select the allowed random
> displacements and when iterating the move function to generate the
> trajectory. Lazy structures are only consumed within the thread in which
> they are created.
>
> Here is the core code where the computations happens:
>
> (defn step-particle
>   "Returns a new value for particle after moving particle once to a new
> position from the current one"
>   [pdf-get-fn step-condition-fn calc-value-fns particle]
>   (let [pos (particle :pos)
> disp (first (filter (fn [x] (step-condition-fn (particle :pos) x))
> (repeatedly (fn [] (pdf-get-fn)
> new-pos (mapv + pos disp)
> new-base-particle {:pos new-pos :steps (inc (particle :steps))}
> new-trackers-results (if (seq calc-value-fns)
>(zipmap
>  (keys calc-value-fns)
>  ((apply juxt (vals calc-value-fns))
> particle new-base-particle))
>{})]
> (merge new-trackers-results new-base-particle)))
>
> (defn walk-particles
>   "While there is work to do, create new particles, move them n-steps, then
> send them to particle container (agent)"
>   [todo particles simul-info init-get-fn init-condition step-get-fn
> step-condition trackers-maps step-extract-fn]
>   (let [init-value-fns (zipmap
>  (keys trackers-maps)
>  (map :create-fn (vals trackers-maps)))
> calc-value-fns (zipmap
>  (keys trackers-maps)
>  (map :compute-fn (vals trackers-maps)))
> move (partial step-particle step-get-fn step-condition
> calc-value-fns)]
>
> (while (> @todo 0)
>   (swap! todo dec)
>   (let [p (last (create-particle init-get-fn init-condition
> init-value-fns))
> lazy-steps (iterate move p)
> result (step-extract-fn lazy-steps)]
>  (send-off particles (fn [x] (conj x result)))
> 
>
> Each worker is created launching a future that executes walk-particles, each
> worker has a separate Mersenne Twister random number generator embedded into
> the pdf-get-fn (using partial on a common pdf-get function and different MT
> generators). In real calculations both number of particles and steps are at
> least 1e4. In the benchmarks I'm posting particles are 1000, steps are 5000.
>
> As expected conjoining to a single global vector poses no problem, I tested
> both conjoining to a single global vector and to separate global vectors
> (one per worker) and the computing time is the same.
>
> I could test in another system with 16 cores. See the results attached for
> the 8 and 16 core systems.
>
> Best,
>
> Jose.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with

Re: Generating functions from data

2013-11-18 Thread Michael-Keith Bernard (SegFaultAX)
Hi Jeremy,

There are a number of existing implementations of what you're describing, 
the most well known of which is the Web Services Description Language 
(WSDL)commonly 
used with 
SOAP . A WSDL file provides a complete, 
pure data (usually XML) description of a remote service which is used to 
automatically generate clients, servers, documentation, tests, and a 
variety of other useful things. If you're not already familiar with these 
technologies, I suggest researching them to get a better understanding of 
what has already been done in this area along with the associated benefits 
and drawbacks. Let me know if you have any specific questions or feedback.

Cheers,
Michael-Keith

On Monday, November 18, 2013 4:48:54 PM UTC-8, 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?
>
> Thanks,
> ;; Jeremy
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Jeremy Heiler
On Mon, Nov 18, 2013 at 9:35 PM, Michael-Keith Bernard (SegFaultAX) <
mkbernard@gmail.com> wrote:

> There are a number of existing implementations of what you're describing,
> the most well known of which is the Web Services Description Language
> (WSDL) 
> commonly used 
> with
> SOAP . A WSDL file provides a
> complete, pure data (usually XML) description of a remote service which is
> used to automatically generate clients, servers, documentation, tests, and
> a variety of other useful things. If you're not already familiar with these
> technologies, I suggest researching them to get a better understanding of
> what has already been done in this area along with the associated benefits
> and drawbacks. Let me know if you have any specific questions or feedback.
>

Yes, I am familiar. Those are what I alluded to when I mentioned generating
the code at build time. While I did mention that as an alternative, I am
mostly interested in doing this at compile time with macros.

This somewhat pushes the performance burden (if that is even measurably
significant) to the user, but it also makes things easier for the user to
tweak with a one-time compile cost versus an every-time runtime cost.

Thanks for pointing out WSDL and SOAP, forcing to to clarify my comments.
:-)

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread Jeremy Heiler
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.


Re: 2013 State of Clojure & ClojureScript survey results

2013-11-18 Thread Jarrod Swart
I will second http://clojure-toolbox.com and I also recently found: 
http://www.clojuresphere.com/ 

On Monday, November 18, 2013 4:01:27 PM UTC-5, Brian Craft wrote:
>
> Wow, this result is shocking to me:
>
> In short, Clojure libraries are easy to find, their maintainers are 
>> receptive to feedback and patches, they are technically of high quality, 
>> but they’re not always very well-documented.  None of that is surprising or 
>> particularly different from last year.
>>
>
> This could not be more starkly different than my experience. I'm not sure 
> I've used a clojure library that doesn't have quirky bugs like hanging at 
> exit, blowing the heap by holding the heads of seqs, or just doing the 
> wrong thing.
>
> Also, I find it difficult to find libraries. When I do find libraries 
> they're often deprecated, or moribund. What's the easy way to find clojure 
> libraries?
>
>
> On Monday, November 18, 2013 11:32:56 AM UTC-8, 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.


Re: core.logic merge substitutions map?

2013-11-18 Thread Norman Richards
On Mon, Nov 18, 2013 at 6:26 PM, Kevin Downey  wrote:

>
> https://github.com/sonian/Greenmail/blob/master/src/clj/greenmail/db.clj#L98-L126
> has an example, using clojure.core.logic/all to make a goal which is a
> conjunction of the clojure.core.logic/== goals


Based on my experience writing pldb, using == in this situation is going to
work better than using unify as shown in the code sample base on the video.
 I found that using unify for this type of custom relation appears to work
but will not do the right thing with more complicated situations.  I found
constraints particularly problematic.  Switching from unify to == makes
sure everything you want to happen on unify actually happens.

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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-18 Thread gaz jones
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.


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

2013-11-18 Thread gaz jones
*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.


Re: Does Pedestal have a future in the long run

2013-11-18 Thread Murtaza Husain

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.