Thanks for the reply.
I could be wrong, but namespaces just provide a package / require mechanism,
such that only required functionality is in the namespace of some code. This
seems to be more of a mapping to the package / import mechanism of java or
something similar in ruby or python. However, though it hides functions from
polluting global namespace, I would say it is not nearly equivalent to a
"class" in the traditional sense. I may be misunderstanding something here.
Now OO may be antithetical to the traditional way of using lisp, however, I see
myself needing something close to an OO-style mapping for part of what I do.
Currently my trading strategies have large and disparate state contained in
each strategy. I'm not really sure how can effeciently map into clojure. So
for instance if I have 50 different pieces of state, some of which will be:
- matrices
- numbers
- vectors
- booleans
- FSMs
How would I encapsulate this into a data structure to be passed into functions
efficiently? I could use a map of symbols to various structures, but that
would be inefficient in access and memory. I could bind into a closure but
then how do I evolve the closure. So for instance could do (excuse
non-idiomatic usage and/or suggest better):
(defn foo-bar-strategy [...]
(let [
valA ...
valB ...
valC ...]
(fn [...] ...)))
Where the returned function is an accessor into the state, perhaps also
including functions operating on that state. In this setup not sure how state
evolves though. If all access in and out goes through delegation is going to
be costly (remember that this is a very performance sensitive application).
I think this application stresses the pure functional approach in that it:
- does small computations at high frequency
- pushes a huge amount of data through at each timestep
- currently can take hours or days to run with mutation.
My worry is that without very careful design, in clojure could end up being
multiples slower ...
On Mar 8, 2010, at 10:14 AM, Stuart Sierra wrote:
> On Mar 8, 9:29 am, Stuart Halloway <[email protected]> wrote:
>> (1) You still have namespaces in Clojure, which correspond 1-1 with
>> Java packages.
>
> More or less. The namespace "foo.bar.baz" is actually a Class named
> "baz" in the package "foo.bar".
>
> -SS
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en