Re: A s/// brain teaser to share
Don't say innocent if you mean punchline. On Tue, May 1, 2018, 10:46 PM ToddAndMargowrote: > Hi All, > > You guys will noticed a bunch of things you have been helping me with > in the following. Thank you! > > :-) > > I have been working on cleaning up the file transfer of data from a > point of sale software (POS) program to a label printer. > > The customer puts his margin on the end of the description line, so > his labels show his margin, not that anyone would know what that > meant. He puts his margin and shipping after a slash. > > Anyway, the transfer file is a comma delimited text file. > "sss","" etc. > > Well now, instead of writing out inches, he used a quote. > There goes the label program. So I changed " to inches. > > and the whacking to rid the margin was something to behold. > > > #!/usr/bin/env perl6 > > my $LabelStr='"00046436405","HALT 3/4" ORIG LNG #35-1333-RD/.55 + > SHP",""," 3.95"," 0.00"," 0.00"," 0.00"," > 0.00","",""," 0.00","35-1002-RD","WEAV","","","BRIDL","",""'; > > say "$LabelStr\n"; > > $LabelStr ~~ s:global|"3/4\""|3/4 inch|; > $LabelStr ~~ s:global|(.*)\/(.*?)(\"\,.*)|$0$2|; > # say "0 = <$0>\n1 = <$1>\n2 = <$2>"; > say $LabelStr; > > > > > $ RemoveMarginTest.pl6 > > "00046436405","HALT 3/4" ORIG LNG #35-1333-RD/.55 + SHP",""," > 3.95"," 0.00"," 0.00"," 0.00"," 0.00","",""," > 0.00","35-1002-RD","WEAV","","","BRIDL","","" > > "00046436405","HALT 3/4 inch ORIG LNG #35-1333-RD",""," 3.95"," > 0.00"," 0.00"," 0.00"," 0.00","",""," > 0.00","35-1002-RD","WEAV","","","BRIDL","","" > > > About killed me, but I got it. > > Part numbers and prices changed to protect the innocent. > > -T > > -- > ~~ > Computers are like air conditioners. > They malfunction when you open windows > ~~ >
Re: <<>> question
MIME Is The Sacha Guitry Picture. On Oct 4, 2017 8:23 PM, "Todd Chester"wrote: > On 10/04/2017 08:20 PM, Todd Chester wrote: > >> So in this context "{$x}" means insert (interpolate) a >> variable into the list? I was thinking it meant to >> insert a variable into a string. Did saying <<>> >> automatically tell Perl6 that this was a list >> and not a sting? >> > > > is ><<>> > synonymous with >qw[] > ? >
Re: Tip: hash indexing
Canadian Handicrafts Guild On Oct 3, 2017 11:22 AM, "ToddAndMargo"wrote: > Sweet!I added a reverse print to the pile! > > > #!/usr/bin/env perl6 > > #`{ > Hashes do not print in the order they are created. it is a Perl 6 thing. > To overcome this, create an index of the hash. > } > > my @SmtpIndex = >qw[ DebugTrace smtp port username password from to Subject Text > FileName ]; > > my %Smtp = > [ "{ @SmtpIndex[0] }" => "1", > "{ @SmtpIndex[1] }" => "smtps://smtp.zoho.com", > "{ @SmtpIndex[2] }" => "465", > "{ @SmtpIndex[3] }" => 'la...@zoho.com', > "{ @SmtpIndex[4] }" => "NaYukYukYuk", > "{ @SmtpIndex[5] }" => 'la...@zoho.com', > "{ @SmtpIndex[6] }" => @['cu...@zoho.com','m...@zoho.com'], > "{ @SmtpIndex[7] }" => "Stooges", > "{ @SmtpIndex[8] }" => "Certainly!", > "{ @SmtpIndex[9] }" => @[""] ]; > > sub output(%hash, @index=@SmtpIndex) { > for @index -> $key { > printf "%10s = %s\n", $key, %hash{$key}; > } > print "\n"; > } > > sub revoutput(%hash, @index=@SmtpIndex) { > for reverse ( @index ) -> $key { > printf "%10s = %s\n", $key, %hash{$key}; > } > print "\n"; > } > > > my @SmtpValues = %Smtp{@SmtpIndex}; > > my %Smtp2 = do { > my $index = 0; > @SmtpValues.map: { "{ @SmtpIndex[$index++] }" => $_ }; > }; > > my %Smtp3 = gather for 0..@SmtpIndex.elems-1 { > take @SmtpIndex[$_] => @SmtpValues[$_].Str; > }; > > my %Smtp4 = @SmtpIndex Z=> @SmtpValues; > > # These are all equivalent > # output(%Smtp); > # output(%Smtp2); > # output(%Smtp3); > output(%Smtp4); > > # print in reverse > revoutput(%Smtp4); > > > $ HashIndexTest.pl6 > DebugTrace = 1 > smtp = smtps://smtp.zoho.com > port = 465 > username = la...@zoho.com > password = NaYukYukYuk > from = la...@zoho.com > to = cu...@zoho.com m...@zoho.com >Subject = Stooges > Text = Certainly! > FileName = > > FileName = > Text = Certainly! >Subject = Stooges > to = cu...@zoho.com m...@zoho.com > from = la...@zoho.com > password = NaYukYukYuk > username = la...@zoho.com > port = 465 > smtp = smtps://smtp.zoho.com > DebugTrace = 1 >
Re: Announce: Rakudo Star Release 2016.07
That is quite a step forward! Happy 22nd, All! On Jul 22, 2016 4:01 AM, "Steve Mynott"wrote: > > On behalf of the Rakudo and Perl 6 development teams, I’m pleased to > announce the July 2016 release of “Rakudo Star”, a useful and usable > production distribution of Perl 6. The tarball for the July 2016 release is > available from http://rakudo.org/downloads/star/. > > This is the third post-Christmas (production) release of Rakudo Star and > implements Perl v6.c. It comes with support for the MoarVM backend (all > module tests pass on supported platforms). > > Please note that this release of Rakudo Star is not fully functional with > the JVM backend from the Rakudo compiler. Please use the MoarVM backend > only. > > In the Perl 6 world, we make a distinction between the language (“Perl 6″) > and specific implementations of the language such as “Rakudo Perl”. This > Star release includes release 2016.07 of the Rakudo Perl 6 compiler, > version 2016.07 of MoarVM, plus various modules, documentation, and other > resources collected from the Perl 6 community. > > Some of the new compiler features since the last Rakudo Star release > include: > > + Ability to use a customer debugger module > + The “is-approx” sub from Test.pm6 now allows for relative/absolute > tolerance > + A fail in a custom BUILD will now be returned, rather than thrown > + Introduce .Map coercer > + Implement alternate ways to call subtest > + Support for new leap-second at the end of 2016 > + The “is required” trait on Attributes can now take a Bool or a Str > + IO::[Path,Handle] gained a .mode method which returns the POSIX file > permissions > + Distribution is now a role interface that enables encapsulating IO used > for distribution installation > + CompUnit::Repository::Installation now uses the new Distribution > interface > + Custom repository implementations now supported, including precompilation > > Compiler maintenance since the last Rakudo Star release includes: > > + Basic object creation (using either .new or .bless) now up to 3x faster > + All routines now have less overhead > + The MMD cache accepts candidates with named parameters if it can. (This > made adverbed slices about 18x as fast) > + Sigificant optimizations for speed in many parts of the system (.map, > gather/take etc.) > + Many precompilation fixes (including EVAL and improved support of OS > packaging) > + Arrays with holes (e.g. from :delete) now correctly iterate/auto-vivify > + An issue with reverse dependencies of installed modules was fixed > + “is_approx” sub (note underscore) from Test.pm6 deprecated > + Harden Mu.Str against moving GC > + Simplify $USER/$GROUP initialization > + Mu can now be the result of a Promise > + samewith() now also works on non-multi’s > + Many fixes in the area of pre-compilation and installing modules > + count-only and bool-only now are optional methods in Iterators (only to > be implemented if they can work without generating anything) > + IO::ArgFiles.slurp / IO::ArgFiles.eof are fixed > + REPL whitespace and error handling > + CompUnit::Repository::Installation no longer considers bin/xxx and > resources/bin/xxx the same content address > + min/max on Failures throw instead of returning ±Inf > + NativeCall’s is mangled trait no longer ignored for CPPStruct > + Many Str, List and Array methods much faster > + Map/Hash initializations are now 30% faster > + make DESTDIR now correctly finds CompUnit::Repository::Staging > + Output from Test.pm6′s diag() is no longer lost in non-verbose prove > output when called at the start of the test file or during TODO tests > + Improved error messages > > Notable changes in modules shipped with Rakudo Star: > > + DBIish: v0.5.9 (with many Oracle/MySQL fixes) plus README.pod and > mojibake fixes > + NativeHelpers-Blob: v0.1.10 > + PSGI: v1.2.0 supports P6SGI 0.7Draft > + Pod-To-HTML: v0.1.2 plus fixes > + debugger-ui-commandline: README fixes > + doc: many fixes to documentation content and HTML generation > + panda: Avoid Rakudo internals deprecation warning and don’t require > Build.pm to inherit Panda::Builder > + perl6-file-which: CI fixes > + perl6-http-easy: v1.1.0 (with more flexible P6SGI support) plus avoid > errors in binary request > + shell-command: Mention already implemented commands missing from README > + perl6-lwp-simple: track github.com/perl6/perl6-lwp-simple as upstream > (as panda does) which has a test fix needed since we don’t support https in > R* and a test url had a new https redirect > > perl6intro.pdf has also been updated. > > There are some key features of Perl 6 that Rakudo Star does not yet handle > appropriately, although they will appear in upcoming releases. Some of the > not-quite-there features include: > > + advanced macros > + non-blocking I/O (in progress) > + some bits of Synopsis 9 and 11 > + There is an online resource at http://perl6.org/compilers/features that > lists the known implemented and missing features of
Re: '!' versus 'not' in boolean expression
Too many Reimanns & Not enough role? -jas On 18 January 2016 at 11:37, Elizabeth Mattijsenwrote: > >> On 18 Jan 2016, at 19:55, Tom Browder wrote: >> >> 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 > > Yeah, this is an unexpected one. However, there is a simple solution: > > my %h; say 'false' if %h:!exists; > > In general, :foo is equivalent to foo => True, and :!foo is equivalent to foo > => False. > > >> Example 2 >> --- >> >>> my %h; say 'false' if not %h:exists; >> false >> >> It looks like '!' doesn't work as I thought it was supposed to. But, >> I just discovered that when I use parens, it works. > > Yes, the ! binds closer, and eats the :exists, and then complains about it. > > > > Liz
Re: Recalling previous commands
Try Out Linenoise https://github.com/hoelzro/p6-linenoise/ panda install Linenoise -jas On 1 January 2016 at 13:52, Brandon Allberywrote: > On Fri, Jan 1, 2016 at 4:47 PM, Parrot Raiser <1parr...@gmail.com> wrote: >> >> Every time I make a typo in a complex command, I reflexively hit >> ctrl-k before remembering I'm not in bash any more. :-)* > > > ...ctrl-k? wtf is bash misteaching people any more? I'd expect ctrl-p, like > pretty much anything else with line editing (including bash). > That said, I don't know how Linenoise does in the history department. > > -- > brandon s allbery kf8nh sine nomine associates > allber...@gmail.com ballb...@sinenomine.net > unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
Re: $epsilon = 1.0e-6 feels too big for Rat()
Considering that the Chinese 5th Century is 1849, I would expect http://babel.hathitrust.org/cgi/pt?id=mdp.39015046627348 to present less zuo. -jas On 31 December 2015 at 03:48, Darren Duncanwrote: > Considering that a non-fat Rat has a 64-bit denominator, I would expect > conversions from Num to make use of that full precision by default, and not > round off to 6 decimal places. -- Darren Duncan >
Hello List! Error found in glossary.pod
Line 1585:1587 Reads: -- =head2 NST No Such Thing. -- Surely Thi[j]s Is No Longer True? -jas