Is there a limited number of models? The model should stay decoupled from the state as they are totally distinct
so general-fn[model old-state] -> new-state then either you (if you know the model) or the user if they can choose any model should define a partial fn partial specific-model-fn general-fn[model] so that it is always clear which model is being used to idiot proof the situation, which was your worry the partial fn can then be used with all the clojure goodies such as iteration and reduction as jony hudsun has pointed out all I am adding to the debate is suggesting having a named partial fn named after the model you are using, for clarity On Sunday, September 14, 2014 3:28:10 AM UTC+1, RJ Nowling wrote: > > Hi all, > > I'm new to Clojure and implementing a Markov Model as part of a larger > project. I'd like some advice on the API for a progress-state function. > > I see two possible options. In the first option, we always ask the user > to provide and keep track of the MSM state themselves: > > (progress-state markov-model previous-state) -> new-state > > In the second approach, we create a record that combines a model and a > current state: > > (defrecord MarkovProcess [model current-state]) > > (progress-state markov-process) -> updated-markov-process, new-state > > Which of these approaches is more idiomatic for Clojure? Are multiple > return types an accepted practice in Clojure? Is there a third, better way? > > Thanks in advance! > > RJ > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.