»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
cpan-p6 New module released to CPAN! Getopt-Long (0.1.0) by 03LEONT 01:02
Elronnd is there a way to say 'this string parameter must be composed of only these characters'? 02:26
timotimo you could use a regex match 02:27
m: sub only-vowels(Str $a where /^<[aeiou]>*$/) { say "ok $a" }; try only-vowels("abcde"); try only-vowels("ae"); try only-vowels("") 02:28
camelia ok ae
ok
Elronnd ahhh thx 02:29
leont I rarely find it useful not to have a default option, if only to give a clearer error 02:31
Elronnd that's probably a good idea; this is an internals function called only once though, and that's just to protect against a case that shouldn't happen _anyway_ (checked against outside the callsite) so it's probably fine 02:36
timotimo the regex check may be relatively expensive, though 02:37
so if it's a function that's called often, perhaps check on the performance every now and then
ToddAndMargo Newbie question: is there a way to declare a variable as both a Buf and a Str and then work on it as either a Buf or a Str? Seems to me they are both arrays of bytes 03:27
MasterDuke ToddAndMargo: there's been some talk of creating/enabling some of the Str functions for Buf. but they're not both arrays of bytes in Perl 6 (in one way) 03:33
MasterDuke a Str could have multiple bytes combined into one grapheme. manipulating those bytes could result in an invalid string 03:34
cpan-p6 New module released to CPAN! Net-BGP (0.1.1) by 03JMASLAK 03:40
ToddAndMargo Rats! What would the fastest way to convert a Beuf into a string with NO CONVERSIONS? 03:53
I would adore a bunch of string functions converted to for type Buf!!!
Bug not a Beuf 03:54
Buf not Bug.
MasterDuke what do you mean no conversions? 03:58
tomato_ Hi, please see a small question: what doe the dollar sign mean in this error message? "# expected: $[1, 2], got: [1, 2]" 04:13
Are they different?
Elronnd if I return Nil from a function, and assign a variable to the output of that function, the variable is Any 05:17
how can I check if the result of the function was Nil? $result ~~ Any returns True, but that's not very helpful
b2gills You either need to bind to the variable with :=, or set the default of the variable to Nil 06:16
m: sub foo ( --> Nil ){}; my $a = foo; say $a; my $b := foo; say $b; my $c is default(Nil) = foo; say $c 06:17
camelia (Any)
Nil
Nil
b2gills Elronnd: ^^^ 06:18
Note that sigiless variables are always binding 06:19
m: sub foo (-->Nil){}; my \sigiless = foo; say sigiless 06:20
camelia Nil
Geth doc: 6a0e6d4428 | (Nick Logan)++ | 2 files
CURFS and CURI basics
07:45
doc: f0cb1f64fb | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | 2 files
Merge pull request #2602 from ugexe/cur-basic

CURFS and CURI basics Thanks!
Elronnd b2gills: ok, thanks 08:15
lizmat weekly: gfldex.wordpress.com/2019/02/02/nq...n-threads/ 09:13
notable6 lizmat, Noted!
Geth doc: 2c795607d7 | (JJ Merelo)++ | doc/Type/IO/ArgFiles.pod6
Adds an example which fails with invalid filehandles.

I couldn't find a way to deal with them, as indicated in #96 and rakudo/rakudo#2666. I asked [this question in SO](stackoverflow.com/questions/545015...ects-too), will reopen if there's some answer that does not involve catching the error. Meanwhile, closes #96
09:44
synopsebot Link: doc.perl6.org/type/IO::ArgFiles
synopsebot RAKUDO#2666 [open]: github.com/rakudo/rakudo/issues/2666 implement a new var @*ARGFILES listing paths for @*ARGS that are existing files
jmerelo hi, lizmat . How''s FOSDEM going? 10:49
jmerelo m: my $m = (1 => 0.5, 2 => 0.25, 3 => 0.3 ).Mix; say $m 11:46
camelia Mix(1(0.5), 2(0.25), 3(0.3))
jmerelo m: my $m = (1 => 0.5, 2 => 0.25, 3 => 0.3 ).Mix; say 2 (elem) $m
camelia True
cpan-p6 New module released to CPAN! App-Prove6 (0.0.9) by 03LEONT 15:03
smallick say 0 16:06
evalable6 0
smallick m: say 1 16:07
camelia 1
Geth doc: 675330d619 | cfa++ | 6 files
a → an (#2604)
18:24
doc: e45f0317e1 | cfa++ | 7 files
an → a, an → and (#2604)
18:27
timotimo .seen cygx 18:29
yoleaux I saw cygx 10 Jan 2019 19:56Z in #moarvm: <cygx> if it solves a legitimate problem, I wouldn't let purity be the enemy of pragmatism...
timotimo .tell cygx i want to put something in the ecosystem to bridge Image::RGBA::Text and SDL2::Raw, how does that sound to you? 19:10
yoleaux timotimo: I'll pass your message to cygx.
TreyHarris This is interesting... I was getting tired of ANSI line noise in my compilation buffer in Emacs, so I added a hook to colorize the output. But it only works for runtime errors. Compile-time errors still show as '^[===^[SORRY!^[===^[ Error while compiling -'. 19:31
I wonder what Emacs could be seeing differently in the two cases?
moritz I think there is an environment variable to suppress the ANSI codes
timotimo is that a difference between stdout and stderr being used? 19:32
TreyHarris Yeah, I'll go that route next, but I was getting pretty colors for runtime errors. :-)
Shouldn't both noparse and divide-by-zero (the two cases I was comparing just now) both go to stderr?
timotimo probably
TreyHarris They both go to stderr, so I'm going to guess it may be that the filter isn't equipped to deal with a output stream that begins with escape codes perhaps? That's the only difference I see immediately. I guess I can load ANSI myself and note something to see 19:38
Geth doc: 0434083c02 | cfa++ | doc/Language/testing.pod6
/type/Role (broken) → /language/objects#Roles
20:37
synopsebot Link: doc.perl6.org/language/testing
doc: d189ee1b86 | cfa++ | 4 files
/type/EVAL (broken) → /routine/EVAL
20:39
gfldex lolibloggedalittle: gfldex.wordpress.com/2019/02/03/th...a-channel/ 21:31
timotimo gfldex: you can use a semaphore, or atomic integers to get that 64-at-the-same-time thing going; another thing i like doing is have a channel for "tickets" and receiving from the channel is "taking a ticket" and sending to it is "freeing the ticket" and you just send, for example, 64 tickets at the very start to fill the channel 21:42
Xliff m: say π - 4 * ([+] <1 -1> <</<< (1,3,5,7,9...20)) 21:54
camelia 0.09975303466039076
Xliff m: say π - 4 * ([+] <1 -1> <</<< (1,3,5,7,9...10000)) 21:55
camelia 0.0001999999980029088
Xliff m: say 3 + [+] ((2, 4...*).map: -> $i {($i % 4 - 1) * 4/[*] $i..($i+2)})[^1000] 21:57
camelia 3.1415926533405423
Xliff m: ((2, 4...*).map: -> $i {($i % 4 - 1) * 4/[*] $i..($i+2)})[^1000] 21:58
camelia ( no output )
Xliff m: ((2, 4...*).map: -> $i {($i % 4 - 1) * 4/[*] $i..($i+2)})[^1000].say
camelia (0.166667 -0.033333 0.011905 -0.005556 0.00303 -0.001832 0.00119 -0.000817 0.000585 -0.000433 0.000329 -0.000256 0.000204 -0.000164 0.000134 -0.000111 0.000093 -0.000079 0.000067 -0.000058 0.00005 -0.000044 0.000039 -0.000034 0.00003 -0.000027 0.00002…
Xliff m: say 3 + [+] ((2, 4...*).map: -> $i {($i % 4 - 1) * 4/[*] $i..($i+2)})[^1000] 21:59
camelia 3.1415926533405423
Xliff m: say 3 + [+] ((2, 4...*).map: -> $i {($i % 4 - 1) * 4/[*] $i..($i+2)})[^30]
camelia 3.1415842726746206
Xliff m: asy 22/7 22:04
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
asy used at line 1. Did you mean 'any', 'say'?
Xliff m: asy (22/7)
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
asy used at line 1. Did you mean 'say', 'any'?
Xliff m: say (22/7)
camelia 3.142857
Xliff m: say 22/7
camelia 3.142857
Xliff m: say 23/7
camelia 3.285714
Xliff m: say 22/7
camelia 3.142857
Xliff m: say 22/7.^name.say
camelia Int
22
Xliff m: say (22/7).^name.say
camelia Rat
True
timotimo gfldex: i think you can save just a little bit of memory by defining @dirs to be a "my str @dirs" 22:09
Xliff m: say (22/7).base-repeating 22:12
camelia (3. 142857)
Xliff m: say (22/7).base-repeating.say
camelia (3. 142857)
True
Xliff m: say (335/113).base-repeating.say
camelia (2. 9646017699115044247787610619469026548672566371681415929203539823008849557522123893805309734513274336283185840707)
True
Xliff m: say (344/113).base-repeating.say
camelia (3. 0442477876106194690265486725663716814159292035398230088495575221238938053097345132743362831858407079646017699115)
True
22:13
Xliff m: say (355/113).base-repeating.say
camelia (3. 1415929203539823008849557522123893805309734513274336283185840707964601769911504424778761061946902654867256637168)
True
Xliff m: say 3~(355/113).base-repeating[1] 22:15
camelia 31415929203539823008849557522123893805309734513274336283185840707964601769911504424778761061946902654867256637168
Xliff m: say 3~(355/113).base-repeating[1].split.comb(2).map(*.join(' '))
camelia Cannot resolve caller split(Str:D: ); none of these signatures match:
(Str:D: Regex:D $pat, $limit is copy = Inf;; :$v is copy, :$k, :$kv, :$p, :$skip-empty, *%_ --> Seq:D)
(Str:D: Str(Cool) $match;; :$v is copy, :$k, :$kv, :$p, :$skip-emp…
Xliff m: say 3~(355/113).base-repeating[1].comb(2).map(*.join(' '))
camelia 314 15 92 92 03 53 98 23 00 88 49 55 75 22 12 38 93 80 53 09 73 45 13 27 43 36 28 31 85 84 07 07 96 46 01 76 99 11 50 44 24 77 87 61 06 19 46 90 26 54 86 72 56 63 71 68
Xliff m: say (3~(355/113).base-repeating[1]).comb(2).map(*.join(' ')) 22:16
camelia (31 41 59 29 20 35 39 82 30 08 84 95 57 52 21 23 89 38 05 30 97 34 51 32 74 33 62 83 18 58 40 70 79 64 60 17 69 91 15 04 42 47 78 76 10 61 94 69 02 65 48 67 25 66 37 16 8)
Xliff \o/\
Xliff m: say (3~(355/113).base-repeating[1]).comb(2) 22:38
camelia (31 41 59 29 20 35 39 82 30 08 84 95 57 52 21 23 89 38 05 30 97 34 51 32 74 33 62 83 18 58 40 70 79 64 60 17 69 91 15 04 42 47 78 76 10 61 94 69 02 65 48 67 25 66 37 16 8)
Xliff m: say (3~(355/113).base-repeating[1]).comb(2).perl.say 22:39
camelia ("31", "41", "59", "29", "20", "35", "39", "82", "30", "08", "84", "95", "57", "52", "21", "23", "89", "38", "05", "30", "97", "34", "51", "32", "74", "33", "62", "83", "18", "58", "40", "70", "79", "64", "60", "17", "69", "91", "15", "04", "42", "47"…
Xliff m: say (3~(355/113).base-repeating.join.comb(2).perl.say 22:41
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 0313).base-repeating.join.comb(2).perl.say7⏏5<EOL>
Xliff m: say (3~(355/113).base-repeating.join('').comb(2).perl.say
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3base-repeating.join('').comb(2).perl.say7⏏5<EOL>
Xliff m: say (355/113).base-repeating.join('').comb(2).perl.say
camelia ("3.", "14", "15", "92", "92", "03", "53", "98", "23", "00", "88", "49", "55", "75", "22", "12", "38", "93", "80", "53", "09", "73", "45", "13", "27", "43", "36", "28", "31", "85", "84", "07", "07", "96", "46", "01", "76", "99", "11", "50", "44", "24"…
Xliff m: say (355/113).base-repeating.join.comb(2).perl.say
camelia ("3.", "14", "15", "92", "92", "03", "53", "98", "23", "00", "88", "49", "55", "75", "22", "12", "38", "93", "80", "53", "09", "73", "45", "13", "27", "43", "36", "28", "31", "85", "84", "07", "07", "96", "46", "01", "76", "99", "11", "50", "44", "24"…
notagoodidea Hi all! I'm digging a little bit in perl6 grammars and binary data parsing after seeing a talk in fosdem and having to some nice chat with perl6 folks. I have found some old (~4yo) gist liking to Synopsis 05, I was asking myself is there a place that recap the state of current implementation vs the synopsis? (i'm looking for the :bytes from the new modifiers section of S05) 22:54
timotimo notagoodidea: that's sadly not implemented at all so far 23:01
rakudo-moar can currently only work with grammars on the grapheme level
which even in latin1 will be normalizing \r\n into a single grapheme
(because that's what the unicode folks have decided) 23:02
notagoodidea timotimo: Someone linked a blog post doing that (buf -> latin1 -> grammar) in my SO question. Where can we find how/where the grapheme definition for perl6 is (the actual code) ? 23:20
timotimo sorry, i was distracted for a while there 23:30
oh no, they already left :< 23:31
i guess i'll post to StackOverflow then?