Re: Is there a list out there of all the \n characters?

2017-03-07 Thread Brent Laabs
Also keep in mind that \v matches one character of vertical space in regexes. Though \n can match one or two charcters, but not all of the Unicode vertical space types. On Tue, Mar 7, 2017 at 12:37 AM, H.Merijn Brand wrote: > On Tue, 7 Mar 2017 00:23:38 -0800, ToddAndMargo > wrote: > > > >>> 0

perl6-all@perl.org

2017-03-07 Thread Brent Laabs
Try &?ROUTINE.name -- that should get you the sub's name. On Tue, Mar 7, 2017 at 11:30 PM, ToddAndMargo wrote: > Hi All, > > I am trying to print out the name of the sub I am in. > > Reference: > https://docs.perl6.org/language/variables#index-entry-%26%3FROUTINE > &?ROUTINE Which rout

perl6-all@perl.org

2017-03-08 Thread Brent Laabs
ub LinuxCheck () { print &?ROUTINE ~ " " ~ "$*DISTRO $OS\n"; } >>> >>> >>> rhel linux >>> >>> &?ROUTINE resolves to "", which is not the name of the sub. >>> What am I missing? >>> >>> >>> Many thanks, >>> -T >>> >> > On 03/07/2017 11:42 PM, Brent Laabs wrote: > >> Try &?ROUTINE.name -- that should get you the sub's name. >> >> > Hi Brent, > > Still prints "". Rats! > > Thank you for the help! > -T >

Re: more match humility

2017-03-14 Thread Brent Laabs
I'm not sure what you mean by lexiconical. I can't find any references to it in the official perl documentation (which would technically be lexicanonical, right?). But if you're talking about lexical scope, then yeah, Perl 6 enforces that even more than Perl 5 does by default. On Mon, Mar 13, 20

Re: How to I create a file?

2017-03-21 Thread Brent Laabs
You can create a file by opening a filehandle for writing. $PathAndName.IO.f or $PathAndName.IO.open(:w).close; On Tue, Mar 21, 2017 at 3:01 AM, ToddAndMargo wrote: > Hi All, > > How to I do this bash code in Perl 6? > > if [ ! -f "$PathAndName" ]; then touch "$PathAndName" fi > > I am not find

Re: Are sigils required?

2017-05-25 Thread Brent Laabs
You didn't keep reading far enough. > For information on variables without sigils, see sigilless variables . > https://docs.perl6.org/language/variables#Sigilless_variables On Thu, May 25, 2017 at 11:10 PM, Gabor Szabo wrote: > http

Re: Get Better error message that "is trait on $-sigil variable not yet implemented. Sorry."?

2017-05-26 Thread Brent Laabs
To file a bug in Rakudo, you should email rakudo...@perl.org. If it's a better error message you want, put "LTA Error" in the email subject somewhere. LTA means "less than awesome", because we in Perl 6 land only accept awesome error messages. If you want to actually have the feature, put "[NYI]

Re: zef, zef-j, zef-m

2017-05-29 Thread Brent Laabs
This works without a module on Rakudo: use nqp; my $path = "foo".IO; my $hardlink-count = nqp::stat($path.absolute, nqp::const::STAT_PLATFORM_NLINKS); On Mon, May 29, 2017 at 1:54 AM, Elizabeth Mattijsen wrote: > > On 29 May 2017, at 10:42, Fernando Santagata > wrote: > > > > The three fil

Re: zef, zef-j, zef-m

2017-05-29 Thread Brent Laabs
n 29 May 2017, at 11:22, Fernando Santagata > wrote: > > > > /me sighs: NQP is still so poorly documented! > Believe it or not, this is documented in nqp/docs/ops.markdown in the section under stat. > > > > On Mon, May 29, 2017 at 11:10 AM, Brent Laabs wrote: >

Re: ding!

2017-06-01 Thread Brent Laabs
The lack of sound is probably from your terminal. For instance, iTerm2.app has the "Silence Bell" option in Preferences > Profiles. On macOS, this makes a ding noise: perl6 -e 'run ' or perl6 -e 'run ' On Wed, May 31, 2017 at 9:18 PM, ToddAndMargo wrote: > On 05/31/2017 09:11 PM, Peter Scott w

Re: How do you call the variable types?

2017-06-09 Thread Brent Laabs
I thought: $ is Scalar @ is Array % is Hash & is a function > my $x; say $x.VAR.WHAT; (Scalar) A dollar variable is a scalar. The Scalar type is the the container for the dollar-variables, just like Array is the container for @array and Hash is the container for %hash. Of course we also have th

Re: String to array problem

2017-07-16 Thread Brent Laabs
$ perl6 > my $x='ls -al "Program Files" "Moe Curly Larry"'; ls -al "Program Files" "Moe Curly Larry" > &EVAL( "qww<$x>" ).perl ("ls", "-al", "Program Files", "Moe Curly Larry") How about this? Obligatory: Much EVAL, very danger wow. On Sun, Jul 16, 2017 at 6:03 PM, ToddAndMargo wrote: > On 0

Re: String to array problem

2017-07-17 Thread Brent Laabs
is to say that I wish the Str.words method had a way of applying Perl 6 quoting rules as if it were the qww operator. On Sun, Jul 16, 2017 at 11:34 PM, ToddAndMargo wrote: > On 07/16/2017 07:48 PM, Brent Laabs wrote: > >> $ perl6 >> > my $x='ls -al "Program Files" &

Re: String to array problem

2017-07-17 Thread Brent Laabs
Sun, Jul 16, 2017 at 11:34 PM, ToddAndMargo >> <mailto:toddandma...@zoho.com>> wrote: >>> >>> On 07/16/2017 07:48 PM, Brent Laabs wrote: >>> >>> $ perl6 >>>> my $x='ls -al "Program Files" "

Re: Help me be greedy!

2017-08-04 Thread Brent Laabs
PCRE has the /U flag that reverses the behavior of .* and .*? ( *PCRE_UNGREEDY)* This was always a terrible idea, and is probably the source of your confusion. On Fri, Aug 4, 2017 at 12:38 PM, Brandon Allbery wrote: > Like I said, greedy is the default, *.? says *don't* be greedy. You wanted >

Re: help with map and regexp

2017-09-21 Thread Brent Laabs
You can also use a whatever star with the subst method to avoid the block entirely, and just chain method calls: my @fields = $line.split( ',' ).map: *.subst(/\'/, "", :g).subst(/^\"|\"$/, "", :g); On Wed, Sep 20, 2017 at 11:37 PM, Luca Ferrari wrote: > On Tue, Sep 19, 2017 at 2:43 PM, Timo Pa

Re: Why can't I "write"?

2017-09-23 Thread Brent Laabs
OK, a method is something you call on an object, using a the dot operator. A subroutine is an independent object installed into your current lexical scope. If write was a sub, it would work exactly as you described: 48: my $Handle = open( $DateFile, :rw ) 53: write( $Handle, $OldDateTime

Re: variable size limit?

2017-10-02 Thread Brent Laabs
I'd recommend using less memory in a variable than your system has in physical RAM, or your program will get slow from swapping to disk. I've never had a computer with less than 8MB of memory, so you should be fine. On Mon, Oct 2, 2017 at 6:22 PM, ToddAndMargo wrote: > Hi All, > > I am about to

Re: Is Haskell the right language for teaching FP. No!

2017-10-16 Thread Brent Laabs
It'd probably be just as useful to reply here: https://news.ycombinator.com/item?id=15483195 On Mon, Oct 16, 2017 at 5:03 PM, Norman Gaywood wrote: > Someone should mention perl6 :-) > > http://profsjt.blogspot.com.au/2017/10/is-haskell-right- > language-for-teaching.html > > -- > Norman Gaywood

Re: who own my code?

2017-10-21 Thread Brent Laabs
This depends on the contract you signed with the customer, and laws in your local jurisdiction. As such, it's probably a question more appropriate to ask a lawyer than this list. On Sat, Oct 21, 2017 at 12:57 AM, ToddAndMargo wrote: > On 10/21/2017 12:40 AM, ToddAndMargo wrote: > >> If I write

Re: Naming debate- what's the location for it?

2018-02-08 Thread Brent Laabs
Thanks for the summary of the high points, as there were a large number of low points in previous discussions. Roku is not the only reading for 六 in Japanese, the kun reading is muttsu. So we could become Mupperl. What's the counter word for computer languages, anyway? On Thu, Feb 8, 2018 at 1

Re: Naming debate- what's the location for it?

2018-02-09 Thread Brent Laabs
Might as well follow Apple and Microsoft and call it Perl Ten. Yes, spelled out. On Fri, Feb 9, 2018 at 8:16 PM, Parrot Raiser <1parr...@gmail.com> wrote: > On 2/10/18, Darren Duncan wrote: > > > I think if we want to keep "Perl" in the name we should use "C" as a > precedent. > > Other related

Re: need s/ help

2018-05-01 Thread Brent Laabs
That last one has a special case available, but it's slightly less portable. But afaik it works on all platforms we actually support: > perl6 -e '"screws/nuts/bolts/washers".path.parent.Str.say' screws/nuts/bolts On Tue, May 1, 2018 at 4:37 PM, ToddAndMargo wrote: > On 05/01/2018 04:29 PM, Tod

Re: odd and even

2018-05-01 Thread Brent Laabs
Yeah, that lexiconic section sounded a bit hyperbolic. On Tue, May 1, 2018 at 6:17 PM, Larry Wall wrote: > On Tue, May 01, 2018 at 01:43:44AM -0700, ToddAndMargo wrote: > : The worst thing I had problems with in Perl was folks telling it > : was "Lexiconical". What? I wish they would have also

Re: number of letters question

2018-05-15 Thread Brent Laabs
Just a quick reminder that matches the underscore, because also does. If you want to exclude underscores, you can match against /<+alnum-[_]>/. That adds the alnum character class, but subtracts underscores from it. Decimal points are definitely not alphanumeric, though. On Tue, May 15, 2018

Re: Real, Num, Rat question

2018-05-27 Thread Brent Laabs
Real is a role, not a type. Both Num and Rat happen to do Real, so the type checking is ok. This would work OK with a type too -- you can safely store a Num in a `my Cool $foo` as well. You can't do anything to make the ^name method return Real. There are a few ways to check this, though. The

Re: How to print colorized text to the terminal

2018-06-03 Thread Brent Laabs
You might want to consider using Terminal::ANSIColor. On Sun, Jun 3, 2018 at 5:53 PM, Xin Cheng wrote: > I just tried to use "put" in place of "say", and got the same result. > > Thanks. > > Ziping > > > On Jun 3, 2018, at 8:44 PM, Brandon Allbery wrote: > > "say" uses the .gist method, which q

Re: need sort help

2018-06-08 Thread Brent Laabs
Rename all of the input files using ISO 8601 dates. I can't tell, from looking at those numbers, if the first field is the month or the day, so it's impossible to sort data like that with certainty. On Fri, Jun 8, 2018 at 5:15 PM, ToddAndMargo wrote: > Hi All, > > https://docs.perl6.org/routine

Re: need sort help

2018-06-08 Thread Brent Laabs
log.06-08-2018_17:07:39.zip >>> log.07-08-2018_06:07:39.zip >>> log.07-08-2018_16:07:39.zip >>> log.12-08-2016_06:07:39.zip >>> ) >>> >>> >>> 2016 should be at the top. >>> >>> >>> Many thanks, >&g

Re: need sort help

2018-06-08 Thread Brent Laabs
, Jun 8, 2018 at 6:59 PM, Brent Laabs wrote: > If possible, you should change the way the files come, or rename them when > you get them, or open an issue to use a proper output log format. > > I mean, you can sort like: > @x.sort: { > my $a = $^a ~~ m:g/\d+/; > my $b = $^b

Re: need sort help

2018-06-08 Thread Brent Laabs
It isn't in any variable, @x.sort got called in sink context. You'll have to assign it if you want, maybe use @x.=sort ? I just wanted to give an example of how to solve the problem, not necessarily a working solution. First of all, I did thinko the solution -- element 6 is [5]... and we don't

Re: a `pe4rl6 -c` error to fix

2018-06-20 Thread Brent Laabs
-c does compile time warnings, not runtime warnings. You can't make runtime warnings appear at compile time without using a BEGIN block. On Wed, Jun 20, 2018 at 9:59 PM, Todd Chester wrote: > > > > On Tue, Jun 19, 2018 at 10:50 PM, Todd Chester > wrote: > >> Dear Perl Developers, > >> > >> Wou

Re: I need hash syntax help

2018-09-15 Thread Brent Laabs
Because << >> is a double-quoted index (same as quote words «»), so it interpolates the variable. <> is a single-quoted string, so it doesn't interpolate. But what you really want here is %x{$z}, so you don't bother with string interpolation at all, and pass the String variable directly. On Fri,

Re: need p5/p6 :: help

2018-09-15 Thread Brent Laabs
Now that Larry has spoken on the issue of vocabulary, it's lexicanonical. On Fri, Sep 14, 2018 at 12:49 PM Larry Wall wrote: > On Fri, Sep 14, 2018 at 04:15:02AM -0700, Todd Chester wrote: > : Also, did you answer my question about "::" and did it > : just go over my head? > > The implication wa

Re: [perl #133541] Grammer bug vs

2018-09-28 Thread Brent Laabs
Are you sure about that? Underscore has been part of the specs (synopses) for for at least 10 years, probably longer. > "_" ~~ // 「_」 alpha => 「_」 On Thu, Sep 27, 2018 at 7:52 PM Brandon Allbery wrote: > "_" is not an alphabetic character. It's allowed in "alnum" because that > is by inten

Re: [perl #133541] Grammer bug vs

2018-09-28 Thread Brent Laabs
uot;=== Example=="; > say G0.parse($str); > say "=== Example=="; > say G1.parse($str); > > $ perl6 gentb.p6 > === Example== > Nil > === Example== > 「scbin bar」 > ruport =>

Re: [perl #133541] Grammer bug vs

2018-10-01 Thread Brent Laabs
tr); > > > > $ perl6 gentb.p6 > > === Example== > > Nil > > === Example== > > 「scbin bar」 > > ruport => 「scbin」 > > type => 「scbin」 > >alpha => 「s」 > >alpha => 「c」 > >a

Re: More efficient of two coding styles?

2018-11-15 Thread Brent Laabs
They do two different things. Style 1 will throw a dispatch error if $ node.name has a value of 'three', where Style 2 will do nothing in that case. On Thu, Nov 15, 2018 at 7:55 PM Richard Hainsworth wrote: > Suppose I have a sub called C that runs different code depending > on the content of a

Re: More efficient of two coding styles?

2018-11-15 Thread Brent Laabs
> > Which coding idiom is better in performance terms? > > May be my question is "incorrect", in which case what is the implicit > assumption I am making that should be explicit? > > > On 16/11/2018 12:13, Brent Laabs wrote: > > They do two different th

Re: Function Signatures: Return Types (replace wantarray?)

2015-03-19 Thread Brent Laabs
There is nothing exactly like wantarray in Perl 6. Functions can no longer return different values based on context, because as Darren mentioned above, it's a Bad Thing. There are a few ways of doing something similar by returning mixins, perhaps something like return $num but [$num, $num2]; (w

Re: Language design

2015-06-16 Thread Brent Laabs
Yes, unpredictable performance is a price I'm willing to pay. I'm using a dynamic language after all. If you aren't willing to pay it, just use typed variables. Or even native types, like num or int. Choose your own number representation -- there's more than one way to do it. The design philos

Re: Anonymous multi-subs

2015-06-24 Thread Brent Laabs
I'll just note that you can fake anon multi subs with lexical subs like this: my $sub = do { proto foo (|) { * } multi foo (Int $x) { $x + 1 } multi foo (Str $y) { $y ~ 'a' } &foo; } say $sub("hello"); The sub there is still named "foo" as attested by $sub.name, but isn't availa

Re: Types for Perl 6: request for comments

2015-06-27 Thread Brent Laabs
>> } >> > > Oh yes, nice ... I think I will add it in my paper (and if you send me > your full name I will give credits to you) > > The do block version to make anonymous sub was my work, Brent Laabs. Using lexical subs to emulate anonymous multi subs was the first thing to

Re: Types for Perl 6: request for comments

2015-06-27 Thread Brent Laabs
Subs are lexical by default, so adding my to the function declarators does nothing. Not sure what anon is doing there. My guess is that anon in sink context does nothing, and Rakudo just builds another proto for foo when it sees the first multi. Protos are optional (but not in the compiler itsel

Re: Sub args: choose one of two?

2015-06-27 Thread Brent Laabs
http://design.perl6.org/S99.html#LTA On Sat, Jun 27, 2015 at 5:57 PM, Tom Browder wrote: > On Jun 27, 2015 7:39 PM, "yary" wrote: > > > > This "sort of" works, in that it does the right thing when you give one > > correct arg, and fails when you give neither arg or both args. The error > > mess

Re: String trim method

2015-08-06 Thread Brent Laabs
I think the optimal way would be: my $s = 'yada yada'; That way the program won't have to trim the whitespace off the string every time it is run. In the more general case, I might do it something like: my $s = something-returning-a-string().trim; But I don't think that there really is a

Re: A new problem.

2015-08-12 Thread Brent Laabs
Use « enc => "latin-1" » as an argument to open (method or class form) to change the character encoding. On Wed, Aug 12, 2015 at 8:32 AM, Christian Aperghis-Tramoni < christian.aperg...@lidil.univ-mrs.fr> wrote: > Now I hane rakudo on MoarVM working, I get an error I didn't have formerly > on par

Re: Recalling previous commands

2016-01-01 Thread Brent Laabs
Linenoise is included in Task::Star. https://github.com/tadzik/Task-Star/commit/8ff101ae15 As a bit of history, Linenoise used to be part of the Rakudo repo, but it was split off in the interest of making the base install smaller, keeping separate software separate, and making it more pluggable.

Re: references and pointers jargon question

2016-01-13 Thread Brent Laabs
Nothing is Forbidden! Everything is Permissible! Also it would make it hard to talk about "is repr('CPointer')" and the Pointer type in NativeCall. While underneath the hood Scalar containers have pointers to values, it's not a particularly useful view of Perl 6. It's more useful to use an OO o

Re: My personal benchmark shows no improvement with Rakudo 2016.02

2016-02-22 Thread Brent Laabs
Without a code sample or statistics, there's not much we can do about it. On Mon, Feb 22, 2016 at 4:56 PM, Tom Browder wrote: > Note that my read of a 10 Gb file shows no significant speed-up from > Rakudo 2016.01 to 2016.02. > > Best regards, > > -Tom >

Re: Is this a bug?

2016-09-18 Thread Brent Laabs
Remember you can call a block with parentheses: > say { 11 + 31 }; -> ;; $_? is raw { #`(Block|140268472711224) ... } > say { 11 + 31 }(); 42 On Sun, Sep 18, 2016 at 12:58 PM, Elizabeth Mattijsen wrote: > I think you want: > > .say for reverse lines; > > not sure what you are trying to achie

Re: Can I call myself

2017-02-04 Thread Brent Laabs
I think you're looking for &?ROUTINE. &?BLOCK is also related. https://docs.perl6.org/language/variables#index-entry-%26%3FROUTINE On Sat, Feb 4, 2017 at 12:51 AM, Darren Duncan wrote: > Any decent programming language supports self-recursion, where a > subroutine may invoke itself. Perl 6 ex

Re: List

2017-02-06 Thread Brent Laabs
Here are the docs on the List type: https://docs.perl6.org/type/List On Mon, Feb 6, 2017 at 12:40 PM, Bob Goolsby wrote: > Help > > -- > > Bob Goolsby > bob.gool...@gmail.com >

Re: [perl #133541] Grammer bug vs

2018-09-28 Thread Brent Laabs via RT
Are you sure about that? Underscore has been part of the specs (synopses) for for at least 10 years, probably longer. > "_" ~~ // 「_」 alpha => 「_」 On Thu, Sep 27, 2018 at 7:52 PM Brandon Allbery wrote: > "_" is not an alphabetic character. It's allowed in "alnum" because that > is by inten

Re: [perl #133541] Grammer bug vs

2018-09-28 Thread Brent Laabs via RT
uot;=== Example=="; > say G0.parse($str); > say "=== Example=="; > say G1.parse($str); > > $ perl6 gentb.p6 > === Example== > Nil > === Example== > 「scbin bar」 > ruport =>

Re: [perl #133541] Grammer bug vs

2018-10-01 Thread Brent Laabs via RT
tr); > > > > $ perl6 gentb.p6 > > === Example== > > Nil > > === Example== > > 「scbin bar」 > > ruport => 「scbin」 > > type => 「scbin」 > >alpha => 「s」 > >alpha => 「c」 > >a

[perl #126876] [BUG] t\spec\S32-io\io-spec-win.t fails on Windows 10 with MSVS 2013

2015-12-14 Thread Brent Laabs via RT
> Pull request submitted. I hope this is the right place to do that: > > https://github.com/perl6/roast/pull/87 I approved the pull request. If the tests pass on Windows, this ticket can be resolved.

[perl #126876] [BUG] t\spec\S32-io\io-spec-win.t fails on Windows 10 with MSVS 2013

2016-04-13 Thread Brent Laabs via RT
On Mon Dec 14 09:29:37 2015, labster wrote: > > Pull request submitted. I hope this is the right place to do that: > > > > https://github.com/perl6/roast/pull/87 > > I approved the pull request. If the tests pass on Windows, this > ticket can be resolved. Given the complete lack of activity/comp

[perl #127071] [BUG] Matching a regex in a scalar returns Bool instead of Match

2016-10-26 Thread Brent Laabs via RT
On the original bug, bisectable suggests f457007181bb might have caused this ("allow ~~ to chain where practical") 01:32 labster viki: Thanks for asking, anyway, about Lingua::Number. For bonus points, you can fix the bug: https://rt.perl.org/Ticket/Display.html?id=127071 01:33