Re: sprintf and print question

2022-09-01 Thread Norman Gaywood
the first four letter s to STDOUT. > $ raku -e 'printf "%.4s\n","andefghi"' ande -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngay

Re: Primitive benchmark comparison (parsing LDIF)

2021-10-28 Thread Norman Gaywood
On Fri, 29 Oct 2021 at 09:14, Norman Gaywood wrote: > > Might have to test this example again on 2021.10 (not easy for me). > I mean, test again on 2021.9 to see if there was a regex speed up in 2021.10 -- Norman Gaywood, Computer Systems Officer School of Science and Technology Univ

Re: Primitive benchmark comparison (parsing LDIF)

2021-10-28 Thread Norman Gaywood
= (split( ": ", $line, 2))[1]; last; } } } say "{%ldap.elems} entries by starts-with in {now - BEGIN now} seconds"; } multi MAIN ( "split", $ldif-fn = "db/icheck.ldif" ) { my ( %f, $k, $v ); for $ldif-fn.

Re: Primitive benchmark comparison (parsing LDIF)

2021-10-27 Thread Norman Gaywood
Oh, and I welcome suggestions on how I might do the task more quickly, elegantly, differently, etc :-) And critiques of the code also welcome. I still have a strong perl5 accent I suspect. On Thu, 28 Oct 2021 at 13:15, Norman Gaywood wrote: > Executive summary: > - comparing raku 2

Primitive benchmark comparison (parsing LDIF)

2021-10-27 Thread Norman Gaywood
k.ldif" ) { my ( %f, $k, $v ); for $ldif-fn.IO.lines -> $line { when not $line { # blank line is LDIF entry terminator %ldap{%f} = User.new( |%f ); # attributes not used are ignored } when $line.starts-with( 'dn: ' ) { %f = () } #

Re: Font used for raku welcome message

2021-08-28 Thread Norman Gaywood
ld. > > Best, Bill. > > On Fri, Aug 27, 2021 at 6:46 PM Norman Gaywood > wrote: > >> Thanks for the suggestions Andinus and James Cloos >> >> In the end I was able to solve the issue by doing: >> >> lsof -p >> >> and examining the ope

Re: Font used for raku welcome message

2021-08-27 Thread Norman Gaywood
graphic): > > [image: image.png] > > While others: > > [image: image.png] > > Does anyone know what font package provides the required font here? > > Pretty sure I have to install this font on the system I'm ssh'ing FROM. > It's correctly displayed ssh&#

Font used for raku welcome message

2021-08-26 Thread Norman Gaywood
: image.png] Does anyone know what font package provides the required font here? Pretty sure I have to install this font on the system I'm ssh'ing FROM. It's correctly displayed ssh'ing from Windows 10. -- Norman Gaywood, Computer Systems Officer School of Science and Technolo

Re: How do a pe-salt an array inside an object?

2021-07-05 Thread Norman Gaywood
ong? > > Many thanks, > -T > > -- > ~~~~~~~~ > If I had a dime every time I didn't know > what was going on, I'd be like, "Why is > everyone giving me all these dimes?" > > -- Norman Gaywood, Computer Systems Officer Scho

gather take eager syntax

2021-04-19 Thread Norman Gaywood
=> 1} > my %h = gather { take eager "foo"=>1; take "bar"=>2;} {foo 1 => bar => 2} > my %h = gather { take eager "foo"=>1} Odd number of elements found where hash initializer expected: Only saw: $(:foo(1),) in block at line 1 -- Norma

Re: qqx with quotes

2020-02-26 Thread Norman Gaywood
T > > > On 2020-02-26 14:16, Andy Bach wrote: > > @Result = qqx { C:/Windows/System32/fsutil.exe usn > > readdata \"$FileName\" }.lines; > > > > Doesn't windows do something special for files with spaces in them? Hm, > > $ type "hi mom" &g

Re: irrational nubmer?

2020-02-20 Thread Norman Gaywood
erl6 -e 'say sqrt(2).Rat.base-repeating();' (1.4 14213197969543147208121827411167512690355329949238578680203045685279187817258883248730964467005076) -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au ht

Re: REPL and arrows problem

2020-01-22 Thread Norman Gaywood
.1.5-2.fc31.x86_64 On Thu, 23 Jan 2020 at 06:21, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > RFE: REPL dependency check for Readline #153 > https://github.com/Raku/problem-solving/issues/153 > > By the way, when you do this, it pops up immediately > on the chat l

Re: REPL and arrows problem

2020-01-21 Thread Norman Gaywood
nenoise` or use rlwrap for a line editor To exit type 'exit' or '^D' > my $history^[[A^[[A This seems like a Fedora 31 packaging problem to me. However, after this: $ zef install Readline The arrow keys once again work for me. -- Norman Gaywood, Computer Systems Officer

Re: Using raku/perl6 as unix "cat"....

2020-01-20 Thread Norman Gaywood
On Tue, 21 Jan 2020 at 03:12, Brad Gilbert wrote: > .say for lines > Since .say calls gist(), would it be not be better/safer to call .put instead? .put for lines -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NS

Re: Need help with a regex

2019-05-06 Thread Norman Gaywood
-T > > > > > > > -- > ~~~~~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~ > -- Norman Gaywood, Computer Systems Officer School of Science and Technology

Re: valid values?

2019-03-04 Thread Norman Gaywood
On Tue, 5 Mar 2019 at 01:23, Brad Gilbert wrote: > > Somewhere on the Internet I layed out the rules that I think that > should normally be followed, but I am not sure where. > Perhaps: https://stackoverflow.com/questions/54338491/string-matching-in-main-parameters -- No

Re: "read" options?

2019-02-03 Thread Norman Gaywood
On Mon, 4 Feb 2019 at 15:12, ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > https://docs.perl6.org/routine/read > > Where is the list of the options this thing will take, such > as :ro and :bin? > > Those are options for open() https://docs.perl6.org/

KEEP/UNDO phaser question

2018-10-27 Thread Norman Gaywood
Just been reading the latest of Elizabeth's wonderful blog posts on how phasers work in perl6: https://opensource.com/article/18/10/how-phasers-work-perl-6?fbclid=IwAR3eJSn5EdJh2DYgpjrFOy7kg-dShuilwQhHDHTANeb4JmHYSBiTz3WyxPA I have question on the KEEP/UNDO example: { KEEP $dbh.commit; UN

Re: EVAL?

2018-06-14 Thread Norman Gaywood
On Fri, 15 Jun 2018 at 06:13, Trey Harris wrote: Thanks for the nice examples of IntStr and friends. I was intrigued with this statement at the end: > Also note that using s/printf at all is not encouraged Could you expand on that? > ​ > -- Norman Gaywood, Computer Systems Offic

Re: How do I remove leading zeros?

2018-06-12 Thread Norman Gaywood
gt; 1 . 2 . 3 > > The second part of the s/// operator is a string (spaces count), not a regex (spaces ignored). > my $x="01.02.03"; $x ~~ s:global/"0"(\d)/$0/; say "$x" 1.2.3 -- Norman Gaywood, Computer Systems Officer School of Science and Technology Un

Re: An operation first awaited

2018-05-28 Thread Norman Gaywood
I've moved this question to stackoverflow https://stackoverflow.com/questions/50573586/perl6-an-operation-first-awaited More comments inline below. On Tue, 29 May 2018 at 01:40, Brad Gilbert wrote: > . > > An operation first awaited: > > in sub MAIN at ./traverse-dir0.p6 line 24 > > in blo

Re: An operation first awaited

2018-05-28 Thread Norman Gaywood
On Mon, 28 May 2018 at 17:24, JJ Merelo wrote: > Hi > > El lun., 28 may. 2018 a las 9:04, Norman Gaywood () > escribió: > >> T""his simple program creates a thread to read a directory with dir() and >> place the files on a channel. $N worker threads read t

An operation first awaited

2018-05-28 Thread Norman Gaywood
T""his simple program creates a thread to read a directory with dir() and place the files on a channel. $N worker threads read that channel and "process" (prints) the files. But I'm getting this "An operation first awaited:" error. I've read the traps page about this error several times, but still

Re: Need match character help

2018-05-17 Thread Norman Gaywood
. >- you are allowed to put a | not only between things, but also at the >very front. This is allowed in the syntax so that you can line things up >vertically like I did. Think of it as similar to allowing a , after the >last element in a list, like with [1, 2, 3, 4, ] &g

Slides for "8 ways to do concurrency and parallelism in Perl 6"?

2018-04-11 Thread Norman Gaywood
There was a talk by Jonathan Worthington at the German Perl Workshop 2018, http://act.yapc.eu/gpw2018/talk/7326 "8 ways to do concurrency and parallelism in Perl 6" I'd be very interested in seeing the slides and/or video of this talk. Anyone know if it is available or will be available anywher

Re: Set difference using hashes vs array

2017-11-22 Thread Norman Gaywood
Talking to myself :-) Seems it has something to do with the values in the hash. If they are just True, this works: $ perl6 To exit type 'exit' or '^D' > my %a= :k, :e, :r; my %r= :r; my %e= :e; my Set $s = %a (-) %r (-) %e; set(k) On 23 November 2017 at 16:20, Norman

Re: Set difference using hashes vs array

2017-11-22 Thread Norman Gaywood
se-10 number must begin with valid digits or '.' in '⏏k' (indicated by ⏏) in block at line 1 > my %a= k=>"k", e=>"e", r=>"r"; my %r= r=>"r"; my %e= e=>"e"; my Set $s = (%a (-) %r) (-) %e; set(k) > my @a= &qu

Set difference using hashes vs array

2017-11-22 Thread Norman Gaywood
tt-a.p6 #!/usr/bin/env perl6 my @excludes = "exclude"; my @all = "keep", "exclude", "remove"; my @remove = "remove"; my Set $take1 = (@all (-) @remove) (-) @excludes; dd $take1; my Set $take2 = @all (-) @remove (-) @excludes; dd $take2; $ ./tt

Re: Nice Channel and thread example

2017-10-30 Thread Norman Gaywood
) in block at ./traverse-dir0.p6 line 12 However, if I change the line 12 to: $dir-channel.close; The program does not throw and exception on this line and runs properly. On 30 October 2017 at 16:58, Norman Gaywood wrote: > Looking at Andrew Shitov's new "Using Perl6" bo

Nice Channel and thread example

2017-10-29 Thread Norman Gaywood
start { while my $file = $dir-channel.receive() { say $file.path; } CATCH { when X::Channel::ReceiveOnClosed { .resume } } } } await $dir-read, @workers; } -- Norman Gaywood, Computer Systems Offic

Is Haskell the right language for teaching FP. No!

2017-10-16 Thread Norman Gaywood
Someone should mention perl6 :-) http://profsjt.blogspot.com.au/2017/10/is-haskell-right-language-for-teaching.html -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au

Re: -f ???

2017-09-28 Thread Norman Gaywood
old verbose: if "eraseme.txt".IO.f { say "exists"; } else { say "does not exist"; } It seems to me it only looks buggy when you are trying to do one liners and you don't naturally get a boolean context. -- Norman Gaywood, Computer Systems Officer School of S

Re: -f ???

2017-09-28 Thread Norman Gaywood
"erasxeme.txt".IO.f It will fail (before the .f even) on the .IO call because "erasxeme.txt" does not exist. perl6 will then throw an exception when you try to use the value of that failed call. So, you need to not "use" the value of the failed .IO call: if not $

[perl #127772] [IO] mkdir($file) succeeds if $file exists and is a regular file

2017-09-19 Thread Norman Gaywood via RT
I'd like to see the same behavior that occurs in perl5. That is: DB<3> mkdir "existingfile" or warn "$!\n" File exists DB<4> mkdir "/" or warn "$!\n" File exists DB<5> mkdir "/root/noway" or warn "$!\n" Permission denied DB<6> mkdir "newdir" or warn "$!\n" DB<7> mkdir "newdir" or warn "$

Re: mkdir not failing appropriately?

2017-09-17 Thread Norman Gaywood
To answer myself, it's a known bug reported over a year ago :-( https://rt.perl.org/Public/Bug/Display.html?id=127772 On 18 September 2017 at 16:18, Norman Gaywood wrote: > $ perl6 -v > This is Rakudo version 2017.07 built on MoarVM version 2017.07 > implementing Perl 6.c. >

mkdir not failing appropriately?

2017-09-17 Thread Norman Gaywood
azinga" } Fail In perl5: DB<3> mkdir "afile" or warn "$!\n" File exists DB<4> mkdir "/" or warn "$!\n" File exists DB<5> mkdir "/root/noway" or warn "$!\n" Permission denied DB<6> mkdir "adir&qu

Re: rw optional parameters

2017-09-16 Thread Norman Gaywood
On 16 September 2017 at 23:29, Elizabeth Mattijsen wrote: > > > On 16 Sep 2017, at 13:32, Norman Gaywood wrote: > > sub MAIN( :$debug = False, :$verbose is rw = False ) { > > ... > > $ ./tt.p6 --debug > > ===SORRY!=== Error while compiling /home/ngaywood/

rw optional parameters

2017-09-16 Thread Norman Gaywood
!=== Error while compiling /home/ngaywood/./tt.p6 Cannot use 'is rw' on optional parameter '$verbose'. at /home/ngaywood/./tt.p6:4 Not sure what the neat way of doing this is. -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New Englan

Re: What is P6 for P5 `use Term::ReadKey`?

2017-09-13 Thread Norman Gaywood
N> in the > docs if you want to know more). > > The point of all this is to not require exhaustive examples to show you > possible ways of calling getc; you just need to know how to unlock the > code. > > Putting it all together, it tells you that these are valid examples: > &g

Thread example from evanmiller

2017-09-07 Thread Norman Gaywood
le is intended to be condensed without any surplus code. So my question is, is the $channel.close required? Leave it out and the code still seems to work. Am I missing some subtle point? -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale

zef install --/test cro

2017-08-30 Thread Norman Gaywood
ro::HTTP:ver('0.7'): ===SORRY!=== Cannot locate symbol 'SSL_load_error_strings' in native library 'libssl.so' ===SORRY!=== Cannot locate symbol 'SSL_load_error_strings' in native library 'libssl.so' in any at /home/ngaywood/rakudo-star-2017.07/ins

Re: User defined infix operators and whitespace

2017-08-26 Thread Norman Gaywood
d I miss something > obvious? > > Obviously it's possible to have operators that ignore whitespace (1+1 > works just fine) but is it possibly for user defined ones? > > Possibly more serious ones. > > Simon > -- Norman Gaywood, Computer Systems Officer School of S

Bi-directional communication with another process

2017-07-27 Thread Norman Gaywood
>From inside a program I'd like to send some input to the stdin of external program and read back the stdout. The example in https://docs.perl6.org/language/ipc under proc comes close to what I want: my $echo = run 'echo', 'Hello, world', :out; my $cat = run 'cat', '-n', :in($echo.out), :out; sa

Re: need help with "next"

2017-05-24 Thread Norman Gaywood
On 24 May 2017 at 16:40, Norman Gaywood wrote: > > However, your code does not look like it will do what you want if you have >> multiple TASKs >> > > Yes it does. Sorry ignore me :-) -- Norman Gaywood, Computer Systems Officer School of Science and Technology U

Re: need help with "next"

2017-05-23 Thread Norman Gaywood
' Ted Moon', '', 'Mission C', ' Jim Kirk', ' Mr Spock', '', ; my $in-TASK = ""; for @Data -> $Line { if $Line.contains( "TASK type" ) { $Line ~~ m/ 'TASK&#

Re: How do I remove N elements

2017-03-20 Thread Norman Gaywood
do it all at once. > > > Many thanks, > -T > -- Norman Gaywood, Computer Systems Officer School of Science and Technology University of New England Armidale NSW 2351, Australia ngayw...@une.edu.au http://turing.une.edu.au/~ngaywood Phone: +61 (0)2 6773 2412 <(02)%206773%20241