I read through the docs on jig and component. Basically, the answer
proposed by that workflow is:
You have to thread your shared state through all the functions (what I
described as Solution 2), and if you don't want the difficulty of
refactoring to that way of doing things, you better just do it
On 28 December 2013 08:21, Mark Engelberg mark.engelb...@gmail.com wrote:
`with-precision` has the same limitations as bindings -- if you want to
produce, for example, a lazy sequence involving decimal arithmetic, you're
going to get burned. Maybe in some projects you can get away with just
On Sat 28 Dec 2013 at 12:21:22AM -0800, Mark Engelberg wrote:
You have to thread your shared state through all the functions (what
I described as Solution 2), and if you don't want the difficulty of
refactoring to that way of doing things, you better just do it that
way from the beginning.
I
On Sat 28 Dec 2013 at 05:12:24AM -0600, guns wrote:
(defn +. [precision xs] …)
(defn *. [precision xs] …)
…
(defmacro with-precision [precision body]
`(let [~'+ ~(partial +. precision)
…]
~@body))
I just realized that this does not help with
I ended up accidentally injecting a completely different thread of
discussion into the Is Clojure right for me? thread. I'm breaking it
into a separate thread here.
Here's where we left off:
On Fri, Dec 27, 2013 at 6:34 AM, Stuart Halloway
stuart.hallo...@gmail.comwrote:
Yes, thanks Mark. It
I posted this in response to the original gist, but it probably wasn't
seen. Does this demonstrate the behavior you want?
https://gist.github.com/johnwalker/8142143
On Friday, December 27, 2013 1:08:49 PM UTC-5, puzzler wrote:
I ended up accidentally injecting a completely different thread
On Fri, Dec 27, 2013 at 1:08 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
Solution 2:
(defn foo [shared-info x] ... body uses shared-info)
(defn bar [shared-info x] ... body uses shared-info)
Call these functions via:
(foo info 2)
(bar info 3)
In what way is this any worse than
We use a lot of configuration information in our product and I mean lot :)
Immutable in regard to the application cycle.
We chose to remove this from each name spaces and instead use a name
space to act as an intermediate to acces it.
It's not as pure as it should be (it's contextually outside
I can think of a couple more alternatives to consider:
;; Turns out you don't need vars for everything.
(let [state {:some :data}]
(defn do-stuff [] (func-of state)))
;; Shifts some burden to the client code
(defn do-stuff-fn [state]
(fn [] (func-of state))
The issue as I see it is a
The thing I like about your record/protocol example version is that all the
protocol function implementations can see the components of the record
and use those names in the implementation without explicit destructuring.
That adds significantly to the ease of working with multiple functions
On Fri, Dec 27, 2013 at 10:35 AM, Softaddicts
lprefonta...@softaddicts.cawrote:
Passing this stuff around using one of the two methods you have shown
would have been cumbersome and unmaintainable. Most of the time
our configuration information comes from top level fns so the lower
layers
On Fri, Dec 27, 2013 at 10:27 AM, Cedric Greevey cgree...@gmail.com wrote:
On Fri, Dec 27, 2013 at 1:08 PM, Mark Engelberg
mark.engelb...@gmail.comwrote:
Solution 2:
(defn foo [shared-info x] ... body uses shared-info)
(defn bar [shared-info x] ... body uses shared-info)
Call these
On Fri, Dec 27, 2013 at 11:03 AM, Gary Trakhman gary.trakh...@gmail.comwrote:
Why should functions share information?
Maybe I'm the odd one out, but every project I've done has at least a few
bits of info shared by many functions. It might be something like
BUFFERSIZE or NUM-THREADS or
I investigated a few of these. Variable arity functions don't some to work,
but destructuring and parameter number seem unaffected.
https://gist.github.com/johnwalker/8151474
I suspect that what I wrote below is possible with multimethods.
(defrecord foobarrecord
foobarprotocol
We have a good basis with
versioning.
99% of the time, workers are the
ones accessing the configuration.
They are at the top level.
It happens that they do access
configuration through
the workers service name space.
In fact through a single fn ...
Passing a version number when
pulling out a
On Fri, Dec 27, 2013 at 2:03 PM, Gary Trakhman gary.trakh...@gmail.com wrote:
The issue as I see it is a complection of namespaces (DAG of bags of
functions) and individual object lifecycles. The grid size stuff impl is a
This is a very fair point, and something people have worked on
Check
On Fri 27 Dec 2013 at 11:40:45AM -0800, Mark Engelberg wrote:
On Fri, Dec 27, 2013 at 11:03 AM, Gary Trakhman
gary.trakh...@gmail.comwrote:
Why should functions share information?
Maybe I'm the odd one out, but every project I've done has at least a few
bits of info shared by many
On Fri, Dec 27, 2013 at 2:32 PM, Mark Engelberg mark.engelb...@gmail.comwrote:
On Fri, Dec 27, 2013 at 10:27 AM, Cedric Greevey cgree...@gmail.comwrote:
On Fri, Dec 27, 2013 at 1:08 PM, Mark Engelberg mark.engelb...@gmail.com
wrote:
Solution 2:
(defn foo [shared-info x] ... body uses
This works (clever hack!), but you would have to reduplicate the keys in
(defn bar [..]...), (defn baz [...] ...) etc.
On Friday, December 27, 2013 3:05:24 PM UTC-5, Cedric Greevey wrote:
On Fri, Dec 27, 2013 at 2:32 PM, Mark Engelberg
mark.en...@gmail.comjavascript:
wrote:
On Fri, Dec
On Fri, Dec 27, 2013 at 3:13 PM, john walker john.lou.wal...@gmail.comwrote:
This works (clever hack!), but you would have to reduplicate the keys in
(defn bar [..]...), (defn baz [...] ...) etc.
(defmacro defthingyfn [name arglist body]
`(defn name ~(vec (cons '{:keys [thingy mumble
+1 for Stuart's component lib. I've been using it a lot in my day job and
it works quite well. It also serves as a reminder not to throw global
config values into vars. Building code that works well with the library
makes it less natural to put random state values in globals.
Timothy
On Fri,
On 27 December 2013 18:08, Mark Engelberg mark.engelb...@gmail.com wrote:
On Fri, Dec 27, 2013 at 6:34 AM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
Yes, thanks Mark. It seems to me that you are saying namespaces make
poor maps. Stipulated. So why not use records or maps?
This
James Reeves has got it. It's same for me. All this boils down to really
knowing the language. Knowing how to make music with the instruments
provided. For me Clojure's namespaces has been one of the most wonderful
things that has happened to me in programming. It has facilitated all kinds
of
23 matches
Mail list logo