This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-14
Channels
- # aws (1)
- # beginners (52)
- # boot (1)
- # cider (9)
- # clara (4)
- # cljs-dev (40)
- # cljsrn (2)
- # clojure (166)
- # clojure-dusseldorf (1)
- # clojure-italy (38)
- # clojure-spec (13)
- # clojure-uk (32)
- # clojurescript (337)
- # cursive (11)
- # data-science (47)
- # datomic (11)
- # emacs (3)
- # events (1)
- # fulcro (57)
- # hoplon (16)
- # jobs-discuss (1)
- # juxt (11)
- # keechma (21)
- # mount (2)
- # off-topic (44)
- # onyx (9)
- # re-frame (33)
- # reagent (1)
- # ring-swagger (3)
- # specter (2)
- # test-check (37)
- # vim (30)
@adambard No, a string will work just fine. The docs recommend using a hash map with :dbtype
instead, but they're all equivalent.
{:dbtype "postgres" :dbname "webdev" :user "postgres" :password "mypassword"}
would be the recommended connection spec @integralexplorer
(but I doubt that's your issue here)
If you're executing DDL (`CREATE`) you should use db-do-commands
, not execute!
-- the latter is for SQL, not DDL.
(the recommended docs for clojure.java.jdbc
are here, BTW, http://clojure-doc.org/articles/ecosystem/java_jdbc/home.html -- and I'm the maintainer of the library so I can probably help you with most stuff... although I don't use Postgres)
Thanks, I have been looking at the documentation and am still trying to understand all the moving parts. I will work on it a bit more tomorrow and see if I can figure it out and if not, will ask some more questions.
There's a #sql channel that's a good place to ask about JDBC stuff btw @integralexplorer /cc @adambard
could you help me what is the problem with that?
graph/ vector > ({1 [2 5]} {2 [3 4]} {5 [6 7]} {8 [9 12]} {9 [10 11]} {12 [13 14]} {15 [16 19]} {16 [17 18]} {19 [20 21]}) (map #(conj (apply second ((vec graph) (position %)) )) [2 5])
- that is works fully in repl but in codeingame.. not (something conj parameter problem)@sb you are using the transducer arity of conj but codingame only runs clojure 1.6.0 which does not have transducers.
I don’t understand how that () without quoting isn’t throwing a big error
in fact, I don’t understand what that code really does because as pasted it’s totally invalid from the start
@noisesmith One moment I show you
@sb was that a ->> call that got pasted wrong? because that would work and wouldn’t use a transducer (except for the () unquoted)
(defn childrens [vct]
"Give back the children elements. Test with [2 5 91]"
(distinct
(flatten
(map #(conj (apply second ((vec graph) (position %))))
(keep #(if (contains? (apply hash-set nodes) %) (conj %)) vct)))))
graph element: {1 [2 5]} {2 [3 4]} {5 [6 7]} {8 [9 12]} {9 [10 11]} {12 [13 14]} {15 [16 19]} {16 [17 18]} {19 [20 21]}
vct [2 5]
you are calling conj with one arg, which is weird
or are you, I could be reading it wrong
it’s just indented wrong
so the keep generates the second arg to map
no - the conj has only one arg
there is no % arg to conj
conj with one arg is weird - why are you doing that?
peregrine.circle=> (conj {:a 0})
{:a 0}
conj doesn’t do anything without at least a second arg
iirc in older versions of clojure that would be an error, in newer versions it is allowed in case you were using apply
no, there is no second arg to conj in your code, and no loop
perhaps you want reduce and not map?
you can just not use conj, and both versions of clojure will return the same thing
since that call to conj doesn’t actually do anything
and older clojure doesn’t like it
@sb your code will work if you change (conj (apply ….)) to (apply …)
the conj only works in newer clojure versions, and isn’t doing anything
@noisesmith thanks I test it now!!