🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
00:12 wamba left 00:28 KotH left, KotH joined 00:32 bartolin left, bartolin joined 00:41 sena_kun left 00:56 sena_kun joined
EuAndreh[m] How can I add a tuple type as a return value? See: euandre.org/pastebin/raku-tuple-ty...ation.html 01:03
vrurg EuAndreh[m]: Use List or modules.raku.org/dist/Tuple:cpan:ELIZABETH 01:15
EuAndreh[m]: Depending on how you plan to use the return value, it could be a Pair or Array too. 01:16
EuAndreh[m] vrurg: I think it's closer to a Pair 01:17
Can the Pair be generic on the contents?
vrurg EuAndreh[m]: Like?
EuAndreh[m] Maybe something like Pair[Str, Str]
Actually, a Pair contains a key and a value. I'm after a tuple instead 01:18
So probably a List or an Array 01:19
vrurg Anyway, Pairs are not parameterizable.
EuAndreh[m] I guess Lists aren't also, right? 01:20
vrurg You're right.
EuAndreh[m] vrurg: Thank you very much :)
vrurg EuAndreh[m]: you're welcome. :) 01:21
01:21 Voldenet left 01:25 sauvin joined 01:26 Voldenet joined, Voldenet left, Voldenet joined 01:52 mensvaga left
cpan-raku New module released to CPAN! Red (0.1.1) by 03FCO 02:21
02:22 sauvin left 02:26 sauvin joined 02:42 sena_kun left 02:56 sena_kun joined 03:56 quotable6 left, shareable6 left, benchable6 left, nativecallable6 left, committable6 left, sourceable6 left, bloatable6 left, unicodable6 left, statisfiable6 left, releasable6 left, reportable6 left, greppable6 left, notable6 left, bisectable6 left, coverable6 left, squashable6 left 03:57 unicodable6 joined, shareable6 joined, bisectable6 joined, nativecallable6 joined, statisfiable6 joined, notable6 joined, reportable6 joined 03:58 sourceable6 joined, committable6 joined, coverable6 joined, benchable6 joined, quotable6 joined 03:59 greppable6 joined, squashable6 joined, releasable6 joined, bloatable6 joined 04:31 johnjohn101 joined 04:41 sena_kun left 04:56 sena_kun joined
xinming_ SmokeMachine: Still trying, busy with other things in life, If I have time, I'll do it, and whenever I have time, I'll trouble you. 04:59
05:08 guifa2 joined 05:24 johnjohn101 left 05:35 Voldenet left
xinming_ What is the difference between categorize and classify in List class? I feel they are the same. 05:38
even the example, there is one example behave the same. 05:39
05:41 Voldenet joined, Voldenet left, Voldenet joined 06:00 guifa2 left
Geth_ doc: 24dd9ebf99 | (Stoned Elipot)++ | assets/sass/style.scss
Be more specific in selecting href to "external" sites

  ...and thus avoid selecting the "internal" link to language/operators#infix_//
as seen in doc/Language/typesystem.pod6
06:30
doc: 20b84e83cd | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | assets/sass/style.scss
Merge pull request #3135 from stoned/fix-external-url-selector

Be more specific in selecting href to "external" sites
06:41 sena_kun left 06:49 RobRaku joined 06:55 sena_kun joined 06:56 wamba joined 07:21 Xliff left 07:25 RobRaku left 07:48 wamba left 07:55 rindolf joined 08:00 squashable6 left 08:01 kensanata joined 08:03 squashable6 joined 08:08 Voldenet left 08:10 kensanata left 08:14 Voldenet joined, Voldenet left, Voldenet joined 08:17 wamba joined 08:18 abraxxa joined, Voldenet left, cpan-raku left, kensanata joined 08:19 abraxxa left, squashable6 left, abraxxa joined, cpan-raku joined, cpan-raku left, cpan-raku joined 08:20 squashable6 joined 08:23 Voldenet joined, Voldenet left, Voldenet joined 08:24 abraxxa left, abraxxa joined 08:30 RobRaku joined 08:37 xinming joined 08:40 xinming_ left 08:42 sena_kun left 08:57 sena_kun joined
sarna hey, can I somehow get more info from a test that failed? like, expected x, got y? 09:02
I'm using `mi6 test` and when something fails I just get "test x failed" :/ 09:06
09:11 ToddAndMargo joined
ToddAndMargo Hi All. I am trying ot code a Native call to a C functions that uses a "LPTSTR". How do I declare that? Something like `constant DWORD := int32; ` but for LPTSTR? 09:12
lizmat sarna: raku -Ilib t/foo.t 09:16
ToddAndMargo if it helps, I found this description: "LPTSTR is a [long] pointer to a (non-const) TCHAR string" 09:17
and "LPTSTR: null-terminated string of TCHAR (Long Pointer)" 09:19
09:21 rindolf left
sarna lizmat: that doesn't give me any more info than "test x failed on line y" 09:26
lizmat well, then maybe the test is a bit wonky? Like being an "ok" or a "flunk" ? 09:27
what does the test say on that line ?
sarna it's an "ok" test
which one would give me more info?
lizmat is-deeply ? 09:28
is ?
09:29 rindolf joined
lizmat m: use Test; is "foo", "bar" 09:29
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: 'bar'
# got: 'foo'
lizmat m: use Test; is-deeply "foo", 42
camelia not ok 1 -
# Failed test at <tmp> line 1
# expected: 42
# got: "foo"
sarna that works, thanks lizmat :)
lizmat afk for a few hours& 09:32
PSA: there will ne *no* Rakudo Weekly this week, the next one will be on 6 January 2020
09:44 AlexDaniel left, AlexDaniel joined, AlexDaniel left, AlexDaniel joined
sarna m: enum Foo<Bar Baz>; Foo(Nil or 0) 09:54
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3enum Foo<Bar Baz>; Foo(Nil7⏏5 or 0)
expecting any of:
sarna m: enum Foo<Bar Baz>; Foo((Nil or 0))
camelia ( no output )
sarna why do I need extra parens here? :D
10:02 chloekek joined 10:07 titsuki joined, wamba left 10:15 ToddAndMargo left 10:43 sena_kun left, mahmudov joined 10:52 RobRaku left 10:55 sena_kun joined 11:02 squashable6 left, pilne left 11:04 squashable6 joined 11:07 Tirifto joined
moritz m: enum Foo<Bar Baz>; say Foo( 0 ) 11:16
camelia Bar
moritz m: enum Foo<Bar Baz>; say Foo( Nil or 0 )
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3enum Foo<Bar Baz>; say Foo( Nil7⏏5 or 0 )
expecting any of:…
moritz m: enum Foo<Bar Baz>; say Foo( 0 or 0 )
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3enum Foo<Bar Baz>; say Foo( 07⏏5 or 0 )
expecting any of:…
moritz looks like a bug to me
it seems to be stopping at the wrong precedence level here 11:17
11:27 kensanata left 11:33 Voldenet left
sarna how to turn an array of chars into an array of numbers? I tried this, but it didn't work 11:37
11:38 Voldenet joined, Voldenet left, Voldenet joined
sarna m: for "1234".comb { Int($_) } 11:38
camelia ( no output )
sarna oh lol it works
m: my @foo = do for "1234".comb { Int($_) }; dd @foo[0] 11:39
camelia Int @foo = 1
moritz m: say "1234".comb.map(+*) 11:40
camelia (1 2 3 4)
moritz m: say "1234".comb>>.Int
camelia (1 2 3 4)
sarna neat! 11:41
11:59 chloekek left, xinming left 12:01 cramel joined, xinming joined 12:25 kensanata joined 12:26 chloekek joined
sarna what does that mean: `expected Positional[Int] but got Array ($[1, 2, 3])`? isn't Array positional? 12:38
m: sub foo(Int:D @arg) { } ; foo([1;2;3]) 12:39
camelia Type check failed in binding to parameter '@arg'; expected Positional[Int] but got Array ($[1, 2, 3])
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
12:41 sena_kun left
tbrowder hi, all 12:42
tellable6 2019-12-26T19:03:19Z #raku <jmerelo> tbrowder what about simply raku-advent-calendar.org for a domain?
2019-12-26T19:09:49Z #raku <lizmat> tbrowder perhaps raku-advent-calendar.blog ?
12:43 mahmudov left
tbrowder the choices i gave are what was offered free, i assume anything else would cost more but i don't know. i'll check when i get a chance... 12:44
ref modules: i want to add to a module a test that requires a debian package. is there any clever way to skip the test if it's not available? 12:48
the meta6 would actually list a module that requires the uuid-dev library 12:49
12:50 Doc_Holliwood joined
tbrowder that module is LibUUID 12:50
Doc_Holliwood Cow-orker: Hey, you, what are you up to? Me: I'm looking for whatever. Cow-orker: Ok, ok. No need to be snarky.
m: .say for (2..50).grep: is-prime(*) 12:52
camelia No such method 'is-prime' for invocant of type 'Whatever'
in block <unit> at <tmp> line 1
Doc_Holliwood Why doesn't this work?
Or rather, why doesn't it dwim?
12:54 cramel left
Doc_Holliwood m: .say for (2..50).grep: is-prime(* + 0) 12:54
camelia No such method 'is-prime' for invocant of type 'WhateverCode'
in block <unit> at <tmp> line 1
Doc_Holliwood m: .say for (2..50).grep: is-prime((* + 0)())
camelia Too few positionals passed; expected 1 argument but got 0
in block <unit> at <tmp> line 1
12:55 RobRaku joined 12:57 sena_kun joined
SmokeMachine m: sub foo(Int:D @arg) { } ; foo([1,2,3]) 13:06
camelia Type check failed in binding to parameter '@arg'; expected Positional[Int] but got Array ($[1, 2, 3])
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
13:06 mahmudov joined
SmokeMachine m: sub foo(Int:D @arg) { } ; foo(Array[Int].new: [1,2,3]) 13:06
camelia ( no output )
SmokeMachine m: sub foo(@arg where .all ~~ Int:D) { } ; foo([1,2,3]) 13:07
camelia ( no output )
lizmat m: .say for (2..50).grep: *.is-prime # Doc_Holliwood
camelia 2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
SmokeMachine sarna: ^^
13:08 bbkr joined
sarna thanks SmokeMachine :) 13:08
SmokeMachine sarna: `Int @array` is different from a array with every element being an int... 13:10
Doc_Holliwood lizmat: that's what i get for simplyfying :P Here's what I originally wanted to do: 13:11
SmokeMachine m: say [1, 2, 3] ~~ Positional[Int]; say Array[Int].new([1, 2, 3]) ~~ Positional[Int]
camelia False
True
Doc_Holliwood m: use Prime::Factor; .say for (2..50).grep: is-prime( prime-factors(*).elems ); 13:13
camelia ===SORRY!===
Could not find Prime::Factor at line 1 in:
inst#/home/camelia/.perl6
inst#/home/camelia/rakudo-m-inst-1/share/perl6/site
inst#/home/camelia/rakudo-m-inst-1/share/perl6/vendor
inst#/home/camelia/rakudo-m-inst-1/sh…
SmokeMachine m: subset ArrayOfInts of Positional where .all ~~ Int:D; say [1, 2, 3] ~~ ArrayOfInts
camelia True
sarna SmokeMachine: wait, what 13:14
D: heck
SmokeMachine sarna: what? 13:15
sarna SmokeMachine: what is `Int @array` then?
isn't it "a thing that does positional and has Ints inside"?
SmokeMachine sarna: `Int @array` is equivalent of `Array[Int]` 13:16
Doc_Holliwood it is. but a plain [1,2] isn't an array of Ints
sarna what's [1,2] then?
Doc_Holliwood it could contain anything. the subset above is a runtime check for any array
SmokeMachine sarna: no, it's a defined type... so, to set a value for that, that value should have that type..
m: [1,2].^name.say 13:17
camelia Array
SmokeMachine m: Array[Int].new([1,2]).^name.say
camelia Array[Int]
SmokeMachine sarna: ^^
sarna oh, that's because I can append values of any type to that literal, right? 13:18
Doc_Holliwood right.
sarna thanks for explaining, I got it now
SmokeMachine m: my Int @a; @a.push: 1; @a.push: "a" 13:19
camelia Type check failed in assignment to @a; expected Int but got Str ("a")
in block <unit> at <tmp> line 1
13:19 mahmudov left
SmokeMachine m: my @a where .all ~~ Int; @a.push: 1; @a.push: "a" 13:19
camelia Type check failed in assignment to @a; expected <anon> but got Str ("a")
in block <unit> at <tmp> line 1
13:19 mahmudov joined
sarna that's funny: 13:21
m: my @a where .any ~~ Int; @a.push: 1; @a.push: "a"
camelia Type check failed in assignment to @a; expected <anon> but got Str ("a")
in block <unit> at <tmp> line 1
13:22 xinming left
SmokeMachine m: my @a where { .all ~~ Int || fail "Please just give me Ints" }; @a.push: 1; @a.push: "a" 13:24
camelia Please just give me Ints
in block <unit> at <tmp> line 1
13:24 RobRaku left 13:27 xinming joined 13:32 bbkr left 13:37 wamba joined 13:50 xinming left 13:51 xinming joined 14:37 leah2 left 14:40 sena_kun left, leah2 joined 14:43 kensanata left 14:45 kensanata joined 14:57 sena_kun joined 15:05 Xliff joined
Xliff . 15:05
sena_kun: You around? 15:06
15:16 elmo40 joined
elmo40 hrmm... interesting 15:17
15:17 elmo40 left 15:21 mahmudov left 15:34 chloekek left 15:36 RobRaku joined 15:47 rba[m] left 15:50 lucasb joined 15:56 kensanata left 16:00 mahmudov joined
Tirifto Hello! Is there a way to create an empty (path-less) IO::Path object, or is it a much better idea to avoid the kind of situation where I would need to do that in the first place? 16:06
AlexDaniel Tirifto: what about a type object? 16:08
m: say IO::Path
camelia (Path)
AlexDaniel but yes, I'm intersted to know why you need this
intersted* uhh sloppy fingers :)
heh I did it again :D
Tirifto AlexDaniel: I'm writing a script to assemble webpages for me. It has a class for data of the pages it's going to export (one object per page), with one datum being the path the page's content should be written to. At one point in the script, it's known that a new page will be exported, but the data of the page is yet to be provided (piece by piece). My first idea was to create the page object with all of its attributes empty, and fill them 16:20
in as the data are read. In keeping with this, I could just give it any arbitrary path, since the datum's going to get overwritten anyways, but some more obviously default/temporary value would feel more proper. :P
AlexDaniel Tirifto: yeah sounds like you just need a type object 16:21
m: my IO::Path $x; dd $x
camelia Path $x = IO::Path
AlexDaniel m: my IO::Path $x; dd $x; $x = ‘foo’.IO; dd $x
camelia Path $x = IO::Path
Path $x = IO::Path.new("foo", :SPEC(IO::Spec::Unix), :CWD("/home/camelia"))
Tirifto AlexDaniel: Aha, neat! So type objects fit in their types? 16:22
AlexDaniel Tirifto: yeah, constraints are :U by default, you can use :D if you wanted to forbid that 16:23
m: my IO::Path:D $x = IO::Path 16:24
camelia Type check failed in assignment to $x; expected IO::Path:D but got IO::Path (IO::Path) (perhaps Nil was assigned to a :D which had no default?)
in block <unit> at <tmp> line 1
AlexDaniel m: my IO::Path:D $x = ‘foo’.IO
camelia ( no output )
Tirifto :D
Actually, :U 16:25
Thank you, AlexDaniel, that solved the problem! I can move on to the next one. :) 16:30
16:35 rindolf left 16:41 sena_kun left 16:46 rindolf joined 16:52 RobRaku left 16:56 sena_kun joined
Geth_ doc: d22976f450 | (Stoned Elipot)++ | doc/Language/typesystem.pod6
Fix link to sub-signatures
17:02
lizmat www.reddit.com/r/rakulang/comments..._a_string/ 17:43
takers?
17:44 mahmudov left 17:45 mahmudov joined 17:55 xinming left 17:56 xinming joined 18:19 RobRaku joined 18:26 patrickb joined, AlexDani` joined 18:29 AlexDaniel left 18:42 sena_kun left 18:56 sena_kun joined 18:59 pony is now known as no-n 19:02 wildtrees joined
moritz there was an answer already, I've given a somewhat longer version 19:12
19:25 sauvin left 19:44 stoned75 left 20:05 rindolf left 20:18 abraxxa left 20:20 abraxxa joined 20:39 mahmudov left 20:40 mahmudov joined 20:41 sena_kun left 20:55 Xliff left 20:56 sena_kun joined 21:05 RobRaku left 21:22 squashable6 left 21:24 squashable6 joined 21:25 Dasein joined, wamba left
Dasein How do you properly install Zef? 21:26
I've had issues because of being a noob
21:26 Dasein left
lizmat 29 seconds is not a lot of time to give you an answer 21:29
Tirifto If my class ‘has @.an-array’, how can I leave it empty upon blessing? 21:44
(I've added a custom ‘new’ method, but blessing with the pair ‘an-array => @()’ raised complaints about wrong number of arguments, and declaring a variable as ‘my $an-array = ()’ and blessing with that as ‘:$an-array’ gives me the array [()], which contains one element, when I'd really like zero.) 21:48
Oh, it looks like I don't need to mind all of the attributes in my blessing, and those omitted will be empty? 21:50
21:54 Xliff joined
Xliff . 21:54
jnthn Tirifto: Yes, an @-sigil thing will default to an empty array, so nothing is needed to leave it empty. But the fix would be to use `my @an-array;` and bless with `:@an-array`, or even shorter without the temporary, `:an-array[]`. 21:57
Easiest to do nothing at all, of course :)
Tirifto Ah, thank you, jnthn! 22:00
Makes sense. :)
Also, does substitution somehow mess with the ‘$_’ variable? I find that ‘$item ~~ s[$ph_title] = .title’ complains about the invocant being of type ‘Str’, even when outside of the line it's not, while ‘my $new = $_; $item ~~ s[$ph_title] = $new.title’ will work just fine. 22:07
(Sorry if I'm overlooking basic information in the documentation; there's (fortunately) a lot to read there!) 22:09
22:11 kensanata joined 22:12 lucasb left 22:13 mahmudov left
tobs Tirifto: it seems that the matchee $item becomes $_ for the duration of s///. (I'm surprised this syntax even does what you meant...) 22:25
m: my $a = "far"; my $b = "bar"; given $a { say $b ~~ s['a'] = .uc; say $_ }; say $a; say $b
camelia 「a」
far
far
bBARr
tobs I for one would have excepted the substitution's Match object to be $_ during the substitution, but that apparently only works with the &subst method when it receives a callable, but that's my own confusion, not yours :) 22:29
Xliff m: my $a = "far"; my $b = "bar"; given $a { say $b ~~ s['a'] = $a.uc; say $_ }; say $a; say $b 22:30
camelia 「a」
far
far
bFARr
22:31 stoned75 joined
Tirifto I like how Raku has kept the sense of wonder and mystery from Perl. :) 22:31
Xliff m: my $a = "far"; my $b = "bar"; given $a { s['a'] = .uc given $b; say $_ }; say $a; say $b 22:33
camelia far
far
bBARr
22:40 RobRaku joined 22:41 sena_kun left 22:57 sena_kun joined 23:05 Suya joined 23:09 RobRaku left 23:11 wamba joined 23:24 wamba left, patrickb left, kensanata left