in reply to Challenge: Simple algorithm for continuing series of integers
As a purely intellectual challenge, provided that you recognise that any solution will be severally restricted in the sequences it will recognise, and will inevitably mis-categorise some high 90s percentage of the possiblities, then it is vaguely interesting.
As an expenditure of Perl6 development time, it is a complete waste.
This is because it would take an immense amount of effort (and code) to do anything more than a 'piss poor job'. And even if that effort was expended and the code incorporated, and it was possible for the computer to intuit the sequence behind (say):
my @sequence = 1, 18, 4, 13 .. *;
The human being (that mythical maintanence programmer), will unlikely be able to do the same!
And almost everyone is going to code that as:
my @sequence = 1, 18, 4, 13 .. *; ## dartboard
Which means it would be far simpler and far better to avoid the "magical" and just incorporate (or have a module that supplies), a few pre-defined sequences like:
my @odds = ODDS; ## or LAZY_ODDS or LAZY_ODDS_FROM( 11 ) my @evens = EVENS; my @board = DARTBOARD;
A simple module that supplies a bunch of these 'well named sequences' would be easy to code and infinitely extensible and keep the need for potentially buggy and always limited 'magical' code out of the core.
Building, testing and verifying a module that contained/exported the entire OEIS database manually would probably take far less time, than trying to write code to divine 1% of them. And it probably would not take a great deal of effort to write code to query the OEIS database directly, and generate the module automatically.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Challenge: Simple algorithm for continuing series of integers
by JavaFan (Canon) on Oct 19, 2008 at 21:55 UTC | |
by TimToady (Parson) on Oct 20, 2008 at 03:19 UTC | |
by BrowserUk (Patriarch) on Oct 20, 2008 at 04:06 UTC | |
|
Re^2: Challenge: Simple algorithm for continuing series of integers
by Perlbotics (Archbishop) on Oct 19, 2008 at 22:54 UTC |