Don't forget about the option of walking over a map by using
clojure.walk/postwalk or clojure.walk/prewalk
I use these functions often lately. Especially useful if you have to update
values in your map and they could occur anywhere. It is a bit tricky to get
working at first, because the return va
I've seen postwalk and prewalk but never really played around with them so
I will give it a shot.
Thanks for your input!
Ryan
On Tuesday, December 10, 2013 10:29:51 AM UTC+2, Jeroen van Dijk wrote:
>
> Don't forget about the option of walking over a map by using
> clojure.walk/postwalk or cloj
Hi,
I was using clojure to upload the dbpedia datasets into neo4j.
Unfortunately, my system hanged and i had to restart everything. Now, if i
start the execution of program again it shows this error:
'neostore' does not contain a store version, please ensure that the
original database was shut
FWIW you can simplify the nested doseqs like this
(doseq [[outer-keys collections] m
[collection-name collection] collections
[string-id data] collection]
;; do stuff with the above
)
HTH,
/thomas
On Wednesday, December 4, 2013 12:05:14 AM UTC+1, Ryan wrote:
>
> Hi a
Oh nvm, just saw that it was suggested before.
But maybe this is new:
(def m
{"outerKeyA" {:innerKeyA {"string id" {:foo 1 :bar 2}}}
"outerKeyB" {:innerKeyB {"string id" {:bar 5 :baz 10)
(defn nested-seq [m]
(for [[outer-key collections] m
[collection-name collection] collecti
Do I understand correctly that to prevent creating a collection per query I
have to wrap multiple consecutive queries inside a `db-transaction` binding
instead of the old `with-connection` bindings ?
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" grou
Oops, should be 'connection' instead of 'collection', of course.
On Tuesday, December 10, 2013 5:24:23 PM UTC+1, Niels van Klaveren wrote:
>
> Do I understand correctly that to prevent creating a collection per query
> I have to wrap multiple consecutive queries inside a `db-transaction`
> bindi
I am working on web software where admins will be using HTML forms to
update data in a MongoDb database. I decided to use Lamina to off-load the
work to the background. There are several operations that need to happen:
updates, deletions, etc, and I thought I'd put each on a different channel.
Remember that only the last form will be returned. So:
(defn foo [] 1 2 3 4)
will always return 4. The same principle applied with your macro. You
define four forms, but only return the last one. Instead, try wrapping all
the forms in a "do" block.
As an aside, this doesn't look like a good
orthogonal, perhaps helpful:
I wrote a clojure (wrapper) library that "streams" data in-and-out of Excel
quite easily (and other applications, mostly finance, that use DDE).
especially useful if you need to monitor or updates changes to cells.
https://github.com/tuddman/clj-dde
feedback welcome
> As an aside, this doesn't look like a good use-case for macros
>. You'd probably be better defining a map with keys for :
> worker, :channel, etc. Either that or a protocol.
Thank you much for your help. But I thought this is exactly what macros
were for? In another language I would end up ju
When is this happening, during the batch import or after for a query?
It sounds like an incomplete shutdown. You need to make sure you issue a
.shutdown to the db (batchinserter) and give it time to complete, it can
take awhile.
Make sure you have write permissions for the directory. And always
On 10 December 2013 18:24, larry google groups wrote:
>
> > As an aside, this doesn't look like a good use-case for macros
> >. You'd probably be better defining a map with keys for :
> > worker, :channel, etc. Either that or a protocol.
>
> Thank you much for your help. But I thought this is exac
Try starting it up with the neo4j-shell to see if it will go through its
recovery. Like so:
bin/neo4j-shell -path
And then exiting properly with "exit".
You didn't say how you were importing, but if this happened during an
org.neo4j.unsafe.BatchInserter run, you might be out of luck--the point o
I have a protocol RestSerializable to represent data that can be serialized
to json from a REST interface.
(defprotocol RestSerializable
(rest-serialize [this]
"Convert to something Cheshire can JSONify"))
By default, things are left alone
(extend Object
RestSerializable
{:rest-seriali
Thanks much. Your approach is much better than mine. I was looking for a
good excuse to use a macro, but I suppose I will postpone that for another
day.
On Tuesday, December 10, 2013 2:03:07 PM UTC-5, James Reeves wrote:
>
> On 10 December 2013 18:24, larry google groups
>
> > wrote:
>
>>
>>
Hello everyone,
I am happy to announce the beta release of the next version of
clojure.tools.cli:
https://github.com/clojure/tools.cli#new-features
Leiningen dependency information:
[org.clojure/tools.cli "0.3.0-beta1"]
Maven dependency information:
org.clojure
tools.
built a clojure (wrapper) library:
https://github.com/tuddman/clj-dde
basically it can 'monitor' defined Excel cells for changes... which can
'trigger' your clojure app to do stuff.
conversely, can add / modify data in Excel cells programmaticaly from
clojure ;-), as well.
useful for 'real-tim
No, you don't have to use db-transaction (although that will have that effect).
You can get a connection and assoc it into the db-spec with a
:connection key and pass that across multiple queries etc, and it will
reuse the :connection passed in:
(with-open [con (get-connection db-spec)]
(let [c
Not functional yet. About 50-60% completed.
I ran into some bugs -- it turns out that sockets in JVM and CLR are not
exactly identical, no great surprise -- and got distracted by versions 1.5
and 1.6alpha and support for mono and nuget for ClojureCLR.
I plan to finish the core.async port (it's a
I want to type hint an overloaded Java method. I used to have a function
like so
(defn iri [name]
(IRI/create name))
Where IRI.create is one of
IRI.create(String)
IRI.create(URL)
IRI.create(File)
Type hinting the return value of this is straight-forward, but the
parameter is one of three ty
Perfect -- I can use lein check interactively, and this in my unit
tests. It's a shame *warn-on-reflection* doesn't take a function, which
would be the general solution.
Phil
Tassilo Horn writes:
> phillip.l...@newcastle.ac.uk (Phillip Lord) writes:
>
>> I know about *warn-on-reflection* but is
I wasn't and this is actually very useful. Thanks for the pointer.
"John D. Hume" writes:
> Are you aware of `lein check`? We have our some of our CI builds wired to
> fail if that finds anything.
> On Dec 9, 2013 4:12 AM, "Phillip Lord" wrote:
>
>>
>> I know about *warn-on-reflection* but is
Okay no problem.
On Tue, Dec 10, 2013 at 4:32 PM, dmiller wrote:
> Not functional yet. About 50-60% completed.
> I ran into some bugs -- it turns out that sockets in JVM and CLR are not
> exactly identical, no great surprise -- and got distracted by versions 1.5
> and 1.6alpha and support for
Hi!
In my opinion, this has a lot of boilerplate for basic operation like this
(reuse a connection for few operations).
The deprecated api of clojure.java.jdbc had some useful methods for do it
more concise and intuitive, you can use it.
Also, you can try use a connection pool for avoid this boil
On Tue, Dec 10, 2013 at 4:25 AM, Phillip Lord
wrote:
> (defn ^IRI iri
> [name]
> (cond
>(instance? String name)
>(IRI/create ^String name)
>(instance? java.net.URL name)
>(IRI/create ^java.net.URL name)
>(instance? java.io.File name)
>(IRI/create ^java.io.File name)))
>
On Tue, Dec 10, 2013 at 12:53 PM, James Reeves wrote:
> Remember that only the last form will be returned. So:
>
> (defn foo [] 1 2 3 4)
>
> `(defn ~start-function-name []
> will always return 4. The same principle applied with your macro. You
> define four forms, but only return the last on
I was recently working on some toy recursion problems, when I ran into a
function that I can express simply using normaly recursion, but I can't
seem to convert it into a form that works nicely with loop/recur.
It's certainly not the right way to solve this problem, but I'm intrigued
to see wha
Just got contected by the same recruiter...
On Monday, December 2, 2013 2:44:36 PM UTC-8, nodename wrote:
>
> Can I get a quick reality check on this?
> Thanks!
>
> -A
>
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, sen
On Tue, Dec 10, 2013 at 6:09 PM, Glen Mailer wrote:
> I was recently working on some toy recursion problems, when I ran into a
> function that I can express simply using normaly recursion, but I can't
> seem to convert it into a form that works nicely with loop/recur.
>
> It's certainly not the r
On Tue, Dec 10, 2013 at 11:09 PM, Glen Mailer wrote:
> I was recently working on some toy recursion problems, when I ran into a
> function that I can express simply using normaly recursion, but I can't seem
> to convert it into a form that works nicely with loop/recur.
>
> It's certainly not the r
On Tue, Dec 10, 2013 at 6:29 PM, Vincent Chen wrote:
> Try this (not tested, might be missing parens and whatnot):
>
> (defn slice [x s n]
> (loop [[h & tail] x, s s, n n, acc []]
> (cond
> (zero? n) acc
> (zero? s) (recur tail s (dec n) (conj acc h))
> :else (recur tail (
@Cesar
I've made a little advancement on dynamic encoding/decoding, here's a gist
with a proof of concept: https://gist.github.com/ifesdjeen/7902409
On Wed, Dec 4, 2013 at 8:28 AM, Cesar Canassa wrote:
> Hi,
>
> I see that the repeated-type requires a constant repeat count. Are you
> planning t
On Tue, Dec 10, 2013 at 2:17 PM, Andrey Antukh wrote:
> In my opinion, this has a lot of boilerplate for basic operation like this
> (reuse a connection for few operations).
I'm open to suggestions for idiomatic enhancements (via JIRA).
> The deprecated api of clojure.java.jdbc had some useful m
extend mutates some state (the protocol definition), so what is happen
here is comp is returning a new function built from the value of the
rest-serialize var (the protocol function before the extend changes it)
and the value of the deref var.
I have not verified this, but I suspect if you use (fn
Oh, interesting. I knew it was changing *some* state but I didn't realize
it was actually changing the binding of the rest-serialize var. Thanks =)
On Tue, Dec 10, 2013 at 4:09 PM, Kevin Downey wrote:
> extend mutates some state (the protocol definition), so what is happen
> here is comp is re
Hi there
What is the ideal way to format Clojure code? I'm following Batsov's Style
Guide but, in some moments, it sounds a bit confuse to me.
To the point:
(reduce +
(filter even?
nums))
or
(reduce
+
(filter
even?
nums))
Which one is preferable, more corre
Why not just,
(reduce + (filter even? nuns))
?
That's a simple enough form I wouldn't bother with the line breaks.
On Tue, Dec 10, 2013 at 9:24 PM, Plínio Balduino wrote:
> Hi there
>
> What is the ideal way to format Clojure code? I'm following Batsov's Style
> Guide but, in some moments, it
Hello Ritchie!
I had almost the same:
(fn [& fs]
(let [f (last fs)
r (rest (reverse fs))]
(fn [& data] (reduce #(%2 %) (apply f data) r
But then I really liked your destructuring, so I'll take it with me:
(fn [& fs]
(let [[f & r] (reverse fs)]
(fn [& data] (r
On Tuesday, December 10, 2013 9:24:16 PM UTC-5, Plinio Balduino wrote:
>
> Hi there
>
> What is the ideal way to format Clojure code? I'm following Batsov's Style
> Guide but, in some moments, it sounds a bit confuse to me.
>
> To the point:
>
> (reduce +
> (filter even?
>
Hi, Joseph,
The problem is happening during batch import.
What i did was i started the clojure code in eclipse and started batch
importing in neo4j.
After processing 2-3 lakhs of lines of a file, the process hangs and even
the eclipse. Now if i interrupt clojure process or restart the eclipse,
Hi wes,
I tried with neo4j-shell but it gave me this error:
Error starting org.neo4j.kernel.EmbeddedGraphDatabase,
/home/himakshi/work/setup/neo4j-community-2.0.0-RC1/bin/../data/dbpedia.db
Yes, I am using org.neo4j.unsafe.BatchInserter.
If this causes the problem, can there be any altern
I sometimes find that, when the formatting gets hairy, I need to either
refactor my code or use one of the pipeline macros.
(->> nums
(filter even?)
(reduce +))
- Russell
On Wednesday, December 11, 2013 11:24:16 AM UTC+9, Plinio Balduino wrote:
>
> Hi there
>
> What is the ideal way
It really doesn't matter, both are right/wrong
Le mercredi 11 décembre 2013, Plínio Balduino a écrit :
> Hi there
>
> What is the ideal way to format Clojure code? I'm following Batsov's Style
> Guide but, in some moments, it sounds a bit confuse to me.
>
> To the point:
>
> (reduce +
>
Put as much as is legible on one line. If you need to break lines, break
after the function name, not after the first parameter, in order to
minimize rightward drift.
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send ema
45 matches
Mail list logo