Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread Jo Geraerts
Hello, I think you are coming to a point where you might want to consider Stuart Sierra's component library. https://github.com/stuartsierra/component A dynamic var is kind of thread-bounded global state, which is to be avoided. There is a nice talk to go with it https://www.youtube.com/watc

Re: ANN: ClojureScript 1.7.28 - Optional Self Hosting

2015-07-31 Thread Shaun LeBron
On Friday, July 31, 2015 at 12:52:23 PM UTC-5, David Nolen wrote: > ClojureScript, the Clojure compiler that emits JavaScript source code. > > > README and source code: https://github.com/clojure/clojurescript > > > Leiningen dependency information: > > >     [org.clojure/clojurescript "1.7.2

Reality check: EC2 + Ubuntu + Atom (from GitHub) + Clojure?

2015-07-31 Thread kirby urner
My day job is teaching Python, but in a school that teaches much else besides. We're small and I'd say prototypical given how quickly the technology is evolving. The description in the blog post below is science fiction from my angle, but I'm aiming for a lot of realism: http://worldgame.blogspo

Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread jongwon.choi
Cut & paste from my own code base: (def ^:dynamic *db-conn*) (defmacro with-db-connection [& body] `(jdbc/with-db-connection [con# (get-db-conn)] (binding [*db-conn* con#] ~@body))) A few points. Do not give any value to the dynamic var, make it unbound and make it fail early for

Re: [ANN] Planck 1.0 - Bootstrapped ClojureScript OS X REPL

2015-07-31 Thread Mark C
Awesome. Starts almost instantly! Btw, in order to get a command-line editor at the repl, I run: rlwrap -m " \ " planck Not sure if there's some other way, but that works fine. rlwrap has a lot of nice features, esp. multi-line edit in your editor of choice. M. On Friday, July 31, 2015 at 2:2

Re: [ANN] sniper, emacs assistant for deleting dead code

2015-07-31 Thread Jason Wolfe
On Thu, Jul 30, 2015 at 6:05 AM, benedek fazekas wrote: >> But it doesn't look like it has the same graph analysis to understand >> cyclic references, etc, > > you are right it does not. Wondering if you were interested in adding an API > to sniper and publish it on clojars... so we could give a t

Re: [ANN] Clojure 1.8.0-alpha3

2015-07-31 Thread Eduardo Aquiles Affonso Radanovitsck
Thanks for the clarification! *--* *Eduardo Aquiles Radanovitsck* ThoughtWorks Brasil On Fri, Jul 31, 2015 at 6:02 PM, Ben Wolfson wrote: > On Fri, Jul 31, 2015 at 1:57 PM, Eduardo Aquiles Affonso Radanovitsck < > eduardoaquiles...@gmail.com> wrote: > >> Not sure if this is expected or not: >>

Re: [ANN] Clojure 1.8.0-alpha3

2015-07-31 Thread Ben Wolfson
On Fri, Jul 31, 2015 at 1:57 PM, Eduardo Aquiles Affonso Radanovitsck < eduardoaquiles...@gmail.com> wrote: > Not sure if this is expected or not: > > (map (fn [v] {:k v}) #{1 2 3}) > => ({:k 1} {:k 3} {:k 2}) > (map #({:k %}) #{1 2 3}) > ArityException Wrong number of args (0) passed to: Persiste

Re: [ANN] Clojure 1.8.0-alpha3

2015-07-31 Thread Eduardo Aquiles Affonso Radanovitsck
Not sure if this is expected or not: (map (fn [v] {:k v}) #{1 2 3}) => ({:k 1} {:k 3} {:k 2}) (map #({:k %}) #{1 2 3}) ArityException Wrong number of args (0) passed to: PersistentArrayMap clojure.lang.AFn.throwArity (AFn.java:429) *--* *Eduardo Aquiles Radanovitsck* On Wed, Jul 29, 2015 at 11:

Re: ClojureScript Self-hosting Demo

2015-07-31 Thread Shaun Gilchrist
This is such an awesome time to be slinging parens! Thank you to everyone who made this possible! On Fri, Jul 31, 2015 at 11:22 AM, gvim wrote: > On 31/07/2015 19:08, David Nolen wrote: > >> Some more words & demos here >> http://swannodette.github.io/2015/07/29/clojurescript-17/ >> >> Cheers, >

[ANN] Planck 1.0 - Bootstrapped ClojureScript OS X REPL

2015-07-31 Thread Mike Fikes
Happy to announce that Planck 1.0 is available: http://planck.fikesfarm.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 memb

Re: ClojureScript Self-hosting Demo

2015-07-31 Thread gvim
On 31/07/2015 19:08, David Nolen wrote: Some more words & demos here http://swannodette.github.io/2015/07/29/clojurescript-17/ Cheers, David Amazing work, David. Clojure[script] really is THE fountain of innovation. Whilst Clojurescript may not be as mainstream as React, Angular etc. develo

Re: Function behaving differently in web app route

2015-07-31 Thread Bryan Maass
If it were me, I'd put something like: (def add-link* [my_id fname surname day2 month2 year2 hour2 min2 zone2]) inside the function that handles the route, hit the endpoint as you would, and check that add-link* is receiving the arguments you expect. On Saturday, August 1, 2015 at 3:46:47 AM UT

ClojureScript Self-hosting Demo

2015-07-31 Thread David Nolen
Some more words & demos here http://swannodette.github.io/2015/07/29/clojurescript-17/ Cheers, David -- 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 mo

ANN: ClojureScript 1.7.28 - Optional Self Hosting

2015-07-31 Thread David Nolen
ClojureScript, the Clojure compiler that emits JavaScript source code. README and source code: https://github.com/clojure/clojurescript Leiningen dependency information: [org.clojure/clojurescript "1.7.28"] ClojureScript now has a proper version number. This version number is designed to re

Re: add-watch and writing data into a core.async channel

2015-07-31 Thread Raymond Huang
Thanks everyone for the suggestions, I'll try it out later today @leon Thanks. I wish this were documented in the API for how to write Clojure/Script compatible code. Just saw your answer on stackoverflow

Function behaving differently in web app route

2015-07-31 Thread gvim
I have a route in my Luminus project: (POST "/add_link" [my_id fname surname day2 month2 year2 hour2 min2 zone2] (let [link (add-user-planets-aspects! [fname surname nil nil nil (Integer/parseInt day2) (Integer/parseInt month2) (Integer/parseInt year2) (Integer/pars

Re: Changing write output file on the fly

2015-07-31 Thread James Reeves
On 31 July 2015 at 17:18, Marcin Jurczuk wrote: > > Some reading is required to understand your code (never used volatile!) > but thanks for direction. > I will try this way. > Volatiles were introduced in Clojure 1.7.0, and trade thread-safety for better performance. I could have used an atom fo

Re: [ANN] Release 0.32.0 of Counterclockwise

2015-07-31 Thread Shantanu Kumar
On Friday, 31 July 2015 19:41:45 UTC+5:30, fasfsfgs wrote: > > Sorry for my noobness but is there any tutorial on how to use > counterclockwise? > > I'm a java developer and I'm super curious about Clojure. > I'm still learning the very basics of the language and I'd like to keep > using ecli

Re: Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
Mars0i, I've tried spit but it looks like there is no caching under the hood and it's using syscalls open, write, close every time it is called, and this spikes system resources. with-open - we will see :) W dniu piątek, 31 lipca 2015 16:41:19 UTC+2 użytkownik Mars0i napisał: > > with-open

Re: Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
James, Some reading is required to understand your code (never used volatile!) but thanks for direction. I will try this way. W dniu piątek, 31 lipca 2015 17:39:50 UTC+2 użytkownik James Reeves napisał: > > The way I'd do it is to write a function that caches the output writer or > stream. Whe

Re: Changing write output file on the fly

2015-07-31 Thread James Reeves
The way I'd do it is to write a function that caches the output writer or stream. When the cache expires, the function closes the old writer and opens a new one to the new file. In the example below, I'm assuming you have a function that returns the same name for the same hour. (let [cache (volat

Re: Changing write output file on the fly

2015-07-31 Thread Mars0i
with-open and spit might be useful. You could also rebind *out*. That may be enough to point you in the right direction, but this page

Re: [ANN] Release 0.32.0 of Counterclockwise

2015-07-31 Thread fasfsfgs
Sorry for my noobness but is there any tutorial on how to use counterclockwise? I'm a java developer and I'm super curious about Clojure. I'm still learning the very basics of the language and I'd like to keep using eclipse for now since I'm very familiar with it. Thanks for any help you guys can

Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread James Reeves
On 31 July 2015 at 09:54, J. Pablo Fernández wrote: > > For me, the thing is, I have a traditional relational database here, this > is already far from pure. For example, calling (db/create-user " > pup...@pupeno.com") twice will not only not return the same thing the > second time, it'll actually

Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread J . Pablo Fernández
On Friday, 31 July 2015 11:48:54 UTC+1, Colin Yates wrote: > > I am away from the code at the moment, but is there any reason why the > dynamic connection can’t be private? This goes some way to providing safety. > No, I don't think there's a problem with it being private, I just didn't think

[ANN] finagle-clojure 0.4.0

2015-07-31 Thread Sam Neubardt
finagle-clojure is a thin wrapper around Finagle[1] for Clojure. Finagle is a Scala library for building highly concurrent RPC services on the JVM. https://github.com/finagle/finagle-clojure/ Notable Changes: * algo.monad support * upgraded to the latest Finagle version * support for new FuturePo

Re: range no longer returns a LazySeq; how to check whether realized?

2015-07-31 Thread Alex Miller
We're focusing on defects right now for 1.8 but eventually we'll roll back around to enhancements too. On Fri, Jul 31, 2015 at 5:04 AM, Marc O'Morain wrote: > This caught us out at Circle when preparing the code-base for Clojure 1.7 > – which reminds me of http://dev.clojure.org/jira/browse/CLJ-

Re: add-watch and writing data into a core.async channel

2015-07-31 Thread Timothy Baldridge
One "gotcha" is that atoms add-watches do not always guarantee order semantics. So if you have a watch put [old-val new-val] on a channel, and your atom operation is something like (swap! a inc), you may see values in your channel like this: [0 1] [2 3] [1 2] [3 4] [6 7] [4 5] This is because the

Re: add-watch and writing data into a core.async channel

2015-07-31 Thread Stefan Kamphausen
On Friday, July 31, 2015 at 8:21:18 AM UTC+2, Raymond Huang wrote: > > I'd like to use `add-watch` on an atom which writes the data to a > core.async channel. So far, I've come up with this, but it seems bad > because I create a new go-routine everytime something happens. > > Makes me think, one

Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
Hi all, This is my first post here so please be compassionate :) I'm evaluating clojure for some of my purposes and I've stuck on task that I don't know to handle. I have applicatin that is receiving a lot of data and writing some results to a file. However once per hour this output file must

Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread Colin Yates
This is always tricky - the other dimension is that the transaction can span multiple components which should all be ignorant of each other, so a collecting fn (like James’ ‘do-things*’) isn’t feasible. For me, I have the service create a tx and then either I pass in the tx instead of the db pa

Re: range no longer returns a LazySeq; how to check whether realized?

2015-07-31 Thread Marc O'Morain
This caught us out at Circle when preparing the code-base for Clojure 1.7 – which reminds me of http://dev.clojure.org/jira/browse/CLJ-1752 It would be very nice if `reliased?` returned true for values that are not instances of IPending On 31 July 2015 at 03:51, Mars0i wrote: > OK, thanks. >

Re: Using a dynamic var for my database connection for implicit connections+transactions

2015-07-31 Thread J . Pablo Fernández
Hello James, Thanks for your answer. I do understand your point. Pure functions are easier to reason about and my use of dynamic here breaks that purity. I'm not doing it lightly. It already happened to me, that one of those functions that was running inside the transaction, was not passed the tra

Re: add-watch and writing data into a core.async channel

2015-07-31 Thread Leon Grapenthin
Use put! On Friday, July 31, 2015 at 8:21:18 AM UTC+2, Raymond Huang wrote: > > I'd like to use `add-watch` on an atom which writes the data to a > core.async channel. So far, I've come up with this, but it seems bad > because I create a new go-routine everytime something happens. > > (add-watch

Re: [ANN] stateful-check 0.3.0 - test stateful systems with test.check

2015-07-31 Thread Atamert Ölçgen
Hi Carlo, This is an awesome lib. Thanks for sharing. README mentions the queue example and goes directly into details. I would inline the queue example and maybe move the Specifications section into a different file. On Fri, Jul 31, 2015 at 7:05 AM, Carlo Zancanaro wrote: > Hey everyone! > >