»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:04 firstdayonthejob left 00:07 firstdayonthejob joined 00:18 buharin left 00:20 firstdayonthejob left 00:25 TreyHarris left
rudi_s Hi. Is there a quick way to to if $a{$b}:exists and $a{$b}.foo eqv $bar { .. }? I don't want to retype $a{$b}. 00:28
raiph m: my $bar; say Nil eqv $bar 00:30
camelia rakudo-moar 1ef247: OUTPUT«False␤»
ugexe but his will autovivify on the second eqv i believe 00:31
raiph m: my %hash; %hash<a>.foo; dd %hash 00:33
camelia rakudo-moar 1ef247: OUTPUT«Method 'foo' not found for invocant of class 'Any'␤ in block <unit> at /tmp/Qs_ioOD1x2 line 1␤␤»
raiph m: my %hash; say %hash<a>.foo; dd %hash
camelia rakudo-moar 1ef247: OUTPUT«Method 'foo' not found for invocant of class 'Any'␤ in block <unit> at /tmp/R70qhRhDM_ line 1␤␤»
raiph m: my %hash; say %hash<a>.?foo; dd %hash 00:34
camelia rakudo-moar 1ef247: OUTPUT«Nil␤Hash %hash = {}␤»
00:34 cdg left
ugexe i've been avoiding a non-existing problem, excellent 00:35
raiph rudi_s: use `.?` as the dispatcher instead of `.`
00:35 cdg joined
rudi_s raiph: Thank you. But this will break if $bar is e.g. a (Int) and $a is an Int hash, right? 00:38
raiph ugexe: those are generally the best type of problem to have but not if you're avoiding them
ugexe: :)
rudi_s raiph: Ah, it returns Nil for undefined values. So unless $bar is Nil, everything is fine? 00:39
raiph m: say Nil eqv Nil
camelia rakudo-moar 1ef247: OUTPUT«True␤»
00:40 cdg left
raiph m: say Nil.foo eqv Nil 00:40
camelia rakudo-moar 1ef247: OUTPUT«True␤»
raiph m: role MyNil {}; say Nil.foo eqv Nil but MyNil 00:41
camelia rakudo-moar 1ef247: OUTPUT«False␤»
rudi_s Hm. When does Nil occur "in normal life"? It's not the same as undefined (undef) in perl5, right? 00:42
raiph rudi_s: Nil represents an explicit absence of a value 00:43
rudi_s But that's different from unitialized or no value for the given key, right? 00:45
raiph rudi_s: correct
rudi_s Good. Thank you. Then that should work fine for me. 00:47
raiph rudi_s: One doesn't encounter Nil nearly as often as Any.
rudi_s: But perhaps more than the almost zero you're thinking.
rudi_s Hm.
So there's no short way which always works? I don't like solutions which may break sometimes. 00:48
00:56 maybekoo5 left
raiph rudi_s: Perl 6 is so beautiful. I'm still figuring stuff out. 00:57
ugexe maybe `if %x<a> andthen $_ -> $foo { say $foo.perl; }`, but its probably even more to type 00:58
raiph m: my $a = Nil; say $a
camelia rakudo-moar 1ef247: OUTPUT«(Any)␤»
timotimo ugexe: that looks syntactically wrong
$_ -> $foo ?
ugexe i meant $_.?foo -> $foo
raiph rudi_s: if one assigns Nil to a container, it resets the container's content to the default value. The default default value is Any.
timotimo that still looks wrong :) 00:59
TTIAR, no?
raiph rudi_s: Nil, which represents an absence of value, disappears when you assign it to things. So $bar won't be Nil 01:02
timotimo yeah, assigning Nil into a scalar variable will reset it to its default value
ugexe what is ttiar? 01:04
timotimo S99:TTIAR 01:05
what's wrong with synopsebot6?
Two Terms In A Row. A common error message often resulting from a missing "semicolon" between two "statement"s or putting an operator directly after a "sub".
looks like synopsebot6 netsplit out and never came back? 01:06
01:07 synopsebot6 joined
timotimo S99:TTIAR 01:07
synopsebot6 Link: design.perl6.org/S99.html#TTIAR
rudi_s raiph: ugexe: Thanks for the explanation. I think for now I'll stick with the explicit check as it feels clearer to me (as perl6 beginner). 01:09
timotimo has someone suggested the "with" syntax? 01:10
that'll check for definedness rather than truthness
raiph timotimo: That was my first thought and it works too 01:11
timotimo ok
01:11 yeahnoob joined, bpmedley left
rudi_s timotimo: How can I extend that with a second condition? 01:12
raiph timotimo: but I felt there ought to be a nicer solution and I thought using `.?` fits the bill 01:13
timotimo can you show example code for what you mean, rudi_s?
rudi_s timotimo: if $a{$b}:exists and $a{$b}.foo eqv $bar { .. }?
(Or actually !eqv is what I need.) 01:14
01:14 bpmedley joined
timotimo ah. for that "with" probably wouldn't be the right thing 01:18
raiph timotimo: darn it, `with` was my first thought but please ignore the rest of what I said about it 01:19
ugexe `say "same" with my $xxx = %x<a> and $xxx.?foo !eqv $bar` i think
raiph (ie I don't know if it works or not)
timotimo ugexe: but the eqv will only ever return a boolean value and the with will check on that, rather than the %x<a> 01:20
rudi_s Something like this would be nice: $a{$b}:exists -> $_ and $_.foo eqv $bar { .. } - then I don't have to write $a{$b} two times.
raiph rudi_s: I don't understand why that's not just: use `.?` instead of `.` 01:21
timotimo you can use "my" inside that line, kind of like ugexe showed
rudi_s raiph: Sorry, eqv should be !eqv. 01:23
How would I combine that with ".?"? 01:24
raiph m: my $bar; my %a; %a<b> = 1; if %a.?foo !eqv $bar { ... } 01:25
camelia rakudo-moar 1ef247: OUTPUT«Stub code executed␤ in block <unit> at /tmp/1twOXXJaxX line 1␤␤»
timotimo raiph: you mean %a{$b}.?foo
raiph m: my $bar; my %a; %a<b> = 1; if %a<b>.?foo !eqv $bar { ... }
camelia rakudo-moar 1ef247: OUTPUT«Stub code executed␤ in block <unit> at /tmp/P6yb16sYjP line 1␤␤»
rudi_s m: my $bar; my %a; if %a<b>.?foo !eqv $bar { ... } 01:26
camelia rakudo-moar 1ef247: OUTPUT«Stub code executed␤ in block <unit> at /tmp/V_2pld3Jb0 line 1␤␤»
rudi_s I don't want to enter the block in this case. 01:27
timotimo ah, right 01:36
because Nil wouldn't eqv $bar
01:42 baest left 01:45 zpmorgan joined 01:47 baest joined 01:56 Actualeyes joined, molaf joined 02:05 raiph left 02:06 molaf_ joined 02:09 molaf left 02:16 BenGoldberg joined 02:20 abaugher left 02:21 abaugher joined 02:32 addison_ left, tmch joined 02:33 raiph joined 02:48 telex left 02:51 colomon joined 02:54 kid51 left 02:55 Actualeyes left 02:57 telex joined 03:15 raiph left 03:24 wamba left 03:30 rburkholder left 03:34 raiph joined 03:53 noganex_ joined 03:55 BenGoldberg left 03:56 inokenty joined, noganex left 04:05 jaldhar_ left, jaldhar_ joined 04:13 xinming left 04:14 xinming joined 04:17 TEttinger left 04:19 anaeem1 joined, anaeem1 left 04:48 skids left 04:49 Actualeyes joined 04:53 molaf_ left 04:56 Actualeyes left 04:57 jaldhar_ left
raiph rudi_s: ping 04:57
04:57 jaldhar_ joined 04:59 jaldhar_ left 05:00 jaldhar_ joined 05:10 abaugher left 05:11 abaugher joined
dalek Iish: 46af42f | (Salvador Ortiz)++ | / (9 files):
Move testing framework to DBIish::CommonTesting

Remove t/lib, we don't want an extra "use lib 't/lib';" in our tests.
The work that was done 't/lib/Test/Config/Pg.pm' is useless as the Pg C library implements all the PG* env vars handling.
Iish: 8f4d682 | (Salvador Ortiz)++ | / (3 files):
Make panda happy bumping the version number.

Continuous Integration needs that every change be reflected in the version of our META6.json.
We take this opportunity to unify the name of the test databases.
05:19 Actualeyes joined 05:25 yeahnoob left
dalek Iish: db002ce | (Salvador Ortiz)++ | t/35-pg-common.t:
Pg: Fix typo in test db name
Iish: f979c70 | (Salvador Ortiz)++ | lib/DBDish/mysql (2 files):
mysql: Better error handling at connect
05:27 idiosyncrat_ left 05:28 yeahnoob joined 05:30 FreezerburnV left 05:43 Cabanossi left 05:47 Cabanossi joined 05:48 Actualeyes left 05:56 Actualeyes joined 06:06 llfourn joined 06:07 khw left 06:15 TEttinger joined 06:22 raiph left
jdv79 that is sad about shimmerfairy bouncin:( 06:23
06:24 darutoko joined 06:26 xinming left 06:29 sftp left 06:33 labster left 06:34 sftp joined 06:38 nakiro joined 06:39 tmch left 06:50 Relsak left 06:59 CIAvash joined 07:01 bjz joined 07:04 tmch joined 07:05 domidumont joined 07:07 domidumont left 07:08 domidumont joined 07:16 buharin joined
buharin moritz, hi 07:16
07:20 sno left
buharin why cant I use variable to initialise itself like in python 07:29
or even C 07:30
07:39 firstdayonthejob joined 07:41 xinming joined
buharin someone here? 07:47
Timbus ? in what way
buharin perl6 t/basic.t 12.66s user 0.18s system 99% cpu 12.850 total
wtf I write simple function 07:48
and it run it 12s
07:49 Relsak joined
Timbus how do you "use a variable to initialize itself" in C ? 07:51
moritz m: my $x = 42; say $x; # initialized variable, for buharin
camelia rakudo-moar 1ef247: OUTPUT«42␤»
buharin a = 2 07:54
b = 3
a = a + b
OUTPUT a = 5
moritz sure
arnsholt m: my $a = 2; my $b = 3; $a = $a + $b; say $a
camelia rakudo-moar 1ef247: OUTPUT«5␤»
Timbus put dollar signs in there and you got it 07:55
moritz you can shorten that to
m: my $a = 2; $a += 2; say $a
camelia rakudo-moar 1ef247: OUTPUT«4␤»
buharin hey see this 07:56
I have started to write it but ;d
my test going thorough 12sec
07:57 nowan left
buharin and sure I cant initialize 07:57
my $temp = $.GRAPH_API ~ "/" ~ $!version ~ "/" ~ $url;
$url = $temp;
07:58 nowan joined 08:00 vendethiel- joined 08:01 vendethiel left
buharin ?? 08:02
08:03 sno joined
buharin moritz, Timbus arnsholt 08:03
moritz buharin: what makes you think you can't do that? 08:04
buharin an error
moritz buharin: what error? 08:08
buharin: do you seriously expect us to be able to help you if you don't even tell us the error you get?
08:14 buharin left, ely-se joined 08:17 TimToady left, buharin joined
buharin need to go 08:17
08:17 buharin left
moritz can't shake off the feeling that buharin trolls us 08:18
08:19 TimToady joined
nine_ Would be an elaborate way of trolling though. 08:20
08:25 zpmorgan left
CIAvash Is "Missing serialize REPR function for REPR VMException" a bug in HTTP::UserAgent or a general issue? 08:29
08:30 firstdayonthejob left, uruwi left 08:31 uruwi joined 08:32 zakharyas joined 08:35 abraxxa joined 08:37 jaldhar_ left, jaldhar_ joined 08:39 nowan left 08:43 labster joined 08:44 nowan joined 08:53 maybekoo5 joined 09:09 kjs_ joined 09:12 kjs_ left, bioexpress joined 09:14 sunnavy left 09:15 sunnavy joined
dalek kudo/nom: 6f96209 | lizmat++ | src/core/Rakudo/Internals.pm:
Streamline error handling for shaped arrays

Hopefully gaining a bit of performance because of easier inlineability and get some clearer code as a bonus
El_Che ls 09:24
lizmat El_Che o/
lizmat clickbaits p6weekly.wordpress.com/2016/02/29/...ping-away/
El_Che it is OK to add additional information to the META6.json file? Maybe "namespaced" prefix_something: "blah" 09:25
El_Che reading p6weekly
09:27 vendethiel joined 09:28 vendethiel- left 09:29 dakkar joined, RabidGravy joined 09:31 yeahnoob left, Actualeyes left
lizmat moritz++ 09:33
afk for a few hours&
09:36 espadrine joined
arnsholt m: role R { my $a = 0; method foo() { $a++; say $a; } }; class A does R {}; class B does R {}; A.foo; B.foo # I wonder... 09:36
camelia rakudo-moar 6f9620: OUTPUT«1␤1␤»
09:36 fireartist joined
arnsholt Spiffy, spiffy 09:37
09:41 bjz_ joined, kjs_ joined
RabidGravy BOO! 09:42
09:42 bjz left
bioexpress Hello, is there a Perl6 signature which I could use to convey a native `wchar_t`? 09:49
CIAvash RabidGravy: Can you take a look at this question? irclog.perlgeek.de/perl6/2016-03-01#i_12121045 09:50
RabidGravy It's both :)
it should however be fixed for H::UA for the most recent 09:51
CIAvash Before, that message would just be printed but the code would work, now the code that uses H::UA dies. 09:53
RabidGravy what causes it is some code in the compile time mainline giving rise to a Failure, in the case of H::UA it is a "try require IO::Socket::SSL" that was in the mainline of the class 09:54
I moved it as late as possible
arnsholt bioexpress: Not currently, I think. Unfortunately
bioexpress Thx, than I have to wait a little bit. 09:57
CIAvash RabidGravy: You mean a fix was released?
arnsholt bioexpress: How much variation is there in how wchar_t is defined on various platforms? 09:58
RabidGravy Hmm I thought so but I may have made a mistake, it's in my local copy but not on GH :( 'ang on a sec 09:59
this will be why I'm not seeing it anymore but every one else is
CIAvash :)
bioexpress arnsholt: I don't know. I asked because I'ld like to use the ncurses `int addwstr(const wchar_t *wstr);` in Perl6. 10:00
arnsholt Right. If you'd like to get stuck in you can always just hardcode the relevant type for the platform you're working on 10:03
And then lobby one of the people working on NativeCall ATM to add a wchar_t type 10:04
bioexpress I will try it 10:05
RabidGravy CIAvash, there github.com/sergot/http-useragent/c...3b5beaf4c4 10:08
10:08 bioexpress left 10:12 vendethiel left
CIAvash RabidGravy: thanks :) 10:12
10:13 vendethiel joined 10:16 Actualeyes joined 10:20 maybekoo5 left 10:23 luiz_lha joined, luiz_lha is now known as Guest22451 10:35 JimmyZ_ joined 10:39 kjs_ left, JimmyZ_ is now known as JimmyZ 10:43 partly joined
partly Hi 10:43
I just search 15 minutes for an error. In the end it was an if $foo = -1 instead if $foo == -1. May be the compiler should warn one about this? Or is it a feature? 10:44
DrForr There are legitimate reasons to assign inside an 'if' expression. 10:45
partly DrForr: There were? (not arguing, trying to understand) 10:46
jast in some languages a warning like that is generated only if the assignment is directly on the top level of the expression
e.g. if foo = 4 creates a warning, if (foo = 4) doesn't
DrForr Sure, think about do_stuff() if $index++; "Tested the index, now move on." 10:47
partly DrForr: Is $index++ not different from $index = -1? The first one is a function call, the second one is an assignment? 10:48
DrForr They're both assigning. 10:49
partly Maybe a similar warning like jast mentioned?
10:50 kjs_ joined
RabidGravy regarding the wchar_t thing, it would need to be implemented in NativeCall::Types, MetaModel::NativeHOW and the P6Int repr 10:50
DrForr Well, propose it, I suppose. I do it myself on occasion but usually find it quickly.
RabidGravy not so trick
partly DrForr: how do i propose something? Any manual on that? 10:51
DrForr Pull requests speak louder than words ;)
I wouldn't know though. Discussing it here can't hurt. 10:52
partly DrForr: ic :)
RabidGravy lots of places where you might want to test an assignment 10:54
if $a = something() { } is quite common 10:55
10:55 labster left
partly RabidGravy: yeah i see how this can be useful. 10:57
DrForr Worst case, rely on the old C trick of '1 == stuff()' :) 10:59
11:00 wamba joined
partly DrForr: TIL. thank you! 11:01
RabidGravy is there some web server module that a) won't output any headers at all if you don't ask it to, b) can support arbitrary request methods 11:02
DrForr Patience, Daniel-San :) 11:03
RabidGravy the icecast source protocol is a bit, er, special
DrForr Will Crust allow [] in place of the usual content-type?
RabidGravy well, HTTP::Server::Tiny always adds the Date and Server headers 11:04
DrForr Feature request of them, maybe? 11:06
RabidGravy and the source protocol don't work if you send anything other than a "HTTP/1.0 200 OK\r\n\r\n" in response to a valid SOURCE request
which is all a bit yuck 11:07
and it appears the client on receipt of that just splurges the data over the open connection 11:10
11:12 rurban joined 11:15 Guest22451 is now known as luiz_lha
RabidGravy the documentation alludes to modern servers using PUT but I haven't find a client that actually does that 11:16
11:17 johndau joined
Juerd 11:55 < RabidGravy> if $a = something() { } is quite common 11:17
Well, it used to be. And then we got: if something() -> $a { ... }
DrForr Well, Prancer accepts PUT but I don't know if the P6SGI layer does. I've had to rewrite the core because I found a problem in the URL mapping.
RabidGravy yes
Juerd So far, I haven't written a single "if $a = something() { ... }" yet, simply because I never wanted that $a to be scoped outside the block anyway. 11:18
RabidGravy well the HTTP::Parser thing will accept any old request method 11:19
Juerd So this does change my mind from not wanting that warning to really wanting it :)
Might even try to patch that myself
RabidGravy I'm relaxed about it, but I think it should be limited to constant values on the RHS 11:20
lizmat re: if $a = something() { } being quite common: yes, in P5 11:33
in P6 we can do: if something() -> $a {} 11:34
so perhaps a general warning for if $a = something *could* be in order in P6, pointing to the something -> $a alternative 11:35
ah, I see Juerd already made the point :-(
llfourn I don't think that should be a warning. You can legit reasons for not using pblock. 11:38
like not wanting a ro container and not wanting to write 'is rw'
or "is copy" rather 11:39
jnthn The "only warn if it's a literal on the RHS" may be a reasonable compromise
llfourn but people don't usually if literals :P 11:40
lizmat m: sub a(\a) is raw { a }; my $a; if a($a) <-> $b { $b = 42 }; dd $a # hmmm.. sorta expected $a to be 42 11:41
camelia rakudo-moar 6f9620: OUTPUT«Any $a = Any␤»
lizmat *or* fail
llfourn doesn't even know what <-> is
lizmat short for "is rw" ? 11:42
arnsholt It's -> {} but with the parameters being is rw, IIRC
llfourn oh cool
jnthn llfourn: Yes, that's exactly the point
llfourn: if $a = 1 { } is very likely a mistake
llfourn ah right yep I understand now
m: say <-> $a { }.perl 11:44
camelia rakudo-moar 6f9620: OUTPUT«-> $a is rw { #`(Block|55179248) ... }␤»
llfourn m: say <-> $a { }.(2)
camelia rakudo-moar 6f9620: OUTPUT«Parameter '$a' expected a writable container, but got Int value␤ in block <unit> at /tmp/n_pG5HSnJC line 1␤␤»
llfourn is there an 'is copy' one?
jnthn No, but it's fun to imagine what it might look like :P 11:45
11:46 ely-se left
moritz -||> 11:47
-(c)> 11:48
-(:c)> # we can put adverbs here!
11:48 ely-se joined
llfourn -⎘> $a { ...} #? 11:49
11:53 vendethiel- joined 11:54 vendethiel left
dakkar has anyone tried to embed a perl6 runtime into some other programs? 11:56
11:56 kjs_ left
llfourn I think there's an Inline::Perl6 that nine++ made... 11:56
dakkar ah right, that may be a nice starting point 11:57
llfourn metacpan.org/pod/Inline::Perl6
dakkar will look
11:58 kid51 joined 12:01 rindolf joined
nine_ dakkar: documentation is sorely lacking, but I'm happy to answer questions. Also there's niner.name/talks/Building Bridges/examples/inline_perl6.html 12:01
12:01 Relsak left 12:07 TEttinger left 12:10 M-Illandan left
dalek kudo/nom: cf3b121 | lizmat++ | src/core/Parameter.pm:
Streamline Parameter.named a bit
12:12 vendethiel- left 12:13 Skarsnik joined, vendethiel joined
Skarsnik Hello 12:13
lizmat Skarsnik o/ 12:15
12:16 kjs_ joined
DrForr \o 12:16
12:16 kjs_ left 12:17 kjs_ joined
dalek kudo/nom: b9a79ec | lizmat++ | src/core/Parameter.pm:
Simplify Parameter.named_names|type_captures
12:26 rurban left, rurban joined
lizmat jnthn: do you have any idea why it is impossible to create a class that does Blob in the setting? 12:30
12:30 Relsak joined
nine_ lizmat: "A module can now print to $*OUT while being compiled without messing up the precompilation process." Shouldn't this be $*ERR? 12:33
lizmat: "Of which one really sad." is missing a verb 12:34
12:34 vendethiel- joined, vendethiel left
lizmat nine_: not sure about that verb missing there 12:34
nine_ Though that might be a subtle hint to that a part of us is missing.
12:34 kid51 left
lizmat yeah, the verb omission there was intentional 12:35
nine_ lizmat++ # I like subtlety
lizmat nine_: cc0472b43e9edb6c777e7 states: fix precompiling a file that outputs to stdout
nine_ Oooh I missed that patch. 12:36
I'm also not sure I like it :/
lizmat yeah, FROGGS didn't like it either... but it makes it work for now
nine_ I wonder why a module's mainline would want to write to STDOUT? 12:37
12:40 skids joined 12:41 skids left 12:42 rurban left 12:46 colomon left 12:52 colomon joined
RabidGravy would it be enormously difficult to "upgrade" a normal IO::Socket client socket to an IO::Socket::Async one? 12:53
12:54 Actualeyes left 12:59 kjs_ left, iH2O joined
lizmat RabidGravy: I think so, because they differ at the nqp level 13:01
RabidGravy is the actual VMIO different?
lizmat nqp::asyncconnect vs nqp::open (I think) 13:02
that I'm not sure of
RabidGravy it was just something that occurred to me while I was playing with this noddy streaming server 13:03
jnthn Moving handles between libuv event loops is very fraught
We may actually have more luck doing it once we stop using libuv for sync I/O
13:06 sufrostico joined, Actualeyes joined 13:07 johndau` joined, johndau left, wamba left 13:10 burnersk left, z8 joined 13:15 jaldhar_ left 13:16 z8 left 13:20 iH2O left 13:23 rurban joined 13:25 Relsak left, Relsak joined 13:28 kaare_ joined 13:34 johndau` is now known as johndau 13:37 kjs_ joined
timotimo o/ 13:37
13:45 cdg joined
lizmat wonders what magic is happening here: $!default_value ~~ Code ?? $!default_value !! { $!default_value } 13:46
lizmat wakes up
tadzik heh 13:47
"callify" the default_value, it seems
lizmat yeah, which means adding overhead
jnthn Probably coping with a place where we may get a funk or may get a value and want it to be consistent
*thunk 13:48
tadzik it may make sense to call it if it's code, save it if not
unless it's meant to be lazy
jnthn It's rather hard to say without context ;)
tadzik ye :)
lizmat $rest ~= ' = { ... }' if $default;
it's about Parameter.perl 13:49
jnthn Hm
If it's a value we could actually .perl the value...
lizmat now, if $default were just a value, we could actually say: $rest ~= " = $default";
jnthn $default.perl() :)
lizmat yeah...
OTOH, this Parameter.perl is really Parameter.gist 13:50
if it's about roundtripping, we could as well do Parameter.new(flags => 723) etc
jnthn Well, .perl certainly needs to get it .perl'd
lizmat instead of figuring out how each flag influences how we look at it
jnthn Yeah, but .perl there is used when .perl-ing Block, Sub, etc. 13:51
And so you want a signature literal out of it really
So they can come out syntacticly sane 13:52
lizmat agree
jnthn Phone call, then - at last - should have some Perl 6 hacking time \o/
13:58 Ven joined
Ven o/ 13:58
masak \o 13:59
13:59 cdg left, addison joined 14:07 sftp left, sftp joined
RabidGravy so if I had a thing to decode the input stream so I can emit a properly encoded output stream this streaming server might actually work 14:08
14:11 dakkar left 14:15 SCHAAP137 joined 14:16 addison left 14:17 dakkar joined 14:25 raiph joined 14:26 skids joined 14:36 abaugher left 14:37 abaugher joined
RabidGravy erk, the mad decoder has a waay weird interface 14:37
14:38 wamba joined 14:41 SCHAAP137 left
rudi_s Hi. I'm having a problem with the classify solution to split an array into two based on a predicate: my (@a, @b) := (1,2,3,4).classify({ $_ %% 2 }).{True, False} 14:41
It works fine if @a and @b are not empty, but if they are, it fails: 14:42
m: my (@a, @b) := (1,3).classify({ $_ %% 2 }).{True, False}
camelia rakudo-moar b9a79e: OUTPUT«Type check failed in binding @a; expected Positional but got Any (Any)␤ in block <unit> at /tmp/VfJiSa2CWB line 1␤␤»
rudi_s Any idea how I could fix this?
*but if either one is empty, it fails.
14:44 themonkeybob11 joined 14:51 Relsak left 14:52 themonkeybob11 left
lizmat commute to Amsterdam.PM& 14:53
14:53 lizmat left
RabidGravy rudi_s, > 14:59
rudi_s RabidGravy: ?
RabidGravy m: my (@a, @b) := (1,3).classify({ $_ %% 2 }).{True, False}.map({ $_ // []}).list; say @a, @b;
camelia rakudo-moar b9a79e: OUTPUT«[][1 3]␤»
rudi_s RabidGravy: Thanks. But that's a little ugly. With just {True, False} it was nice, but this needs quite a lot of boilerplate. 15:01
RabidGravy I won my bet with mysefl 15:02
15:02 sufrostico left
rudi_s Which was? 15:02
RabidGravy there was going to be a "but"
rudi_s Well ;-)
Please don't tell me you think this is a nice solution for the simple task to split a list in two? 15:03
RabidGravy I don't have any opinion whatsoever about it
rudi_s Hm.
masak rudi_s: whenever you feel a solution is insufficiently nice or un-idiomatic, there's a particular language pattern that helps 15:04
it's called "named subroutines"
it can help abstract away some tedious code, pulling it out of the way of your main sentence 15:05
all the while providing an action or a transformation with a nice, domain-aligned designation
people underestimate this pattern
rudi_s masak: And how's that going to help? I have to write that small subroutine in each perl6 project where I need that particular feature. 15:06
masak yes, that's an excellent start, IMO
whenever the name makes sense, at least
timotimo C question, if i may 15:07
src/6model/reprs/P6opaque.c:686:52: error: lvalue required as left operand of assignment
(void *)(repr_data->attribute_offsets) += (char *)allocated_repr_blob;
geekosaur or you can make a private library of such things as modules
rudi_s I don't like duplication. Anyway, would be nice if perl6 had a short way to express that.
timotimo all i want to do is move the pointer on the lhs by the amount of bytes on the RHS. how do i spell that correctly?
masak rudi_s: one of the nice parts about this is re-use -- if you end up using the pattern in many places, and you need to change the underlying code, you only need to change the code in one place.
geekosaur timotimo, it's the cast that's doing it
LHS cast
timotimo geekosaur: right, but if i don't cast, wouldn't i have to divide the RHS by the pointer size of the LHS? 15:08
masak rudi_s: I guess it's all a question of what's more important at this point -- using an abstraction mechanism and making the code nicer, or being stubborn
rudi_s masak: Not sure if you're trolling.
masak not trolling.
genuinely trying to help.
rudi_s timotimo: You'd need to cast to char *.
timotimo i had (char *) on the lhs before, that errored the same way
rudi_s Pointer arithmetic is not defined on void *.
geekosaur casting to (char *) still makes an rvalue 15:09
rudi_s Yeah, what geekosaur said. void * vs. char * is a separate problem.
timotimo well, if i drop the cast, i get "invalid operands to binary +"
so i just won't be able to += ?
and instead replicate the LHS with the cast onto the RHS of a simple =?
geekosaur yep 15:10
rudi_s timotimo: Yeah.
But you don't need the cast on the left side (unless it's C++).
geekosaur note that old versions of gcc used to permit that because the optimizer removed the cast before it was detected 15:11
15:11 tadzik left
geekosaur so it seems to be biting a bunch of people who got used to gcc allowing it 15:11
timotimo OK
src/6model/reprs/P6opaque.c:688:79: error: invalid operands to binary + (have ‘char *’ and ‘char *’)
well, that's fun
rudi_s masak: I know I can abstract things, but I'd like to get core features in the language. 15:12
geekosaur hm
15:13 nakiro left
rudi_s timotimo: You can't add a char *, you can only add a int. 15:13
s/int/numeric value/
masak rudi_s: is this about wanting .classify to work differently? maybe the discussion would be more productive if it was clearer what exactly you're currently missing.
geekosaur timotimo, what is allocated_repo_blob? 15:14
(in particular what is its type?)
15:14 tadzik joined
rudi_s masak: I want to split an array/list into two based on a predicate. The first contains the ones where the predicate returns true, the second where it's false. 15:14
Btw. how can I return two arrays from a function so that I can do my (@a, @b) = foo()? 15:15
timotimo geekosaur: void *
masak rudi_s: the first list can be had through .grep
pyrimidine Anyone here interested in bioinformatics apps for Perl 6? Open Bioinformatics Foundation is accepting proposals for the Google Summer of Code: summerofcode.withgoogle.com/organi...329984000/
geekosaur so how were you expecting to add two addresses together?
did you want the size instead of the address? (you can't derive that from the address if it's allocated) 15:16
masak m: sub split_on_predicate(@l, &p) { [@l.grep(&p), @l.grep({ !&p($_) })] }; say split_on_predicate [1, 3], * %% 2
camelia rakudo-moar b9a79e: OUTPUT«[() (1 3)]␤»