On Nov 17, 2008, at 14:30, Rich Hickey wrote:

> It's best to do this as generally as possible, building on something
> like this:
>
> (defn map-same [f coll]
>   (let [ret (into (empty coll) (map f coll))]
>     (if (seq? coll)
>       (reverse ret)
>       ret)))

OK, so I have as a minimal set of cases (1) seq (2) other coll and  
(3) everything else. That gives me

(defn replace-syms
    [sym-map expr]
    (cond (coll? expr) (let [replace #(replace-syms sym-map %)
                             r-expr (map replace expr)]
                          (if (seq? expr)
                             r-expr
                             (into (empty expr) r-expr)))
          (contains? sym-map expr) (get sym-map expr)
          :else expr))


This experience leaves me wondering if perhaps "seq" is the closest  
equivalent to the list concept in other Lisps. Everything that test  
positive with (seq?) seems to print like a list and behave like a  
list. But then, what would be a valid reason to use the (list?) test?

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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to