[mercury-users] Interesting Challenge

Ralph Becket rbeck at microsoft.com
Tue Sep 19 02:29:58 AEDT 2000


If you're having a slow afternoon, you might like to look at
Chris Okasaki's breadth-first tree numbering problem, described
in "Breadth First Numbering..." at
http://www.cs.columbia.edu/~cdo/papers.html

There seem to be three main approaches; curiously, I came up 
with the one employed by the Haskell programmers, but they
were exploiting laziness.  I'd be interested to see (a) what
solutions other people come up with (without peeking first)
and (b) whether Mercury programmers also show the same bias
as the functional programmers (read the paper - it's only a
few pages long).

Ralph

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com 


begin 600 bfnum.m
M)2`M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM("4*)2!B9FYU;2YM
M"B4 at 4F%L<&@@0F5C:V5T(#QR8F5C:T!M:6-R;W-O9G0N8V]M/@HE($UO;B!3
M97`@,3@@,38Z,C$Z,3@@0E-4(#(P,#`*)2!V:6TZ('1S/30@<W<]-"!E="!T
M=STP('=M/3`@9F8]=6YI>`HE"B4 at 37D@8F5F;W)E+7)E861I;F<M0VAR:7,G
M+7-O;'5T:6]N('-O;'5T:6]N('1O('1H92!B<F5A9'1H+69I<G-T"B4@=')E
M92!N=6UB97)I;F<@<')O8FQE;2P@<&]S960@:6X at 0VAR:7, at 3VMA<V%K:2=S
M(")"<F5A9'1H($9I<G-T"B4 at 3G5M8F5R:6YG.B!,97-S;VYS(&9R;VT at 82!3
M;6%L;"!%>&5R8VES92!I;B!!;&=O<FET:&T at 1&5S:6=N(@HE("A&=6YC=&EO
M;F%L(%!E87)L*2X*)0HE("TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2T@)0H*.BT@;6]D=6QE(&)F;G5M+ at H*.BT@:6YT97)F86-E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A4*2D@/2!L:7-T*&EN="DN"@IP;'ES*%0I(#T@<&QY<U\P
M*#$L(%M472DN"@H*"CHM(&9U;F,@<&QY<U\P*&EN="P@;&ES="AT<F5E*%0I
M*2D@/2!L:7-T*&EN="DN"@IP;'ES7S`H3BP at 5',I(#T*("`@("@@:68 at 5',@
M/2!;72!T:&5N(%M="B`@("`@(&5L<V4@("`@("`@("`@("!;3B!\('!L>7-?
M,"A.("L@;&ES=%]?;&5N9W1H*%1S*2P at 8VAI;&1R96XH5',I*5T*("`@("DN
M"@HZ+2!F=6YC(&-H:6QD<F5N*&QI<W0H=')E92A4*2DI(#T@;&ES="AT<F5E
M*%0I*2X*"F-H:6QD<F5N*%1S*2`]"B`@("!L:7-T7U]F:6QT97(H"B`@("`@
M("`@:7-N="AP<F5D*&QE868Z.FEN*2!I<R!S96UI9&5T*2P*("`@("`@("!L
M:7-T7U]F;VQD;"@*("`@("`@("`@("`@*"!F=6YC*%0L($-S*2`]"B`@("`@
M("`@("`@("`@("`H(&EF(%0@/2!T<F5E*%\L3"Q2*2!T:&5N(%M,+"!2('P@
M0W-=(&5L<V4 at 6UT@*0H@("`@("`@("`@("`I+`H@("`@("`@("`@("!4<RP*
@("`@("`@("`@("`@6UT*("`@("`@("`I"B`@("`I+ at H=
`
end
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list