defadt defines an algebraic data type - so, imagine a record with a finite number of implementations (Boolean is an algebraic data type since it only has "true" and "false", for example. Chess pieces would be another one.)

Once you define an ADT you can use that contrib library's "match" macro to do exhaustive case matches. Without the defadt thing, you just have to trust that the user knows how to handle all of your cases.

Sean Corfield <mailto:s...@corfield.org>
March 28, 2014 9:05 PM

That's very out of date documentation. The current documentation is here:

http://clojure.github.io/

The old monolithic clojure-contrib library hasn't been maintained for a very long time.

Some parts of that library were migrated to the new modular contrib libraries. You can read more about that here:

http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go

The old clojure.contrib.types library was not one of those so it's essentially "gone" now. That usually means there are better ways to do what the old library did - or that the old library was never really a good way to do things in the first place. I've no idea what defadt was meant to do, I'm afraid.

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



Christopher Howard <mailto:cmhowa...@alaska.edu>
March 28, 2014 8:40 PM
Hi. --Insert here the usual caveats about being new to Clojure and
Java.--

I wanted to try out this Contrib function describe on this
page
<http://richhickey.github.io/clojure-contrib/types-api.html#clojure.contrib.types/defadt>. How
do I get that in my project? Trying to follow documentation, I did
"lein search":

code:
--------
my-host:~/my-project$ lein search contrib
Warning: couldn't download index for http://repo1.maven.org/maven2
== Results from clojars - Showing page 1 / 1 total
[webnf.deps/contrib "0.0.1"] The uber dependency to get a full set of popular
dependencies. For development or when you have room in your .m2 repo.

my-host:~/my-project$ lein search clojure.contrib.types
Warning: couldn't download index for http://repo1.maven.org/maven2
my-host:~/my-project$ lein search defadt
Warning: couldn't download index for http://repo1.maven.org/maven2
--------

Is that "webnf" package the thing I am supposed to put in my
"dependencies" list? Version 0.0.1 doesn't sound right. Or am I
supposed to download something myself and throw it in my lib
directory?


--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com <http://www.paddleguru.com/>
Twitter <http://twitter.com/paddleguru>// Facebook <http://facebook.com/paddleguru>

--
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.

<<inline: postbox-contact.jpg>>

<<inline: compose-unknown-contact.jpg>>

Reply via email to