First, I have a suggestion for your associative: make `seq' return (map vector (iterate inc' 0) (constantly the-const-value)). This would be a correct result, as far as it's possible to observe.
On Fri, 2013-01-18 at 16:16 -0800, Ben Wolfson wrote: > Right: I basically want (constantly 'foo), but supporting the map > interface. Or, rather, a subset of the map interface as it's currently > defined: it seems odd to me that being able to answer the question "do > I contain x?" implies "I can enumerate my contents". It may seem less odd if, instead of "I can enumerate my contents", you take the implication as "I can transform my domain forwards". In ordinary functions, the domain can be transformed, but the transformer function can't go olddomain -> newdomain; it has to go newdomain -> olddomain. (This also applies to those functions that can, given a value, report whether that value is defined for the domain, because such functions simply have a total codomain of a particular shape.) Associatives are related to functions in that converting an associative to a function is an injection, and both have domains and codomains. But the way you transform the domain of an associative is backwards from how you must for functions: the transformer function goes olddomain -> newdomain. Why does this imply enumeration? You can't use the transformer function on lookups; the lookup keys are in newdomain already. So you must have applied that transformer to a data representation of the domain first, so that you have a newdomain search space for the key you're looking up. You must be able to produce the entire search space during a domain transform, which implies an enumeration. Once you're enumerating the domain, you can just apply the associative to produce the codomain, and thus, "enumerate the contents." The only way you can apply both transformations is if your domain is vacuous: that is, constant functions like yours are the only ones that permit domain transform in either direction. -- Stephen Compall ^aCollection allSatisfy: [:each|aCondition]: less is better -- 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