[Haskell-beginners] Tying the knot

Alex Rozenshteyn rpglover64 at gmail.com
Wed Dec 29 07:52:18 CET 2010


I'm trying to understand the technique referred to as "tying the knot", but
documentation on the internet seems to be much sparser and more obtuse than
I like.

So I'm asking here.

As far as I understand, "tying the knot" refers to a way of using laziness
to implement something like references in a purely functional way.

I'm trying to write a toy simulation:
I have a population :: [Person]
I want to collect a random subset of possible pairs of distinct people.
So I go to each person in the population and select a subset of the people
after him/her in the list; these are pairs in which s/he is the first
element.

I want to then be able to ask for all pairs in which a person is the first
or the second element.  I could give each person a unique id, but it seems
like tying the knot is a valid way to implement this.

Please correct me if I am misunderstanding.

Thank you.

-- 
          Alex R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20101229/2951ef2a/attachment.htm>


More information about the Beginners mailing list