[Jprogramming] Picking lottery tickets
david alis
david.alis at gmail.com
Sun Aug 2 14:28:05 HKT 2009
> Roger Hui: Sun Aug 2 12:20:10 HKT 2009
> John, how can it be random when the first
> five numbers are always in order? ;-)
The MegaMillions 1-56 numbers are random but
displayed in ascending order because it simplifies checking.
pick2=: 1 + ([:/:~ 56 ?~ 5:) , (46 ?~ 1:)
As a follow on to Neville's postings. These tacit solutions
are as good as they get when it comes to demonstrating
what an executable notation is all about.
I wonder what led John to think of his solution
because it is curiously out of character for someone
who's been using J for such a long time.
That said, his solution does demonstrate another
aspect of tacit programming - namely, that it facilitates program analysis.
Another way to put this is that because the tacit solution has a clear
structure it is easy to refine it.
More information about the Programming
mailing list