Why are errors in nested futures suppressed?

2013-05-21 Thread Colin Yates
Hi all, If the function executed in a future throws an error it is printed out in the repl immediately. If that function is executed in a future which itself is executed in a future then it isn't. For example, imagine somebody wrote the following code (please, suspend belief and just accept p

executing tests using clojure-test-mode in emacs throws ClassNotFoundException

2013-05-21 Thread Colin Yates
Hi, I am trying to get clojure-test-mode working in emacs from https://github.com/technomancy/clojure-mode. I have the nrepl working great, the problem is if I C-c, C-, in a test file then I get the "clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode,

Re: executing tests using clojure-test-mode in emacs throws ClassNotFoundException

2013-05-21 Thread Colin Yates
https://github.com/technomancy/clojure-mode/issues/146#issuecomment-15447065 provides one solution - navigate to the source code and then start nrepl. On Tuesday, 21 May 2013 11:37:19 UTC+1, Colin Yates wrote: > > Hi, > > I am trying to get clojure-test-mode working in emacs f

Structing Clojure tests/setup and tear down

2013-05-21 Thread Colin Yates
Howdy, I am using clojure.test and have some questions of how to write idiomatic Clojure. This really isn't about testing at all per-se. First - I know about fixtures to get (at least) the same as JUnit's before/after behaviour. My code is a bloomy. You can configure the bloomy and it does d

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread Colin Yates
v.blogspot.co.uk/2012/09/before-and-after-logic-in-clojuretest.html > > U > > > On 21 May 2013 15:17, Colin Yates wrote: > >> Howdy, >> >> I am using clojure.test and have some questions of how to write idiomatic >> Clojure. This really isn't about te

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread Colin Yates
so there may be typos etc. > > > > On Tue, May 21, 2013 at 10:05 AM, Colin Yates wrote: > >> Hi Ulises, >> >> I don't think I am as that would require essentially a fixture per >> distinct combinations of test state, which is almost the same number of &g

Re: Structing Clojure tests/setup and tear down

2013-05-21 Thread Colin Yates
No worries ;) On 21 May 2013 17:18, Ulises wrote: > Hey Colin, > > Apologies, I missed your "First - I know about fixtures..." line :) > > I'd probably +1 Gaz's macro (I've not tested it either but it looks > reasonable.) > > > On 21 May 201

Re: A blocking lazy sequence populated by multiple worker threads

2013-05-30 Thread Colin Yates
Can you not use http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/LinkedBlockingQueue.html? That will provide the blocking element. To execute N (i.e. 10 in your example) use a http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html. The 'glue' w

Re: A blocking lazy sequence populated by multiple worker threads

2013-05-30 Thread Colin Yates
Nice. On 30 May 2013 12:57, John D. Hume wrote: > On May 30, 2013 4:12 AM, "Colin Yates" wrote: > > ; the following would need to reify itself to be a Runnable, not got > that far yet :) > > (defn execute [job result-queue] (let [result (job)] (.put result-queue &

(clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Colin Yates
Hi all, I am doing some (naive and trivial) performance tests before deciding whether and how to use Clojure for some performance critical number cruching and I wanted help understanding the behaviour. I am defining an array inside a function, setting the contents to be 1 and then summing them

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Colin Yates
l defs and then rerun your benchmarks. > > > On Fri, Jun 21, 2013 at 8:36 AM, Colin Yates wrote: > >> Hi all, >> >> I am doing some (naive and trivial) performance tests before deciding >> whether and how to use Clojure for some performance critical number >> cruch

Re: (clojure 1.5.1) Weird performance results when using let versus def for variable

2013-06-21 Thread Colin Yates
Ah OK, I didn't realise. I thought the vars would be locally scoped, i.e. semantically equivalent to 'let'ed symbols. Thanks everyone for contributing. On Friday, 21 June 2013 14:49:52 UTC+1, Jim foo.bar wrote: > > On 21/06/13 14:34, Colin Yates wrote: > > I

(newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Colin Yates
Hi all, I think this is one of those questions which has quite a few answers, but given a map, how do I replace the values by applying a function to those values, but only if they meet a condition? I understand the building blocks of (map..), (filter..), (assoc-in..) and (filter..) and I can s

Re: (newbie) replace certain values of a map based on a predicate

2013-07-05 Thread Colin Yates
gt; > > wrote: > >> You'll never really 'replace' any values so why not reduce/reduce-kv ? >> Just build a new map out of the old one... >> >> Jim >> >> >> On 05/07/13 21:59, Colin Yates wrote: >> >>> Hi all, >&g

how to create in-memory hsqldb database via java.jdbc

2013-07-08 Thread Colin Yates
Hi, I am using clojure.java.jdbc with HSQLDB, but I cannot figure out how to create an in-memory database. Whatever I try defaults to a file based instance, so: (def hsql-db {:classname "org.hsqldb.jdbcDriver" :subprotocol "hsqldb" :subname "memory"}) creates a file called memory.log etc. in

Re: how to create in-memory hsqldb database via java.jdbc

2013-07-08 Thread Colin Yates
hopes this help the next clueless newb :) On Monday, 8 July 2013 15:16:44 UTC+1, Colin Yates wrote: > > Hi, > > I am using clojure.java.jdbc with HSQLDB, but I cannot figure out how to > create an in-memory database. Whatever I try defaults to a file based > instance, so: > >

clojure 1.5.1, emacs/nrepl and clojure.repl

2013-07-08 Thread Colin Yates
Hi all, If using clojure 1.4.0 then when I start nrepl (CcMj) then I the clojure.repl namespace is automatically 'used. If I upgrade to Clojure 1.5.1 then it doesn't. I can still (use 'clojure.repl) but is this a bug? I can't believe I would be the first to spot this but there I couldn't find

Re: clojure 1.5.1, emacs/nrepl and clojure.repl

2013-07-08 Thread Colin Yates
Ah yes - nice find. On 8 July 2013 17:24, Tim Visher wrote: > On Mon, Jul 8, 2013 at 11:43 AM, Colin Yates > wrote: > > If using clojure 1.4.0 then when I start nrepl (CcMj) then I the > > clojure.repl namespace is automatically 'used. If I upgrade to Clojure > &

Re: clojure 1.5.1, emacs/nrepl and clojure.repl

2013-07-08 Thread Colin Yates
That works a treat - thanks. On 8 July 2013 16:49, Neale Swinnerton wrote: > Hi Col, > > On Mon, Jul 8, 2013 at 4:43 PM, Colin Yates wrote: > >> Alternatively, in the vein of just getting things done, can I do some >> emacs fu to automatically load clojure.repl? Si

group-by replacement when an item has many groups?

2013-07-08 Thread Colin Yates
Hi, I have a sequence of items and want to group them into categories, the value of which is a function of the item. This sounds exactly what group-by is after. The kicker is that the function could return multiple values. Imagine each item was a date range and I wanted to group them by the

Re: group-by replacement when an item has many groups?

2013-07-08 Thread Colin Yates
efn > group-by [f coll] (groups-by (comp vector f) coll)). > > > > On Mon, Jul 8, 2013 at 12:25 PM, Colin Yates wrote: > >> Hi, >> >> I have a sequence of items and want to group them into categories, the >> value of which is a function of the item. This so

Re: group-by replacement when an item has many groups?

2013-07-08 Thread Colin Yates
with '(count key)'...I don't see a way of doing this in > one-pass using group-by alone... > > Jim > > > > On 08/07/13 20:25, Colin Yates wrote: > >> Hi, >> >> I have a sequence of items and want to group them into categories, the >> val

Re: group-by replacement when an item has many groups?

2013-07-08 Thread Colin Yates
Wow - I need to get some sleep: {1 [1 2 3] 2 [2 3] 3 [3]} On 8 July 2013 20:52, Colin Yates wrote: > Perfect, and bonus points for spotting my stupid "not slept in days" > muppetry. The results I want are as you infer: {1 [1 2 3] 2 [1 2] 3 [3]}. > > Now all I have to

java.jdbc - (sql/where ...) with multiple values (i.e. 'x in (1,2,3')

2013-07-08 Thread Colin Yates
Using the latest release of java.jdbc, does anybody know how I can construct a where clause when I want to check if the value is one of many values? For example, if I have a filter {:age [1 2 3 4]} then (sql/where filter) causes an error: "Wrong data type: java.lang.NumberFormatException: For

Re: java.jdbc - (sql/where ...) with multiple values (i.e. 'x in (1,2,3')

2013-07-09 Thread Colin Yates
Thanks both. On 9 July 2013 01:55, James Ferguson wrote: > > > On Monday, July 8, 2013 5:28:07 PM UTC-4, Colin Yates wrote: >> >> Using the latest release of java.jdbc, does anybody know how I can >> construct a where clause when I want to check if the value is one o

Re: group-by replacement when an item has many groups?

2013-07-09 Thread Colin Yates
Thanks Y.Kohyama - it does. On 9 July 2013 03:00, Yoshinori Kohyama wrote: > Hi Colin, > > One more solution, with example data in the process commented > > *(let [f #(range 1 (inc %))* > * coll '(1 2 3)]* > * (->>* > **(for [*x coll*; x = 1, 2, 3 > * y *(*f x*)]* *; y =

Re: java.jdbc - (sql/where ...) with multiple values (i.e. 'x in (1,2,3')

2013-07-09 Thread Colin Yates
you don't have that, you tend to need to build up state through method calls. End of musing. On Tuesday, 9 July 2013 01:55:54 UTC+1, James Ferguson wrote: > > > > On Monday, July 8, 2013 5:28:07 PM UTC-4, Colin Yates wrote: >> >> Using the latest release of java.jdbc, do

Re: (newbie) replace certain values of a map based on a predicate

2013-07-12 Thread Colin Yates
;> replacement-value %) your-map). >> >> >> On Fri, Jul 5, 2013 at 2:08 PM, John Walker wrote: >> >>> I had to do something similar, and used >>> clojure.walk.<http://clojuredocs.org/clojure_core/clojure.walk/walk> >>> >>> On Friday,

Re: Do you like the Clojure syntax?

2013-08-12 Thread Colin Yates
I think that jarring effect is actually beneficial, it helps stop people carrying invalid assumptions across. It is all too easy to slip into writing code the old way using the new tool. The lack of familiarity between LISPs and Java (Groovy, Scala, rails etc.) makes it that much harder to sl

(newbie-ish) Modelling question - multi methods?

2013-08-12 Thread Colin Yates
Hi all, I have a strategy that defines handling a woosey. Most woosey handlers are going to need some help, maybe a wibbly and a woobly. In OO land I would have a WooseyHandler { void handle(Woosey woosey); }. The implementations would then receive Wibblies and Wooblies via dependency inject

Re: (newbie-ish) Modelling question - multi methods?

2013-08-12 Thread Colin Yates
Hi Russell, Maybe the concrete case will help. I have a single entry point into which Commands can be posted, let's call it a CommandGateway. This gateway will do many things, the least of which will be to delegate the handling of the command to the command handler registered with the gateway.

Lazy group-by for sorted maps?

2013-08-12 Thread Colin Yates
Is there such a thing as a lazy group-by for a sequence of elements when the elements are sorted on the criteria used to group them? I can imagine how one would look in a few lines of Clojure code but I am surprised there isn't one already. My actual criteria is that I am pulling things from a

Re: Do you like the Clojure syntax?

2013-08-12 Thread Colin Yates
Nice tip - thanks. On Monday, 12 August 2013 18:09:56 UTC+1, Steven Degutis wrote: > > I also like Clojure's syntax because it shows me the structure of my > function more clearly than does the imperative code I've written in other > languages. > > My functions always turn out in either pyramids

Re: Lazy group-by for sorted maps?

2013-08-12 Thread Colin Yates
Great - thanks! On 12 August 2013 19:07, Jonah Benton wrote: > > Sounds like a job for partition-by: > > http://clojuredocs.org/clojure_core/clojure.core/partition-by > > > > On Mon, Aug 12, 2013 at 1:55 PM, Colin Yates wrote: > >> Is there such a thing as

Re: Lazy group-by for sorted maps?

2013-08-13 Thread Colin Yates
identity "aaabbbcccaaabbbcc") > ;;=> ((\a \a \a) (\b \b \b) (\c \c \c) (\a \a \a) (\b \b \b) (\c \c)) > (partition-by identity (sort "aaabbbcccaaabbbcc")) > ;;=> ((\a \a \a \a \a \a) (\b \b \b \b \b \b) (\c \c \c \c \c)) > > > On Monday, August 12, 2013 11:17:29

Re: Clojure for Desktop UI Design Application

2015-01-13 Thread Colin Yates
IntelliJ is swing! Well, knock me other with a feather :). Still wouldn't want to go anywhere near building a Swing app though :). On 14 Jan 2015 01:36, "Colin Fleming" wrote: > On 14 January 2015 at 05:50, Colin Yates wrote: > >> My evolution of Java UI was swing&g

Re: which are the pros and cons between stuartsierra/component and prismatic/graph?

2015-02-04 Thread Colin Yates
You might also want to consider prismatic schema if you are evaluating your tool stack. I too would condone component, and the various component compatible libs that have sprung up. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this grou

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Colin Yates
+1 This separation of behaviour and state is a key part of Clojure's philosophy. That isn't to say that stateful components are bad as such (Stuart Sierra's https://github.com/stuartsierra/component is an obvious analog here) only that they aren't a given as they are in OO languages. As Jony says,

Re: OO Programmer trying to move to Clojure: Encapsulation

2015-02-08 Thread Colin Yates
of maps [{..} {..} ...] and can be sufficiently transformed with the 'map' function (with assoc/assoc-in). On Sunday, 8 February 2015 17:16:40 UTC, Colin Yates wrote: > > +1 This separation of behaviour and state is a key part of Clojure's > philosophy. That isn't to

Re: OO Programmer trying to move to Clojure: Namespace Organization

2015-02-11 Thread Colin Yates
I wouldn't get too hung up on imitation as whilst there are style guides [1] I you will find a lot of diversity in "published" Clojure code. I would suggest you internalise the style guide, lean on "lein kibit" and "lein eastwood" and then do some navel gazing and ask yourself what problem you are

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
Style police would point out zero? and when-not :). On 17 Feb 2015 20:40, "Cecil Westerhof" wrote: > 2015-02-17 20:26 GMT+01:00 Timothy Baldridge : > >> Tweak as needed: >> >> (keep-indexed >> (fn [i v] >> (if (= 0 (mod i 5)) >> nil >>

Re: Removing the 5th, 10th, 15th ... element of a list

2015-02-17 Thread Colin Yates
runs every snippet posted to this > mailing list through kibit (https://github.com/jonase/kibit). > > On Tue, Feb 17, 2015 at 1:49 PM, Colin Yates > wrote: > >> Style police would point out zero? and when-not :). >> On 17 Feb 2015 20:40, "Cecil Westerhof" wro

Re: ANN: Onyx Dashboard 0.5.2.1

2015-02-18 Thread Colin Yates
Hi Lucas, This looks great - thanks. [off topic] I don't know much about Onyx but I am just about to start committing code for server app which is going to use a CQRS design. It doesn't need to be internet scale at all, will be a single machine, and spend all of its time taking a command, executi

Re: ANN: Onyx Dashboard 0.5.2.1

2015-02-19 Thread Colin Yates
lem (https://github.com/MichaelDrogalis/onyx-examples). > > We hang out in Gitter if you have any questions: > https://gitter.im/MichaelDrogalis/onyx > > -- Mike > > On Wednesday, February 18, 2015 at 10:22:07 AM UTC-8, Colin Yates wrote: >> >> Hi Lucas, >> >&g

Advice on core.async and (JDBC) transactions

2015-02-23 Thread Colin Yates
Currently each request gets serviced in its own thread (web container) and I am thinking of integrating core.async and I wonder how core.async and a JDBC transactional "unit of work" get on. Conceptually, this model (thread-per-request) is trivial however the problems are well known. Replacing

Re: Can someone offer refactoring suggestions for my protocol example?

2015-02-23 Thread Colin Yates
A minor point (get col n) is the same as (col n). It's more of a stylistic thing, but your use of protocols and implementation is quite 'stateful'. I would have done the same with vanilla maps: (def employee [first-name last-name level] {:first-name .}) (defn promote [{:keys [level] :as emp

Re: Can someone offer refactoring suggestions for my protocol example?

2015-02-23 Thread Colin Yates
Unless of course your whole example was to work with Protocols (he says as he notices the file is called protocols.clj in a protocols namespace) in which case - yep, that is fine :). On Monday, 23 February 2015 19:51:00 UTC, Colin Yates wrote: > > A minor point (get col n) is the same as

Re: Advice on core.async and (JDBC) transactions

2015-02-23 Thread Colin Yates
Thanks Christian, that looks interesting. By the way, any idea what tool was used to generate the documentation? On 23 February 2015 at 21:22, Christian Weilbach wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 23.02.2015 18:20, Colin Yates wrote: >> Currently

Re: Advice on core.async and (JDBC) transactions

2015-02-24 Thread Colin Yates
ut the suricata approach is share a > connection instance between threads but ensuring that only one thread can > use it at same time (as I said previously) using serialization semantics of > clojure agents. > > I hope it has been helpful. > > Cheers > Andrey > > > 2015-02

Re: Advice on core.async and (JDBC) transactions

2015-02-24 Thread Colin Yates
It seems like it is worthwhile to brush up my knowledge then, this looks quite hopeful - thanks! On 24 February 2015 at 10:39, Andrey Antukh wrote: > > > 2015-02-24 10:15 GMT+01:00 Colin Yates : >> >> Hi Andrey - thanks for responding. Asciidoctor looks great! >>

Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
Hi all, What are you all using for interacting with an RDBMS? In the past I looked at clojure.java.jdbc, honeysql and korma (and for querying, honeysql just rocks). I have lost touch a bit - any recommendations? Thanks. -- You received this message because you are subscribed to the Google Gro

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
Actually, https://github.com/krisajenkins/yesql, now that it supports named parameters is probably just the ticket... On Tuesday, 24 February 2015 14:04:36 UTC, Colin Yates wrote: > > Hi all, > > What are you all using for interacting with an RDBMS? In the past I looked > at cl

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
gt; > All in all, pretty impressed with Clojure and HoneySQL. > > > On Tuesday, February 24, 2015 at 3:04:36 PM UTC+1, Colin Yates wrote: >> >> Hi all, >> >> What are you all using for interacting with an RDBMS? In the past I looked >> at clojure.java.jdbc, h

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
OK - thanks all. I am surprised that yesql isn't more adopted, particularly now named parameters is there - has anyone run into roadblocks with it? On 24 February 2015 at 16:50, Sean Corfield wrote: > On Feb 24, 2015, at 6:04 AM, Colin Yates wrote: >> What are you all using f

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
. Still, if SQL is known up front then it seems very nice. On 24 February 2015 at 18:10, Sean Corfield wrote: > On Feb 24, 2015, at 9:16 AM, Colin Yates wrote: >> I am surprised that yesql isn't more adopted, particularly now named >> parameters is there - has anyone run into

Re: Current best-of-breed JDBC libraries?

2015-02-24 Thread Colin Yates
I haven't used it but I remember building up pages of SQL in Clojure wasn't fun. The idea of putting that SQL into a .sql file, accessible by non-Clojure DB developer is very appealing. On 24 February 2015 at 18:24, Niels van Klaveren wrote: > Perhaps I'm missing something, but I don't really see

should edn recognise defrecord?

2015-02-24 Thread Colin Yates
I am sending instances of defrecords from clojurescript via transmit/edn and getting: 2015-Feb-24 19:23:52 + dev-os-mbp.local DEBUG [taoensso.sente] - Bad package: [[:client/message #health.shared.domain.PingCommand{}]] (clojure.lang.ExceptionInfo: No reader function for tag health.shared.

Re: should edn recognise defrecord?

2015-02-25 Thread Colin Yates
d to encode a > Clojure record as a tagged literal (for edn compatibility). It’s only for > the Clojure side at the moment, but I imagine it wouldn’t be hard to port > to CLJS. However, I suggest that you use transit. > > https://github.com/miner/tagged > > > > On Feb 24,

defmethod inside of a (stuart sierra) component?

2015-02-25 Thread Colin Yates
Hi, I have a number of commands flying around which need to be handled. defmulti/defmethod seem a nice answer. The problem is that each command handler will need different collaborators (those with long memories will realise this isn't new ground here ;)). I want to do something like: (ns one

Re: defmethod inside of a (stuart sierra) component?

2015-02-25 Thread Colin Yates
nctions). I'm using component a lot and I never had the need for > this. > > Maybe you can elaborate on why you think you need a multimethod inside the > component? Maybe a full example? > > Cheers, > Jeroen > > > > On Wed, Feb 25, 2015 at 12:08 PM, Colin Yates w

Re: defmethod inside of a (stuart sierra) component?

2015-02-25 Thread Colin Yates
ending on your need). So: > > (defmulti handle-command(fn [component command] (first command))) > > (defmethod handle-command :add-customer [{:keys [db eventstore} [[_ > customer]]] > ... ) > > Isn't something like this enough? > > Jeroen > > On Wed, Feb

Idiomatic access to collaborators/services

2015-02-25 Thread Colin Yates
Hi, I ran into a bit of a brick wall when thinking about how to register to and dispatch to multiple micro-services and it made me realise the underlying tension came from not having peace about a fundamental design decision; how do you access your collaborators. Note: I am specifically talking

Re: defmethod inside of a (stuart sierra) component?

2015-02-25 Thread Colin Yates
u'll end up with. > > Cheers, > Jeroen > > On Wed, Feb 25, 2015 at 2:01 PM, Colin Yates wrote: >> >> Yes, I did consider that but didn't like the idea of passing the >> system around. Also handle-command would need access to the system as >> well

Re: defmethod inside of a (stuart sierra) component?

2015-02-25 Thread Colin Yates
] > (export-query (@system :db) (@system :pdf-generator))) > > (defmethod handle-command :export-query [[_]] > (export-query)) > > > > marc > > > > > On Wed, Feb 25, 2015 at 8:23 AM, Colin Yates wrote: >> >> Not as curious as me! Naval gazing i

Re: Idiomatic access to collaborators/services

2015-02-25 Thread Colin Yates
ifecycle idea from Stuart Sierra's component (maybe define IStoppable) for > things that need shutdown, such as custom thread-pools. > > Shantanu > > > On Wednesday, 25 February 2015 18:52:28 UTC+5:30, Colin Yates wrote: >> >> Hi, >> >> I ran into a

Re: Idiomatic access to collaborators/services

2015-02-25 Thread Colin Yates
d)) > > But for testing purposes, you want to be able to overload the queue with a > stubbed version. Well, that's no problem; you can just change the queue/push > function into a method on a protocol. Any code that uses queue/push will act > the same, but now we have different b

Re:

2015-02-26 Thread Colin Yates
Hi Cecil - have you looked at hiccup? On 26 February 2015 at 19:39, Cecil Westerhof wrote: > At the moment I have the following code: > (str "" > " "style='font-family:Arial; font-size:16px; margin: > 10px;width:100%'>" > "" > "Quote" > "Author" >

Re:

2015-02-26 Thread Colin Yates
def headers ["Quote" "Author"]) (html (html5 [:table {:border: 1 :cellpadding :10 :style {:font-family "Arial" :font-size "16px" :margin "10px" :width "100%"}} [:tr (for [header headers] [:th {:bgcolor "black&

Re: should edn recognise defrecord?

2015-02-27 Thread Colin Yates
http://www.compoundtheory.com/clojure-edn-walkthrough/ is a nice read around this as well. On Tuesday, 24 February 2015 21:40:14 UTC, Colin Yates wrote: > > I am sending instances of defrecords from clojurescript via transmit/edn > and getting: > > 2015-Feb-24 19:23:52 + d

Re: Breaking out of a sequence

2015-03-01 Thread Colin Yates
I would replace it with loop/recur or a while, with both checking a termination flag (probably an atom) which is set by the user. An alternative approach would be core.async with a stop channel and then use alt! to check them both simultaneously. On 1 Mar 2015 10:30, "Cecil Westerhof" wrote: > I

Re: Breaking out of a sequence

2015-03-01 Thread Colin Yates
out to be a mess of unnecessary code. As Dr Eli Goldratt/TOC states: "never say I know" :). For example, I meant 'for/while' not 'while' :). On 1 March 2015 at 10:52, Cecil Westerhof wrote: > 2015-03-01 11:33 GMT+01:00 Colin Yates : >> >> I would repl

Re: Breaking out of a sequence

2015-03-01 Thread Colin Yates
invaluable. On Sunday, 1 March 2015 10:53:05 UTC, Cecil Westerhof wrote: > > 2015-03-01 11:33 GMT+01:00 Colin Yates >: > >> I would replace it with loop/recur or a while, with both checking a >> termination flag (probably an atom) which is set by the user. >> > ​I was ju

idiomatic use of Stuart Sierra's component

2015-03-01 Thread Colin Yates
If I have a stateful thing with a lifecycle then is the system component the instance of the thing or a wrapper that contains the thing. For example, let's say I have a registry of clients that want to be polled then I might have the following: (defrecord Registry [state]) (defn register-with [

Re: clj-uuid: time-based uuid now 350% faster than java.util.UUID/randomUUID

2015-03-02 Thread Colin Yates
Note - at least in chrome on OS X the link is broken as it terminates at the hype (http://danlentz.github.io/clj-). Great work despite the chrome breaking project name ;). On Monday, 2 March 2015 00:35:16 UTC, danl...@gmail.com wrote: > > Ok, for anyone following my adventures optimizing clj-uui

Re: [ANN] lein-html5-docs-3.0.0

2015-03-02 Thread Colin Yates
And an example of its output would be nice :). The project is https://github.com/tsdh/lein-html5-docs I think. On 2 March 2015 at 20:49, Jeremy Heiler wrote: > Do you have a link to the project? :-) > > On Mon, Mar 2, 2015 at 3:26 PM, Tassilo Horn wrote: >> >> Hi all, >> >> I've just pushed vers

Re: idiomatic use of Stuart Sierra's component

2015-03-02 Thread Colin Yates
rt the registry >> this) >> (stop [this] >> ;; stop the registry >> this) >> IRegistry >> (register-with [registry cb spec] >> (swap! state :assoc cb spec))) >> >> (defrecrod UsesRegistry [registry] >> Lifecycle >&

Re: clj-uuid: time-based uuid now 350% faster than java.util.UUID/randomUUID

2015-03-03 Thread Colin Yates
Ha - the irony of you and I posting a message about uniqueness at pretty much the same time :). On 3 Mar 2015 20:11, "Lucas Bradstreet" wrote: > Hi, > > Nice work! > > I wanted to clarify something: it seems to me that the v1 uuids clj-uuid > generate are not exactly equivalent or comparable to t

Re: clj-uuid: time-based uuid now 350% faster than java.util.UUID/randomUUID

2015-03-03 Thread Colin Yates
Are v1 as "unique" as randomUUID()? On 3 Mar 2015 20:08, "danle...@gmail.com" wrote: > PS. We are now TEN TIMES faster, so it is a lot easier to compute that > percentage: > > #'uuid/v1:201 nanoseconds > #'java.util.UUID/randomUUID: 2012 nanoseconds > > > Best, > Dan > > > O

Re: clj-uuid: time-based uuid now 350% faster than java.util.UUID/randomUUID

2015-03-03 Thread Colin Yates
DESCRIBED ABOVE." > ;; > ;; -- [RFC4122:4.5 "Node IDs that do not Identify the Host"] > > If there are any good reasons why one should pay 10 times the cost to > generate a UUID randomly, I'd like to hear them. > > > > On Tuesday, March 3, 2015

Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-04 Thread Colin Yates
Hi, I am looking for the Clojure equivalent of: class Whatever { @Transactional void doSomething(IDoSomething one, IDoSomethingElse two) { one.doSomething() two.doSomething() } } where both one and two are dependency injected with a proxy which resolves to a thread local

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-04 Thread Colin Yates
-c. On Wednesday, 4 March 2015 17:58:58 UTC, Colin Yates wrote: > > Hi, > > I am looking for the Clojure equivalent of: > > class Whatever { > @Transactional > void doSomething(IDoSomething one, IDoSomethingElse two) { > one.doSomething() > two.doSome

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-04 Thread Colin Yates
e scenario (where an > arbitrary function is passed to the component, possibly composed with other > functions, and invoked elsewhere), I usually have a convention where I pass > a map of options as an argument to the handler, and make the database a > value in that map. > > > On Wed

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-04 Thread Colin Yates
ite a macro to do this, >> closing/doing cleanup of the connection before exiting the dynamic scope of >> your transaction. >> >> On Wednesday, March 4, 2015 at 1:15:02 PM UTC-5, Colin Yates wrote: >>> >>> Hi Adrian, and thanks for replying. >>>

Re: Any Lispers in South Devon, UK?

2015-03-04 Thread Colin Yates
Only if you promise to move up to Leicester :). On 4 March 2015 at 13:14, John Kane wrote: > Hello Stephen, > > There is a small group of us based around Exeter and we are trying to get a > group off the ground, is that close enough to be of interest? > > John > > > On Tuesday, 3 March 2015 21:53

Re: clojure map to java instance of pojo class

2015-03-05 Thread Colin Yates
Isn't this exactly what defrecord does? On 5 March 2015 at 07:42, Xiangtao Zhou wrote: > hi all, > > is there some library or simple way to do it like the function "map-to-pojo" > in the following code ? > > java code > class A{ > public int a; > public String b; > } > > clojure code > (def a

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-05 Thread Colin Yates
implicitly through the call stack. > > Jonah > > > > On Wed, Mar 4, 2015 at 12:58 PM, Colin Yates wrote: >> >> Hi, >> >> I am looking for the Clojure equivalent of: >> >> class Whatever { >> @Transactional >> void doSometh

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-05 Thread Colin Yates
follow one pattern (taking a > context map) so they can be easily composed and rearranged, while functions > that deal with edge resources take those resources along with other > parameters more explicitly, so the data flow can run in an insulated > fashion. > > > > On Thu, Mar 5, 20

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-05 Thread Colin Yates
t; because everything takes a context map. You could also generate a visual > decision tree of the model, or a real time heat map of decisions or of > action performance. > > Anyway- sorry, this isn't intended to pitch an internal library, rather to > share another though

Re: Idiomatic way to co-ordinate 'disconnected' services into a single transaction (ala Spring's @Transactional functionality)?

2015-03-05 Thread Colin Yates
es compose, > because everything takes a context map. You could also generate a visual > decision tree of the model, or a real time heat map of decisions or of > action performance. > > Anyway- sorry, this isn't intended to pitch an internal library, rather to > sh

Re: Om design query

2015-03-06 Thread Colin Yates
I know this is a different direction than a lot of people but I store everything in the app-state and so far it has worked well. There are a hundred reasons why this (storing everything in app-state) is a terrible idea, but I haven't run into any of them. The main driver for this was for bug repor

Re: Disk based caching for Clojure app

2015-03-06 Thread Colin Yates
You could build something on top memory mapped files. I did this to solve similar requirements with good effect. On 6 Mar 2015 18:55, "JPatrick Davenport" wrote: > Hello, > I'm been thinking about an idea for a cache layer. It's driven by two > trends. > > Most caches are in memory. They might ha

Composing Stuart Sierra's components

2015-03-11 Thread Colin Yates
I have a non-trivial component which requires a bunch of internal and external collaborators to work. This component is itself re-usable. What I really want to do is have ReusableComponent be a component in a system so it can pull its external collaborators. However, ReusableComponent construc

Re: Composing Stuart Sierra's components

2015-03-11 Thread Colin Yates
dependency as a value. > > On Wednesday, March 11, 2015 at 2:17:12 PM UTC-4, Colin Yates wrote: >> >> I have a non-trivial component which requires a bunch of internal and >> external collaborators to work. This component is itself re-usable. >> >> What I really wan

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
to break these apart more explicitly > in accordance with guidelines around managing micro-services. Easy to say, > of course. :) > > Not sure if that's helpful > > Jonah > > > > On Wed, Mar 11, 2015 at 3:01 PM, Colin Yates > wrote: > >> merge

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
d your question; I didn't realize it was system (as > opposed to any general component) specific. I think systems can be merged > together (via 'merge'). Would that help? > > On Wednesday, March 11, 2015 at 2:40:14 PM UTC-4, Colin Yates wrote: >> >> Hi Adria

Re: Composing Stuart Sierra's components

2015-03-12 Thread Colin Yates
rote: > On Wednesday, March 11, 2015, Colin Yates wrote: >> I can't merge the two systems because the reusable >> component is chocka full of very fine grained command >> handlers and both the internal and external systems will >> have their own 'bus' for example

defmacro help

2015-03-13 Thread Colin Yates
Hi, I am wiring up a bunch of CRUD command handlers for different aggregates using prismatic schema to validate and it is screaming out for a macro, but my ignorance is screaming even louder :). The form I want to emit is something like (for a 'Location' for example): (s/defn ^:always-validate

Re: defmacro help

2015-03-13 Thread Colin Yates
is defined in. Any ideas? On Friday, 13 March 2015 12:27:02 UTC, Colin Yates wrote: > > Hi, > > I am wiring up a bunch of CRUD command handlers for different aggregates > using prismatic schema to validate and it is screaming out for a macro, but > my ignorance is screamin

Re: defmacro help

2015-03-13 Thread Colin Yates
OK, so ~(symbol "create") was what I needed to do but that now loses the ^:always-validate meta :).. On Friday, 13 March 2015 12:42:36 UTC, Colin Yates wrote: > > Nope, never mind - it was a dirty REPL. It works fine-ish. > > My next problem is that it works fine, but on

Re: defmacro help

2015-03-13 Thread Colin Yates
Thanks Tobias. The complete macro body is now: (let [{:keys [hierarchy-key cascade-keys define-command-schema defined-event-schema define-command-key defined-event-key]} (default-options aggregate)] `(do (schema.core/def

  1   2   3   4   5   6   >