Re: Referential integrity constraints using only clojure.java.jdbc?

2013-12-15 Thread Sean Corfield
The difficulties inherent in providing a database-independent
abstraction over DDL is precisely why clojure.java.jdbc doesn't do
this - and why there are strong recommendations to use other libraries
(in combination with java.jdbc) if you want DSLs for that.

java.jdbc is intended to be a thin wrapper around JDBC that acts as a
common base for all the other database libraries.

If you want referential integrity constraints, use db-do-commands to
run SQL/DDL to add them - or leverage a library that provides those
abstractions on top of java.jdbc.

(personally, I find heavy use of such constraints to be
counter-productive since it makes refactoring and evolution of both
schema and code to be much more difficult)

Sean

On Sat, Dec 14, 2013 at 2:29 AM, Simon Brooke  wrote:
> First, yes, I now know I could build referential integrity constraints using
> Korma, and that's almost certainly what I shall do next time.
>
> However, I'm quite a long way down building an app against a very tight
> deadline and I've declared my tables in clojure.java.jdbc, e.g.
>
> (defn create-categories-table
>   "Reference data: award categories"
>   [db-spec]
>   (sql/with-connection db-spec
> (sql/create-table
>  :categories
>  [:id "serial primary key"]
>  [:name "varchar(48)" "not null"])
> (sql/do-commands "insert into categories (name) values ('Best Use of
> Ecommerce (UK market)')")
> (sql/do-commands "insert into categories (name) values ('Best Use of
> Ecommerce (International market)')")
> (sql/do-commands "insert into categories (name) values ('Ecommerce
> Innovation of the Year')")
> (sql/do-commands "insert into categories (name) values ('Ecommerce
> Newcomer of the Year')")
> (sql/do-commands "insert into categories (name) values ('Ecommerce
> Digital Agency of the Year')")
> (sql/do-commands "insert into categories (name) values ('Ecommerce
> Specialist Supplier of the Year')")
> ))
>
> (defn create-nominations-table
>   "Actual nominations"
>   [db-spec]
>   (sql/with-connection db-spec
> (sql/create-table
>  :nominations
>  [:id "serial primary key"]
>  [:firstname "varchar(64)" "not null"]
>  [:surname   "varchar(64)" "not null"]
>  [:phone "varchar(24)" "not null"]
>  [:email "varchar(128)" "not null"]
>  [:business  "varchar(64)" "not null"]
>  [:category  "integer" "not null"]
>  [:url   "varchar(256)" "not null"]
>  [:contact   "varchar(128)"]
>  [:citation  :text]
>   )))
>
> Obviously, 'category' in the nominations table should reference categories.
> And obviously, I can hack that in the database, so the fact that Clojure
> doesn't automatically set it up doesn't (this time) matter. However, I'd
> like to know for the future whether Korma is just the best way to go, or
> whether there is some database-independent[*] way to set up referential
> integrity constraints at the clojure.java.jdbc.
>
> [*] Yes, I know that the fact I'm using 'serial primary key' tells you
> already that I'm using Postgres, so this isn't database-independent!
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



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

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

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


Re: Is Clojure more functional then Scala?

2013-12-15 Thread Robin Heggelund Hansen
The reason Clojure "supports you better" is that Clojure doesn't really 
give you an alternative. Scala is BOTH OO and FP, Clojure is only FP.

The "problem" with Scala is that if you come from an OO language, Scala 
doesn't force you to use FP concepts, sure it's idiomatic, but there is 
nothing that forces you to write things in a functional way. Clojure forces 
you to do that, cause you don't really have an alternative. Because of 
that, you'll probably get better at FP faster with Clojure than with Scala. 
I write probably, because if someone really wants too, they'll learn FP 
regardless.

kl. 04:33:35 UTC+1 mandag 16. desember 2013 skrev John Kida følgende:
>
> I jumped on the FP bandwagon over a year ago and have been using Scala 
> both at work and for personal interest. Recently however I decided to take 
> a closer look at Clojure and see if it is something i actually like. I have 
> to admit at first the syntax form was awkward, but im starting to really 
> see the simplicity behind it.
>
> I have heard many people claim that Clojure sets you up and supports you 
> for FP more so then Scala does. However they never provide any examples of 
> something Clojure does that is more supporting of FP then the way idiomatic 
> Scala does it.
>
> Here are some things that I have heard people say when comparing Clojure 
> vs Scala in reference to FP
> Clojure has immutable persistance data structures. but so does Scala
> Scala also tries to get you to use its immutable collections, like 
> Vectors, and are also persistent data structures. However they are not as 
> uniform as Clojures Seq i agree with that.
>
> Also Scala recommends using vals and not vars, which gives you immutable 
> references points
>
> I am certainly learning towards dropping Scala for a bit and giving 
> Clojure a real shot. The reason i even picked up Scala was because i wanted 
> to learn more about FP, and if there is a better tool for both doing and 
> learning FP then i want it.
>
> So tell me, if you have used both Scala and Clojure, do you have some real 
> examples of some things where Clojure really does support you better when 
> doing FP, where Scala really leads you no way, or worse the imperative way?
>
>
>

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


Is Clojure more functional then Scala?

2013-12-15 Thread John Kida
I jumped on the FP bandwagon over a year ago and have been using Scala both 
at work and for personal interest. Recently however I decided to take a 
closer look at Clojure and see if it is something i actually like. I have 
to admit at first the syntax form was awkward, but im starting to really 
see the simplicity behind it.

I have heard many people claim that Clojure sets you up and supports you 
for FP more so then Scala does. However they never provide any examples of 
something Clojure does that is more supporting of FP then the way idiomatic 
Scala does it.

Here are some things that I have heard people say when comparing Clojure vs 
Scala in reference to FP
Clojure has immutable persistance data structures. but so does Scala
Scala also tries to get you to use its immutable collections, like Vectors, 
and are also persistent data structures. However they are not as uniform as 
Clojures Seq i agree with that.

Also Scala recommends using vals and not vars, which gives you immutable 
references points

I am certainly learning towards dropping Scala for a bit and giving Clojure 
a real shot. The reason i even picked up Scala was because i wanted to 
learn more about FP, and if there is a better tool for both doing and 
learning FP then i want it.

So tell me, if you have used both Scala and Clojure, do you have some real 
examples of some things where Clojure really does support you better when 
doing FP, where Scala really leads you no way, or worse the imperative way?


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

2013-12-15 Thread guns
On Tue 10 Dec 2013 at 01:54:21PM -0600, guns wrote:

> I am happy to announce the beta release of the next version of
> clojure.tools.cli:
>
> https://github.com/clojure/tools.cli

Okay, tools.cli 0.3.0 has been released. Thanks to everyone for trying
the beta!

I look forward to fielding questions and feature proposals on JIRA and
the github page.

Leiningen dependency information:

[org.clojure/tools.cli "0.3.0"]

Maven dependency information:


  org.clojure
  tools.cli
  0.3.0


Cheers,
guns


pgpCT8Mbdtcrt.pgp
Description: PGP signature


Re: [ANN] A post on CLJS DOM manipulation libraries

2013-12-15 Thread Timothy Pratley
Very illuminating - thank you!
This is a topic that needed explaining :)

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

2013-12-15 Thread Nikki Degutis
It's called Leviathan. You should check it out here, 

https://github.com/sdegutis/Leviathan

Go ahead and click the link, it's totally not a virus. 

Thanks,
Team Degutis. :)

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

2013-12-15 Thread Oleksandr Petrov
Thanks! Great idea, posted!


On Fri, Dec 13, 2013 at 11:08 AM, Philipp Meier  wrote:

> Hi,
>
> Am Donnerstag, 12. Dezember 2013 18:54:03 UTC+1 schrieb Alex P:
>
>> We (Munich Lambda[1]) are organising Meetups, dedicated to Functional
>> Programming, and Clojure specifically.
>>
>
> I suggest to post this also to the (very silent) google group "clojure-de".
>
> -billy.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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.
>



-- 
alex p

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