On 26.05.2009, at 03:17, Andrew Wagner wrote: > Seems straightforward enough. My difficulty though comes in trying > to figure out how to write the winboard bit. I know how to do the > IO stuff, that's pretty trivial. But, let's say I'm ready to ask > the engine what move to make in a particular position. The engine > itself should provide a function that takes a position and returns > a move. But...and this is where my old OO mindset is probably > kicking in...there's no way to do something like engine.getMove > (position), and it does have "its own" functions. > > There is only one way I can think of: engine is itself a function. > When run, it returns a map. One key in the map is, e.g., :get-move. > The value at that key is the desired function. But...this seems > rather hackish. I'm sure there's some obvious clojure-ish/lisp-ish > way of doing this, and it's just not coming to me. Any suggestions?
What else do you want your engine to do? If its only task is to return a move for a given position, then just make it a function of position: (defn engine [position] ...) Konrad. --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---