I wish to create an abstraction which represents a database table, but which can be accessed using all the usual Clojure seq and conj and all that fancy stuff. Is there a protocol I need to add?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes. The protocol is defined by the Java interface
clojure.lang.ISeq. You may want to extendclojure.lang.ASeqwhich provides an abstract implementation of it.Here is an example: a
seqabstraction of a resource which is closable and is closed automatically when theseqends. (Not rigorously tested)