Clojure-Intro-Course / clojure-intro-class

NOTE: This repository is obsolete. Was: A pilot project to use Clojure for introductory computer science courses at the University of Minnesota - Morris
20 stars 3 forks source link

can check-if-transducer? exist? #81

Closed leek5pin closed 8 years ago

leek5pin commented 9 years ago

so far, I created preconditions for transduce, and added a precondition for into, to fix an arity problem. Currently I am using check-if-function? in the preconditions where I would like to be using check-if-transducer?.

elenam commented 9 years ago

I don't think transducers implement any special interface or extend any common class. I looked at all superclasses/interfaces of 'into' (which you can do using (supers (class into))), and didn't find anything that makes it a transducer. Your best bet is to just make a list (although one may define their own transducer, I suppose). Note that a class of clojure.core 'into' is clojure.core$into (not sure if you want to list our functions which are corefns.corefns$into or the standard one.

If you are writing a function that checks the list, please mark it here, but don't close the issue.

Thanks!

elenam commented 9 years ago

Ok, I see what you are saying: not a function that takes a transducer, but a function that is a transducer. I don't know if there is a list of those or an interface. Try playing with class/supers of a known one.