Joplin: No method in multimethod 'migrate-db' for dispatch value: :sql

2015-03-21 Thread Hildeberto Mendonça
Hello,

I'm trying to use Joplin for database migration in the project
javaee-utility-belt (despite the name, it's written in Clojure ;-) The way
I found to start programming in Clojure at work:
https://github.com/htmfilho/javaee-utility-belt), but I'm getting the
following exception:

#

I've added joplin.core in my dependencies:

  :dependencies [[org.clojure/clojure "1.6.0" ]
 [org.clojure/java.jdbc "0.3.6" ]
 [mysql/mysql-connector-java "5.1.25"]
 [joplin.core "0.2.9" ]]

I'm trying to call Joplin from code to run the migration automatically at
every execution. For that, I wrote datasource.clj as follows:

(ns jub.datasource
  (:require [clojure.java.jdbc :as jdbc]
[joplin.core   :as joplin]))

(def mysql-db {:subprotocol "mysql"
   :subname "//localhost:3306/jub"
   :user"jub_user"
   :password"psswd"})

(def joplin-target {:db {:type :sql, :url (str "jdbc:mysql:" (get mysql-db
:subname)
   "?user="  (get mysql-db
:user)
   "&password="  (get mysql-db
:password))}
:migrator "resources/migrators/sql"})

(defn migrate-mysql-db []
  (joplin/migrate-db joplin-target))

Then, I'm calling migrate-mysql-db from core.clj, as follows:

(ns jub.core
  (:require [jub.log-file  :refer :all]
   [jub.datasource:refer (migrate-mysql-db)])
  (:gen-class))

(migrate-mysql-db)

When I start the repl (lein repl) the function (migrate-mysql-db) is called
and the exception above is produced.

You can see the code in this branch:
https://github.com/htmfilho/javaee-utility-belt/tree/Issue%237

Can anybody help me with this issue? Thanks in advance!

-- 
Hildeberto Mendonça 

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


Re: [ANN] Dunaj project, an alternative core API for Clojure

2015-03-21 Thread Jozef Wagner
Thank you James!

If someone has already tried Dunaj, I'd be interested to know whether 
you've encountered some stopping bugs, mainly on platforms other than Linux.

Best,
Jozef


On Friday, March 20, 2015 at 8:43:30 AM UTC+1, James Trunk wrote:
>
> Congratulations on the release!
>
> Thank you for putting yourself and your ideas out there in this way, and 
> for reminding us not to settle for what we have now, but to continually 
> push towards ever greater heights.
>
> Best,
> James
>
> On Friday, March 20, 2015 at 6:35:37 AM UTC+1, Jozef Wagner wrote:
>>
>> Dunaj, an alternative core API for Clojure, has been released! 
>> Try it yourself and check out its extensive documentation at 
>> http://www.dunaj.org/
>>
>> Last Dunaj experiment aims to improve API's primary documentation.
>>
>> Official documentation is available at project's homepage at
>> http://www.dunaj.org. API and SPI documentation is
>> automatically generated from Dunaj sources. Other parts of
>> the documentation are written in AsciiDoc format and are available in
>> project's repository alongside other sources.
>> Everything is released under the same license as Clojure.
>>
>> Library used for the actual documentation generation can be used
>> to generate documentation for any Clojure project, and will be
>> released soon.
>>
>> API documentation is presented in a clear and user friendly way.
>> Vars in a given namespace are grouped by their purpose into
>> several categories. In addition to Var's docstring, type signatures,
>> examples and see also references are provided.
>>
>> Moreover, Dunaj defines new metadata keys for vars that provide
>> additional information to IDEs. With these metadata, editors can
>> offer improved and more precise highlighting and indentation.
>>
>> You can read about this and previous experiments at the documentation
>> section of Dunaj at http://www.dunaj.org/doc.html 
>>
>> Best,
>> Jozef Wagner
>>
>> On Thursday, March 5, 2015 at 10:33:53 PM UTC+1, Jozef Wagner wrote:
>>>
>>> I'm happy to announce a project called Dunaj [1], which provides an 
>>> alternative core API for Clojure. Its main aim is to experimentally test 
>>> major additions to the language. 
>>>
>>> Dunaj /ˈdunaɪ/ is a set of core language experiments aimed to improve 
>>> Clojure language and its core API. It deals with language features that 
>>> require changes across different parts of Clojure and which cannot be 
>>> evaluated in isolation. Dunaj aims to bring Clojure even more towards 
>>> simplicity, consistency and performance. 
>>> It is intended to be used by regular Clojure developers, either for 
>>> application or library development.
>>>
>>> Dunaj was created to test 10 experiments that bring significant changes 
>>> to the Clojure language. As there is a substantial number of additions and 
>>> changes, I want to try a bit unconventional approach here. Before I'll 
>>> release the actual library, I will introduce Dunaj's experiments in a 
>>> series of individual posts. Every part states the motivation behind the 
>>> experiment, introduces changes and additions to the language and 
>>> demonstrates its intended use. If you do not want to miss any of this, you 
>>> may want to register for a mailing list at [1] or follow @dunajproject at 
>>> Twitter.
>>>
>>> -- Jozef Wagner
>>>
>>> [1] http://www.dunaj.org/ 
>>>
>>>

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


Re: Joplin: No method in multimethod 'migrate-db' for dispatch value: :sql

2015-03-21 Thread Daniel Kersten
Make sure you require the sql migrations in your jub.datasources source
file. This is probably it since jub.datasources cannot find the correct
defmethod for migrate-db. Also make sure the migrations are on the
classpath.

On Sat, 21 Mar 2015 at 09:38 Hildeberto Mendonça  wrote:

> Hello,
>
> I'm trying to use Joplin for database migration in the project
> javaee-utility-belt (despite the name, it's written in Clojure ;-) The way
> I found to start programming in Clojure at work:
> https://github.com/htmfilho/javaee-utility-belt), but I'm getting the
> following exception:
>
> # multimethod 'migrate-db' for dispatch value: :sql,
> compiling:(jub/core.clj:5:16)>
>
> I've added joplin.core in my dependencies:
>
>   :dependencies [[org.clojure/clojure "1.6.0" ]
>  [org.clojure/java.jdbc "0.3.6" ]
>  [mysql/mysql-connector-java "5.1.25"]
>  [joplin.core "0.2.9" ]]
>
> I'm trying to call Joplin from code to run the migration automatically at
> every execution. For that, I wrote datasource.clj as follows:
>
> (ns jub.datasource
>   (:require [clojure.java.jdbc :as jdbc]
> [joplin.core   :as joplin]))
>
> (def mysql-db {:subprotocol "mysql"
>:subname "//localhost:3306/jub"
>:user"jub_user"
>:password"psswd"})
>
> (def joplin-target {:db {:type :sql, :url (str "jdbc:mysql:" (get mysql-db
> :subname)
>"?user="  (get mysql-db
> :user)
>"&password="  (get mysql-db
> :password))}
> :migrator "resources/migrators/sql"})
>
> (defn migrate-mysql-db []
>   (joplin/migrate-db joplin-target))
>
> Then, I'm calling migrate-mysql-db from core.clj, as follows:
>
> (ns jub.core
>   (:require [jub.log-file  :refer :all]
>[jub.datasource:refer (migrate-mysql-db)])
>   (:gen-class))
>
> (migrate-mysql-db)
>
> When I start the repl (lein repl) the function (migrate-mysql-db) is
> called and the exception above is produced.
>
> You can see the code in this branch:
> https://github.com/htmfilho/javaee-utility-belt/tree/Issue%237
>
> Can anybody help me with this issue? Thanks in advance!
>
> --
> Hildeberto Mendonça 
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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/d/optout.
>

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


Re: [ANN] rmap - define lazy, recursive maps

2015-03-21 Thread Arnout Roemers
Hi all,

I would like to announce a new version 0.4.0 of rmap.

The library internals have changed to a simpler and more memory efficient 
model (i.e. the LinkedHashMap is gone). This model also allows adding new 
lazy entries to a recursive map and merging them.

In addition to that, this version supports a new realization mode: *structural 
sharing* of the lazy values. When enabled, realizing an entry in a 
recursive map means that all structurally shared recursive maps that still 
have this entry will have it realized as well. This mode has to be enabled 
explicitly. More on this can be read in the API documentation 
.

Cheers,

Arnout Roemers
Functional Bytes 

Op vrijdag 10 oktober 2014 10:55:53 UTC+2 schreef Arnout Roemers:
>
> Hi Ben,
>
> That's pretty nifty indeed! Maybe a tad memory intensive as it retains the 
> head, but if it were a more complex, CPU intensive calculation in :next, 
> that might be very worthwhile. Good stuff.
>
> Cheers,
> -Arnout
>
> P.S. The memory consumption will be a little less when I think of a way to 
> efficiently replace the backing LinkedHashMap with an actual persistent 
> map, while keeping track of the evaluation order.
>
> Op donderdag 9 oktober 2014 02:53:38 UTC+2 schreef Ben:
>>
>> This is pretty nifty:
>>
>> user=> (require '[rmap.core :as rmap])
>> nil
>> user=> (def fibs (rmap/rmap FIBS {:a 0 :b 1 :next (-> FIBS (update-in 
>> [:a] (constantly (:b FIBS))) (update-in [:b] (constantly (+ (:b FIBS) (:a 
>> FIBS)}))
>> #'user/fibs
>> user=> (defn fib [n] (loop [fibs fibs n n] (if (zero? n) (:a fibs) (recur 
>> (:next fibs) (dec n)
>> #'user/fib
>> user=> (fib 40)
>> 102334155
>>
>>

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


Re: Sum up second elemsts of pairs in a sequence by grouping by the first item in pair

2015-03-21 Thread Fluid Dynamics
Or (reduce (partial merge-with +) (map (partial apply hash-map) in-seq))...

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


[GSoC] Typed Overtone proposal

2015-03-21 Thread Christopher Medrela
Hello! As you may remember I wanted to work at "Source meta information 
model"
project during Google Summer of Code this year, but I've decided to switch 
to
"typed Overtone" project because there was already another student (Richard)
who wanted to work at the same project. I believe that Clojure community 
will
benefit more if we work at different projects.

What I'd like to do this summer is: 

1) Writing excellent tutorial make Overtone less harsh. While there are some
   topical guides and incomplete reference, there is no introductory 
tutorial.
   And Overtone requires also some musical knowledge. I believe that if we
   lower the entry barrier, Overtone can became a Clojure killer app that 
will
   foster Clojure adoption.

2) Typing Overtone to stress core.typed and find its limits.

You can find my proposal at github [1]. If you have some thoughts, feedback 
or
criticism, feel free to share it!

[1] https://gist.github.com/chrismedrela/7fe431fa5189c2c64bd8

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


Re: [GSoC] Typed Overtone proposal

2015-03-21 Thread Ambrose Bonnaire-Sergeant
We should work on this proposal, I sent you some suggestions.

Thanks,
Ambrose

On Sat, Mar 21, 2015 at 1:03 PM, Christopher Medrela <
chris.medr...@gmail.com> wrote:

> Hello! As you may remember I wanted to work at "Source meta information
> model"
> project during Google Summer of Code this year, but I've decided to switch
> to
> "typed Overtone" project because there was already another student
> (Richard)
> who wanted to work at the same project. I believe that Clojure community
> will
> benefit more if we work at different projects.
>
> What I'd like to do this summer is:
>
> 1) Writing excellent tutorial make Overtone less harsh. While there are
> some
>topical guides and incomplete reference, there is no introductory
> tutorial.
>And Overtone requires also some musical knowledge. I believe that if we
>lower the entry barrier, Overtone can became a Clojure killer app that
> will
>foster Clojure adoption.
>
> 2) Typing Overtone to stress core.typed and find its limits.
>
> You can find my proposal at github [1]. If you have some thoughts,
> feedback or
> criticism, feel free to share it!
>
> [1] https://gist.github.com/chrismedrela/7fe431fa5189c2c64bd8
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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/d/optout.
>

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


Re: [GSoC] Typed Overtone proposal

2015-03-21 Thread Chris Ford
That sounds a cool idea.

One interesting challenge will be how specific you can make the types of
things like unit generators, which can be used in very different ways e.g.
low frequency for vibrato, high frequency for tones themselves.

On 21 March 2015 at 17:14, Ambrose Bonnaire-Sergeant <
abonnaireserge...@gmail.com> wrote:

> We should work on this proposal, I sent you some suggestions.
>
> Thanks,
> Ambrose
>
> On Sat, Mar 21, 2015 at 1:03 PM, Christopher Medrela <
> chris.medr...@gmail.com> wrote:
>
>> Hello! As you may remember I wanted to work at "Source meta information
>> model"
>> project during Google Summer of Code this year, but I've decided to
>> switch to
>> "typed Overtone" project because there was already another student
>> (Richard)
>> who wanted to work at the same project. I believe that Clojure community
>> will
>> benefit more if we work at different projects.
>>
>> What I'd like to do this summer is:
>>
>> 1) Writing excellent tutorial make Overtone less harsh. While there are
>> some
>>topical guides and incomplete reference, there is no introductory
>> tutorial.
>>And Overtone requires also some musical knowledge. I believe that if we
>>lower the entry barrier, Overtone can became a Clojure killer app that
>> will
>>foster Clojure adoption.
>>
>> 2) Typing Overtone to stress core.typed and find its limits.
>>
>> You can find my proposal at github [1]. If you have some thoughts,
>> feedback or
>> criticism, feel free to share it!
>>
>> [1] https://gist.github.com/chrismedrela/7fe431fa5189c2c64bd8
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clojure@googlegroups.com
>> Note that posts from new members are moderated - please be patient with
>> your first post.
>> To unsubscribe from 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/d/optout.
>>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from 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/d/optout.
>

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


Re: Who's using Clojure?

2015-03-21 Thread Eric Richmond
We're using Clojure in production @ Indaba Music to power 
conversesamplelibrary.com

-Eric

On Tuesday, April 19, 2011 at 10:38:14 AM UTC-4, Damien wrote:
>
> Hi Everyone,
>
> I'm on a mission: introducing Clojure in my company, which is a big 
> consulting company like many others.
>
> I started talking about Clojure to my manager yesterday.
> I was prepared to talk about all the technical benefits and he was 
> interested.
> I still have a long way to go but I think that was a good start.
>
> However I need to figure out how to answer to one of his questions: who is 
> using Clojure?
>
> Obviously I know each of you is using Clojure, that makes almost 5,000 
> people.
> I know there is Relevance and Clojure/core.
> I read about BackType or FlightCaster using Clojure.
>
> But, let's face it, that doesn't give me a killer answer.
>
> What could help is a list of success stories, a bit like MongoDB published 
> here:
> http://www.mongodb.org/display/DOCS/Production+Deployments
>
> Is there a place where I could find this kind of information for Clojure?
>
> Thanks
>
> -- 
> Damien Lepage
> http://damienlepage.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/d/optout.


Re: Joplin: No method in multimethod 'migrate-db' for dispatch value: :sql

2015-03-21 Thread Hildeberto Mendonça
Hi Daniel, thanks for your feedback.

On Sat, Mar 21, 2015 at 11:40 AM, Daniel Kersten  wrote:

> Make sure you require the sql migrations in your jub.datasources source
> file. This is probably it since jub.datasources cannot find the correct
> defmethod for migrate-db. Also make sure the migrations are on the
> classpath.
>

Could you be more specific about that? The readme file says that I have to
load the joplin.core namespace (done) and also the namespaces of the
database plugins, but it doesn't say a word about these plugins. I've tried
to refer the namespaces joplin.jdbc.database and joplin.sql.database, but
the error persists.

Thanks a lot

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


about binding and dynamic vars

2015-03-21 Thread coco
Hi guys, I'm curious about how work some codes with binding and dynamics 
vars, for instance, in sqlkorma you define your db settings

(defdb prod (postgres {:db "korma"
   :user "db"
   :password "dbpass"}))


and then you can use other functions like this

(select user
  (with address)
  (fields :firstName :lastName :address.state)
  (where {:email "ko...@sqlkorma.com"}))


without pass your config db as parameter..

some korma functions expects your db configuration as first parameter...but if 
you had defined your db before using defdb macro, then you can omit this 
parameter


(defentity users
  ;; Basic configuration
  (pk :id) ;; by default "id". This line is unnecessary.
   ;; it's used for relationships joins.
  (table :users) ;; by default the name of the symbol.
 ;; The line above is also unecessary.
  (database db) ;; if none is specified the last defdb  <---
;; will be used. Also unnecessary.

)


I've found this pattern in many clojure codes, but I can't understand how it 
works..can someone provides me a simple and clear example about how write 
something like this?..thank so much!

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


about binding and dynamic vars

2015-03-21 Thread coco
Hi guys, I'm curious about how work some codes with binding and dynamics 
vars, for instance, in sqlkorma you define your db settings

(defdb prod (postgres {:db "korma"
:user "db"
:password "dbpass"}))

and then you can use other functions like this
(select user
(with address)
(fields :firstName :lastName :address.state)
(where {:email "korma sqlkorma.com"})) 

without pass your config db as parameter..
some korma functions expects your db configuration ...but if you had 
defined your db before using defdb macro, then you can omit this parameter, 
other sample:

(defentity users
;; Basic configuration
(pk :id) ;; by default "id". This line is unnecessary.
;; it's used for relationships joins.
(table :users) ;; by default the name of the symbol.
;; The line above is also unecessary.
(database db) ;; if none is specified the last defdb <---
;; will be used. Also unnecessary.
)

I've found this pattern in many clojure codes, but I can't understand how 
it works..can someone provides me a simple and clear example about how 
write something like this?..thank so much!

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


Re: about binding and dynamic vars

2015-03-21 Thread Colin Yates
http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope is a good
read around this subject.

On 21 March 2015 at 21:47, coco  wrote:
> Hi guys, I'm curious about how work some codes with binding and dynamics
> vars, for instance, in sqlkorma you define your db settings
>
> (defdb prod (postgres {:db "korma"
>:user "db"
>:password "dbpass"}))
>
>
> and then you can use other functions like this
>
> (select user
>   (with address)
>   (fields :firstName :lastName :address.state)
>   (where {:email "ko...@sqlkorma.com"}))
>
>
> without pass your config db as parameter..
>
> some korma functions expects your db configuration as first parameter...but
> if you had defined your db before using defdb macro, then you can omit this
> parameter
>
>
> (defentity users
>   ;; Basic configuration
>   (pk :id) ;; by default "id". This line is unnecessary.
>;; it's used for relationships joins.
>   (table :users) ;; by default the name of the symbol.
>  ;; The line above is also unecessary.
>   (database db) ;; if none is specified the last defdb  <---
> ;; will be used. Also unnecessary.
>
> )
>
>
> I've found this pattern in many clojure codes, but I can't understand how it
> works..can someone provides me a simple and clear example about how write
> something like this?..thank so much!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from 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/d/optout.

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