Re: Chained Comparisons ?

2008-04-16 Thread Joe Gottman
support. Yes, they use multiple-typed values such that (3 < 5) returns (5 but True), which used in a numeric context is a 5 that can be chained with further infix:{'<'}s but in a boolean context is True. So does (5 < 3) return (3 but False) or just False ? Joe Gottman

Definition of Order in S29

2008-01-23 Thread Joe Gottman
In the definition of cmp, S29 says the function "returns |Order::Increase|, |Order::Decrease|, or |Order::Same| (which numify to -1, 0, +1)". Shouldn't the enumerations and their numerical values be listed in the same order? Joe Gottman

Re: Sequential bias in S04 (and Perl6 in general)

2008-01-03 Thread Joe Gottman
ot be used with , because the next case might already have been checked when is called. Joe Gottman

Re: Micro-articles on Perl 6 Operators

2007-09-18 Thread Joe Gottman
This one's very nice. One question: what's the "~+" operator you talk about in your discussion of prefix ~ ? I can't find any mention of it in Synopsis 3. Joe Gottman

Re: Micro-articles on Perl 6 Operators

2007-09-17 Thread Joe Gottman
: you might want to mention the roundrobin function in the article on the zip function since the two are very closely related. Joe Gottman

Re: [svn:perl6-synopsis] r14447 - doc/trunk/design/syn

2007-09-06 Thread Joe Gottman
=back Do the results of andthen and orelse really bind to ANY arguments of the second block? If the second block has two parameters it makes more sense to me for the results to bind to the first parameter and nothing to bind to the second parameter. Joe Gottman

Re: [svn:perl6-synopsis] r14376 - doc/trunk/design/syn

2007-04-17 Thread Joe Gottman
or elsif were usable in all subsequent elsif or else statements in the same if .. elsif .. else clause, so you could do something like if testa() -> $a {say "$a is true"} elsif testb() -> $b say {"$a is false and $b is true"} else say {"Neither $a nor $b is true"} Joe Gottman

Re: Y not

2007-02-20 Thread Joe Gottman
taoperator. Maybe you could use DD instead (for dot product). Joe Gottman

Question about interpolating version of qw

2007-02-10 Thread Joe Gottman
Does the interpolating version of qw split a string into words before or after it interpolates? So if I have my $foo = 'Hello World'; my @bar = «$foo»; does @bar equal ('Hello World') or ('Hello', 'World')? Joe Gottman

Error in S04

2007-01-28 Thread Joe Gottman
In the "Multiplicative Precedence" section of S04, "div" is specified twice. Joe Gottman

Map on a multislice

2007-01-25 Thread Joe Gottman
, 11]) Obviously both should be possible, and if we have a multislice with more than 2 dimensions we should be able to iterate at any level. So what is the default iteration level and how do we override? Joe Gottman Joe Gottman

Suggestion: minmax operator

2007-01-09 Thread Joe Gottman
Since Perl6 is going to have infix min and max operators, it might be a good idea to have an infix minmax operator, defined by $a minmax $b === ($a min $b), ($a max B); #2-element list This would be especially useful as a reduction operator: my ($min, $max) = [EMAIL PROTECTED]; Joe

Gather/Take and threads

2006-12-06 Thread Joe Gottman
Suppose I have a gather block that spawns several threads, each of which calls take several times. Obviously, the relative order of items returned from take in different threads is indeterminate, but is it at least guaranteed that no object returned from take is lost? Joe Gottman

A suggestion for a new closure trait.

2006-08-29 Thread Joe Gottman
first {$_ = $value;} will resume {$_ += value;} ... } Joe Gottman

RE: NEXT and the general loop statement

2006-08-18 Thread Joe Gottman
. This would be much easier to implement that the idea of NEXT blocks being mutually exclusive to LAST blocks, because it depends only on what happened in the past, not the future. Luke's example could then be implemented as for @objs { .print; REENTER { print ", " } LAST { print "\n" } } In a language that has both if and unless, it makes sense to have a block that means not FIRST. I'm not sure about the name; besides REENTER, other possible names would be SUBSEQUENT or NOTFIRST. Joe Gottman

RE: NEXT and the general loop statement

2006-08-17 Thread Joe Gottman
possible? This would require Perl to know which iteration is going to be the last one. In many cases there is no way to know this: repeat { $num = rand; print $num; NEXT {print ',';} LAST {print "\n";} } while $num < 0.9; If rand is a true ran

RE: NEXT and the general loop statement

2006-08-17 Thread Joe Gottman
> -Original Message- > From: Luke Palmer [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 17, 2006 8:44 PM > To: Perl6 Language List > Subject: Re: NEXT and the general loop statement > Wasn't NEXT supposed to do something tricky, such as being mutually > exclusive with LAST? I remembe

NEXT and the general loop statement

2006-08-16 Thread Joe Gottman
Is a NEXT clause called before or after the update portion of a general loop statement? For instance, consider the following code: loop $n = 0; $n < 5; ++$n { NEXT {print $n;} } Is the output 01234 or 12345? Joe Gottman

RE: S29 update ready

2006-07-08 Thread Joe Gottman
is the first big update. There will be more if this all goes well. I have one minor comment about join. You should specify its behavior when it is passed an empty list. Does it return undef or the empty string? Joe Gottman

S5 - Question about repetition qualifier

2006-04-25 Thread Joe Gottman
ax for the code. Joe Gottman

RE: [svn:perl6-synopsis] r8637 - doc/trunk/design/syn

2006-04-10 Thread Joe Gottman
ecutes > +immediately as in Perl 5. If you wish to return a closure from a > +function, you must use an explicit C. > + How does the "sub" keyword fit in here? Is there any difference between the lines return {say "Hello World";}; and return sub {say "Hello World";}; ? Joe Gottman

RE: [svn:perl6-synopsis] r8520 - doc/trunk/design/syn

2006-04-01 Thread Joe Gottman
#x27;$args as Array" or "Array($args)" > +%$args; # same as '$args as Hash" or "Hash($args)" > +&$args; # same as '$args as Code" or "Hash($args)" Shouldn't this last one be +&$args; # same as '$args as Code" or "Code($args)" Joe Gottman

Named Subroutine return values

2006-02-23 Thread Joe Gottman
"our" Note that the third possibility here does not include a return type. Does this imply that if we want to declare a subroutine with a return type we have to declare it as either a "my" sub or an "our" sub? Joe Gottman

RE: Is S05 correct?

2006-02-06 Thread Joe Gottman
odification date is November 16, 2005. Is this the most up-to-date version? Joe Gottman

Do chained comparisons short-circuit?

2006-01-18 Thread Joe Gottman
Suppose I have code that looks like this: my ($x, $y, $z) = (1, 2, 3); say "sorted backward" if ++$x > ++$y > ++$z; Will $z be incremented even though the chained comparison is known to be false after ++$x and ++$y are compared? Joe Gottman

RE: binding arguments

2005-12-24 Thread Joe Gottman
med_arg <- $value); foo($value -> $named_arg); Which one of these two is better depends on whether you think the parameter or the argument being bound to it is more important. Joe Gottman

RE: Problem with dwimmery

2005-12-22 Thread Joe Gottman
cuted. {} is an empty subroutine that executes by doing absolutely nothing. Joe Gottman

What's the latest on Iterators?

2005-11-11 Thread Joe Gottman
several independent ones? Joe Gottman

RE: Look-ahead arguments in for loops

2005-10-01 Thread Joe Gottman
couple of parameters, one to say how many copies of the list it zips up, and another to say what the first offset is. sub contextual($number_of_copies, $first_offset, @list) {...} # I'm not sure how to write it. Then your example would be for contextual(3, -1, create_list_here() )-> $last, $first, $next { Joe Gottman

RE: $object.meta.isa(?) redux

2005-08-10 Thread Joe Gottman
t; (in) Element > (=) Set equality > > I believe the unicode variants are also allowed. > > And now we're doing away with junctive types in favor of set types. Will there be an operator for symmetric difference? I nominate (^). Joe Gottman

RE: reduce metaoperator on an empty list

2005-05-31 Thread Joe Gottman
rns empty string. You could think of C as being > implemented: > > sub join (Str $sep, [EMAIL PROTECTED]) { reduce { $^a ~ $sep ~ $^b } "", > @list } > > Just as C is probably implemented: > > sub sum ([EMAIL PROTECTED]) { [+] 0, @list } > If this were the case, then join '~', 'a', 'b', 'c' would equal '~a~b~c' instead of 'a~b~c' Joe Gottman

RE: Declaration of my() variables using symbolic referentiation

2005-05-21 Thread Joe Gottman
ot;} Then you wouldn't even need the BEGIN block. my declare_var(calc_varname()) = 42; The compiler wouldn't know the variable name until runtime, but I think this just means that this just transforms compile-time errors to runtime errors. Joe Gottman

RE: should we change [^a-z] to <-[a..z]> instead of <-[a-z]>?

2005-04-17 Thread Joe Gottman
ashed"? That I'd get a warning *any* time I use a > dash in a character class? I guess I can live with that. On the other hand, you can use the canonical perl 5 trick of having the dash be the first character in the class if you want to use a literal dash. Joe Gottman.

RE: New S29 draft up

2005-03-16 Thread Joe Gottman
ns List Returns the indexes and associated values stored in @array, lazily and in order by index. Optionally, only those of the slice defined by @indices. multi sub reduce (Code $expression : [EMAIL PROTECTED]) returns List { my $res; for @values -> $cur { FIRST {$res = $cur; next;} $res = &$expression($res, $cur); } $res; } Joe Gottman

Closure trait for loop entry

2005-02-12 Thread Joe Gottman
e used as a trait on a variable state $first_iteration will setup {$_ = true} will next {$_ = false}; Joe Gottman

Making control variables local in a loop statement

2005-01-13 Thread Joe Gottman
s copy" attribute, so that it can be modified inside the loop (by the update portion if nothing else), but does not alias a variable it was initialized from. Joe Gottman

RE: Perl 6 Summary for 2004-11-08 through 2004-11-15

2004-11-15 Thread Joe Gottman
urrence > can be accessed similarly. I believe that the OP wanted to know how to match the second-to-last occurrence. So if we were to do something like m:nth(-2)/foo/ # just a guess about the syntax. on a string containing 4 foo's, then this would match the third foo. Joe Gottman

RE: Reverse .. operator

2004-09-03 Thread Joe Gottman
> -Original Message- > From: Larry Wall [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 02, 2004 8:41 PM > To: Perl6 > Subject: Re: Reverse .. operator > > On Thu, Sep 02, 2004 at 08:34:22PM -0400, Joe Gottman wrote: > : Is there similar shorthand to s

Reverse .. operator

2004-09-02 Thread Joe Gottman
evaluated lazily; reverse has to see the entire list before it can emit the first element of the reversed list. Would @foo = (5 .. 1 :by(-1)); do the trick? If so, would the same trick work for @bar = ('e' .. 'a' :by(-1)); ? Joe Gottman

Synopsis 4: Return type of a ~~ b

2004-08-27 Thread Joe Gottman
ter all, in Perl 5, the expression $string =~ /(a+)(b+)/ returns a list of captured substrings in list context Joe Gottman

RE: This fortnight's summary

2004-08-25 Thread Joe Gottman
None of the links for the perl6-language threads work. Joe Gottman

Anonymous Named params (Was Revision of A12's lookahead notions)

2004-08-13 Thread Joe Gottman
x27;from' => 2}; Would splurt :%foo; have the same result as splurt :by(1) :from(2); or would I need the braces in this case? Joe Gottman

Mailing list archives

2004-08-13 Thread Joe Gottman
There's something wrong with the mailing list archives at http://dev.perl.org/perl6/lists/. I can get to this page OK, but when I click on a link to the perl6-internals or perl6-language archives, I get a "This page cannot be displayed" error. Joe Gottman

RE: if not C<,> then what?

2004-07-09 Thread Joe Gottman
a statement modifier also? This would be useful for quick topicalization: say "$_ => %hash{$_}" given get_random_key(); Joe Gottman

RE: definitions of truth

2004-06-24 Thread Joe Gottman
t this to be defined as a coercion, > using > the "as" operator, not "dot": > > $foo as boolean > > What am I missing? Why not just use say ?$foo Isn't the prefix ? operator designed specifically for this use? Joe Gottman

Next Apocalypse

2004-06-10 Thread Joe Gottman
Now that Apocalypse 12 is out, which one is Larry going to work on next? Joe Gottman

FW: Periodic Table of the Operators

2004-05-28 Thread Joe Gottman
with almost all the changes that people > here sent me, as well as reading a few more threads and references. > This will be the last update for some time The zip operator is now the Yen sign (¥). Joe Gottman

A12 - Protected Attributes and Methods

2004-04-19 Thread Joe Gottman
could have another secondary sigil to mark a protected method or attribute. I'd suggest the semicolon, but I'm afraid it would cause havoc with the parser. Joe Gottman

Re: backticks

2004-04-14 Thread Joe Gottman
330 > > $ find . -name \*.pl -exec grep -hlE 'qx|`|`|readpipe' {} \; | wc -l > > 123 > > > > `` gets used an awful lot > > But that's in Perl 5, which is a glue language. > And Perl 6 isn't? I use backticks quite a bit in Perl, and I don't see that changing if I upgrade to Perl 6. Joe Gottman

New functions in the core (Was Re: Dereferencing Syntax)

2004-03-26 Thread Joe Gottman
e to implement it more efficiently in the core than as a sub in a module I think we should do so. Joe Gottman

Some questions about operators.

2004-03-19 Thread Joe Gottman
gal chaining? Or $x < $y lt $z? 5) Would it be possible for me to create a user-defined operator that does chaining? Joe Gottman

Re: Mutating methods

2004-03-15 Thread Joe Gottman
Damian-shaped will probably come in and point out how to prettify that > using "given", but it still wouldn't be as short as last week's > > $coderef.("argument").{hashelem}.self:sort(); Why not just do @{$_} = sort @{$_} given $coderef.("argument").{hashelem}; Joe Gottman

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

2004-03-09 Thread Joe Gottman
lement of @array after we leave the loop; it also ensures that $prior has the correct value of undef() when we start the loop the next time. Joe Gottman

Exegesis 7: Literal '{' in format string

2004-02-29 Thread Joe Gottman
How do you put a literal '{' or '}' into a format string in Perl 6? Do you use a backslash? Joe Gottman

Re: The Sort Problem: a definitive ruling

2004-02-19 Thread Joe Gottman
> 'a', 10 => 'b', 2 =>'c'); There is nothing in the signature of the key-extractor to suggest that all the keys are numbers, but as it turns out they all are. Will the sort end up being numerical or alphabetic? Joe Gottman

Re: The Sort Problem

2004-02-15 Thread Joe Gottman
sort ('foo', 'bar', 'glarch'); attempt to use the first parameter as a Criteria? Since sort has to be a multi sub anyhow, why don't we do multi sub *sort(Criteria $by : [EMAIL PROTECTED]) {...} multi sub *sort( : [EMAIL PROTECTED]) { ...} # returns sort {$^a cmp $^b} @data Joe Gottman

Re: [perl] The Sort Problem

2004-02-11 Thread Joe Gottman
er annoying problem with sort as it is currently defined. If you have an @array and you want to replace it with the sorted version, you have to type @array = sort @array; Besides being long-winded, this causes Perl to make an unnecessary copy of the array. It would be nice calling if sort (or reverse, or other similar functions) in void context resulted in in-place modification of the array that was input. Joe Gottman

Re: Semantics of vector operations

2004-01-22 Thread Joe Gottman
$a >>= 1; Will this right-shift the value of $a one bit and assign the result to $a (the current meaning)? Or will it assign the value 1 to each element in the array referenced by $a (as suggested by the new syntax). Both of these are perfectly valid operations, and I don't think its acceptable to have the same syntax mean both. I'm aware that using "Â=" instead of ">>=" will eliminate the inconsistency, but not everyone has easy access to Unicode keyboards. Joe Gottman

Re: Comma Operator

2004-01-21 Thread Joe Gottman
- Original Message - From: "Larry Wall" <[EMAIL PROTECTED]> To: "Perl6" <[EMAIL PROTECTED]> Sent: Wednesday, January 21, 2004 2:51 PM Subject: [perl] Re: Comma Operator > On Tue, Jan 20, 2004 at 08:12:28PM -0800, Jonathan Lang wrote: > : Joe Gottma

Comma Operator

2004-01-20 Thread Joe Gottman
is in loop statements (formerly for statements), which is where most of them are found anyway. For instance loop (my ($x = 0, $y = 10); $x < $y; ++$x, --$y) {...} Joe Gottman

Re: Roles and Mix-ins?

2004-01-06 Thread Joe Gottman
- Original Message - From: "Luke Palmer" <[EMAIL PROTECTED]> To: "Joe Gottman" <[EMAIL PROTECTED]> Cc: "Perl6" <[EMAIL PROTECTED]> Sent: Tuesday, January 06, 2004 9:34 PM Subject: [perl] Re: Roles and Mix-ins? > Joe Gottman writes: &g

Re: Roles and Mix-ins?

2004-01-06 Thread Joe Gottman
eBark} {...} Then we could have code like my Trog $foo = Trog.new(); my Dog $spot := $foo; my Tree $willow := $foo; $spot.bark(); # calls dogBark() $willow.bark(); #calls treeBark() This works better when Dog::bark and Tree::bark are both needed but they do different things. Joe Gottman

Re: [perl] Re: Object Order of Precedence (Was: Vocabulary)

2003-12-20 Thread Joe Gottman
tle leery about calling this trait "default". The problem is that we are already using "default" as a keyword (see the switch statement), and having a trait with the same name as a keyword might confuse users and/or the compiler. Joe Gottman

Iterating through two arrays at once

2003-12-10 Thread Joe Gottman
ned. In case 3), the problem is differentiating between an undef returned because the arrays were of different sizes, and an undef returned because one of the arrays contained an undef. Joe Gottman

Re: [perl] Re: syntax: multi vs. method

2003-11-18 Thread Joe Gottman
t; and "invoke" do not. > Also, I assume that invoke and check will have access to $a's private data members and methods, while call will not. Joe Gottman

Re: [perl] RE: s/// in string context should return the string

2003-11-18 Thread Joe Gottman
re possible, so they can cascade and nest. Excuse me. I know enough C++ to know the difference between an lvalue and an rvalue, but what the heck is a BValue? Joe Gottman

Re: Some questions about currying

2003-10-30 Thread Joe Gottman
- Original Message - From: "Luke Palmer" <[EMAIL PROTECTED]> > Joe Gottman writes: > > 3) Currying binds a function parameter to a value? Is there any way to > > bind a function parameter to a variable? Consider the following code: > > >

Some questions about currying

2003-10-29 Thread Joe Gottman
s called. It would be nice if there were some way to curry so that a parameter is bound to a variable reference. This would probably have to be a different method than assuming. Maybe something like &printNum(int).bind(x => \$foo) Joe Gottman

How to create a function that returns nothing

2003-10-14 Thread Joe Gottman
imilar. This would be an absolute necessity if you wanted to emulate C++, Java, or any other strongly typed language. Also, it could be useful for causing a compile-time error if someone types something like $z = swap($x, $y); Joe Gottman

Re: Perl 6's for() signature

2003-07-31 Thread Joe Gottman
- Original Message - From: "Hanson, Rob" <[EMAIL PROTECTED]> To: "'Rod Adams'" <[EMAIL PROTECTED]>; "Perl 6 Language" <[EMAIL PROTECTED]> Sent: Thursday, July 31, 2003 1:29 PM Subject: RE: Perl 6's for() signature > > Anyone but me feel the need for non-greedy > > slurpy arrays? similar

Re: Short-circuiting user-defined operators

2003-04-03 Thread Joe Gottman
<[EMAIL PROTECTED]> wrote: > > > > > >>Dave Whipp wrote: > > >> > > >>>Joe Gottman wrote: > > > > > > > > > Getting deep -- sorry. :) > > > > > > > > >>>>Alternatively, t

Short-circuiting user-defined operators

2003-04-01 Thread Joe Gottman
no idea how difficult it would be to implement either of these concepts. Also, if a parameter is deferred, would we need a new keyword to say when to actually evaluate it? Joe Gottman

Re: is static?

2003-03-15 Thread Joe Gottman
s scope only if the user returns a reference to it. A static variable should be like a variable except that it is only initialized once and is not destroyed when it goes out of scope. Joe Gottman

Re: A6: overloading multis on constness of parameters

2003-03-12 Thread Joe Gottman
- Original Message - From: "Damian Conway" <[EMAIL PROTECTED]> To: "Perl6" <[EMAIL PROTECTED]> Sent: Tuesday, March 11, 2003 9:35 PM Subject: Re: A6: overloading multis on constness of parameters > Joe Gottman wrote: > > >Will it be possi

A6: overloading multis on constness of parameters

2003-03-11 Thread Joe Gottman
then the first getX would be called, and if it were called on a non-const Foo object the second one would be. Joe Gottman

Re: "my int( 1..31 ) $var" ?

2003-01-03 Thread Joe Gottman
- Original Message - From: "Uri Guttman" <[EMAIL PROTECTED]> To: "Joe Gottman" <[EMAIL PROTECTED]> Cc: "Perl6" <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 10:06 PM Subject: Re: "my int( 1..31 ) $var" ? > >>>&

Re: "my int( 1..31 ) $var" ?

2003-01-03 Thread Joe Gottman
$var = 2.5; print "date" if $var == any(1..31); print "in interval" if 1 <= $var <= 31; Speaking of which, is there a run-time test to check if a variable is of integral type? Something like print "date" if ($var is int) && (1 <= $var <= 31); Joe Gottman

Re: This week's summary

2002-11-27 Thread Joe Gottman
There's something wrong with your links to the messages in the documentation list. Whenever I click on one, I get the message "Unable to find thread. Please recheck the URL." Joe Gottman

Re: exegesis 5 question: matching negative, multi-byte strings

2002-10-02 Thread Joe Gottman
', then gets rid of the bit at the end that we don't want. The capturing parentheses ensure that we return the part of the string we want, and we manually reset $pos to the correct position. This is easy to understand, and very extensible. Joe Gottman

Fw: perl6 operator precedence table

2002-09-26 Thread Joe Gottman
Apocalypse 4 mentions unary '?' . Since this is used to force boolean context, I would assume that it has the same precedence as unary '+' and '_' which force numeric and string context respectively. By the way, has anyone come up with a use for

Questions about private variables

2002-04-05 Thread Joe Gottman
itialization code is performed only once. Unfortunately, I have no idea how this would be implemented in Perl 6. Joe Gottman