Documenting clojure data structures

2012-10-31 Thread Jason Bennett
Over the last month, I've been learning clojure for my new job, and taking Odersky's scala course on coursera. I've been enjoying my time with clojure much more, but the one thing I miss from scala is the ability to document a data structure. It's really nice in Java/Scala to type in an object

Re: Documenting clojure data structures

2012-10-31 Thread gaz jones
you could try using contracts to specify what keys are supposed to be in the map, or just use pre/post conditions built in to clojure? https://github.com/fogus/trammel On Wed, Oct 31, 2012 at 1:01 PM, Jason Bennett jaso...@gmail.com wrote: Over the last month, I've been learning clojure for my

Re: Documenting clojure data structures

2012-10-31 Thread Ben Mabey
On 10/31/12 12:04 PM, gaz jones wrote: you could try using contracts to specify what keys are supposed to be in the map, or just use pre/post conditions built in to clojure? https://github.com/fogus/trammel FYI, it looks like trammel's ideas are being moved over to

Re: Documenting clojure data structures

2012-10-31 Thread Paul deGrandis
If your concern is passing around associative data, contracts and general membership functions are the two most common approaches. If you're dealing with some unknown thing, you can see what protocols it satisfies and what functions/operations those protocols specify. Doc strings should be

Re: Documenting clojure data structures

2012-10-31 Thread Ben Mabey
On 10/31/12 2:15 PM, Paul deGrandis wrote: If your concern is passing around associative data, contracts and general membership functions are the two most common approaches. If you're dealing with some unknown thing, you can see what protocols it satisfies and what functions/operations those

Re: Documenting clojure data structures

2012-10-31 Thread Paul deGrandis
This sounds like a fantastic approach. Do you have any of your thoughts of how the spec would look like publicly available? (or maybe a github project) It's not in the public currently but I'm hoping to have something together for consumption by Conj (Nov 14th). At this time, the

Re: Documenting clojure data structures

2012-10-31 Thread Zack Maril
Not sure this is exactly what you are looking for, but clojure.reflect has been helping me a ton lately. I've written a few wrappers around it that I've found quite useful: https://gist.github.com/3990888 Hope this helps! -Zack On Wednesday, October 31, 2012 2:26:38 PM UTC-7, Paul deGrandis