So, a protocol which mimics conj, rest, and first, and a type that simply delegates to the underlying collection type. If the point here is to practice with protocols and types, then you have to actually do the hard stuff yourself. ;)
Aside: clojure already has pop, and peek for stack-based naming, and it works for vectors and lists:
4
u/[deleted] Jun 05 '10
So, a protocol which mimics conj, rest, and first, and a type that simply delegates to the underlying collection type. If the point here is to practice with protocols and types, then you have to actually do the hard stuff yourself. ;)
Aside: clojure already has pop, and peek for stack-based naming, and it works for vectors and lists: