RosettaCodeData/Task/Hailstone-sequence/Ursala/hailstone-sequence.ursala

13 lines
286 B
Text
Raw Permalink Normal View History

2013-04-10 22:43:41 -07:00
#import std
#import nat
hail = @iNC ~&h~=1->x ^C\~& @h ~&h?\~&t successor+ sum@iNiCX
#show+
main =
<
^T(@ixX take/$4; %nLP~~lrxPX; ^|TL/~& :/'...',' has length '--@h+ %nP+ length) hail 27,
^|TL(~&,:/' has sequence length ') %nP~~ nleq$^&r ^(~&,length+ hail)* nrange/1 100000>