Re: [perl #60364] [PATCH] pod fixes: Ldraft/pdd19_pid.pod, typos, syntax

2008-11-06 Thread Brad Bowman
again. Brad diff --git a/CREDITS b/CREDITS index eea9d13..b125ee7 100644 --- a/CREDITS +++ b/CREDITS @@ -129,6 +129,9 @@ N: Bob Wilkinson D: Numerous document typos. E: [EMAIL PROTECTED] +N: Brad Bowman +D: pod fixes + N: Brad Gilbert D: Add test for sysinfo op. E: [EMAIL PROTECTED] diff --git

Re: Signatures and matching (was Re: XPath grammars (Was: Re: globs and trees in Perl6))

2008-10-22 Thread Brad Bowman
The scrap your boilerplate scheme for generics in Haskell addresses traversals, queries, transformations, parallel zipping and the like. I've only briefly felt like I understood it, so I was going to revise before trying to adapt it to Perl 6. (Any lambdacamels out there that do understand

Re: globs and trees in Perl6

2008-10-09 Thread Brad Bowman
Tim Bunce wrote: Thinking in terms of grammars, I'd ask the question: could grammars be used to match tree-like data structures? I think the current answer is no. Grammars are too tightly bound to the concept of a position in a linear string. But I have a nagging suspicion that this is a very

S05 :exhaustive eg

2007-04-27 Thread Brad Bowman
Hi, Is the ordering of the output of this example in S05 correct? ( http://perlcabal.org/syn/S05.html#Modifiers ) $str = abracadabra; if $str ~~ m:exhaustive/ a (.*) a / { say @();# br brac bracad bracadabr c cad cadabr d dabr br } I assume that there is an ordering to

using sp space in character classes

2007-04-12 Thread Brad Bowman
Hello, In S05, sp is listed under named assertions and isn't explicitly mentioned in the section on character classes. Can sp be used in character classes, in particular to include or exclude space (U+0020)? eg. space-sp, alnum+sp Is there another way to do this, maybe [\ ] escaping?

DFA rules and p5's $/

2007-03-13 Thread Brad Bowman
Hello, Regarding this from perlvar: Remember: the value of $/ is a string, not a regex. awk has to be better for something. :-) It seems to me that the DFAable rules would intertwingle nicely as a non-backtracking stream chunker. Is the form of per-filehandle input record

Re: Smooth or Chunky?

2007-01-26 Thread Brad Bowman
Larry Wall wrote: But the point is *not* to force it one way or the other--the point is that many such functions would probably prefer not to commit one way or the other, and they can't do that if they automatically throw away the dimensional information. The dimensional information has to

DFA/NFA context is non-local

2007-01-21 Thread Brad Bowman
Hello, I'm still wrapping my head around the recent changes to rules but at the moment I feel slightly uneasy about the context dependence of DFA prefix mode. The unease hasn't resolved into an example yet, but my concern is that the interpretation and result of a pattern varies with the

Re: class interface of roles

2006-10-10 Thread Brad Bowman
TSa wrote: TSa wrote: Note that the superclass interface of roles should be mostly inferred from the usage of next METHOD. As such it is a useful guidance for error reports in the class composition process. Actually 'next METHOD' doesn't catch all superclass interface issues. There is the

Re: class interface of roles

2006-10-02 Thread Brad Bowman
Sam Vilain wrote: TSa wrote: is this subject not of interest? I just wanted to start a discussion about the class composition process and how a role designer can require the class to provide an equal method and then augment it to achieve the correct behavior. Contrast that with the need to do

Common Serialization Interface

2006-09-25 Thread Brad Bowman
Both Data::Dumper and Storable provide hooks to customize serialization ($Data::Dumper::Freezer|Toaster, STORABLE_freeze|_thaw). Other modules like YAML and Clone could also possibly reuse a common state marshalling interface. Is there some common element to this process which can be gathered

Re: clarify: how WALK arguments can be combined

2006-09-04 Thread Brad Bowman
Mark Stosberg wrote: In the Objects chapter, a WALK pseudo-class is spec'ed for using when calling sets of methods: http://feather.perl6.nl/syn/S12.html#Calling_sets_of_methods These are the arguments listed that can be used with WALK: :canonical # canonical dispatch order

Anonymous Self-referential Datastructure Literals

2006-07-11 Thread Brad Bowman
Just some random thoughts about self-referential structures and their literal representations: $ perl -MData::Dumper -e '$a=[1,\$a]; print Dumper($a)' $VAR1 = [ 1, \$VAR1 ]; $ perl -MYAML -e '$a=[1,\$a]; print Dump($a)' --- 1 - 1 - !perl/ref: =: *1 $ pugs -e 'my @a =

sprintf and snake envy

2006-07-04 Thread Brad Bowman
Hello, It seems that sprintf is will still be around in Perl 6 [1], and that sprintf formats will be available using the .as() method. While looking at some Python docs [2] I noticed two things that might be worth stealing; a sprintf operator (%) and named parameters in the format string: a =

Re: Fw: Logic Programming for Perl6 (Was Re: 3 Good Reasons... (typo alert!))

2006-05-26 Thread Brad Bowman
Hi, I used AI::Prolog once briefly, and that's the extent of my logic programming knowledge. There do seem to be a few Perl 6 features that may be useful for logic programming, although I'm not really qualified to judge. How would one assert facts and rules in Perl6? How would one know that

S06 Splicing clarification

2006-03-10 Thread Brad Bowman
S06/Splicing finishes with: A quasiquote is not a block (even if the delimiters are curlies), so any declaration of a variable is taken to be part of the block surrounding the macro call location. Add your own {...} if you want a block to surround your declarations. I read this as meaning

Re: Selective String Interpolation

2006-02-19 Thread Brad Bowman
On 19/02/06 03:48, Jonathan Lang wrote: I don't see why you'd need a universal anti-backwhack, any more than you need universal quote delimiters. Here-docs are usually safe to quote any amount of line noise, but I take your point. I could see

Re: Selective String Interpolation

2006-02-18 Thread Brad Bowman
On 18/02/06 07:49, Damian Conway wrote: There is already a mechanism for this. You simply turn off all variable interpolation, and interpolate any the variables you wish to interpolate via block interpolations. Or, more simply, only turn on block interpolation in a non-interpolating string:

Re: Selective String Interpolation

2006-02-18 Thread Brad Bowman
On 18/02/06 12:23, Jonathan Lang wrote: Piers Cawley wrote: And backwhacking braces in generated code is *not* a pretty solution to my eyes. I'd *like* to be able to have a quasiquoting environment along the lines of lisp's backquote (though I'm not sure about the unquoting syntax): Let me

Re: CODE {...} mentioning variables without interpolation

2006-02-18 Thread Brad Bowman
On 18/02/06 03:10, Larry Wall wrote: On Sat, Feb 18, 2006 at 01:57:18AM +0200, Brad Bowman wrote: : $a is spliced into the say as either a string or AST, not : as a runtime use of $a. If the snippet was: : : $a = '$a'; : return CODE { say $a }; : : Then we'd (eventually) get a non-splicing

Selective String Interpolation

2006-02-17 Thread Brad Bowman
Hello, When building code strings in Perl 5 I usually write the code, then wrap it in double quotes, then \ escape everything light blue under syntax highlighting. I was wondering if there'll a better way in Perl 6. I thought it would be nice to define the variables you wish to interpolate

CODE {...} mentioning variables without interpolation

2006-02-17 Thread Brad Bowman
Hi again, LS06/Macros Is it possible to refer to a variable in a CODE quotation without splicing it in as an AST or string? I can't see how this is be possible under S06, unless using OUTER:: is intended to be a non-splicing variable mention. The sample snippet in S06 seems simple but got

Re: Pattern matching on arrays and for loops

2006-01-14 Thread Brad Bowman
On 14/01/06 00:59, Larry Wall wrote: That doesn't seem sufficiently general. I'd rather see some context that can apply a signature to the head of a list and treat the unslurped part as unmatched. Maybe a for loop could be taught to supply such a context, or a when. Or maybe it's just the

Re: Pattern matching and for loops

2006-01-13 Thread Brad Bowman
On 13/01/06 20:36, Dave Whipp wrote: Is there some way to associate alternate codeblocks for different patterns (i.e. local anonymous MMD)? Is it possible to have an anonymous multi sub? This would seem to require new syntax for combining two anonymous definitions. Of course we want

Re: Iterating over complex structures

2005-12-23 Thread Brad Bowman
But in Perl 5 to navigate complex structures one needs ad-hoc solutions. I wonder if something is planned in Perl 6 as a means to do that through a syntactically convenient construct with ad-hoc-isms pluggable in in the form of suitable hooks (e.g. .on_node( { code; ... } ), etc.) that would

Re: Iterating over complex structures

2005-12-23 Thread Brad Bowman
Well, @Larry has been researching attribute grammars for a month or two now, which are an efficient (programmer-wise, not necessarily processor-wise) method for specifying computations over trees. The only syntax we've seen is that of Language::AttributeGrammar and TGE, whose roots come from

Re: Transliteration preferring longest match

2005-12-16 Thread Brad Bowman
On 15/12/05 23:35, Larry Wall wrote: On Thu, Dec 15, 2005 at 06:50:19PM +0100, Brad Bowman wrote: : The first in order rule is more flexible, the user can sort their : arrays to produce the longest input rule, or use another order if that is : preferred. What possible use is a user-ordered rule

Re: Transliteration preferring longest match

2005-12-16 Thread Brad Bowman
This is only about transliteration (tr///), not rules in general. So you are only matching a fixing set of strings at a certain position. If one string is the prefix of another, the longer is preferred. If there are two identical match strings, the replacement corresponding to the first is used.

Transliteration preferring longest match

2005-12-15 Thread Brad Bowman
Hi, S05 describes an array version of trans for transliteration: ( http://dev.perl.org/perl6/doc/design/syn/S05.html#Transliteration ) The array version can map one-or-more characters to one-or-more characters: $str.=trans( [' ', '','',''] =

Re: Clarification for External Regex Variables?

2005-12-09 Thread Brad Bowman
On 08/12/05 17:12, Larry Wall wrote: On Thu, Dec 08, 2005 at 11:14:16PM +0100, Brad Bowman wrote: : it may be acceptable with a my in the regex or limiting the : additions to declaring scope. I've gone around about that in my head lots of time, but there isn't a good way to sneak a my

Clarification for External Regex Variables?

2005-12-08 Thread Brad Bowman
Hello, I'd like to get clarification on the scoping of variables bound in a regex. It's described in S05 as follows: External aliasing * Instead of using internal aliases like: m/ mv @files:=ident+ $dir:=ident / the name of an ordinary variable can be used as an external

Matching a literal # in a rule

2005-12-02 Thread Brad Bowman
Hello, How can you match a literal # in a rule? \# or only \x{23}? S05 seems clear # now always introduces a comment, and \# is not listed in the escapes. But then Perl 5 has \# so I assume it's just an omission... Brad -- A person who knows but a little will put on and air of knowledge.

Re: Elimination of Item|Pair and Any|Junction

2005-08-01 Thread Brad Bowman
FWIW, I've been reading up on Scala's formulation of trait/class/delegation hierarchy, and I feel a bit like flipping through a puzzle book to look at the hints, if not answers. :-) http://scala.epfl.ch/docu/files/api/index.html I misread mutable as mumble and thought they'd been

Re: Complete type inferencing

2005-08-01 Thread Brad Bowman
1. Asserted The usual case for Perl 6 functions, due to its default Item signature for parameters. In the example below, I assume that ::* cannot be changed freely to do away with ::*IO at runtime. (If it could, then assertions won't be of much use in general.)

Quasiquoting

2005-06-27 Thread Brad Bowman
Hi Autrijus' journal mentions quasiquoting (Perl 5). I was wondering how that would work. Many languages use unusual syntax for quasiquoting and code splicing but Perl 6 is already nibbling into unicode. Does that mean macros will be grafting and pruning the AST that comes back from a

Re: reduce metaoperator on an empty list

2005-05-18 Thread Brad Bowman
Another alternative is to give the user the option of specifying such a unit when using the reduction meta-operator, but this seems to work against the whole point of [+] (which is brevity). If you want to specify your own unit, use 'reduce'. Can't the appropriate identity just be prepended?

Re: ./method

2005-05-15 Thread Brad Bowman
: ../method : : to mean $?SELF.SUPER::method, or however that's normally written. That's almost terminally cute, but I like it. Unless someone can think of a major objection (such as that it makes it too easy to use SUPER semantics rather than NEXT semantics), let's go with it.

Re: receivers of pipes (the sharp end again)

2005-05-08 Thread Brad Bowman
I guess the real question is whether == my $x is really assigning a list or binding an iterator to a Lazy slot somewhere. It feels like the latter is more useful. Which means that == @x can return as soon as it binds the iterator to @x.specs. It doesn't have to wait for all the values to

Re: The pipe's sharp end

2005-05-07 Thread Brad Bowman
What if you give it a 1-ary sub that you thought was slurpy, and in fact does something different (hmm, that doesn't seem very likely). How do we handle options and the like? .assuming ? Although map would be simpler, clearer and more flexible. Still, semantics like that are dwimmery, and

The pipe's sharp end

2005-05-06 Thread Brad Bowman
Hi, $*IN == process() == print; This A06 example got me thinking. Could non-variadic subrountines in a pipeline be useful? A single arg sub or block could be a map without the map: $*IN == process == print; # print map { process($_) } $*IN (1..6) == { $_++ } == say; A two param sub

Re: for all(@foo) {...}

2005-04-24 Thread Brad Bowman
No, S03 is probably just wrong there. Junctions are scalar values, and don't flatten in list context. Maybe we need something like: for =all(@foo) {...} to iterate the junction. for all(1,2,3).values { say $_; } reads nicely and works in pugs. Also, flattening may get messy

Lazy Lists + Mutable Arrays + Garbage Collection

2005-04-24 Thread Brad Bowman
Hi, I've been wondering how to lazy lists will work. The answer Correctly, don't worry about it, is entirely acceptable... The intent of this example in S06 seems clear, make @oddsquares a lazily filled array of squares of odd @nums: S06/Pipe operators It [==] binds the (potentially lazy)

Re: Lazy Lists + Mutable Arrays + Garbage Collection

2005-04-24 Thread Brad Bowman
With cons based lists, past stream values are no longer referred to so can be reclaimed, but we have random access arrays. That's about where my wondering stopped. It started again. @primesquares.shift would do it Brad

for all(@foo) {...}

2005-04-23 Thread Brad Bowman
Hi, I'm trying to understand the following section in S03: S03/Junctive operators Junctions are specifically unordered. So if you say for all(@foo) {...} it indicates to the compiler that there is no coupling between loop iterations and they can be run in any order or even in

Calling junctions of closures

2005-04-20 Thread Brad Bowman
Hi, Assuming this is allowed, what will the .() calls below return? Does the result depend on the calling context? use junctions; # still required? my @subs = ( sub { return 1 } , sub { return 2 } ); # call the closures in the junction any(@subs).(); all(@subs).();

Re: Calling junctions of closures

2005-04-20 Thread Brad Bowman
Once more, with less room to wriggle... I'd guess the rule is call 'em all and return a similarly structured junction. How far off the mark am I? Unless you ask a question nothing is called. Boolean context is clear, how about scalar: my $a = rand(); # runtime variable my $result

S03 Precedence for junctions

2005-04-17 Thread Brad Bowman
Hi all, S03 gives infix + a higher precedence than junctive operators in the listed table, but that seems to contradict the examples under Junctive operators. The relevant parts of S03 are: Junctive operators 1|2|3 + 4; # 5|6|7 1|2 + 34; # (4|5) (5|6)