Hi,

Its been 19 years since I last wrote anything serious in lisp (and
that was Scheme).  In the intervening time I've mostly used OO
languages, for lack of more practical functional ones.   There are now
a number of functional or hybrid functional languages available which
have become practical.   I am now trying to decide which language to
use.

Having been in the OO space for a long time I find struggling to
determine how to think about the following in regards to clojure:

Organization of large projects
--
I have 1/2 million lines of my own code. I'm sure a lot of this
compresses to something smaller in clojure.   This is manageable for
me in the OO setting because functions (methods) are bound to their
data (object) and in their own namespaces (classes).

I am aware of clojure multimethods, but still seems to me that I would
end up having a near flat space of thousands of functions.  This would
be hard to track and grok over time.

I see multimethods working very well for data structures, but not
offering much for distinct concepts.

Dealing with State
--
What follows is very domain specific.  I have a trading strategy which
takes a vector of market data as the market ticks.   In the OO
composition, the strategy has a large amount of state and the state
will differ from one strategy to the next.   For instance I would
have:

- some window of prior tick history or returns (a rolling matrix)
- positions
- performance tracking
- various matrices used in online statistical analysis (specific to
strategy)
- instances of other classes used in the analysis (specific to
strategy)
- finite state machine(s) to manage execution and other behavior

I can also have strategies that contain sub-strategies.    A high-
level OO interface would look something like:

- method: tick (time, market-vector)
- method: ...
- property: positions (an object with various atributes and
collections)
- property: performance (an object with various attributes)
- property: ...

it sounds like the approach in Clojure would be to have a single large
data structure composed of the common stuff and the specific stuff
that gets passed around to functions.   Of course this is exactly what
happens in the OO world, except that the "class" framework allows one
to simplify the presentation (implementation) of this binding of
state.

Now I suppose the structure / obj equiv can be described as a function
with a let binding and a series of functions accessible through some
means that work on the closure.

As is current, the state of this strategy mutates with each tick.   I
can see theoretically that could be done immutably, seeing each tick
creating a partially modified new strategy state, in effect a
versioning trail of prior strategy states.   I'm not sure whether I
would need to bend over backwards to affect this though.

Conclusion
--
Wondering whether anyone has done something very complex in the algo
space or comparable so can get an idea of how this sort of stuff is
structured idiomatically.   I will also be concerned with performance
and memory use, as one of my strategies creates a few thousand sub-
strategies and/or also uses massive matrices that get updates from
tick to tick.

Thoughts?

Thanks

Jonathan

-- 
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 moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to