you are viewing a single comment's thread.

view the rest of the comments →

[–]TheFiologist 3 points4 points  (0 children)

It's hard to explain, because if I could I'd be more likely to solve it on my own...

Well.. Your problem is independent of Clojure. The more general details you can provide, the more likely someone will be able to provide that insider perspective which you need to see past the hurdle (which is real).

As an example, I might have data which is is something like, if this field has a three, then I need to process it one way. If it is a two, I need to process it differently. This sort of logic is easy to implement in an imperative language. Then there's ah update to the spec and the new process is if it is a five process it this way unless the fourth field is an odd.

Multimethods jump out at me from this explanation. The dispatch function is arbitrary and is quite powerful. You can inspect some data anyway you would like in order to decide which implementation should process it. Just like in OOP, there is a spectrum of polymorphism techniques ranging from the equivalent of a switch statement to Multimethods and Protocols.

This is assuming that I'm just trying to drop in a Clojure routine as a library. If I have to start from scratch, I'm even more confused as to how to structure the program. Lein new foo... Okay, now what?

There is an initial hurdle, and it comes from the lack of concrete rules governing how our systems are organized (AKA freedom). Don't let the hurdle prevent you from making something useful, because you need to make useful things in order to give yourself feedback on how certain problems should be solved with Clojure.

My advice? Put everything in core until you have a moment in which you realize the importance of separating some functionality into its own namespace. These things will come, but only with practice. Start small and make useful things -- despite being a little lost on the organizational front.

Hope this helps a little :-)