Re: series operator issues

2010-07-31 Thread David Green
On 2010-07-23, at 4:25 am, Moritz Lenz wrote: I'm still not convinced. [that there should be a special index variable] Yes, it would be convient, but I've yet to see a non-contrived example where it's actually necessary, and which can't be implemented trivially with other Perl 6 tools. I

Re: series operator issues

2010-07-23 Thread Mark J. Reed
If we expected Perl6 to be able to recognize these series and continue them based on nothing but the first few elements, that would be a dwimmy OEIS. (And an OEIS module that did that by consulting the real OEIS would be cool, outside of core.) But that's not what this is about. This is just

Re: series operator issues

2010-07-23 Thread Moritz Lenz
Am 23.07.2010 00:29, schrieb Damian Conway: However, those *are* clunky and nigh unreadable, so I certainly wouldn't object to having the index of the next generated element readily available as an explicit variable in a series' generator block. That would make all manner of evil both easier

Re: series operator issues

2010-07-22 Thread Moritz Lenz
Hi, Am 22.07.2010 17:18, schrieb Jon Lang: When I last reviewed the writeup for the series operators, I noticed two issues: First, why is the RHS argument a list? You only ever use the first element of it; so why don't you just reference a single value? The idea is that you can continue

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 11:41 AM, Moritz Lenz mor...@faui2k3.org wrote: The difficulty you're running into is that you're trying to use the wrong tool for the job. Just don't use the series operator when it's not easy to use. Perl 6 has other mechanism too, which are better suited for these

Re: series operator issues

2010-07-22 Thread Jon Lang
On Thu, Jul 22, 2010 at 9:25 AM, Aaron Sherman a...@ajs.com wrote: On Thu, Jul 22, 2010 at 11:41 AM, Moritz Lenz mor...@faui2k3.org wrote: The difficulty you're running into is that you're trying to use the wrong tool for the job. Just don't use the series operator when it's not easy to use.

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 1:13 PM, Jon Lang datawea...@gmail.com wrote: I also think it's doable without a special tool: 0, { state $i = 1; $^a + $i++ } ... * Kludgey; but possibly doable. Well, it's kind of what state is there for. But what I'd really like to see would be for the

Re: series operator issues

2010-07-22 Thread Jon Lang
On Thu, Jul 22, 2010 at 11:35 AM, Aaron Sherman a...@ajs.com wrote: On Thu, Jul 22, 2010 at 1:13 PM, Jon Lang datawea...@gmail.com wrote:  Yes, it would be a special tool; but it would be much more in keeping with the keep simple things easy philosophy that Perl 6 tends to promote:    0, {

Re: series operator issues

2010-07-22 Thread Aaron Sherman
On Thu, Jul 22, 2010 at 4:52 PM, Jon Lang datawea...@gmail.com wrote: I do have to admit that that's awfully clean-looking, but the implementation would force a closure in a series to behave differently from a closure anywhere else. How so? Unlike some of you, I haven't managed to

Re: series operator issues

2010-07-22 Thread Damian Conway
On 23 July 2010 01:41, Moritz Lenz mor...@faui2k3.org wrote: Use the right tool for the right job:    square numbers: 0, 1, 4, 9, 16, 25, 36, etc. (1..10).map(* ** 2) Or even just: (1..10) »**» 2 Note that you can also get most of the effects you want by using @_ in the series'

Re: series operator issues

2010-07-22 Thread Brandon S Allbery KF8NH
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 7/22/10 11:18 , Jon Lang wrote: Second, I'm trying to think of a simple and intuitive way to write up a series expression for: triangle numbers: 0, 1, 3, 6, 10, 15, 21, etc. square numbers: 0, 1, 4, 9, 16, 25, 36, etc. factorials: