Re: Retry: ITypes and VTypes.

2005-02-05 Thread Brent 'Dax' Royal-Gordon
Alexey Trofimenko <[EMAIL PROTECTED]> wrote: >my $var = "test"; >my @arr := $var; > error? or maybe it would be the same weirdness, like in former example? or > maybe it's a ["test"]? The := operator uses the same rules as parameter passing. So, what do you think this does? sub foo(@

Re: Retry: ITypes and VTypes.

2005-02-05 Thread Alexey Trofimenko
On Fri, 4 Feb 2005 04:09:03 +0800, Autrijus Tang <[EMAIL PROTECTED]> wrote: ... Let's take the first one first, because it is what S06 seems to imply, although it is against Perl5's tie() intuition: my @carton is Scalar; # assuming this is the default Now @carton implements the

Re: CLI signature?

2005-02-05 Thread Johan Vromans
Hi Juerd, [Quoting Juerd, on February 5 2005, 16:57, in "CLI signature?"] > signature ( > Rule $pattern, > bool +$help:short('h'), > Int +$verbose :short('v'), > Str [EMAIL PROTECTED] = <-> > ); The actual parsing still has to happen 'somewhere else'

Re: CLI signature?

2005-02-05 Thread Juerd
Ingo Blechschmidt skribis 2005-02-05 18:52 (+0100): > signature(...) looks like a function/sub call, while it isn't one > really. Macros can do this to a language :) macro signature is parsed /;/ { ... } > Maybe it should be possible to create Signature objects without > creating a sub That

Re: Junctive puzzles.

2005-02-05 Thread Uri Guttman
> "NC" == Nicholas Clark <[EMAIL PROTECTED]> writes: NC> If junctions are sets, and so a|b is identical to b|a, then isn't NC> it wrong for any implementation of junctions to use any NC> short-circuiting logic in its implementation, because if it did, NC> then any active data (such as

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 06:35:55PM +, Nicholas Clark wrote: > If junctions are sets, and so a|b is identical to b|a, then isn't it wrong > for any implementation of junctions to use any short-circuiting logic in > its implementation, because if it did, then any active data (such as tied > thing

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sun, Feb 06, 2005 at 02:30:21AM +0800, Autrijus Tang wrote: > On Sat, Feb 05, 2005 at 02:39:26PM +, Nicholas Clark wrote: > > On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: > > > On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: > > > > > #t and

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 02:39:26PM +, Nicholas Clark wrote: > On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: > > On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: > > > > #t and (0 | 6) < 2 # reduction in boolean > > > > context(!) > > > > >

Re: Semicolons as list separators.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 06:56:00AM -0800, Larry Wall wrote: > Yes, unless it returns [[1],[2],[3]] instead. (What you have written is > context dependent.) Yup. Thanks! Oh, by the way, may I use the infix: operator for creating none() junctions? I was writing pretty-printing code for junction

Re: Some quick questions.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 06:52:49AM -0800, Larry Wall wrote: > Hmm, I believe I said somewhere that references are no longer always true > in Perl 6. So perhaps it's not an exception after all. We're trying > to get rid of as many useless exceptions as possible in Perl 6, after all. Yes, the rele

Re: CLI signature?

2005-02-05 Thread Ingo Blechschmidt
Hi, Juerd wrote: > Ingo Blechschmidt skribis 2005-02-05 17:19 (+0100): >> ...this seems a bit ugly to me. > > The "signature" part, or the signature itself? Because you'll > encounter lists like this all over Perl 6 code anyway... I refered to the way the signature is specified, not the signatur

Re: CLI signature?

2005-02-05 Thread Juerd
Ingo Blechschmidt skribis 2005-02-05 17:19 (+0100): > ...this seems a bit ugly to me. The "signature" part, or the signature itself? Because you'll encounter lists like this all over Perl 6 code anyway... > What do you say about that: > use Getopt::Auto; > run &main; > sub main ( >Rule $pa

Re: CLI signature?

2005-02-05 Thread Juerd
Matthew Walton skribis 2005-02-05 16:20 (+): > Would this actually be any better than the interface provided by > Getopt::Long? I'm not sure if it's *better*. I personally find it easier to read and much easier to remember. It would reduce the number of mini languages needed. Passing argumen

Re: CLI signature?

2005-02-05 Thread Ingo Blechschmidt
Hi, Juerd wrote: > This probably goes against everything a shell based platform wants, > but would it be possible to give the program a sub-like signature? I like that idea very much, but... > signature ( > Rule $pattern, > bool +$help:short('h'), > Int +$verbos

Re: CLI signature?

2005-02-05 Thread Matthew Walton
Juerd wrote: This probably goes against everything a shell based platform wants, but would it be possible to give the program a sub-like signature? I ask this after another painful session of forgetting how things work, reading Getopt::Long's documentation. signature ( Rule $pattern,

CLI signature?

2005-02-05 Thread Juerd
This probably goes against everything a shell based platform wants, but would it be possible to give the program a sub-like signature? I ask this after another painful session of forgetting how things work, reading Getopt::Long's documentation. signature ( Rule $pattern, bool

Re: Semicolons as list separators.

2005-02-05 Thread Larry Wall
On Sat, Feb 05, 2005 at 04:30:58PM +0800, Autrijus Tang wrote: : So it turns out that A03 says that semicolons within "brackets" defaults : to a list-of-list builder. Curiously, it is missing from S03, and the : behaviour is not documented in detail. That's because it's still a bit hand-wavey. :

Re: Some quick questions.

2005-02-05 Thread Larry Wall
On Sat, Feb 05, 2005 at 02:08:32PM +0800, Autrijus Tang wrote: : On Sat, Feb 05, 2005 at 04:44:41AM +0800, Autrijus Tang wrote: : > * What is the value of a reference in any of the scalar contexts? : > : > Currently I'm blindly dereferencing it. : : It seems that I got four out of five correc

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 10:04:02PM +0800, Autrijus Tang wrote: > On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: > > > #t and (0 | 6) < 2 # reduction in boolean context(!) > > > > Why is it allowed to do this? > > Because "and" forces boolean context to determ

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 08:43:10PM +0800, Autrijus Tang wrote: > On Sat, Feb 05, 2005 at 12:38:57PM +, Nicholas Clark wrote: > > Surely you can do better than that for counterintuitive? :-) > > > > 4 < (0 | 6) < 2 > > pugs> ? 4 < (0 | 6) < 2 > (#t|#f) > > Why is it so? Because: > >

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 01:52:05PM +, Nicholas Clark wrote: > > #t and (0 | 6) < 2 # reduction in boolean context(!) > > Why is it allowed to do this? Because "and" forces boolean context to determine whether it short-circuits or not. However, I should've make it clear t

The Number Tower.

2005-02-05 Thread Autrijus Tang
(Again, this is really a language question. Sorry for the hopefully digestible use of internal symbols.) Pugs currently has two numeric types: VInt - Arbitary sized integer VNum - Double-precision point number with NaN and Inf support. Division is done like this: pugs> ? 1 / 3

Re: Junctive puzzles.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 12:38:57PM +, Nicholas Clark wrote: > Surely you can do better than that for counterintuitive? :-) > > 4 < (0 | 6) < 2 pugs> ? 4 < (0 | 6) < 2 (#t|#f) Why is it so? Because: 4 < (0 | 6) and (0 | 6) < 2 (4 < 0 | 4 < 6) and (0 | 6) < 2 # local

Re: Junctive puzzles.

2005-02-05 Thread Nicholas Clark
On Sat, Feb 05, 2005 at 08:33:25PM +0800, Autrijus Tang wrote: > With the note that "b" must be evaluated at most once. However, if > taken literally, it gives this rather weird result: > > pugs> ? 2 < (0 | 3) < 4 > (#t|#t) Surely you can do better than that for counterintuitive? :-) 4

Junctive puzzles.

2005-02-05 Thread Autrijus Tang
(I've just finished the pretty printing part in Pugs, so I'll use actual command line transcripts below. The leading "?" does not denote boolean context -- it's just telling pugs to do a big-step evaluation. Also, boolean literals are written in their Scheme forms.) In S06, the meaning of chaini

Semicolons as list separators.

2005-02-05 Thread Autrijus Tang
On Sat, Feb 05, 2005 at 02:08:32PM +0800, Autrijus Tang wrote: > Here's another quick question: In S03 zip() is used like this: > > for zip(@names, @codes) -> $name, $zip { ... } > > But in S04 it becomes: > > for zip(@a;@b) -> $a, $b { ... } > > Why semicolon? Is it a special form?