Re: '!' versus 'not' in boolean expression

2016-01-25 Thread Carl Mäsak
Tom (>): > In creating some new Perl 6 programs I've run across several instances > I'm confused about, to wit: > > Example 1 > --- > >> my %h; say 'false' if !%h:exists; > Unexpected named parameter 'exists' passed I can explain this one. But it's the kind of explanation that makes a

Re: signatures, multi and named arguments

2015-09-29 Thread Carl Mäsak
the "signatures, multi and named arguments" email on p6u, is that a case of the querent forgetting to ! their nameds? masak: Sounds like; named args serve as a tie-break but you actually have to demand them be present in methods for that to help, given methods accept all named args. * masak

Re: What are Perl 6's killer advantages over Perl 5?

2015-08-28 Thread Carl Mäsak
Moritz (), Tux (): I could continue with other Perl 5 deficiencies (no strict by default, Using strict *STILL* is not enabled by default for perl6 one-liners either: $ perl6 -e'my Int $this = 1; $thıs++; say $this;' 1 $ perl6 -Mstrict -e'my Int $this = 1; $thıs++; say $this;' ===SORRY!===

Re: Is there an equivalent env var to PERL5LIB for Perl 6 module locations?

2015-03-31 Thread Carl Mäsak
It's worth noting that PERL6LIB is at most a developer convenience, shouldn't be encouraged or used by module consumers, and will possibly be deprecated in the future. This is because Perl 6 has a slightly more ambitious view of module loading which isn't directly compatible with OS paths. I use

Re: Can a user cheat and call a class's private method?

2015-03-27 Thread Carl Mäsak
This feels like the same conversation we had earlier this week about accessing private methods. :) But maybe there are still a few new points that can be made. Tom (), Moritz (): I need to test some private routines, so is there a way to do that? The easiest way to do that is when the class

Re: Object Introspection for Existence of Methods: How?

2015-03-23 Thread Carl Mäsak
(resending to p6u) Tom (), Henk (): That doesn't seem to work with private methods. Any trick to accomplish that? What part of 'private' did you mis? Henk, that's an unnecessarily harsh way to say Private methods are private and not visible or testable outside of the class. In my

Re: time and now showing different time?

2015-01-12 Thread Carl Mäsak
Yes, this is why phasers are awesome. They allow you to write code in a natural order, but the phasers will basically time-travel the code around to where you send it. The two `now` calls execute in two completely different environments; the first one in the runtime, the second one during the

Re: Could method calls warn in void context?

2015-01-11 Thread Carl Mäsak
...It could also be taken as a subtle suggestion to write unit tests, in which case you would discover such logical bugs within one red/green/refactor iteration. ;-) // Carl On Sat, Jan 10, 2015 at 10:12 PM, Gabor Szabo ga...@szabgab.com wrote: On Sat, Jan 10, 2015 at 11:02 PM, Moritz Lenz

Re: non-string keys (in a BagHash, for example)

2014-12-01 Thread Carl Mäsak
Theo van den Heuvel (): Perl6 considers all entries as new, and the hash has 3 separate entries. Do I actually have to project my objects to strings to accomplish this? You're putting arrays into a hash. When you put something into a hash, it matters whether the object in question has

Re: non-string keys (in a BagHash, for example)

2014-12-01 Thread Carl Mäsak
Yes, the WHICH method controls how the hashing happens. But the more fundamental principle is that the method always return the same value for the same objects. This tends to be implemented by returning either (a representation of) the reference, or the value itself (which must then not be

Re: how to handle debug code?

2014-01-04 Thread Carl Mäsak
Richard (): What am I doing wrong? Passing constant strings into the macro, instead of code. masak r: macro m($code) { quasi { {{{$code}}} } }; class A { m(has $.x is rw) }; say A.new(:x('OH HAI')).x camelia rakudo-parrot e32249, rakudo-jvm e32249: OUTPUT«OH HAI␤» * masak replies to the p6u

Re: hyperoperator bug? «~» != ~

2013-03-04 Thread Carl Mäsak
No, both programs are wrong, not correct. The bug is that Rakudo accepts the first one, not that it rejects the second one. The error message to the second one looks correct to me. (It tries to hash-index the list of stuff the .map generated.) masak r: .say for (1, 2, 3) ~ !; .say for (1, 2, 3)

Re: Per-Object Roles..

2013-03-04 Thread Carl Mäsak
Frank (), Moritz (): Hi, I am new to Perl6 and I'm interested in the feature that allows you to add roles to classes. From what I understand you can add a role to an object using the does keyword. Is there any way you can remove a role or No, you cannot remove roles. However, if you want

Re: implementing every(N)

2013-01-07 Thread Carl Mäsak
Ted (): Are state variables available now, or is the every(N) functionality possible in some other way now? Why not try it by writing a small program? :) Rakudo is available at a discount right now -- download it before it's too late! -- and the syntax for state variables is the same as it's

Re: s:g/T/U/ doesn't work ?

2012-10-24 Thread Carl Mäsak
Marc (): hello perl6 people, On This is perl6 version 2012.09.1 built on parrot 4.6.0 revision 0 When i try to run use v6; use Test; for 'GATGGAACTTGACTACGTAAATT' { s:g/T/U/; is $_ , 'GAUGGAACUUGACUACGUAAAUU' , 'RNA'; } I

Re: More bugs or PEBKAC

2011-09-05 Thread Carl Mäsak
1parrota (), Carl (): $ perl6 -e 'say Yo; if !{...}  { say Bye} ' Yo $ perl6 -e 'say Yo; if {...}  { say Bye} ' Yo Bye #       The opposite to what I'd expect, if ... returns failure Same base cause as your first example above. Similarly wrong. Oops, I jumped the gun on this one, and

Re: Criteria for production-ready?

2011-04-16 Thread Carl Mäsak
gvim (): Does there currently exist a set of criteria by which Perl6, or an implementation thereof, can be defined as production-ready? Not just one set of criteria, but lots of sets of criteria. Some of these sets have already gone from showing a no flag to showing a yes flag in the past few

Re: Pack in perl6

2011-02-13 Thread Carl Mäsak
Richard (): I came across the idiom print P4\n$w $h\n; for my $y (0..$h-1) {    print pack 'B*', pack 'C*', map dot($_, $y), 0..$w-1; } in a perl5 program for outputting dots in a graphical format. dot() produces a 0 or -1. I found the 'pack' function in perl6, but it does not seem to

Re: Things to Implement for Rakudo

2011-01-06 Thread Carl Mäsak
Guy (): I may have asked them why they did not map (A,C,G,T) - (0,1,2,3) but since then, I've learned more about what GC-content implies in terms of chemistry -- it also seems to have evolutionary implications, about which I know nothing. With this I can help at least, being schooled in

Announce: Rakudo Perl 6 development release #30 (Kiev)

2010-06-17 Thread Carl Mäsak
contributors and sponsors for making Rakudo Perl possible, as well as those people who worked on parrot, the Perl 6 test suite and the specification. The following people contributed to this release: Patrick R. Michaud, Moritz Lenz, Jonathan Worthington, Solomon Foster, Patrick Abi Salloum, Carl

Re: Perl6 confused about module name

2010-03-02 Thread Carl Mäsak
Victor (): Why it asks for Opendir.pir instead of Opendir.pm ? Any clue ? Short answer: Rakudo has regressed and doesn't support loading .pm modules at the moment. You're probably on the Amsterdam (February) release. I suggest using the Minneapolis (January) release until Rakudo regains this

Re: trouble building rakudo

2009-11-22 Thread Carl Mäsak
Paul (): I try building rakudo from git clone git://github.com/rakudo/rakudo.git but during make it hangs forever (12+ hours) at    /usr/local/bin/parrot  perl6_s1.pbc --target=pir src/gen_setting.pm src/gen_setting.pir While it hangs at that line the linux (Debian 5.0 Lenny) box starts

Rakudo Perl 6 development release #23 (Lisbon)

2009-11-19 Thread Carl Mäsak
Announce: Rakudo Perl 6 development release #23 (Lisbon) On behalf of the Rakudo development team, I'm pleased to announce the November 2009 development release of Rakudo Perl #23 Lisbon. Rakudo is an implementation of Perl 6 on the Parrot Virtual Machine (see http://www.parrot.org). The tarball

Announcing pun (Re: rakudo-current loop 2-3 orders of magnitude slower than perl 5?)

2009-06-05 Thread Carl Mäsak
Steffen (), Fagyal (): However, performance is an issue. I would not mind running into bugs, writing some extra code to work around missing stuff, etc., but right now it is just hard to find any projects (for me - YMMV) where performance would not be a blocker. I suggest to start using it as

Re: the file slurping is not working

2009-06-05 Thread Carl Mäsak
Daniel (), Leon (), Daniel (): Then why is it that .get works fine for $*IN? while $*IN.get - $line {       say $line } Because you're using a while loop instead of a for loop ;-) Worse. The code I wrote has a subtle but horrible error. The condition will fail as soon as you hit a blank

Announcing Form

2009-03-16 Thread Carl Mäsak
I'd like to take this opportunity to announce Form[1], a Perl 6 project by Matthew Walton. It's a port to Perl 6 of Damian Conway's Perl6::Form[2], and is meant to replace the Cformat built-in in Perl 5.[3][4] Form is still in its early stages, but is already showing great promise. Consider

Re: perl6 tutorials

2009-03-02 Thread Carl Mäsak
Hej Lars, Lars (): I do not know Perl at all, but I'm very interested in perl6. My problem is I do not find a good tutorial how to do real perl6 development, all I find seems to assume you know perl5 and the perl community. And I do not. That's an interesting question! I guess most of the

Re: perl6 -e 'say Hello World!'

2009-02-02 Thread Carl Mäsak
Jeremiah (): OHAI! I have just built Parrot and perl6 and am just getting started. I'm gonna lurk a little. :) Welcome! Enjoy Perl 6, and let us know if you need clarification or think you've found a bug. There's plenty of people here (and on #perl6 at irc.freenode.net) who can help in

Re: Roles definition

2009-01-18 Thread Carl Mäsak
Илья (): I use role to mix in some functionality for testing: my $s = November::Storage::File.new does Testing; And I have Role definition _after_ this: role Testing { ... } Now this is fall with: Null PMC access in isa() current instr.: 'infix:does' pc 20660 (src/builtins/op.pir:403)

Re: getting the face value of an enum

2009-01-14 Thread Carl Mäsak
Richard (): S12 defines enums and rakudo impliments them, so perl6 enum wkend Sat Sun; my $x = Sun; say $x 1 But suppose I want to get the face value of $x, viz., 'Sun'? How do I get it? say $x.key doesnt work. Far as I know, the answer to your question is unspecced. (Yes, that sucks.

Re: Solution to Games #2

2009-01-11 Thread Carl Mäsak
Richard (): use v6; my %players; my $scores = open('./skaters.txt', :r) or die $!; for =$scores { my ($name,@list) = .split /\,/; %players{$name} = ([+] @list.sort[2..6]) / 5; }; my @ranking = %players.sort: { .value }; for Gold Silver Bronze - $m { given pop @ranking { say $m

Re: Fwd: [november] Re: arrays and arrays ref question

2008-10-31 Thread Carl Mäsak
Guy (), Carl (), Moritz (): for @($ar) { ... } This would arguably be the nicest variant. Well, actually, by this I meant all three variants that Moritz suggested. :) for @$ar { ... } or even for @ $ar { ... } or for @($ar) { ... } Guy (): for ( @$ar ) { ... } ? That's Moritz'

Re: Precompilation to PIR

2008-10-27 Thread Carl Mäsak
Chris (): How safe is it today to pre-compile Rakudo code to PIR and expect that to behave identically to as if I compiled from .pm at runtime? I believe PCT is just generating PIR anyway, so my initial guess is that there should be no differences. Are there any gotchas, like compile-time

Re: Assigning and passing $/

2008-10-24 Thread Carl Mäsak
Chris (): I can't assign $/ to a variable or pass it to a method. Is this a bug, or am I just confused? I think it's a bug. I sent your message along to [EMAIL PROTECTED] // Carl

Re: Recommended Perl 6 best practices?

2008-09-14 Thread Carl Mäsak
Conrad (): Is there something more up-to-date concerning Perl 6 best practices that are presently-recommended (by p6l or @Larry) than the following item on the Perl 6 wiki? If you ask me, best practices evolve as a countering force to enough people using less-than-ideal practices to create

November

2008-08-15 Thread Carl Mäsak
. To learn more, please browse the slides from the YAPC:EU 2008 lightning talk: http://viklund.pp.se/november.pdf November is free, released under the Artistic License 2.0, and available online: http://github.com/viklund/novmber/ Enjoy! // Carl Mäsak Johan Viklund

Re: pugs bugs (or features?)

2007-09-07 Thread Carl Mäsak
Wim (): The following program works fine in pugs r17041 (which is the rev of /usr/bin/pugs on feather): my $r=\{say $x+1}; my $x=2; $r(); With r17041, this gives 3; However, on the latest pugs (r17615 or later), it gives an error: *** Unexpected $r expecting =, ::, context, :

Re: Same-named arguments

2006-08-23 Thread Carl Mäsak
Juerd (), Michael Snoyman (): sub mysub($foo, @foo, %foo) { I hope this is a compile time failure. If not, I'd expect a warning, at least. Why? It looks reasonable IMHO. // Carl