Does anyone have style suggestions for distinguishing the states from
the refs to mutable data?

Let's say I'm manipulating a cell in a lattice, or doing dynamic
programming, or something. In any case, I have a cell.

;; Current convention: use "cell-" as the type of the state of a
"cell".
(defstruct cell- :location :data)

(defn make-cell [location data]
  (ref (struct-map cell- :location location :data data))

(defn print-cell- [cell-state]
  (prn cell-state))

(defn print-cell [cell]
  (print-cell- @cell))

The details don't matter that much, but what would people name these
arguments? Is the "cell-" convention good? I'd use something like "cell
%" if I were in scheme, but that's not legal in Clojure. What should I
name function arguments to distinguish the ones that take the refs
from the ones that take the states?

Clearly, I can come up with something that keeps me happy, but I was
wondering if the community's evolved a standard or has an opinion.

Thanks,
Johann

-- 
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