Re: Easy question: what is a list comprehension ?

2008-04-05 Thread Luke Palmer
On Sat, Apr 5, 2008 at 7:32 PM, Brandon S. Allbery KF8NH [EMAIL PROTECTED] wrote On Apr 5, 2008, at 15:07 , John M. Dlugosz wrote: What is a list comprehension? I've seen that term bantered around here. The term comes from Haskell and Python; it's a shorthand notation for list

Re: Query re: duction and precedence.

2008-03-30 Thread Luke Palmer
On Sun, Mar 30, 2008 at 12:56 PM, Mark J. Reed [EMAIL PROTECTED] wrote: I'm a believer in generalizing where possible, modulo the principles of KISS and YAGNI. The latter essentially means at least make it general enough that you can extend it later without major retooling if it turns out

Re: Musings on operator overloading (was: File-Fu overloading)

2008-02-24 Thread Luke Palmer
On Sun, Feb 24, 2008 at 3:00 PM, Aristotle Pagaltzis [EMAIL PROTECTED] wrote: Something like path { $app_base_dir / $conf_dir / $foo_cfg . $cfg_ext } where the operators in that scope are overloaded irrespective of the types of the variables (be they plain scalar strings, instances

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

2008-01-04 Thread Luke Palmer
On Jan 4, 2008 9:18 AM, Jonathan Lang [EMAIL PROTECTED] wrote: Joe Gottman wrote: On the other hand, this being Perl, I do believe it should be easy to specify the concurrent case. I think that a forall keyword (and a givenall keyword corresponding to given) would be a good idea.

Re: Standards bearers (was Re: xml and perl 6)

2007-11-30 Thread Luke Palmer
On Nov 30, 2007 10:57 AM, David Green [EMAIL PROTECTED] wrote: Maybe some kind of Advisory Board would help, where people (who might be experts in various ways) can offer informed recommendations on what modules make a good fit for what circumstances. Ultimately, if this is something we want,

Re: xml and perl 6

2007-11-29 Thread Luke Palmer
On Nov 29, 2007 6:40 AM, James Fuller [EMAIL PROTECTED] wrote: I would argue that XML is slightly evolved 'text' and I would like to see my fav programming language treat it as a first class citizen internally. I think you are falling into a classic builtin trap. The idea is that when you

Re: xml and perl 6

2007-11-29 Thread Luke Palmer
Hi Jim, This has become quite the flame war. There seem to be two sides of the argument, you arguing one, everybody else arguing the other. So to bring some perspective back into this discussion, I'd like to ask you, what would it mean to you for there to be an XML type in core? That is, from

Re: Indirect objects, adverbial arguments and whitespace

2007-10-07 Thread Luke Palmer
On 10/7/07, Mark J. Reed [EMAIL PROTECTED] wrote: I would argue for disallowing the all-jammed-together case, lest we run into longest-match arguments where foobar:baz is foobar: baz but foo:barbaz is foo :barbaz. Yuck. Uh, that doesn't make sense. Longest match arguments are leftmost, so if

Re: **{x,y} quantifier

2007-07-01 Thread Luke Palmer
On 7/1/07, Amir E. Aharoni [EMAIL PROTECTED] wrote: I got the reply that it is similar to exponentiation of variables in math: a ** 5 == a * a * a * a * a == a It makes sense after it is explained and i do like the rationalization of the range as a list-like range, instead of the comma,

Re: **{x,y} quantifier

2007-07-01 Thread Luke Palmer
On 7/1/07, Amir E. Aharoni [EMAIL PROTECTED] wrote: please correct me if i say something stupid or if this has already been discussed before.) Another important loss if we were to go with 1..3 would be the ability to have runtime-dependent ranges; e.g.: / ($ntimes) x**{$ntimes} /

Re: Named captures (was: **{x,y} quantifier)

2007-07-01 Thread Luke Palmer
On 7/1/07, Amir E. Aharoni [EMAIL PROTECTED] wrote: On 01/07/07, Luke Palmer [EMAIL PROTECTED] wrote: / $ntimes := (\d+) x**{$ntimes} / The examples of := usage in S05 seem to have notation such as this: $ntimes := (\d+) Yes, that is correct. I've been away from the Perl 6

Re: Web Module (Was: Perl6 new features)

2007-06-25 Thread Luke Palmer
On 6/25/07, Peter Scott [EMAIL PROTECTED] wrote: I will just voice my support for putting best-of-breed modules for very common tasks (CGI, DBI for sure) in the core. Of course, then you get the disadvantage that most users will see new versions of those modules as often (or seldom, as it

Re: Generalizing ?? !!

2007-06-11 Thread Luke Palmer
On 6/11/07, Jonathan Lang [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Besides ?? !! with out an else part is just . No, it isn't. While behaves properly when the condition turns out to be true, the result of the condition turning out to be false is whatever the condition turned out to

Re: explicit line termination with ;: why?

2007-05-15 Thread Luke Palmer
On 5/15/07, Dave Whipp [EMAIL PROTECTED] wrote: A slightly tangental thought: is the behavior of Cgiven with no block defined? I.e. is given $foo { when 1 {...} }; equivalent to given $foo; when 1 {...}; Doubtful. However, I do think that it's useful to be able to treat the rest of the

Re: Should a dirhandle be a filehandle-like iterator?

2007-05-01 Thread Luke Palmer
On 5/1/07, Smylers [EMAIL PROTECTED] wrote: What are the situations in which a programmer really needs to open something but doesn't know wether that thing is a file, a directory, or a URL? I'm still unpersuaded this is sensible default behaviour. Lots of times. It's an agnosticism, meaning

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

2007-04-27 Thread Luke Palmer
On 4/27/07, Larry Wall [EMAIL PROTECTED] wrote: : Are you sure you want to guarantee left-to-right starting : position order? If there are multiple processors available, and : in a lazy context, it may be preferrable to not guarantee any : order. Then, if one processor that starts at a later

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

2007-04-17 Thread Luke Palmer
On 4/17/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Note that unless no longer allows an else Hmm, that's interesting. I don't _think_ I'm opposed, but maybe I am. The main case that I can see this limiting me is where I like to put my error conditions at the end of my code, out of the

Re: File test operators as Pairs

2007-04-13 Thread Luke Palmer
On 4/13/07, brian d foy [EMAIL PROTECTED] wrote: Which then makes me think I'd want to do something a bit wacky to see if the modtime is greater than 5: doc ~~ M = any( 5 ..* ); Or even doc ~~ M = (5..*). Then again, (doc ~~ :M) ~~ 5..* does the same thing, without having to have pattern

Re: for ... else

2007-03-02 Thread Luke Palmer
On 3/2/07, Thomas Wittek [EMAIL PROTECTED] wrote: Today I stumbled upon the Perl5 module For::Else. It adds an else block to a foreach loop: foreach my $item (@items) { #process each item } else { #handle the empty list case } I find it a very nice addition as I've written code

Re: [S09] Whatever indices and shaped arrays

2007-02-23 Thread Luke Palmer
On 2/23/07, Jonathan Lang [EMAIL PROTECTED] wrote: ' I'm still debating the boolean context myself. I _think_ it will work; but I have a tendency to miss intricacies. You might instead want to require someone to explicitly check for definedness or existence instead of merely truth; or you

Re: Y not

2007-02-21 Thread Luke Palmer
On 2/21/07, Thomas Wittek [EMAIL PROTECTED] wrote: Damian Conway schrieb: If the very much more readable 'zip' and 'minmax' are to be replaced with 'ZZ' and 'MM', then I think that's a serious step backwards in usability. Fully agree here and I think that there are still even more places,

Re: The S13 is commutative trait

2007-01-16 Thread Luke Palmer
On 1/16/07, Dave Whipp [EMAIL PROTECTED] wrote: Synopsys 13 mentions an is commutative trait in its discussion of operator overloading syntax: Binary operators may be declared as commutative: multi sub infix:+ (Us $us, Them $them) is commutative { myadd($us,$them) } A few

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

2007-01-08 Thread Luke Palmer
On 1/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: +Set Subsetsubset .any === X.all +Set Superset superset.any === X.all I think these should be reversed. Since function application is commonly read of, this: Set(2,3) ~~

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

2007-01-07 Thread Luke Palmer
On 1/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote Author: larry Date: Sun Jan 7 00:50:30 2007 New Revision: 13515 Modified: doc/trunk/design/syn/S03.pod +$_$xType of Match Implied Match if +=== = = +Any

Patterns

2007-01-05 Thread Luke Palmer
I propose that we remove the following two lines from the smart match table in S03: HashAny hash entry existence exists $_{$x} Array Any array contains item* any($_) === $x These are the two lines with Any on the right side. I want to remove these so that we can

Re: Non-integers as language extensions (was Re: Numeric Semantics)

2007-01-04 Thread Luke Palmer
On 1/4/07, Darren Duncan [EMAIL PROTECTED] wrote: It occurs to me that, while they still need privileged support in Perl 6 the language, non-integer numbers aren't actually all that important as far as implementing the language core goes. Well, that's true to an extent. It's also true that we

Re: Numeric Semantics

2006-12-31 Thread Luke Palmer
On 12/31/06, Darren Duncan [EMAIL PROTECTED] wrote: For example, we could have: div - integer division mod - integer modulus / - number division % - number modulus Or alternately: idiv - integer division imod - integer modulus ndiv - number division nmod - number

Numeric Semantics

2006-12-29 Thread Luke Palmer
When do we do integer/rational math and when do we do floating point math? That is, is 1 different from 1.0? Should 10**500 be infinity or a 1 with 500 zeroes after it? Should 10**10**6 run out of memory? Should say (1/3)**500 print a bunch of digits to the screen or print 0? These are just

Re: RAII in Perl6/Parrot

2006-12-18 Thread Luke Palmer
On 12/18/06, Blair Sutton [EMAIL PROTECTED] wrote: I agree entirely that not all objects need this capability but some certainly do. That is, the capability to execute code once every reference of an object has been removed. Could you point to, or give an example of the Perl 6 way for doing

Re: supertyping

2006-12-13 Thread Luke Palmer
In spite of Larry's comments, I will continue to entertain this idea until it is solid to myself that I would be comfortable accepting it. On 12/13/06, Jonathan Lang [EMAIL PROTECTED] wrote: Agreed. The question is whether you think of a role as a set of methods (intension set) or as a set of

Re: supertyping

2006-12-12 Thread Luke Palmer
On 12/12/06, TSa [EMAIL PROTECTED] wrote: HaloO, Jonathan Lang wrote: In any case, one should never add anything while going from specific to general. The crux of my example is that one indeed adds methods in the supertype. The subtype receives a standard implementation. This pattern is

Re: supertyping

2006-12-12 Thread Luke Palmer
On 12/13/06, Luke Palmer [EMAIL PROTECTED] wrote: Things work a little differently for required methods. When a superrole requires a method be implemented, we (the language designers) have a choise to make: it is illegal if the superrole requires a method that the subroles don't implement

Re: Don't tell me what I can't do!

2006-10-02 Thread Luke Palmer
On 10/2/06, Jonathan Lang [EMAIL PROTECTED] wrote: I'm not used to programming styles where a programmer intentionally and explicitly forbids the use of otherwise perfectly legal code. Is there really a market for this sort of thing? This reminds me of the endless student proofs that trisect

Re: Common Serialization Interface

2006-09-27 Thread Luke Palmer
On 9/27/06, Aaron Sherman [EMAIL PROTECTED] wrote: BTW: for the above, it would be nice to be able to say: when m:i/^perl$/ {...} without all the noise. That is, it would be nice to have something like: when 'perl':i {...} Well, there are a few ways to do that: given lc

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

2006-09-26 Thread Luke Palmer
On 9/25/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Log: Slaughter of special [,], now is just listop form of [...] To support |func() syntax, | is the new * (desigilized) Woohoo! I was about to complain about this whole capture sigil nonsense, but I'm guessing somebody else already did.

Re: Capture sigil

2006-09-20 Thread Luke Palmer
On 9/20/06, Larry Wall [EMAIL PROTECTED] wrote: Conjecture: We need a corresponding sigil to request captureness. As with @ and %, you can store a capture in a $ to hide it, but we don't have the ability to have capture variables that know how to behave like captures without fakey syntactic

Re: multi method dispatching of optional arguments (further refined)

2006-09-02 Thread Luke Palmer
I don't follow your examples. What is the logic behind them? On 9/3/06, Mark Stosberg [EMAIL PROTECTED] wrote: Examples: Arguments (1 2) to signatures 1. (@a?) and 2. (@a) calls 2 For example, I would expect this one to be ambiguous, because the 1. (@a?) sub introduces two different

Re: Naming the method form of s///

2006-08-31 Thread Luke Palmer
On 8/31/06, Juerd [EMAIL PROTECTED] wrote: Still, though, How would you specify :g? It doesn't make a lot of sense on rx// -- just like you can't use it with qr// in Perl 5. It is a good point that it doesn't belong on the regex. Perhaps: $foo.subst(/bar/, baz, :g) That seems to work,

Re: clarifying the spec for 'ref'

2006-08-25 Thread Luke Palmer
On 8/25/06, Mark J. Reed [EMAIL PROTECTED] wrote: Why not? Is it any weirder than simply changing that functionality beyond recognition? You can always fake removing functionality even if the language doesn't actually support it. Yes, yes, of course. That is not the issue. We are trying to

Re: clarifying the spec for 'ref'

2006-08-25 Thread Luke Palmer
On 8/25/06, Daniel Hulme [EMAIL PROTECTED] wrote: That's because you're used to one way of thinking about class inheritance: that the subclass can do everything that the superclass can do, and more. In this scheme, you might have a Square class, with a field representing its corner and another

Re: Same-named arguments

2006-08-25 Thread Luke Palmer
On 8/25/06, Michael Snoyman [EMAIL PROTECTED] wrote: I asked this same question on perl6-users, but no one really seemed to have a definitive answer, so please forgive me for reasking. I was wondering how named arguments would work when parameters of different types had the same name, ie sub

Re: My first functional perl6 program

2006-08-24 Thread Luke Palmer
On 8/23/06, Larry Wall [EMAIL PROTECTED] wrote: Yes, that should work eventually, given that hypers are supposed to stop after the longest *finite* sequence. Shudder xx * What the hell does that mean!? Let me posit this: @a = 0..42; @b = list_of_twin_primes(); (@a = @b).length; Is

Re: My first functional perl6 program

2006-08-24 Thread Luke Palmer
On 8/24/06, Mark J. Reed [EMAIL PROTECTED] wrote: I found your rant a bit long on vehemence and short on coherence, Luke, but if I understand you correctly, your complaint is that this is finite: @finite_list = @infinite_list while, according to S03, this is long: @short_list = @long_list

Re: clarifying the spec for 'ref'

2006-08-24 Thread Luke Palmer
On 8/24/06, Mark J. Reed [EMAIL PROTECTED] wrote: On 8/24/06, Luke Palmer [EMAIL PROTECTED] wrote: Well, actually Array would be a subtype of Array::Const, not t'other way round. Why? That makes no sense to me. An Array isn't a variety of constant Array; a constant Array is a variety

Re: clarifying the spec for 'ref'

2006-08-23 Thread Luke Palmer
On 8/23/06, Larry Wall [EMAIL PROTECTED] wrote: you really want: if $a ~~ Array { and that also matches Array::Const, assuming it's derived from Array. Well, actually Array would be a subtype of Array::Const, not t'other way round. That is a little bit disconcerting, because when you

Re: Heredoc issue in pugs.

2006-08-22 Thread Luke Palmer
On 8/22/06, Larry Wall [EMAIL PROTECTED] wrote: print qq:from/FOO/; On a somewhat related, somewhat unrelated note, I am a little bit worried about the false duality of :to and :from. Luke

Re: multi-line comments, C macros, Pod abuse

2006-08-20 Thread Luke Palmer
On 8/20/06, Andrew Suffield [EMAIL PROTECTED] wrote: On Sun, Aug 20, 2006 at 10:50:31AM -1000, Joshua Hoblitt wrote: #{ if $baz { $foo.bar } } To uncomment, remove the # before the {. This is exactly the type of construct that I had in mind. A couple of questions.

Re: multi-line comments, C macros, Pod abuse

2006-08-20 Thread Luke Palmer
On 8/20/06, Luke Palmer [EMAIL PROTECTED] wrote: Well, I think you are being too picky. [snip snarky sarcastic rant] Hmm, perhaps I'm feeling edgy. Or maybe some of the comments reminded me of those rediculously long, whiny threads. Anyway, that was un-called-for. Luke

Re: NEXT and the general loop statement

2006-08-18 Thread Luke Palmer
On 8/17/06, Jonathan Scott Duff [EMAIL PROTECTED] wrote: Depends on when it fires I guess. Your example might be equivalent to this perl5ish: while (1) { $num = rand; print $num; last if $num 0.9; print ,; # NEXT } print \n;

Re: multi-line comments, C macros, Pod abuse

2006-08-18 Thread Luke Palmer
On 8/19/06, Aaron Crane [EMAIL PROTECTED] wrote: You don't actually need a macro in that case: if 0 { q ... } Which, of course, eliminates the original desire to have a code-commenting construct where you just change the 0 to a 1. After all, we already have #{}.

Re: NEXT and the general loop statement

2006-08-17 Thread Luke Palmer
On 8/16/06, Larry Wall [EMAIL PROTECTED] wrote: : Is the output 01234 or 12345? I'd say 01234 on the theory that the 3-arg loop is really saying: $n = 0; while $n 5 { NEXT { ++$n } NEXT { print $n } } and also on the theory that block exiting blocks always run in

Curious corner cases concerning closure cloning

2006-08-14 Thread Luke Palmer
What do these do? for 1,2 { my $code = { my $x; BEGIN { $x = 42 } $x; }; say $code(); } for 1,2 { my $code = { state $x; BEGIN { $x = 42 } # mind you, not FIRST $x++; }; say $code(); say $code(); }

Re: underscores in the core lib

2006-08-11 Thread Luke Palmer
On 8/10/06, Larry Wall [EMAIL PROTECTED] wrote: Yes, it's a design smell. The point of core is to huffman code common things, so something in core with _ should normally either be shorter or out of the core. I don't think I agree. I've been programming in Ruby, and I appreciate all the nice

Fwd: [svn:perl6-synopsis] r10804 - doc/trunk/design/syn

2006-08-11 Thread Luke Palmer
On 8/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Some object types can behave as value types. Every object can produce a safe key identifier (CSKID for short) that uniquely identifies the -object for hashing and other value-base comparisons. Normal objects +object for hashing and other

Re: weak roles

2006-08-08 Thread Luke Palmer
On 8/8/06, Yuval Kogman [EMAIL PROTECTED] wrote: The way it could work is a bit like this: class Mail::TheOneTrueWay { does Mail::SomeAPI is weak { method header; # this method has different semantics for # each role. It

Re: Type annotation on expressions

2006-08-08 Thread Luke Palmer
On 8/8/06, Yuval Kogman [EMAIL PROTECTED] wrote: On Tue, Aug 08, 2006 at 11:12:11 +0100, Daniel Hulme wrote: I may be in a little world of my own here, but isn't this what 'as' is supposed to do? foo($x as Moose); as is a method invocation not a type annotation... It's related, but not the

Re: weak roles

2006-08-08 Thread Luke Palmer
On 8/8/06, Yuval Kogman [EMAIL PROTECTED] wrote: I personally prefer delegates for almost any design dillema, but most CPAN modules aren't that way. Well, what way are they? How else has this problem been solved? snipped stuff about adaptors Yes, this is necessary for anything heavyweight

Re: Type annotation on expressions

2006-08-08 Thread Luke Palmer
On 8/8/06, Yuval Kogman [EMAIL PROTECTED] wrote: It's much more relevant for: fun( $x.foo :: Bar ); in order to annotate the return type for a call's context even if the 'fun' function's signature accepts Any. Touche, this is independent of type inference. I'm not up-to-date on

Re: weak roles

2006-08-08 Thread Luke Palmer
On 8/8/06, Yuval Kogman [EMAIL PROTECTED] wrote: My original idea was that this is again an ambiguity error - without the helper function stating which role it's using it cannot dispatch the header method at all, since it's in a role-conflicted state. The difference, though, is that this

Re: Perl 6 built-in types

2006-04-27 Thread Luke Palmer
On 4/28/06, Larry Wall [EMAIL PROTECTED] wrote: How about Bag, a set container? Alternately what we really want is just a Hash where the type of the value is defined as 1, so it need not be stored at all. Then most of the syntax for it just falls out of Hash syntax, unless you like writing $x

Re: 'temp $x;' with no assignment

2006-04-06 Thread Luke Palmer
On 3/27/06, Larry Wall [EMAIL PROTECTED] wrote: The p5-to-p6 translator will turn local $x; into temp undefine $x; Are you sure that that's not: undefine temp $x; It seems to me that the other way would undefine $x and then temporize it. Luke

Re: Do junctions support determining interesections of lists

2006-04-04 Thread Luke Palmer
On 4/4/06, Larry Wall [EMAIL PROTECTED] wrote: On the other hand, if junctions really are sets of sets, then maybe it's a mistake to autocoerce junctions to sets by swiping their internal set of values. Arguably any(1,2,3) should coerce not to (1,2,3) but to ( (1),

Fwd: Set Theory (Was: Do junctions support determining interesections of lists)

2006-04-04 Thread Luke Palmer
On 4/4/06, Jonathan Lang [EMAIL PROTECTED] wrote: OK, then; what would be the specification for a _single_ set that contains everything that doesn't intersect with a corresponding all() Junction (the sort of thing that I'd use if I wanted to find the largest subset of A that doesn't intersect

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

2006-04-03 Thread Luke Palmer
On 4/3/06, Amos Robinson [EMAIL PROTECTED] wrote: This is perl 6, right? my %hash; $hash{foo}{bar} - shouldn't it be %hash{foo}{bar}? %hashfoobar even. Luke

Re: Named Subroutine return values

2006-02-23 Thread Luke Palmer
On 2/24/06, Damian Conway [EMAIL PROTECTED] wrote: No. One of the available TRAITS is Creturns RETTYPE. So you can always specify a postfix return type, even without a declarator: sub data() returns Str {...} The declarator is only needed if you want to prefix your return type

Re: Instance attributes collision

2006-02-13 Thread Luke Palmer
On 2/13/06, Yiyi Hu [EMAIL PROTECTED] wrote: For perl 6, Array and Scalar are in different namespace. So, class A { has $.a; has @.a }; what will A.new.a return by default? That's a compile time error. Both has declarations generate a method a, so it is a method conflict. Luke

Re: Typo Alert: Synopsis 5

2006-02-13 Thread Luke Palmer
On 2/13/06, Amos Robinson [EMAIL PROTECTED] wrote: I think there's a typo in synopsis 5, Indirectly quantified subpattern captures: [ (\w+) \: (\w+ \h+)* \n ]**{2...} I have a feeling the \h should be *, not +. It looks like you're right. Thanks, fixed. Luke

Re: Instance attributes collision

2006-02-13 Thread Luke Palmer
On 2/13/06, Juerd [EMAIL PROTECTED] wrote: Luke Palmer skribis 2006-02-13 9:36 (+): That's a compile time error. Both has declarations generate a method a, so it is a method conflict. Doesn't normally double declaration end in the later masking/overriding the earlier declaration

Re: Smart match table

2006-02-08 Thread Luke Palmer
On 2/7/06, Robin Houston [EMAIL PROTECTED] wrote: Any undef undefinedmatch if !defined $a Any Regex pattern matchmatch if $a =~ /$b/ Code() Code()results are equalmatch if $a-() eq $b-() Any Code()simple closure

Re: overloading the variable declaration process

2006-02-06 Thread Luke Palmer
On 2/6/06, Larry Wall [EMAIL PROTECTED] wrote: This is mostly motivated by linguistics rather than computer science, insofar as types/classes/roles in natural language are normally represented by generic objects rather than meta objects. When I ask in English: Can a dog bark? that's

Re: something between state and my

2006-02-02 Thread Luke Palmer
On 2/3/06, Dave Whipp [EMAIL PROTECTED] wrote: sub factorial(Int $x) { temp state Int $result = 1; $result *= $x; factorial $x-1 if $x 2; return $result if want; } say factorial 6; That's precisely what env variables are for. The right way: sub

Re: Macros?

2006-01-29 Thread Luke Palmer
On 1/29/06, Yuval Kogman [EMAIL PROTECTED] wrote: Aside from that they are normal perl 6 subroutines, that simply get invoked during compile time instead of during runtime. With one extra feature. By default (my preference) or with a trait, parameters can get passed in as ASTs instead of real

Re: Perl 6 OO and bless

2006-01-19 Thread Luke Palmer
On 1/19/06, Rob Kinyon [EMAIL PROTECTED] wrote: OOP is all about black-box abstraction. To that end, three items have been identified as being mostly necessary to achieve that: 1) Polymorphism - aka Liskov substitutability 2) Inheritance - aka specialization 3) Encapsulation P5

Re: Do chained comparisons short-circuit?

2006-01-18 Thread Luke Palmer
On 1/19/06, Joe Gottman [EMAIL PROTECTED] wrote: 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

Re: Indeterminate forms for the Num type.

2006-01-17 Thread Luke Palmer
On 1/17/06, Audrey Tang [EMAIL PROTECTED] wrote: I personally like having 0/0 be NaN and 1/0 be Inf (as in JavaScript), but all of Python/Perl/Ruby/Scheme/OCaml throws exceptions for them... I believe we've been through this before. We go with a standard, probably IEEE, horridly mathematically

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Luke Palmer
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: I'm trying to work out if there's a clever perl6 way to write this using pattern matching: for @*ARGV - -f, $filename { $filename .= absolute_filename; } There is, but it's a different kind of pattern matching: if @*ARGV ~~ / ,

Array Holes

2006-01-13 Thread Luke Palmer
In perl 5: my @a = (1,2,3); delete $a[1]; print exists $a[1]; This is false, whereas $a[0] and $a[2] do exist. This is creepy. Not only is it creepy, it raises a whole bunch of questions with nontrivial answers: * does [EMAIL PROTECTED] include nonexistent elements? * does

Re: Pattern matching on arrays and for loops

2006-01-13 Thread Luke Palmer
On 1/13/06, Dave Whipp [EMAIL PROTECTED] wrote: What happens if I simply abandon the attempt at anonymous MMD and use a named multi-sub, instead: { my multi sub process_arg(-f, Str $f is rw) { $f .= absolute_filename } my multi sub process_arg(--quux, Str arg1, Str arg2) {

Re: Table of Perl 6 Types

2006-01-12 Thread Luke Palmer
On 1/12/06, Jonathan Lang [EMAIL PROTECTED] wrote: I think that Dave has a point about a Range[Real] being an infinite set: According to DWIM, if I see 4.5..5.7, I don't think of 4.5, 5.5; I think of numbers greater than or equal to 4.5 but less than or equal to 5.7. Likewise, 4.5^..^5.3

Re: facades, use_ok, and lexical export

2006-01-09 Thread Luke Palmer
On 1/9/06, Gaal Yahas [EMAIL PROTECTED] wrote: sub use_ok($module) { eval package {caller.package}; require etc.; } I'd like to see a nice interface to scopes in general. That is, we would have a scope object which would provide access to all the lexical scopes and the package

Re: Junctions again (was Re: binding arguments)

2006-01-04 Thread Luke Palmer
On 1/4/06, Rob Kinyon [EMAIL PROTECTED] wrote: Luke Palmer wrote: The point was that you should know when you're passing a named argument, always. Objects that behave specially when passed to a function prevent the ability to abstract uniformly using functions.[1] ... [1] This is one

Re: Junctions again (was Re: binding arguments)

2006-01-03 Thread Luke Palmer
On 1/4/06, Jonathan Lang [EMAIL PROTECTED] wrote: And I'm almost sure that I agree with him. It's too bad, because except for that little detail, fmap was looking pretty darn nice for junctions. Not really. If I read the fmap proposal correctly, You didn't :-) if any($x, $y, $z)

Re: Junctions again (was Re: binding arguments)

2006-01-02 Thread Luke Palmer
On 1/2/06, TSa [EMAIL PROTECTED] wrote: But I have no idea for this nice syntax, yet. Perhaps something like my junc = any(1,2,3); my $val = 1; if junc( infix:==, $val ) {...} which is arguably clumsy. I don't think anyone would waste his time arguing that. :-) The part that

$/ and $! should be env (and explanation of env variables)

2006-01-01 Thread Luke Palmer
I propose that we change $! (formerly global) and $/ (formerly implicitly lexical) to being env variables. Here is the IRC conversation where Audrey convinced me: http://colabti.de/irclogger/irclogger_log/perl6?date=2006-01-01,Sunsel=1213#l1893 Let me explain env variables, because my

Rules should be independent of evaluation strategy

2006-01-01 Thread Luke Palmer
Recursive descent is slow, and it produces bad error messages unless you are very careful with your commit calls, but it is very flexible and (locally) predictable. Predictive parsing is faster and produces fantastic error messages, and is fairly flexible. Bottom up parsing is very flexible, but

Re: Match objects

2005-12-26 Thread Luke Palmer
On 12/26/05, Patrick R. Michaud [EMAIL PROTECTED] wrote: On Fri, Dec 23, 2005 at 02:09:19PM +, Luke Palmer wrote: x ~~ / [ [ (x) ]* ]* / As I understand things, $/[0][0] would be x. Hmm, that seems wrong. Consider: xxxyxxyxy ~~ / [ [ (x) ]* (y) ]* / I argue

Re: Match objects

2005-12-26 Thread Luke Palmer
On 12/26/05, Patrick R. Michaud [EMAIL PROTECTED] wrote: I argue that by the structure of that rule, you should be able to tell which xs go with which y. ... Is there a counterargument that I'm not seeing? I'd say that if you want a structured rule, it should be written that way, as in

Re: binding arguments

2005-12-24 Thread Luke Palmer
On 12/25/05, Juerd [EMAIL PROTECTED] wrote: foo( named_arg := $value, other_arg := $value, ); I'll point out that Joe's argument is completely moot, because you're not using $s on the named arguments. As a matter of fact, we could double up the := symbol as both

Match objects

2005-12-23 Thread Luke Palmer
What sort of match object should this return, supposing that it didn't infinite loop: x ~~ / [ [ (x) ]* ]* / Should $/[0][0] be x, or should $/[0][0][0] be x? If it's the latter, then when do new top-level elements get added? / [ [ { say +$/[0][] } # is this

Deep copy

2005-12-23 Thread Luke Palmer
Does .clone do deep or shallow copying of objects? I'm going to argue for shallow. I know there's a obvious tendency to say that we should go with deep, because it's useful sometimes. However, I think that would be ignoring the amazing prevelance of the shallow copy idioms in perl 5: [

Re: Deep copy

2005-12-23 Thread Luke Palmer
On 12/23/05, Juerd [EMAIL PROTECTED] wrote: Luke Palmer skribis 2005-12-23 16:16 (+): However, I think that would be ignoring the amazing prevelance of the shallow copy idioms in perl 5: [ @array ] { %hash } It's a great idiom. Not much typing, easy on the eyes and easy

Re: real ranges

2005-12-23 Thread Luke Palmer
On 12/23/05, TSa [EMAIL PROTECTED] wrote: HaloO Everybody, here's a an idea from me about makeing range object a bit like junctions. That is a range object has a $.min and $.max and the following comparison behaviour: str num lt strictly inside -+ gt strictly outside

Re: Iterating over complex structures

2005-12-22 Thread Luke Palmer
On 12/22/05, Michele Dondi Please do not ask me what I have in mind, for I'm not really sure. 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

Problem with dwimmery

2005-12-21 Thread Luke Palmer
Recently, I believe we decided that {} should, as a special case, be an empty hash rather than a do-nothing code, because that's more common. However, what do we do about: while $x-- some_condition($x) {} Here, while is being passed a hash, not a do-nothing code. Should we force people to

Re: handling undef better

2005-12-17 Thread Luke Palmer
On 12/17/05, Darren Duncan [EMAIL PROTECTED] wrote: An undefined value is NOT the same as zero or an empty string respectively; the latter two are very specific and defined values, just like 7 or 'foo'. I definitely agree with you in principle. This is something that has been bugging me, too.

Re: Transliteration preferring longest match

2005-12-15 Thread Luke Palmer
On 12/15/05, Brad Bowman [EMAIL PROTECTED] wrote: Why does the longest input sequence win? Is it for some consistency that that I'm not seeing? Some exceedingly common use case? The rule seems unnecessarily restrictive. Hmm. Good point. You see, the longest token wins because that's an

Re: relational data models and Perl 6

2005-12-14 Thread Luke Palmer
On 12/15/05, Darren Duncan [EMAIL PROTECTED] wrote: I propose, perhaps redundantly, that Perl 6 include a complete set of native Okay, I'm with you here. Just please stop saying native and core. Everyone. rant Remember, syntax in Perl 6 can be stuffed in a library like anything else. You

Re: Fully-qualified symbols and exportation

2005-12-14 Thread Luke Palmer
On 12/15/05, Gaal Yahas [EMAIL PROTECTED] wrote: What should this mean? package Foo; sub Bar::baz is export { ... } The problem is in how callers request this export. use Foo baz; Hmm. My gut reaction is that that is the correct way to request that export. Looks weird,

Re: Flunking tests and failing code

2005-12-06 Thread Luke Palmer
On 12/6/05, chromatic [EMAIL PROTECTED] wrote: On Mon, 2005-12-05 at 07:54 +, Luke Palmer wrote: I wonder if there is a macroey thing that we can do here. That is, could we make: ok(1); is(1, 1); like(foo, /foo/); Into: ok(1); ok(1 == 1); ok

Re: Flunking tests and failing code

2005-12-06 Thread Luke Palmer
On 12/6/05, Luke Palmer [EMAIL PROTECTED] wrote: That still leaves the problem of what to do with fail() and is() in the compiler suite. Here's a handwavey crack at what I was talking about: Ack. Accidentally sent the half written message. Let's try again: my $comparators = set == eq

  1   2   3   4   5   6   7   8   9   10   >