caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* recursion/iterator question
@ 2006-04-16 21:11 Tato Thetza
  2006-04-16 22:00 ` [Caml-list] " David Powers
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Tato Thetza @ 2006-04-16 21:11 UTC (permalink / raw)
  To: caml-list

Hi caml-list
Given a list, I would like to iterate over all triplets in the list. For
example, in mathematcs, its not uncommon to have expressions such as
"for all i,j,k in set X, do f(i,j,k)"

The only way I can think of is to create a list with all triplets of the
list, so:
  triplets([1,2,3,4]) = [(1,2,3),(1,2,4),(1,3,4),(2,3,4)]
and take this list and map a function f to it.

questions: 
1) what would be the best way to write triplets?
2) is there a cleaner way to iterate over all triplets in a list?

please excuse my english
Tato T.


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

end of thread, other threads:[~2006-04-20 11:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-16 21:11 recursion/iterator question Tato Thetza
2006-04-16 22:00 ` [Caml-list] " David Powers
2006-04-16 22:27 ` Martin Jambon
2006-04-17  0:06 ` Jon Harrop
2006-04-17  9:36   ` Christian Stork
2006-04-17 17:07     ` Jon Harrop
2006-04-18  3:25       ` Jonathan Roewen
2006-04-18  8:58       ` Christian Stork
2006-04-18 16:15         ` Christian Stork
2006-04-20 11:53     ` Damien Doligez
2006-04-17  6:50 ` Li-Thiao-Té Sébastien
2006-04-17 11:26   ` Nils Gesbert
2006-04-17 13:09 ` Xavier Leroy

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