Are you aware of the %% operator?
$var %% 2 checks wether it is dividable by 2.
Am 30.04.2018 um 08:47 schrieb ToddAndMargo:
Hi All,
I know it would only take me 25 seconds to write one,
but do we have an odd and even function build in?
Many thanks,
-T
$ perl6 -e 'my $x=3; say $x.odd;'
No
I've changed the code to this, It's better but still not correct.
1) curl with http hangs and must be terminated with Ctrl+C
2) the code now restarts the server socket, which I also dont expect to
happen.
use v6;
use IO::Socket::Async::SSL;
sub auto-restart(Supply $incoming) {
supply {
at dosen't shut down the server,
or leaves the react block, for incomming http traffic or for ssl
negotiation errors that might happen.
Thanks
Martin
$b = B.new; $b.public-method()'
>> priv method
>>
>>
>> 2) but can't write its private members:
>>
>> > perl6 -I. -e 'use A; use B; my $b = B.new; $b.set_private(A.new); $b.r'
>> No such private method '!!private' for invocant of type 'B'
t_private(A.new); $b.r'
No such private method '!!private' for invocant of type 'B'
in method set_private at /home/martin/.workspace/p6/realerror/A.pm
(A) line 24
in block at -e line 1
WHEN! the set_private looks like this:
method set_private(A $a) {
self!private = $a;
}
m the report and
it picks the version up from the module file. Other options like that
seem sensible to me.
Simon
On Wed, 28 Jun 2017, 13:01 Martin Barth, <mar...@senfdax.de
<mailto:mar...@senfdax.de>> wrote:
Hello,
but your approach means you have to state the versi
new; $b.public-method()'
priv method
2) but can't write its private members:
> perl6 -I. -e 'use A; use B; my $b = B.new; $b.set_private(A.new); $b.r'
No such private method '!!private' for invocant of type 'B'
in method set_private at /home/martin/.workspace/p6/realerror/A.pm
(A) line 24
in
module withouth having this
suffix in it?
Am 28.06.2017 um 14:16 schrieb Simon Proctor:
See I'm using mi6 to generate my META6.json file from the report and
it picks the version up from the module file. Other options like that
seem sensible to me.
Simon
On Wed, 28 Jun 2017, 13:01 Martin Barth
Hello,
but your approach means you have to state the version in the META6.json
AND in the Module.pm6 file again. This would be the similar to having
$VERSION in perl5. Shouldnt there be a simpler way?
Am 28.06.2017 um 08:45 schrieb Fernando Santagata:
Hi Martin,
This works for me:
File
Hello everyone,
I wanted to repeat the question that I asked today on #perl6.
I am looking for a way to retrieve the version of a Perl6-Module from
within the module itself.
there is often a our $VERSION in perl5 modules. is this still
idiomatic/a good way to go in perl6
i think the
Hi There,
I am not sure if my RoleType @array; is correct, or if there is a better
way to declare such an array. But I find the error that is happening
when there are no elements in the array confusing on the first sight. It
took me a while to realize that my array was empty and therefore it
with differing
associativity?
Which then would mean that R would have to tweak the precedence slightly, to
avoid an implicit infraction.
So perhaps we could have a rule that meta-ops generate new operators of
marginally looser precedence than the originals?
-Martin
On Sun, 29 Mar 2015, GitHub wrote
Hmmm, what about just implementing mmap-as-string?
Then, assuming the parsing process is somewhat stream-like, the OS will take
care of swapping in chunks as you need them. You don't even need anything
special to support backtracking -- it's just a memory address, after all.
-Martin
On Thu, 14
up front that the test might change.
-Martin
) )
* a logical contradiction (return an unthrown exception)
* a formal error (throw an exception)
-Martin
.
Likewise for AscendingArithmeticIteratorExclusiveTerminalSmartMatch (=)
DescendingArithmeticIteratorInclusiveTerminalSmartMatch () and
DescendingArithmeticIteratorExclusiveTerminalSmartMatch (=).
-Martin
it clear that
BUILDALL is NOT required?
Is there an answer to this conundrum?
-Martin
fan, but that feature has a
particularly wholesome appeal about it.)
-Martin
On Sun, 25 Sep 2011, nore...@github.com wrote:
Date: Sun, 25 Sep 2011 17:33:22 -0700
From: nore...@github.com
To: perl6-langu...@perl.org
Subject: [perl6/specs] ff11f1: define %%; clarify that % is not quantmod
until after the sub returns. (BTW this
would have a lot of benefits for auto-threading code.)
-Martin
,
including sometimes latent ones in ported code.
Duration is a fairly clear example of a dimensioned quantity, and I think we
should think twice about abandoning its dimensionality, and the
restrictions that implies.
-Martin
when the threads
are recombined; the result often won't be what's expected.
Don't get me wrong, I think Junctions are a really clever way of writing
concise conditional expressions, but I think algebraic consistency is
more important than clever conciseness.
-Martin
rule produces the same junction type, or
like !=, where the distributive rule produces the inverse junction type?
Or do we not invert junctions, and run the risk of unexpected
action-at-a-distance instead?
-Martin
, and then A ~~ B just works like ?! (A) xor B, if B is a Bool.
-Martin
PS: I also considered some other possibilities, but I don't like them as
much:
if - VALUE-TO-MATCH {...}
when - VALUE-TO-MATCH {...}
- if VALUE-TO-MATCH {...}
- when VALUE-TO-MATCH {...}
.if VALUE-TO-MATCH {...}
.when
.
To paraphrase Dante, the road to hell is paved with Reasonable Defaults.
Or in programming terms, your reasonable default is the cause of my ugly
work-around.
-Martin
would be written as
Set(Set(X,Y,...))
or perhaps more mathematically as
2 ** Set(X,Y,...)
-Martin
? Well, privacy, trust, ...
-Martin
suggest Predicate as the name of the role which implements a single
true-or-false value (as distinct from a bit, which implements a 0-or-1
value).
-Martin
quadrant, take
them in turns. Extends to 3D and higher in a logic fashion.
But totally useless as a greater than/equal to/less than comparison test.
-Martin
, Martin Kjeldsen wrote:
+if $str ~~ /\x0a$/ {
+$str = $str.substr(0, $str.chars - 1);
Unless newlines are being canonicalized elsewhere, this seems
*nix-specific.
(Sorry I haven't researched further, this just caught my eye in passing;
feel free to ignore
This patch is looping and * .1 instead of dividing. Sorry for not being in git
format-diff format (unified diff instead)
0002-patch-with-multiplication-instead.patch
Description: Binary data
On 07/03/2010, at 14.48, perl6 via RT wrote:
Greetings,
This message has been automatically
On behalf of the Rakudo development team, I'm pleased to announce the
February 2010 development release of Rakudo Perl #26 Amsterdam.
Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine
(see http://www.parrot.org). The tarball for the February 2010 release
is available from
of the mathematical over-bar notation)
⌇ verticle squiggly line
⇅ up-and-down arrow (since it inverts imaginary but not real
parts)
-Martin
of the roles (by passing them through to the appropriate methods on the
original object).
This could be done transparently to formal parameters, so that when they're
used locally they would dispatch the expected method based on the locally
declared type for the object.
-Martin
}
I wonder if this is becoming the new Perl mantra use lexically scoped
pragmata.
perl6 -MCwd=fake ... # legacy behaviour
-Martin
On Thu, 2 Jul 2009, TSa wrote:
Martin D Kealey wrote:
This solves both the human expectation (Would you like wine or beer or
juice? Beer and juice please Sorry...) and the associativity
problem: (a ^^ b) ^^ (c ^^ d) == a ^^ (b ^^ (c ^^ d)).
I don't understand how the associativity
operand (which should be false).
This solves both the human expectation (Would you like wine or beer or
juice? Beer and juice please Sorry...) and the associativity
problem: (a ^^ b) ^^ (c ^^ d) == a ^^ (b ^^ (c ^^ d)).
-Martin
PS: Given that my suggested definition would always return one
, and
- that invariance should be enforced passing a deep immutable clone
(*5) in place of any object that isn't already immutable.
-Martin
Footnotes:
*1: There are many possible reasons, but for example the caller didn't
declare it :readonly in turn to its callers because it *did* plan to meddle
On Fri, 19 Jun 2009, Martin D Kealey wrote:
To that end I would propose that:
- parameters should be read-only AND invariant by default, and
- that invariance should be enforced passing a deep immutable clone
(*5) in place of any object that isn't already immutable.
Sorry, typo
# New Ticket Created by Martin Berends
# Please include the string: [perl #65548]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=65548
Declaring constants and using them in the same file works, but moving
state. Indeterminate states
aren't sufficiently value-like to justify constant folding.
-Martin
, but I hope you get the idea.)
-Martin
)
$x OP none($y,$z) none($x OP $y, $x OP $z)
-Martin
(*1: An argument could be made that none should leave the junction alone,
the same as all.)
(*2: I would like to suggest that the semantics of one be changed to mean
pick one (randomly) rather than exactly one. In this respect it
would
;
# matches for -1 +1
-Martin
after their results are flattened by the junctive operator.
-Martin
# New Ticket Created by Martin Berends
# Please include the string: [perl #64046]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=64046
Unsure whether the following should work, but it doesn't:
perl6 -e 'enum E foo
);
@list = iterator(@list);
But I suspect they should logically be the other way around:
iterator = code.map($signature);
@list = iterator(@list);
@list = @array.for(code);
-Martin
-open ranges.)
-Martin
On Thu, 26 Feb 2009, Martin D Kealey wrote:
On Wed, 25 Feb 2009, Timothy S. Nelson wrote:
I'm in favour of retaining the $[ functionality, but lets give it some
name like $*INDEX_BEGINNING or something like that, so that it's quite
long for people to type :).
Surely the interpretation
?
role OffsetArray[::ElementType = Object;; int $MinIndex = 1]
{
is Array;
has ElementType @.contents;
method circumflex:? [ ] ? (int $index where { $_ = $MinIndex } ) {
return @.contents[$index - $MinIndex];
}
}
-Martin
) would mostly be useful for
expressing solutions to polynomials.
Perhaps we could define infix:± as a range generator and prefix:± as a
set generator:
$y + ±5 # same as ($y - 5) | ($y + 5) (also same as $y - ±5)
$y ± 5# same as ($y - 5) .. ($y + 5)
-Martin
ranges will match; back to the original question, I'd only expect one match
from:
$time ~~ $date-yesterday
$time ~~ $date-today
$time ~~ $date-tomorrow
even if $time falls precisely on midnight.
-Martin
-level code that receives signals and arranges
not to leave a (broken) partially-formed call frame in the chain while
setting up a call frame to invoke the handler function.
-Martin
), and Localtime and Date (which
believe fictions 3 and 4).
For each of these you have corresponding variants of Duration.
So my question is, which of these fictions should the core temporal type(s)
believe or disbelieve? Then we should name them appropriately.
-Martin
PS: IMHO core types should
more :).
Ah, we want a noun that isn't readily confused as an adjective.
Suitable terms might include: Instant Jiffy Juncture Moment Occasion Snap Tick
...
-Martin
On Fri, 20 Feb 2009, Timothy S. Nelson wrote:
On Thu, 19 Feb 2009, Martin D Kealey wrote:
Rather, let's have immutable time values, and methods which return other
values where various computations (*1) have been applied. Provide
constructors which take the Y/M/D/h/m/s/dst_now/dst_rule tuple
/Geneva'), :no_dst );
-Martin
*1: Operations on localtime objects involve differences, offsets and
baselines, expressed in a range of units.
The core units are seconds, minutes and days which are almost-but-not-quite
exact multiples of each other (consider leap seconds (*2) and daylight
saving
).
Question: does/should MMD differentiate between :ro and :rw parameters or
invocants that are otherwise identical?
-Martin
*1: actually it's a bit more complicated; a mutable object can be re-tagged
as immutable iff it's at end-of-life according to data-flow analysis AND all
its contained sub-objects
function parameters (that can't be changed by someone else
while the function is looking at them, even by other threads or coroutines)
* deep auto-cloning mutable container objects into immutable value
ones
* auto-boxing immutable value objects into container objects
-Martin
(*1
On Mon, 16 Feb 2009, Jon Lang wrote:
if there's any doubt about the matter (e.g., conclusively proving or
disproving purity would be NP-complete or a halting problem), then
Deciding whether you have a halting problem IS a halting problem... :-)
-Martin
mistake.
Please read as s/NP-complete/halting problem/g
-Martin
. :-)
-Martin
Moritz Lenz via RT (09:23 2008-12-14):
Martin Kjeldsen (via RT) wrote:
# New Ticket Created by Martin Kjeldsen
# Please include the string: [perl #61308]
# in the subject line of all future correspondence about this issue.
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=61308
file away);
}
}
# can't (or don't need to) give file away
POSIX::chmod $filename, Fcntl::ST_PERM($stat.mode);
POSIX::utime $filename, $stat.mtime, $stat.atime;
}
-Martin
back-traces available? A created_by back-trace
and a thrown_by back-trace?
-Martin
a logical inversion, so that conjunctions
and disjunctions can be alternated?
-Martin Kealey
= split($pat, $src);
return @r[0..$limit-2], join($pat, @r[$limit-1..*]);
}
except of course it works where $pat isn't a string literal, and does sensible
things if $limit is 0 or 1, and is implemented more efficiently.
-Martin
-Original Message-
From: Mark J
If a routine is rw, you may optionally define a single slurpy scalar
(e.g., '*$value') in its signature.
A good start, but why limit the Lvalue to a scalar? A list l-value seems like a
pretty useful thing to me.
-Martin
isn't implemented simply as a singleton reference to a value object (and
there may be good efficiency reasons for this too: think String vs
StringBuf in Java).
-Martin
(*1: At least that one works; is you want to see something that doesn't know
whether it's a value or a container, have a look
the value class automatically). So it makes sense to associate these two
approaches with the suggested Value and Class keywords.
-Martin
(Or you could call them CONSTANT and VARIABLE I suppose; the names aren't
important at this stage
to all who wrote the configuration scripts with portability in mind.
cu,
Martin
[1] for a make/MMS comparison, please see
http://vms.pdv-systeme.de/users/martinv/VMS_Programming_FAQ.html#4.1.
(and yes, the trailing dot is part of the URL)
--
| Martin Vorlaender
to an empty
PMC list) - I'm looking into it.
cu,
Martin
--
O Lord, won't you buy me | Martin Vorlaender | OpenVMS rules!
an HP OS | work: [EMAIL PROTECTED]
its name starts with Open | http://www.pdv-systeme.de/users/martinv/
and ends in VMS ...| home
- then how do you know its going to be so hard to write?
Perhaps the above is a little harsh (and unnecessarily long) but its how
I'd tackle it.
Martin
.
-Martin
in
respect of being an inheritance hierachy? Simply make 'yourHLL' inherit from
'parrot', and the rest follows...
-Martin
.
But how often are these actually likely to be the case, and are there
any other cases?
-Martin
' in
the line
for %bucketswarray.kv - $i, $w {
Is it just me?
Regards
Martin
A. Pagaltzis (10:52 2006-05-24):
my %buckets = (
w = {
count = 4,
scale = 10.5,
},
x = {
count = 6,
scale = 7,
},
y
Hi Aristotle,
A. Pagaltzis (12:12 2006-05-24):
Hi Martin,
* Martin Kjeldsen [EMAIL PROTECTED] [2006-05-24 11:50]:
Just curious does this actually run? I'm trying on pugs 6.2.11
and it complains quite a bit. First of all shouldn't
for %buckets.values - $arg_for
parameter types, the filter can decide which it can implement, and
how.
-Martin
stuff at a language level too.
So can we look towards having things like map and grep be parallel (or
at least unordered) by default?
-Martin
in a corner, scared and shaking.
But maybe I should just get used to that. :-)
Juerd
Martin
. And when the
transaction goes out of scope it needs to be either committed or rolled
back.
-Martin
On Thu, 28 Apr 2005, Luke Palmer wrote:
Or, with the block hooks that I keep claiming makes timely destruction
almost never needed, it is:
{
my $s = new CoolClass;
# ... do stuff that may throw ...
LEAVE { destroy $s }
}
This destroys properly and even
it is not even shared between multiple closures *within* a thread.
-Martin
temporary strings to hold the concatenations, but where
you did have a string that included the appropriate sigil, it could be used
directly by having an empty prefix.
-Martin
perhaps a vtable, with both store for
when we're interpreting, and generate_jit_store for when we're jitting?
-Martin
we're generally after speed,
surely we want to allow for optimisations such as don't store unless
something's changed; this would also be compatible with the boolean context
value of s///.
-Martin
--
CAUTION: The information contained in this message is consequential and
subject to legacy provenance
On Tue, 7 Sep 2004, Leopold Toetsch wrote:
[*] Unless it's a _feature_ that given tied $a,
($a = aaa) =~ s/a/b/g
would call STORE four times (aaa, baa, bba, bbb).
I'd expect two stores here. One for the initial setting of the value and
one for the final result of the global
],
and a concatenation iterator over those. Whether the iterator over [2] is
created over a singleton array or directly from the scalar would seem to be
simply a matter of economy.
-Martin
want to
sleep for a specific time, or wake up at a specific time, and it would be
nice if Parrot didn't rule out making use of that.
-Martin
On Mon, 15 Sep 2003, Dan Sugalski wrote:
Great. But will it also be possible to add methods (or modify them)
to an existing class at runtime?
Unless the class has been explicitly closed, yes.
That strikes me as back-to-front.
The easy-to-optimise case should be the easy-to-type case;
into a direct subroutine call, but I would hope that method
calling will be fast enough that it won't need to.
Will we require methods in subclasses to use the same signatures as the
methods they're overriding?
-Martin
--
4GL ... it's code Jim, but not as we know it.
On Thu, 4 Sep 2003 [EMAIL PROTECTED] wrote:
On Mon, 1 Sep 2003, Michael G Schwern wrote:
You also must worry about volumes.
[my long explanation snipped]
Sorry, wrong list; this is a standard-module issue, not an implementation
issue or even a core-language issue.
-Martin
Windows, MacOS, VMS and even RMX all have POSIX
emulation, do we really care? Maybe we should just have functions for convert
native name to POSIX and convert POSIX name to native and be done with it?
-Martin
[* Ok, an arbitrary number really means a 32-bit number -- or smaller]
PS: don't forget
don't break things by
making them so later.
-Martin
--
Help Microsoft stamp out software piracy: give Linux to a friend today...
require L-valueness.
All this is orthogonal to the concept of object: in C++ an object can be
used to implement either a value (such as string) or a container (such as
vector); it would be nice to be able to do this in P6 too.
-Martin
PS: sorry for the long post...
is desired, and then we'd have to use the long-hand
$ref@[$index] and $ref%[$index] versions?
Hm, actually, I think I could class that as a feature, if the reader --
human or compiler -- could know just by looking whether auto-viv is expected.
-Martin
of the file (one
to the zip archive, another to the unarchiver).
And how is this going to interact with -T or whatever we're going to use?
Under my suggested scheme, the data would be untainted if it's covered by a
verified signature, and tainted if not.
-Martin
, but has anyone else thought about this?
- Martin
be overloadable on a per-arrayish-class
basis, no?
Then what happens to
@A = map { ! $_ } @B, @C;
when @B and @C are different classes?
Does that transmogrify into
@A = ( @B.map { ! $_ }, @C.map { ! $_ } )
or into
@A = [ @B, @C ] .map { ! $_ }
?
-Martin
of visible is that it would make a lexically scoped thing
accessible to an inner dynamic scope at run-time.
By default that would only apply to $_, but the mechanism should be
generalisable to any name.
-Martin
1 - 100 of 114 matches
Mail list logo