Re: Temporal revisited

2009-02-20 Thread Dave Rolsky
On Fri, 20 Feb 2009, Dave Whipp wrote: I'm getting a bit lost following precisely what's being proposed. What I'm sort of feeling is that there are two fundamental immutable types needed: Instants and Durations: multi sub infix:<-> (Instant, Instant --> Du

Re: Temporal revisited

2009-02-20 Thread Dave Rolsky
s, this is completely broken. Of course, if you're dealing with TAI only, you're safe for constants up to ONE_WEEK. -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */

Re: Temporal revisited

2009-02-20 Thread Dave Rolsky
always to be written to say 30, 60 or 90 days not 1, 2 or 3 months from now. It is ill-defined, but a good API can make something reasonable out of it. I refer you to DateTime and DateTime::Duration, which provide a reasonable AP

Re: Range and continuous intervals

2009-02-28 Thread Dave Whipp
Jon Lang wrote: Keys, OTOH, don't have any such requirement; so continuous keys may very well be doable. If they _are_ doable, you have to ask questions such as "how do I assign values to a continuous interval of keys?" To truly be robust, we ought also answer this question in terms of multidi

Statement modifiers as list comprehension operators

2009-03-02 Thread Dave Whipp
S04 mentions that statement modifiers behave as for perl5 (excpet that you can have both an conditional modifier and a looping modifier on a single statement. Both then it gives this example, with be modifiers being operators within an expression, not as modifiers of a statement. line 260:

Re: Recursive Runtime Role Reapplication Really Rebounds

2009-03-12 Thread Dave Whipp
Larry Wall wrote: Note however that coercions require parens these days, since types parse as values, not as routine names. $x = Role::Serializable::XML($resultset); $y = Role::Serializable::YAML($resultset); Should "indirect object" syntax work in this context?: $a = Foo: $value;

Re: On Junctions

2009-03-27 Thread Dave Whipp
Richard Hainsworth wrote: The following arose out of a discussion on #perl6. Junctions are new and different from anything I have encountered, but I cant get rid of the feeling that there needs to be some more flexibility in their use to make them a common programming tool. I strongly agree w

Re: On Junctions

2009-03-27 Thread Dave Whipp
[I’d been planning to put this suggestion on hold until the spec is sufficiently complete for me to attempt to implement it as a module. But people are discussing this again, so maybe it's not just me. I apologize if I appear to be beating a dead horse...] Jon Lang wrote: Maybe you could hav

Re: simultaneous conditions in junctions

2009-04-01 Thread Dave Whipp
Richard Hainsworth wrote: Thinking about Jon Lang's -1|+1 example in another way, I wondered about simultaneous conditions. Consider $x = any (1,2,5,6) How do we compose a conditional that asks if any of this set of eigenstates are simultaneously both > 2 and < 5? Clearly the desired answer

Re: junctions and conditionals

2009-04-01 Thread Dave Whipp
Jon Lang wrote: [proposal that conditional statements should collapse junctions] $x = +1 | -1; if $x > 0 { say "$x is positive." } else { say "$x is negative." } I suspect that both codeblocks would be executed; but within the first block, $x == +1, and within the second codeblock,

Re: junctions and conditionals

2009-04-01 Thread Dave Whipp
Mark J. Reed wrote: [I] wrote: So I'd vote for going with simple semantics that are easy to explain -- that is, don't attempt implicit junctional collapse. Provide operators to collapse when needed, but don't attempt to be too clever. While it's easier to find clever programmers than to write

Re: Temporal

2009-05-25 Thread Dave Rolsky
On Sat, 2 May 2009, Timothy S. Nelson wrote: Hi. Can someone (Dave Rolsky?) please tell me why rewriting S32/Temporal in terms of Enum roles would be bad? See the example of Enum day roles here: http://www.rakudo.org/node/39 Because day and month names are hardly universal, and forcing

Re: YAPC::EU and Perl 6 Roles

2009-07-08 Thread Dave Whipp
Ovid wrote: I'd like to see something like this (or whatever the equivalent Perl 6 syntax would be): class PracticalJoke does Bomb does SomeThingElse { method fuse() but overrides { ... } } The "overrides" tells Perl 6 that we're overriding the fuse() method > from either Bomb or Som

Re: Filename literals

2009-08-18 Thread Dave Whipp
Leon Timmermans wrote: Reading this discussion, I'm getting the feeling that filename literals are increasingly getting magical, something that I don't think is a good development. [...]. I don't want to deal with Windows' strange restrictions on characters when I'm working on Linux. I don't want

Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
$mag where 0..Inf, Real $angle where -π ..^ π ]) is export { ... } Finally, anyone using complex numbers probably wants a "conjugate" method and/or operator postfix:<*> almost as much as they want unary-minus: $mag = sqrt( $z * $z* ); Dave.

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
Moritz Lenz wrote: our multi method polar (Complex $nim: --> [ Real $mag where 0..Inf, Real $angle where -π ..^ π ]) is export { ... } If you put this into a signature, it is checked on every call to that method and thus slows down execution. If you want a formalization that's not part of th

Re: Comments on S32/Numeric#Complex

2009-12-16 Thread Dave Whipp
yary wrote: At 00:15 +0100 12/17/09, Moritz Lenz wrote: Not quite, .abs returns one of the polar coordinates (the magnitude), so only a method is missing that returns the angle. Any ideas for a good name? Would a method called "phi" with a unicode synonym "φ" be too obtuse? Anything wrong

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Moritz Lenz wrote: Dave Whipp wrote: [cut] Contrast with Rat which has both separate accessors and the "nude" method (a name that could possibly be improved to avoid adult-content filters) suggestions welcome. Attempting to generalize: what we want is an operator that extracts

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Jon Lang wrote: my ($num, $denom) = $num.^attr; # $num.WHAT == Ratio; my ($mag, $phase) = Complex::Polar($z).^attr; my ($re, $im) = Complex::Cartesian($z).^attr; my ($x, $y) = $vector.^attr »·« ( [1, 0], [0, 1] ); If I'm reading this right, the .^attr is exposing implementation details

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Doug McNutt wrote: my ($x, $y) = $vector «·« ( [1, 0], [0, 1] ); After a while I became resigned to the fact that dot and cross products were not what was being offered. Instead a product of two vectors was to be simply a component by component multiply that produced another "vector" of the s

Re: Comments on S32/Numeric#Complex

2009-12-17 Thread Dave Whipp
Todd Olson wrote: At 14:54 -0500 2009-12-17, Jon Lang wrote: And really, my whole point is that the implementation details are (conceptually) the only thing that distinguishes Complex::Polar from Complex::Cartesian. All though both e^(i ¼) and e^(i 3 ¼) evaluate to -1 + 0i it is often u

Re: A new era for Temporal

2010-04-09 Thread Dave Rolsky
On Thu, 8 Apr 2010, Carl Mäsak wrote: I do want to explicitly credit Dave Rolsky, whose work on the DateTime family of modules on CPAN has informed much of the current spec, sometimes to the point of verbatim copying. Thanks, but I'd hate to see you copy all my mistakes too! One th

Re: A new era for Temporal

2010-04-11 Thread Dave Rolsky
ec it. I think that having a standard, minimal API for this defined in core as a Date role would be ideal. -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */

Re: expression of seconds (was Re: A new era for Temporal)

2010-04-11 Thread Dave Rolsky
not always control how the DateTime object is constructed. Nonetheless, when they want to know "what is the value for seconds", I think _most_ users will want an integer, not a floating point number. -dave /*

Re: underscores vs hyphens (was Re: A new era for Temporal)

2010-04-11 Thread Dave Rolsky
ple s/_/-/g -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */

a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Dave Whipp
masak wrote: Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod Log: [S32/Numeric] removed method form of srand Overwhelming consent on #perl6 about this. - multi method srand ( Real $seed: ) multi srand ( Real $seed = default_seed_algorithm()) Seed the generator C uses. C<$seed>

Re: a more useful srand (was Re: r30369 - docs/Perl6/Spec/S32-setting-library)

2010-04-12 Thread Dave Whipp
Moritz Lenz wrote: 1) A RNG class (don't really care what the name is, for now) 2) An instance of that in $*RAND (which you can temp()) 3) rand() and srand() act on $*RAND 4) It should be easy to create instances of the RNG to use in your own class. The sounds reasonable. The one thing I'd add

Re: A new era for Temporal

2010-04-20 Thread Dave Rolsky
On Mon, 12 Apr 2010, Moritz Lenz wrote: Am 12.04.2010 03:47, schrieb Dave Rolsky: On Sun, 11 Apr 2010, Moritz Lenz wrote: I've planned to add such a module to the Perl 6 spec, but some comments on #perl6 suggested it should be kept out of core to prevent bloat. Still if the overall op

Re: r30398 - docs/Perl6/Spec/S32-setting-library

2010-04-20 Thread Dave Rolsky
n the Perl 5 DateTime sweet. Exposing this value explicitly (rata-die-day-count) would be a wise decision, IMO. Also, "day-count", not "daycount" ;) -dave /* http://VegGuide.org http://blog.urth.org

Re: Proposal for a new Temporal time-measurement paradigm

2010-04-22 Thread Dave Rolsky
endar objects in core makes a lot of sense. For folks who need to get fancier, the day count on the Date class will allow simple conversion between calendars, which they can find on CPAN6, along with modules that do more with the Gregorian calendar.

Re: optional rules cluttering parse trees

2010-04-28 Thread Dave Whipp
Moritz Lenz wrote: Am 27.04.2010 06:31, schrieb Stéphane Payrard: When doing an analyse of a sample parse tree, I note that it is cluttered by the reduction of optional subrules to generate a zero length parse subtree. That is, rules with a '?' quantifier matching zero time. Currently the ? q

Re: Ideas for a "Object-Belongs-to-Thread" threading model

2010-05-12 Thread Dave Whipp
indeed interesting to consider how these map ot vastly difference computation platforms: OpenCl Vs OpenMP Vs Cloud. It deeps a little premature to be defining roles (e.g. RemoteInvocation) without defining the mapping of the core operators to these various models of computation. Dave.

Re: Parallelism and Concurrency was Re: Ideas for a"Object-Belongs-to-Thread" threading model (nntp: message 20 of 20 -lastone!-)

2010-05-17 Thread Dave Whipp
nigelsande...@btconnect.com wrote: There are very few algorithms that actually benefit from using even low hundreds of threads, let alone thousands. The ability of Erlang (and go an IO and many others) to spawn 100,000 threads makes an impressive demo for the uninitiated, but finding practical

Re: Parallelism and Concurrency was Re: Ideas fora"Object-Belongs-to-Thread" (nntp: message 4 of 20) threading model (nntp:message 20 of 20 -lastone!-)

2010-05-17 Thread Dave Whipp
ufficient mechanisms (via traits) to define data placement without any new features. And therefore the issue can be ignored until someone actually attempts to implement OpenCL bindings. Dave.

Re: Exceptions

2003-06-27 Thread Dave Whipp
gt;1 ) } else { $a = $a + 1 } return $a; } I think it could work, and the rope's not really enough to hang the unwary. Dave. p.s. the example is a toy, but saturated arithmetic is useful, and often supported in the instruction set of the host cpu --- any chance of it being build into parrot/jit? Ditto for overflow exceptions.

Parsers with Pre-processors

2003-07-17 Thread Dave Whipp
# meta-chars rule filename { Safe.filename } } -- Dave.

Re: Aliasing an array slice

2003-07-18 Thread Dave Whipp
fine the spilling algorithm in a way that makes sense (e.g. all remaining items go into the element of the righmost index). But perhaps there's a better way to beet the desire. Perhaps ellipses could be emplyed to indicate that the splice is allowed to resize the array: @a[1...3] = qw(a b c d e); Dave.

Re: The Perl 6 Summary -- preprocessors

2003-07-21 Thread Dave Whipp
"Piers Cawley" <[EMAIL PROTECTED]> wrote > Parsers with Pre-processors > I didn't quite understand what Dave Whipp was driving at when he talked > about overloading the "" pattern as a way of doing preprocessing of > Perl 6 patterns. I di

Re: The Perl 6 Summary -- preprocessors

2003-07-21 Thread Dave Whipp
.source = (new Grammars::Language::C::Preprocessor).open($source); > } > ... > } I find myself wondering if this is covered by the P6 equiv of TieHandle. I.e. is it just an input stream filter? Dave.

Re: The Perl 6 Summary -- preprocessors

2003-07-21 Thread Dave Whipp
stead, lets try the A6 pipeline syntax inside an assertion: $fh =~ / < ==> > /; This might provide a starting point the defining the associated L0 structure. And I can think of some intersting generalizations for the LHS. Dave.

E6: Small Junctions

2003-08-01 Thread Dave Whipp
, given that we don't have true/false keywords, becomes: none( none(0,"",undef), any(0,"",undef) ), which I think simplifies to "none(none())". So is a junctions of zero and one elements valid? Abjunctions don't seem to have any problems with the concept. Dave.

Re: E6: Small Junctions

2003-08-01 Thread Dave Whipp
"Mark J. Reed" <[EMAIL PROTECTED]> > Quick, dumb question: what is an "abjunction"? How does it differ > from a junction? An abjuction requires that none of its members match. For example, ($a == none(1,2,3)) is true for any value of $a except 1, 2 or 3. Dave.

Implicit parameter aliases

2003-08-06 Thread Dave Whipp
d} multi sub alu( $num, $sub is required_named) { print $num - $sub } alu( 5, add=>4 ); # prints "9" alu( 5, sub=>4 ); # prints "1" Dave.

Re: Pondering parameterized operators

2003-09-26 Thread Dave Whipp
ods". One thing of concern is that we'd need whitespace rules to disambiguate things. I sense some wonderful opportunities for obfuscation. Dave.

Re: The Block Returns

2003-10-02 Thread Dave Mitchell
On Thu, Oct 02, 2003 at 04:15:06AM -0600, Luke Palmer wrote: > And to clarify: > > sub indexof(Selector $which, [EMAIL PROTECTED]) { > for zip(@data, 0...) -> $_, $index { > when $which { return $index } > } > } > > Which actually creates a closure (well, in th

Re: The Block Returns

2003-10-16 Thread Dave Mitchell
On Thu, Oct 16, 2003 at 01:46:30AM +0100, Simon Cozens wrote: > [EMAIL PROTECTED] (Larry Wall) writes: > > But for the time being I'm tied to an IV pole > > We got rid of those; they're PMC poles now. > > Get well soon, Ditto! Dave. -- Little fly, thy summer

Anonymous Multi's? [was Re: Control flow variables]

2003-11-20 Thread Dave Whipp
multi &foo; $ref("hello"); # calls &foo(String) If this is possible, then $ref is presumably holding some form of junction of the multi subs. Is it possible to create a similar junction of anonymous multi-subs? Dave.

Re: Semantics of vector operations

2004-01-21 Thread Dave Mitchell
On Wed, Jan 21, 2004 at 04:01:43PM -0500, Austin Hastings wrote: > Perhaps the right way to vectorize the arguments is to delimit them with > vectorization markers? > > @a + >>$b<< or @a + @$b even! -- Justice is when you get what you deserve. Law is when you get what you pay for.

Re: Semantics of vector operations

2004-01-23 Thread Dave Whipp
h contexts. Indeed, if we had a "this is an operator" operator, we could give every symbol a textual name: $a \op[assign] $b \op[plus] $c; @a = @b \op[leach plus reach] @c; Dave. "Luke Palmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Larry Wall wr

Re: Semantics of vector operations

2004-01-23 Thread Dave Whipp
mp_leading_whitespace; return "«" } then the macro magic would expand "leach eq reach" as "»eq«" (which, hopefully, it then re-parses as a single token^Woperator). This doesn't solve the generalized problem of disambiguating, though I could see a "_" operator defined as a macro that eats all its surrounding whitespace. Dave.

Re: The Sort Problem

2004-02-12 Thread Dave Whipp
Perhaps something like: @sorted = sort { infix:<=> map { scalar $_.foo('bar').compute } @^_ } } @data I'm not entirely sure it's readability is better than yours, though. Dave. "Luke Palmer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTE

Re: The Sort Problem: a definitive ruling

2004-02-19 Thread Dave Whipp
this: what is the signature of prefix:-M ? i.e. how does it tell the outer block that it (the outer-block) needs a parameter? There seems to be some transitive magic going on here. Could similar magic be used to have infix:<=> require two higher-order variables (e.g. could "sort { <=> } @unsorted" be made to work?) Dave.

Whither Apocalypse 7?

2004-02-29 Thread Dave Mitchell
Did I miss something? Was there ever an apocalyse 7? Also, why aren't the apocalyses and excegises announced on any of the p6 lists (like, er, perl6-announce for example)? Yours grumpily, Dave. -- My get-up-and-go just got up and went.

Re: Magic blocks (was: Compile-time undefined sub detection)

2004-03-08 Thread Dave Mitchell
rry, perhaps I wasn't paying close enough attention, but suddenly we've leaped from oddly named subs that get called at interesting times, to array variables with oddly-named properties (or attributes, or whatever). Je ne comprend pas :-(. Dave. -- A walk of a thousand miles begins with

Re: Mutating methods

2004-03-12 Thread Dave Whipp
an assigning version of that operator. For example, lets use the "section" Unicode symbol: "§" to locally set the current topic within an expression. Now we could say: $x = ( $foo § .a + .b + .c ) to mean $x = $foo.a + $foo.b + $foo.c The assigning version of the operator could be $x §= .foo; my Dog $dog §= .new; Dave.

Re: backticks

2004-04-14 Thread Dave Whipp
heses where possible: qx rm -rf usr/bin/* ; (i.e. it goes to the end of the current expression-scope). Perhaps a "qx<<"HERE";" form could be useful, too. If we could implement such a prefix:qx operator (as a macro?), then the qx form would be only one char (the space) more than the backtick form. Dave.

Re: backticks

2004-04-15 Thread Dave Mitchell
If hypothetically we *are* going to have a simplfied constant-index hash access syntax, is there any reason why we can't use a single quote (') rather than backtick ('), akin to the Perl4-ish package separator, ie %foo'bar rather than %foo`bar? On the grounds that personally I hate the backtick

Re: placeholder attachment?

2004-04-19 Thread Dave Whipp
ical scopes that are tagged as placeholder scopes; but C and C do not. Its a bit like an inside-out-in-reverse C concept. Dave.

Re: A12: Typed undef

2004-04-23 Thread Dave Whipp
ions, then you get a trap. I'm not sure how much of this is relevant to C, but it might be nice to have the ability to have an undef that says "if used, then trap" (using the current "use fail" mode -- if that still exists) Dave. ps. as an aside, it would be really nice

Re: MethodMaker techniques in Perl 6

2004-04-25 Thread Dave Whipp
*{"Foo::name1"} = -> $a { $a->{name1} }; If I read A12 correctly, this could be written as: &Foo::$name1 := -> $a {$a.name1}; Dave.

signature of a program

2004-05-12 Thread Dave Whipp
program you use in place of functions like system and exec. sub qw(Str $exe) { program.new( $exe ) as string } OK, maybe that's not quite what you'd want, but I you get the picture (I hope). Dave.

Re: MethodMaker techniques in Perl 6

2004-04-25 Thread Dave Whipp
Abhijit A. Mahabal wrote: *{"Foo::name1"} = -> $a { $a->{name1} }; If I read A12 correctly, this could be written as: &Foo::$name1 := -> $a {$a.name1}; Could be; that sounds somewhat right, but could you point out where in A12 because a search for := revelaed nothing relevant to me. Sorry, t

hyper-hyper operators?

2004-05-20 Thread Dave Whipp
te depth" hyper operator for operating on trees? Dave.

Re: FW: Periodic Table of the Operators

2004-05-30 Thread Dave Whipp
It probably depends on what nationality that keyboard is for. If its Japanese, you probably won't have a problem ;-). But for the rest of us, use Vi and Ye (or zip). Dave. "Gabriel Ebner" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, > > Joe

Re: definitions of truth

2004-06-24 Thread Dave Whipp
abstract. My reading of A12 leads me to expect this to be defined as a coercion, using the "as" operator, not "dot": $foo as boolean What am I missing? Dave.

Re: The .bytes/.codepoints/.graphemes methods

2004-06-28 Thread Dave Whipp
once, the need for ultra-short abbreviations is reduced. Dave.

Re: push with lazy lists

2004-07-12 Thread Dave Whipp
be to define rand(@x) as rand(@x) == @x.rand == @x[ rand int @x ] == @x[ rand(1) * @x ] guaranteeing a uniform distribution unless adverbial modifiers are used. Dave.

Re: push @bar, .splice;

2004-07-17 Thread Dave Mitchell
On Sat, Jul 17, 2004 at 06:53:28PM +0200, Juerd wrote: > If an array element knows that it is an array element, this can be > useful: > > for @foo { push @bar, .splice if EXPR } What happens if the element is an element of more than one array? -- A power surge on the Bridge is rapidly and c

Why do users need FileHandles?

2004-07-18 Thread Dave Whipp
producer" sends messages to a "consumer", and thus has an object (proxy/handle) that represents that consumer. The fact that the implementation is a "File Handle" is not something that a user needs to worry about (usually). I guess what I'm saying is that if we can make tying the standard idiom, then we can relax you huffmanization worries for things like the "open" function. Dave.

Re: Why do users need FileHandles?

2004-07-18 Thread Dave Whipp
e same underlying implementation, we might want to abstract them differently. C is as good a name as any for the sync-to-disc usage; but the second might be better named C -- and probably wouldn't be on a "text" object, anyway. I'm not sure that the details of inter-thread messaging have been decided yet, but I'd think that a common messaging paradigm would apply. Dave.

Re: Why do users need FileHandles?

2004-07-18 Thread Dave Whipp
hat having wrapper classes for file handles is a bad idea, it just > doesn't relate to what I saw being discussed. > Oh, and "TextFile" should be spelled "IO::File::Text", IMHO. Possibly, but would need a hufmanized alias for common use. Possible just "file": my Str $text is file("foo.txt") does no_follow_symlink does no_create; Do we have an antonym for C? Dave.

Re: Why do users need FileHandles?

2004-07-19 Thread Dave Whipp
ot;, "is const", instead of inventing new ones to pass to the C function as named-args). Alan Cooper, in his book on human-computer interface design, makes the case that files are an obsolete abstraction for users. I guess I'm making the same argument for programmers. Dave.

Re: String interpolation

2004-07-21 Thread Dave Whipp
x27;@') ) ); and then my $email_address = email([EMAIL PROTECTED]); This could also be implemented as a macro, but that shouldn't be necessary. A good, spicy, adverbial curry should be sufficient. Dave.

Re: String interpolation

2004-07-21 Thread Dave Whipp
"Chromatic" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Shh, no one's let slip the idea of curried roles yet! I'm not even > certain A12 mentioned parametric roles, let alone first-class roles. And with parametric roles, perhaps we also get C roles? Dave.

Re: Why do users need FileHandles?

2004-07-22 Thread Dave Whipp
of course) if this happens when we've mapped a file into an object. Dave.

Re: Why do users need FileHandles?

2004-07-22 Thread Dave Whipp
the encoding. If the file is ASCII, then we don't need to worry about multi-byte characters, so the under-the-hood implementation could follow a heuristic such as "seek to 1000 bytes from end of file: scan forward for "\n". If none found, then go back further. Otherwise continue to scan to find last "\n" in the file". Dave.

Re: String interpolation

2004-07-22 Thread Dave Mitchell
ybe "@foo[]" in Perl6 could be what "@foo" is in Perl5? And I mean a literal '[]', not "@foo[expression-that-returns-an-empty-list]" Dave -- You never really learn to swear until you learn to drive.

Re: Synopsis 4 draft 1 -- const block params and placeholders

2004-08-20 Thread Dave Whipp
$a, because $_ is implicitly bound to the same elem as $a? $^a++; # Can we mix placeholders with explicit args? Is this also bound to $a's element? } Dave.

Re: Instantiation

2004-08-23 Thread Dave Whipp
"Sean O'Rourke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > my $x = (use Some::Module::That::Defines::A::Class).new("blah"); how about some variation on my $x = Some::Module::That::Defines::A::Class.AUTOLOAD.new("blah"); Dave.

Re: Return with no expression

2004-08-24 Thread Dave Whipp
tor, defined as {eval $RHS if $LHS; return $LHS}. For that interpretation, one might choose a different name (e.g. C). We could actually define ?? as a binary operator in much the same way. Dave.

S5: grammar compositions

2004-09-15 Thread Dave Whipp
~ /<(Letter but greet_word(rule :w { Guten Tag })).text>; ? Dave.

can gather/take have multiple bins

2004-11-24 Thread Dave Whipp
I was wondering just how much once can do with gather/take: is it possible to have multiple bins? @words = << abc def ade afe ade agc >>; gather @bin1, @bin2 -> $bin1, $bin2{ for @words { $bin1.take if /^^a/; $bin2.take if /e$$/; } } ?

Re: can gather/take have multiple bins

2004-11-24 Thread Dave Whipp
> gather @bin1, @bin2 -> $bin1, $bin2{ > for @words { > $bin1.take if /^^a/; > $bin2.take if /e$$/; > } > } Juerd point out (private email) that my example doesn't really make any sense in that it doesn't do anything over and above s/take/push. However, I think the concept of multiple

Undeclared attributes

2004-12-10 Thread Dave Whipp
Attributes are declared with C, but also have a unique signil C<$.>. So is it strictly necessary to declare them? Or rather, is it Cly necessary -- i.e. is the following legal? no strict; class Foo { method bar { say $.a++ } }

Re: Dimension of slices; scalars versus 1-element arrays?

2005-01-11 Thread Dave Whipp
); @d[*;*] = @c[ 1 ; * ]; # @d is 2d @e[*] = @c[ 1 ; * ]; # @e is 1d @f = @c[1;1]; # @f is 2d: no dimensions lost @g[*] = @c[ 0,1 ; 0,1 ]; # error: cannot collapse as our disambiguator. { @c[;*] but shape(*) } wouldn't work, because the :shape option leaves additional dimensions open. Dave.

Dynamically Scoped Dynamic Scopes

2005-02-27 Thread Dave Whipp
then we need a way to unbind the variables, and restore them to the bindings that existed before they were bound to our scope space. I'm not sure how to do that, because we don't have any builtin concept of dynamically scoped scopes. Dave.

Adding linear interpolation to an array

2005-03-07 Thread Dave Whipp
} Would I be able to pass a normal (non-interpolating) array to this sub, and then access it using non-integer indices (i.e. is the data in the array independent of the interface through wich it is accessed). Dave.

Re: Adding linear interpolation to an array

2005-03-07 Thread Dave Whipp
@raw_in) { my Num @in does LinearInterpolation = @raw_in; ... } Or perhaps even sub foo (Num @in is copy does LinearInterpolation) { ... } Dave.

Re: Adding linear interpolation to an array

2005-03-08 Thread Dave Whipp
of Num that is used as argument gets the role attached while it lingers in foo. Perhaps a new keyword/opertor is need to separate the constraints from the directives. C would read nicely: sub foo ( Num @in is copy that does LinearInterpolation ) Dave.

Re: Junctions - feedback and desires

2005-03-10 Thread Dave Whipp
Rod Adams wrote: I do not believe that you can create a 'lazy junction'. But I don't recall the topic coming up before, so we'll have to wait for Damian to come back unless someone else knows for certain. My understanding is that all lists are conceptually lazy. "any(2..Inf)" is perfectly valid.

Re: A possible solution for s?pintf

2005-03-12 Thread Dave Whipp
Larry Wall wrote: I don't see that this buys us anything over just shortening "sprintf" to something shorter, like: print as '%03d %15s', $foo, $bar; And your argument list falls out naturally from making "as" a listop. Plus it naturally lets you say other "as-ly" things: print as MyBigInt, $

Re: eval (was Re: New S29 draft up)

2005-03-18 Thread Dave Whipp
Larry Wall wrote: On Fri, Mar 18, 2005 at 10:28:18AM -0500, Aaron Sherman wrote: : Thus: : : eval read :file("foo"); : : There you have it. The problem being that it will now report errors in some random temporary string rather than at some line number in a file. Not good. Orthogonality strike

Re: Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-16 Thread Dave Whipp
Chip Salzenberg wrote: As you know, under Unix, there's no such thing as "the current directory" as a string. The only durable current directory is the device and inode of C. It's not wise to conflate the current directory with a name that at some point in the past could have been used to reach i

statement modifiers for setting variables

2005-04-18 Thread Dave Whipp
The following is legal perl: print "$a $b $c" if ($a,$b,$c)=(1,2,3); This prints "1 2 3", but the definitions obviously aren't scoped to the modified statement. And a C in the modifier is a bit too late. Any reason to [not] add a C statement modifier which restricts the scope of the declaratio

Re: LABELS: block

2005-04-26 Thread Dave Whipp
Juerd wrote: ... Or just add quotes (yes, please) and keep the colon: "foo": for 1... { next "foo"; } Given that "next" throws a control-exception that is handled by the looping construct, perhaps we sohuld think of the label as an optional parameter to the looping statement funct

Re: BEGIN and lexical variables inside subroutines

2005-05-12 Thread Dave Mitchell
On Thu, May 12, 2005 at 09:06:48PM +0100, Benjamin Smith wrote: > sub foo { my $x; BEGIN { $x = 3 }; say $x } > foo; foo; foo; > > Currently in perl5 and pugs this prints "3\n\n\n". > > Should BEGIN blocks be able to modify values in lexical variables that > don't really exist yet? (People ca

Re: Syntax of using Perl5 modules?

2005-05-25 Thread Dave Whipp
;t seem correct in this context. Even if you got rid of one of the hypthens (so that "perl5" is the "version"), then it still feels wrong. Each version of a module should be free to choose its language, but that should be encapsulated within the module. If you do want to impose the language from the "use"er, the I'd expect an adverbial syntax: "use:p5 Digest;". Dave.

Re: reduce metaoperator on an empty list

2005-05-31 Thread Dave Whipp
Damian Conway wrote: 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) ... $sum = ([+] @values err 0); $prod = ([*] @values err 1); $prob = ([*] @probs err 0); Just wanted to check, if I've said "use fatal": will that "err 0" DWIM, or will the fatal

Re: reduce metaoperator on an empty list

2005-05-31 Thread Dave Whipp
Damian Conway wrote: And what you'd need to write would be: $sum = (try{ [+] @values } err 0); The "err ..." idiom seems too useful to have it break in this case. Afterall, the purpose of "err 0" is to tell the stupid computer that I know what to do with the empty-array scenario. Feel

Re: reduce metaoperator on an empty list

2005-06-01 Thread Dave Whipp
Luke Palmer wrote: For something like: $ordered = [<] @array; If @array is empty, is $ordered supposed to be true or false? It certainly shouldn't be anything but those two, because < is a boolean operator. I have no problem with 3-state logic systems (true, false, undef) if this is w

<    1   2   3   4   5   >