Talk:Algebraic data types: Difference between revisions

I don't get it.
(I don't get it.)
Line 13:
 
There's also unification - when a variable name appears multiple times in a pattern, it must stand in for the (fsvo) same data in all cases. But pattern-matching is most commonly used in conjunction with languages with Hindley-Milner type checkers and should be understood in terms of these implementations. foobie-bletch 18:02, 6 August 2009 (UTC)
----
I don't understand the essence of the task.
 
<lang J>NB. comparisons of arbitrary data types in j
compare=: <:@:(-: + +:@:A.@:/:@:,:&:<)
assert _1 -: 0 compare 1 NB. less than
assert 0 -: compare~'abc' NB. equal
assert 1 -:'0'compare 0 NB. consistent order of
assert _1 -: 0 compare'0' NB. dissimilar data types
assert 1 -:'a'compare'@' NB. greater than
</lang>
 
If I were to implement red-black tree I'd hash to compare integers, and the result would be to provide associative array functionality. Does this prove algebraic data type? I suppose. Data can be recovered via j verbs.
--LambertDW 20:47, 27 February 2012 (UTC)
Anonymous user