HaloO,
Darren Duncan wrote:
But some significant ones I don't know and really want to know:
Bit
Here we could get away with defining two new enums, e.g.
Bit::High and Bit::Low. And I want to pose the question if
we really need two types Bool and Bit.
Blob
Set
Bag
Mapping
HaloO,
[EMAIL PROTECTED] wrote:
The literals for Bit are just 0 and 1.
I doubt that this works. I assume that there are integer calculations
that give the result 1 as an Int. Then comparing these with === to the
literal 1 should fail because the types mismatch:
my Int $x = 7 - 6; #
TSa wrote:
Here we could get away with defining two new enums, e.g.
Bit::High and Bit::Low.
I like that approach. Go the same way as Bool and Order value literals. Don't
know why I didn't think of it before.
And I want to pose the question if
we really need two types Bool and Bit.
I
Hi all,
I occasionally find myself annoyed at having to do something like
this (I use Perl 5 vernacular, but it actually crops up in every
single language I have ever used):
my $i;
@stuff = grep !$_-valid, @stuff;
while ( @stuff ) {
$_-do_something( ++$i ) for @stuff;
On Dec 3, 2008, at 7:14 AM, Aristotle Pagaltzis wrote:
--snip--
Does Perl 6 have some mechanism so I could write it along the
following obvious lines?
my $i;
while ( @stuff ) {
$_-do_something( ++$i ) for @stuff;
}
# plus some way of attaching this fix-up just once
HaloO,
Darren Duncan wrote:
Strong typing in Perl means that Perl is conveniently and reliably
keeping track of this user-intended interpretation of the data, so it is
easy for any piece of code to act on it in a reasonable way. Strong
typing lets user code be clean and understandable as it
* Bruce Gray [EMAIL PROTECTED] [2008-12-03 18:20]:
In Perl 5 or Perl 6, why not move the grep() into the while()?
Because it’s only a figurative example and you’re supposed to
consider the general problem, not nitpick the specific example…
Regards,
--
Aristotle Pagaltzis //
Aristotle Pagaltzis wrote:
* Bruce Gray [EMAIL PROTECTED] [2008-12-03 18:20]:
In Perl 5 or Perl 6, why not move the grep() into the while()?
Because it's only a figurative example and you're supposed to
consider the general problem, not nitpick the specific example…
But how is that not a
OK, so let's look at the general problem. The structure is this:
doSomething();
while (someCondition())
{
doSomethingElse();
doSomething();
}
...and you want to factor out the doSomething() call so that it only
has to be specified once.
Is that correct, Aristotle?
The gotcha is that
On Wed, Dec 3, 2008 at 2:26 PM, Mark J. Reed [EMAIL PROTECTED] wrote:
Overall, the goal is to ensure that by the end of the loop the program is in
the state of having just
called doSomething(), whether the loop runs or not - while also ensuring that
the program is in that
state at the top
On Wed, Dec 03, 2008 at 02:26:57PM -0500, Mark J. Reed wrote:
OK, so let's look at the general problem. The structure is this:
doSomething();
while (someCondition())
{
doSomethingElse();
doSomething();
}
...and you want to factor out the doSomething() call so that it only
has
On Wed, Dec 3, 2008 at 3:05 PM, Patrick R. Michaud [EMAIL PROTECTED] wrote:
It does seem like a closure trait sort of thing, but I don't think
it's currently provided by the p6 spec.
Perhaps PRE ... ?
Isn't PRE { blah; } just short for ENTER { die unless blah; } ?
It still has the problem
oops make that
last if !someCondition();
--
Mark Biggar
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-- Original message --
From: [EMAIL PROTECTED]
loop {
doSomething();
next if someCondition();
doSomethingElse();
}
--
Mark Biggar
On Wed, Dec 3, 2008 at 3:42 PM, [EMAIL PROTECTED] wrote:
loop {
doSomething();
next if someCondition();
doSomethingElse();
}
That loops forever, doesn't it? But I think this works:
loop
{
doSomething();
last unless someCondition();
doSomethingElse();
}
--
Mark J. Reed
On Wed, Dec 3, 2008 at 3:44 PM, Mark J. Reed [EMAIL PROTECTED] wrote:
On Wed, Dec 3, 2008 at 3:42 PM, [EMAIL PROTECTED] wrote:
loop {
doSomething();
next if someCondition();
doSomethingElse();
}
That loops forever, doesn't it? But I think this works:
loop
{
doSomething();
Mark J. Reed wrote:
Mark J. Reed wrote:
loop
{
doSomething();
last unless someCondition();
doSomethingElse();
}
That is, of course, merely the while(1) version from Aristotle's
original message rewritten with Perl 6's loop keyword. As I said, I'm
OK with that, personally, but
On 2008-Dec-3, at 10:18 am, TSa wrote:
Darren Duncan wrote:
Strong typing in Perl means that Perl is conveniently and reliably
keeping track of this user-intended interpretation of the data, so
it is easy for any piece of code to act on it in a reasonable way.
Strong typing lets user code
Mark J. Reed [EMAIL PROTECTED] writes:
OK, so let's look at the general problem. The structure is this:
doSomething();
while (someCondition())
{
doSomethingElse();
doSomething();
}
...and you want to factor out the doSomething() call so that it only
has to be specified once.
Darren Duncan wrote:
Now, with some basic types, I know how to do it, examples:
Bool # Bool::True
Please forgive my ignorance; but are there any cases where
'Bool::True' can be spelled more concisely as 'True'? Otherwise, this
approach seems awfully cluttered.
--
Jonathan Dataweaver
On Wed, Dec 03, 2008 at 02:50:23PM -0800, Jon Lang wrote:
Darren Duncan wrote:
Now, with some basic types, I know how to do it, examples:
Bool # Bool::True
Please forgive my ignorance; but are there any cases where
'Bool::True' can be spelled more concisely as 'True'? Otherwise,
TSa wrote:
Darren Duncan wrote:
Strong typing in Perl means that Perl is conveniently and reliably
keeping track of this user-intended interpretation of the data, so it
is easy for any piece of code to act on it in a reasonable way.
Strong typing lets user code be clean and understandable as
21 matches
Mail list logo