Perl 6 - the future is here, just unevenly distributed

IRC log for #marpa, 2017-07-10

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:56 idiosyncrat joined #marpa
01:07 idiosyncrat Question:
01:07 idiosyncrat ronsavage: for you
01:07 idiosyncrat but also anyone else interested in the Marpa::R2 interface
01:08 idiosyncrat Currently the SLIF grammars have methods
01:08 idiosyncrat $g->rule_ids()
01:08 idiosyncrat $g->l0_rule_ids()
01:09 idiosyncrat $g->g1_symbol_ids()
01:09 idiosyncrat $g->l0_symbol_ids()
01:09 idiosyncrat These return the valid ids, as a list.  In terms of efficiency, this really does not scale.
01:11 idiosyncrat I'm thinking of eliminating them in favor of, for example:
01:12 idiosyncrat my $high_id = $g->highest_rule_id; for (my $id = 1; $id <= $high_id; $id++) { do_stuff($id); }
01:12 idiosyncrat Comments?
01:49 ilbot3 joined #marpa
01:49 Topic for #marpa is now Start here: http://savage.net.au/Marpa.html - Code paste/run: https://f.perlbot.pl/#marpa - Jeffrey's Marpa site: http://jeffreykegler.github.io/Marpa-web-site/ - IRC log: http://irclog.perlgeek.de/marpa/today - Youtube channel: https://www.youtube.com/channel/UCYKVfGBtfTqbs1JdYq-dc5g
02:07 ronsavage JK: Two things: (a) You could return a reference to an array, or do you wish to avoid refs?, and (b) Your idea has the advantage that the user can add code to { do_stuff($id);} to skip processing some ids, which I like the idea of.
02:09 idiosyncrat Returning the reference to the array is slightly better, but if the grammar is large (2000 symbols) it's still a bit hard on space.
02:31 idiosyncrat I could make them callbacks so that
02:32 idiosyncrat for_rule_ids(sub { ... do stuff ... })
02:36 idiosyncrat Or I could make it a Perl iterator factory: https://www.perl.com/pub/2005/06/16/iterators.html
02:58 ronsavage You could adopt code from Iterator::Simple or Array::Iterator.
03:09 idiosyncrat ronsavage: Thanks.  Good pointer.
05:24 sivoais joined #marpa
05:51 sirdancealot joined #marpa
06:40 ronsavage joined #marpa
07:45 kook joined #marpa
10:49 kook joined #marpa
19:56 ceridwen joined #marpa
23:10 ronsavage joined #marpa

| Channels | #marpa index | Today | | Search | Google Search | Plain-Text | summary