Am 29.01.2017 um 21:15 schrieb Michael Lindon: > Not quite what I'm looking for. There is an assigment in the Functional > Programming in Scala coursera course called "funsets" - purely > functional sets. A set is defined by its characteristic functions (a > predicate) and source code can be found here > > https://mwclearning.com/sourcecode/scala/funsets/src/main/scala/funsets/FunSets.scala > > this is the sort of thing I am looking for.
What do you expect exactly from such an implementation? The definition by the characteristic function might make elements of a set in theory computably enumerable, but it is not practical to get a materialized view. You can only query membership. Maybe if you can create a persistent datastructure over characteristic functions you can actually compose such a datastructure, but in fact you just compose predicates (as is also done in FunSets.scala) and reify them as a type there. If you just want such an implementation to fulfill part of Clojure's contracts for sets, you would implement the corresponding interface: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IPersistentSet.java But you would have to throw on some of these methods and I am not sure what the benefits are. You can always create new interfaces (protocols) ofc. Do you have a concrete problem in mind? Best, Christian -- 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.
signature.asc
Description: OpenPGP digital signature