caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] equi-recursive Fold isomorphism
@ 2002-07-27 17:32 John Max Skaller
  2002-07-27 19:43 ` Alain Frisch
  0 siblings, 1 reply; 7+ messages in thread
From: John Max Skaller @ 2002-07-27 17:32 UTC (permalink / raw)
  To: caml-list

Given a recursive type

    Fix 'a .  T  (where 'a occurs in T)

we can unfold the type to T' = T['a -> Fix 'a.T],
we define unfold t = t, if t doesn't start with a fixpoint operator.

Any ideas how to best implement fold, the inverse isomorphism?

Brute force method: examine every subterm, and compare with
the main term using equi-recusive comparison .. this seems quadratic
in the number of nodes .. smarter method: only compare arguments
of fixpoint binders .. can we do any better? For example,
replace the subterm in the main term with a fixpoint variable, and compare
the subterm with the modified main term (directly, ie. using ocaml 
'compare')
[I don't know how to do this 'replacement' efficiently though]

-- 
John Max Skaller, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-08-03 17:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-27 17:32 [Caml-list] equi-recursive Fold isomorphism John Max Skaller
2002-07-27 19:43 ` Alain Frisch
2002-07-28  1:45   ` John Max Skaller
2002-07-28 20:14     ` Alain Frisch
2002-08-01 14:49   ` [Caml-list] Question about distribution John Max Skaller
2002-08-01 15:48     ` Xavier Leroy
2002-08-03 17:34     ` Daniel de Rauglaudre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).