»ö« 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:01 pyrimidine joined 00:05 pyrimidine left 00:06 Cabanossi left 00:08 Cabanossi joined 00:10 jp_ left 00:14 cdg joined 00:17 cdg_ left 00:19 cdg left 00:27 wamba left 00:32 agentzh joined 00:37 pyrimidine joined 00:44 aborazmeh joined, aborazmeh left, aborazmeh joined 00:46 dugword joined, ocbtec left
Geth oc: 29295940fe | (Will "Coke" Coleda)++ | 2 files
Don't generate .png typegraph files
00:47
oc: 525e94eec1 | (Will Coleda)++ | 2 files
Merge pull request #1131 from perl6/coke/pngless

Don't generate .png typegraph files
00:51 dugword left, cyphase left 00:56 cyphase joined
Geth oc: antquinonez++ created pull request #1171:
added line breaks to grammar_tutorial
00:57
01:04 bpmedley joined 01:06 astj joined 01:11 astj left, agentzh left, cdg joined 01:12 LeCamarade joined, LeCamarade left
Geth oc/master: 4 commits pushed by Altai-man++ 01:12
01:13 astj joined, LeCamarade joined 01:15 sena_kun left 01:19 LeCamarade left 01:25 kyan left 01:33 labster left 01:40 agentzh joined
brokenchicken wtf.. travis just emailed me about a failed build... of a commit from JAN 19! 01:40
cale2 So "grep" is perl's version of "filter" 01:41
I was wondering for the longest time why there was no filter
brokenchicken
.oO( must've been delayed by Donald's administration... )
cale2 as someone that doesn't have a background in unix admin stuff, that's something I found confusing 01:43
brokenchicken Filter's a strange name since you're doing the opposite. 01:44
01:47 espadrine_ left
cale2 `'`'`'`'`'` filter onlySingleQuotes ''''' 01:47
Just depends on how you write your filtering function
01:48 BenGoldberg joined
cale2 Like you're filtering out the bad stuff 01:48
where does "grep" even come from?
"get representation"
BenGoldberg global regular expression print 01:49
cale2 Is grep just one of those things that you'd never think to change? Because it's so loved and gives warm fuzzy feelings, etc 01:50
BenGoldberg Perl has always had a grep builtin... 01:51
cale2 Just wondering how many things are in the language because "it's always been that way" 01:52
BenGoldberg You could of course add some sort of alias, like "filter", but most programmers are used to the name grep.
cale2 I guess P6 isn't necessarily about starting completely over. More like revolution rather than evolution 01:53
or the other way around haha
BenGoldberg The *feature* grep is important, the *name* grep slightly less so. Removing that feature entirely would be stupid.
Renameing it, while possible, is kinda pointless.
02:01 mst joined 02:02 mst left, mst joined
masak TimToady: sorry about the miscategorization of your hat. can I call it an "Aussie hat" next time? :) 02:06
02:06 user__ joined
masak TimToady: any thoughts on BEGIN firing per expansion? do you mind the semi-consensus that emerged yesterday (that it does)? 02:06
another thing that pushed me in that direction was: we don't mind at all that END fires per expansion. 02:07
02:09 kalkin- left
brokenchicken What's an expansion? 02:12
masak brokenchicken: it's when code returned from a macro gets put in the code where the macro call was. 02:13
brokenchicken Ah
masak it's an old Lisp term. 02:15
little bit misleading, since the result can be smaller, bigger, the same size or even divergent 02:16
brokenchicken No, makes sense to me :) 02:18
cale2 the new rakudo star release says advanced macros aren't implemented yet. what does that mean exactly?
masak TimToady: also, there are two kinds of consistency at odds here for quasis with BEGIN blocks without unquotes. they could fire ASAP (once) or per expansion.
cale2 simple macros work, but advanced ones dont? 02:19
masak cale2: there's no short answer. but somewhat simply, I wouldn't want to use the macros that are implemented so far.
cale2: if you're *really* interested in Perl 6 macros, then the development of 007 is worth paying attention to.
it has some cutting-edge insights into macros and slangs that sometimes leak over into this channel. 02:20
implementation of all those new things will commence in Rakudo at some point. don't know exactly when.
cale2: "advanced macros" are based off something called the Qtree. it's an AST structure for the program. 02:21
02:21 cdg left
cale2 Is it basically Racket macros in perl6? 02:22
02:28 travis-ci joined
travis-ci Doc build errored. Will Coleda 'Merge pull request #1131 from perl6/coke/pngless 02:28
travis-ci.org/perl6/doc/builds/196794815 github.com/perl6/doc/compare/c17ac...5e94eec1d5
02:28 travis-ci left 02:30 lostinfog left
brokenchicken hmmm... moar configure failed :/ 02:35
02:35 Cabanossi left
brokenchicken don't really say why 02:36
Ahhh git error: fatal: unable to access 'github.com/libuv/libuv.git/': Failed connect to github.com:443; Connection timed out
samcv :\
02:37 LeCamarade joined, Cabanossi joined 02:40 _28_ria left 02:41 hartenfels joined 02:42 _28_ria joined, gregf_ left 02:45 MasterDuke joined 02:46 dugword joined 02:47 travis-ci joined
travis-ci Doc build errored. Altai-man 'Merge pull request #1165 from Altai-man/comments 02:47
travis-ci.org/perl6/doc/builds/196797707 github.com/perl6/doc/compare/525e9...efe96978ce
02:47 travis-ci left 02:54 _28_ria left 02:56 _28_ria joined 02:58 LeCamarade left, LeCamarade joined 03:06 Cabanossi left 03:08 Cabanossi joined 03:16 cibs left 03:18 cibs joined 03:19 agentzh left 03:20 dugword left 03:21 dugword joined 03:29 xtreak joined 03:32 LeCamarade left 03:34 LeCamarade joined 03:35 avuserow left 03:37 avuserow joined 03:39 noganex_ joined 03:43 noganex left 03:48 cdg joined 03:51 cale2 left 03:59 xtreak_ joined 04:01 xtreak left, xtreak joined 04:02 Cabanoss- joined 04:04 xtreak_ left 04:05 solarbunny left 04:06 Cabanossi left, Cabanoss- is now known as Cabanossi 04:12 solarbunny joined 04:18 LeCamarade left 04:20 itcharlie1 joined
brokenchicken POTATO! 04:29
04:32 khw left 04:36 BenGoldberg left 04:48 dugword left 04:53 _28_ria left 04:55 _28_ria joined 04:56 itcharlie1 left 04:57 dugword joined 05:00 Cabanoss- joined 05:02 agentzh joined, cdg left 05:03 Cabanossi left, Cabanoss- is now known as Cabanossi 05:05 Vynce left 05:27 astj left 05:30 labster joined
samcv brokenchicken, what's the best way to create all possible orderings of an array? 05:32
m: my @a = 1,2,3; @a.op # (1,2,3), (1,3,2), (3,2,1), (3,1,2) etc 05:33
camelia rakudo-moar 3e28b1: OUTPUT«No such method 'op' for invocant of type 'Array'␤ in block <unit> at <tmp> line 1␤␤»
masak cale2: re "grep" -- I feel your confusion, FWIW. 05:37
cale2: I had that function/method as "grep" in 007 for a long while too, until I took a fresh look at it and decided that the name doesn't make sense unless you have a very specific (Unix-y) history. 05:38
"filter" ain't perfect, no, but it's probably the least bad among the various contenders.
samcv a Grep is a goblin like creature 05:39
well that's what the name sounds like at least
masak, any clue how to generate all possible orders of a list in p6?
masak my s/grep/filter/ commit at the time explains my reasoning: github.com/masak/007/commit/9097ba...1438bb9b77 05:40
samcv: I believe that's a built-in these days
m: say [1, 2, 3].permutations.perl
camelia rakudo-moar 3e28b1: OUTPUT«((1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2), (3, 2, 1)).Seq␤»
samcv nice 05:41
masak yeah, we're nice that way
samcv prolly gonna use that for my bitfield packing
masak Perl 6 no longer has the problem that there are too *few* built-ins :P
I think sometimes we're slightly bad at holding back and looking for that wonderful generalization that could reduce the built-ins a tad more 05:42
perhaps that's an inevitable consequence of the community having as much steerage as it does
samcv i think that's the most trivial way to do it. since it's much easier to write a function to compute how items in a bitfield will be padded than to write something to try and find the best possible ordering programmatically
heh
masak also, I happened to see the .kxxv method name the other day, and was reminded how I wanted to institute an "ugliest built-in name ever" prize :P 05:43
05:43 agentzh left
masak (no, I don't have a better suggestion) 05:43
samcv heh
TEttinger yay bitfields 05:45
is this for unicode stuff, samcv? 05:46
samcv yea
05:50 agentzh joined 05:52 Vynce joined 05:55 _28_ria left 05:58 _28_ria joined, CIAvash joined
Geth oc: antquinonez++ created pull request #1172:
edits to exceptions pod
06:20
06:21 dugword left 06:25 bjz joined 06:29 agentzh left 06:31 agentzh joined 06:32 domidumont joined 06:35 hartenfels1 joined 06:36 bjz left 06:37 hartenfels left, hartenfels1 is now known as hartenfels 06:38 domidumont left, domidumont joined 06:40 domidumont left 06:41 jraglin left 06:44 agentzh left 06:52 RabidGravy joined, xtreak left 06:53 travis-ci joined
travis-ci Doc build passed. Antonio Quinonez 'edits to exceptions pod' 06:53
travis-ci.org/antquinonez/doc/builds/196846373 github.com/antquinonez/doc/commit/bd26cbe7509b
06:53 travis-ci left 06:55 xtreak joined
masak m: macro swap($a, $b) { quasi { ({{{$a}}}, {{{$b}}}) = {{{$b}}}, {{{$a}}} } }; my $w = 5; my $z = 10; swap $w, $z; say [$w, $z].perl 07:00
camelia rakudo-moar 3e28b1: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Use of macros is experimental; please 'use experimental :macros'␤at <tmp>:1␤------> 3macro7⏏5 swap($a, $b) { quasi { ({{{$a}}}, {{{$b␤»
07:00 domidumont joined
masak m:use experimental :macros; macro swap($a, $b) { quasi { ({{{$a}}}, {{{$b}}}) = {{{$b}}}, {{{$a}}} } }; my $w = 5; my $z = 10; swap $w, $z; say [$w, $z].perl 07:00
m: use experimental :macros; macro swap($a, $b) { quasi { ({{{$a}}}, {{{$b}}}) = {{{$b}}}, {{{$a}}} } }; my $w = 5; my $z = 10; swap $w, $z; say [$w, $z].perl 07:01
camelia rakudo-moar 3e28b1: OUTPUT«[10, 5]␤»
masak \o/
07:04 aborazmeh left
masak tried the corresponding macro in 007, and found a bug :P 07:06
07:12 wamba joined 07:15 hchienjo joined 07:16 hchienjo left 07:17 jraglin joined 07:18 vendethiel left 07:20 darutoko joined 07:25 mr-foobar left 07:27 domidumont left 07:31 mr-foobar joined 07:35 domidumont joined 07:36 mr-foobar left 07:37 agentzh joined 07:47 agentzh left 07:48 e1 joined
samcv masak, i want to use a macro to simplify this: 07:57
macro dump($a) { $a.VAR.^name ~ $a.gist }
i try this and i get "Too few positionals passed; expected 3 arguments but got 2"
masak m: my $a = [1, 2, 3]; say :$a.perl 07:58
camelia rakudo-moar 3e28b1: OUTPUT«:a($[1, 2, 3])␤»
masak :)
samcv that doesn't answer my question
masak agreed
samcv tho :\
masak I notice that your macro doesn't have a quasi 07:59
samcv i know .perl, but i am doing some custom dumping, and want to macro it
samcv has no clue what quasi does
masak they are the thing you put your generated code in
otherwise the code just ends up running as part of the macro call
samcv m: macro dump($a) { quasi { $a.VAR.^name ~ $a.gist } }; my $var = 'test'; say dump($var)
camelia rakudo-moar 3e28b1: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Use of macros is experimental; please 'use experimental :macros'␤at <tmp>:1␤------> 3macro7⏏5 dump($a) { quasi { $a.VAR.^name ~ $a.gi␤»
samcv m: use experimental :macros; macro dump($a) { quasi { $a.VAR.^name ~ $a.gist } }; my $var = 'test'; say dump($var) 08:00
camelia rakudo-moar 3e28b1: OUTPUT«ScalarAST.new␤»
samcv :\
what's the closest to c's #define ?
i literally only need verbatim insertion
masak m: use experimental :macros; macro dump($x) { quasi { say VAR({{{$x}}}).name, ": ", {{{$x}}}.perl } }; my $foo = "OH HAI"; dump($foo)
camelia rakudo-moar 3e28b1: OUTPUT«$foo: "OH HAI"␤»
masak there ya go 08:01
samcv so many {{{}}}
08:01 bwisti left
masak feel free to write it in any other way that works 08:01
samcv what works ;P
TimToady masak: the consensus view seems fine to me
samcv ?
masak also, you're welcome ;)
TimToady: cool
geekosaur samcv, quasi "quotes" code for later evaluation (at run time); {{{ }}} is what "unquotes" stuff to be substituted into the quoted code 08:02
masak samcv: you're not the first person to complain about the {{{ }}}
samcv: there's a lighter syntax being thrown around in 007 (though NYI): `unquote(...)`
samcv can we have a 'define'? 08:03
geekosaur in common lisp, quasi is `() and {{ }}} is ,@ or , depending on whether lists are to be "flattened" or not (respectively)
samcv that can do less fancy things?
masak samcv: no :)
samcv :|
masak samcv: at least, I'm not going to implement one
someone else might get a kick out of repeating C's mistakes. not me.
samcv i guess i'll just have to type lots of braces
haha
masak no-one is forcing you to use macros
samcv well i can't reliably do .VAR.^name without them 08:04
if I make a sub even is pure i often get some random thing outputted that's not the variable's name
masak this is true
VAR(...).name is a very macro-ish wish to have 08:05
note that it's .name, too, not .^name as you wrote
TimToady goodness, it's tomorrow already
samcv no it is .name 08:06
m: my $var; say $var.VAR.^name; say $var.VAR.name;
camelia rakudo-moar 3e28b1: OUTPUT«Scalar␤$var␤»
samcv oh. yeah
sorry i got mixed up
i will take my macros where I can get them though ;) 08:07
08:07 khw joined
masak samcv: I wouldn't be so cranky about `#define` if I didn't deeply believe that what Perl 6 is aiming for is strictly better ;) 08:09
samcv agreed lol
i just want less {{}} tbh
geekosaur perl6 specifically went with that because it was ugly (and therefore highly obvious that Something Weird is going on) 08:10
samcv ah
<----begin weirdness---->
geekosaur because $x means the $x at the time the expanded macro is evaluated, but {{{$x}}} is the $x at the time the macro is being expanded
masak "ugly" here can actually be taken to mean "doesn't collide with normal language syntax" 08:11
see strangelyconsistent.org/blog/macros...eholdeeers
08:12 lolo78 joined 08:14 xtreak left 08:16 xtreak joined
samcv masak, are you implying perl 5 uses macros to do sprintf? 08:20
masak no, not implying that 08:22
samcv "Don't believe me when I say that all templating syntax sucks? Fine, I'll bring you examples:" not sure what you mean by this?
geekosaur no, the %-escapes in the format string are a similar templating notion
samcv it's just a bad way to template items into the string?
ah
yeah that's pretty bad
geekosaur and TT as the second example :) 08:23
08:24 TimToady left
samcv wow python's is really weird 08:24
08:25 tojo joined
arnsholt samcv: I know! What weirdness did you trip over today? 08:25
samcv docs.python.org/3/library/string.h...matstrings
08:26 TimToady joined
tojo how can I take class name from variable? something like this: my $obj = $classname.new 08:27
samcv m: my $var = 'te'; say $var.WHAT.name;
camelia rakudo-moar 3e28b1: OUTPUT«No such method 'name' for invocant of type 'Str'␤ in block <unit> at <tmp> line 1␤␤»
samcv m: my $var = 'te'; say $var.WHAT.^name;
camelia rakudo-moar 3e28b1: OUTPUT«Str␤»
samcv like that kind of class name?
masak m: my $var = 'te'; say $var.^name 08:28
camelia rakudo-moar 3e28b1: OUTPUT«Str␤»
masak samcv: no need for .WHAT
samcv oh. ok 08:29
08:29 e1 left
tojo sorry, bad question.. i hold a class name in variable and want to use that to make object from that class name 08:29
for 'Foo', 'Bar' -> $t { my $obj = $t.new; } 08:30
masak m: for Int, Str -> $t { say $t.new } 08:31
camelia rakudo-moar 3e28b1: OUTPUT«0␤␤»
masak m: for Int, Str -> $t { say $t.new.perl }
camelia rakudo-moar 3e28b1: OUTPUT«0␤""␤»
CIAvash tojo: ::($t).new 08:32
samcv is there a page on perl 6 special methods and stuff? 08:33
like .^methods and uh, how to get the possible signatures of a method or sub
tojo CIAvash: yes! that worked, thanks :)
samcv tojo, docs.perl6.org/language/packages#i...A%3A%28%29 08:34
08:35 dakkar joined 08:36 parv joined
tojo samcv: thx! that page didn't come up on my previous searches 08:37
gfldex samcv: .^ is the same as .HOW, so you need to get the *HOW and look that up in the docs 08:41
most of the time you will be looking for docs.perl6.org/type/Metamodel$COLO...ONClassHOW
samcv what am i doing wrong here gist.github.com/b34f9f7a9a5ee6c9b6...56cae47b3d 08:43
stderr: Too few positionals passed; expected 2 arguments but got 1
gfldex samcv: you are trying to call $c in line 9 08:45
samcv well i created the variable on line 7 08:46
gfldex samcv: try this gist.github.com/gfldex/006d385aa45...b5727cda17 08:48
samcv yeah i was about to try that
08:49 KDr2 joined, g4 joined, g4 left, g4 joined
gfldex samcv: actually, your version should have worked to 08:50
08:52 as__ joined
as__ radudo: my $x = 42; say $x[0]; 08:52
rakudo: my $x = 42; say $x[0]; 08:53
camelia rakudo-moar 3e28b1: OUTPUT«42␤»
samcv also what's the shortcut for getting the last element of an array?
as__ Guys is it because there is a default circumfix for []?
gfldex [*-1]
or .tail(1)
samcv [*-1] seems a lot faster 08:54
gfldex as__: yes
method calls are always dynamic and can't be inlined 08:55
moritz they can, heuristically, at run time
gfldex does that depend on traits? 08:56
geekosaur as__, it's because there's code to pretend that a scalar is a single-element list when used in a place that requires a list 08:57
as__ aha ok thanks! 08:58
parv is there any plan for ";" to be the implicit default on perl6 prompt (REPL), as "my $x = 2" gives error but not with ";"?
09:00 KDr2 left
hartenfels parv: `my $x = 2` on the REPL doesn't give me any errors. 09:02
09:02 ocbtec joined 09:04 jonas2 joined
parv after definition+assignment with ";" (my $x = 2;), there is no problem afterwords. with any new variables sans end ";". 09:07
09:08 rindolf joined
parv where can i post screenshot without an account? 09:08
hartenfels parv: you could post the text to pastebin. 09:09
09:10 aindilis` joined 09:12 aindilis left
parv error: pastebin.com/DTWXN2ws 09:15
09:16 mxco86 joined
hartenfels parv: It works fine for me, maybe your Perl 6 is really old? What do you get when you run `perl6 -v`? 09:16
parv i am using rakudo ae9d517
09:16 domidumont left 09:17 domidumont joined
hartenfels I'm not sure then, because it's supposed to work I think. 09:19
parv actual version output: pastebin.com/sEZ1NuW0 09:21
thanks for trying, hartenfels
09:24 rba__ left 09:25 wamba left 09:27 pyrimidi_ joined, pyrimidine left 09:35 tojo left, zakharyas joined 09:42 domidumont left 09:50 xtreak left, user10 joined 09:51 xtreak joined 09:52 user9 left, user10 is now known as user9 09:54 breinbaas joined 09:56 hartenfels left, carl_ joined
carl_ working? 09:56
hello beings
samcv hello 09:57
hi carl_
carl_ quick question... 09:58
want to do something like this: if $a.WHAT eq (Int) {} , but no good.
moritz if $a ~~ Int { }
that's a type check that propery respects subtypes 09:59
carl_ ~~ ? I'll look it up
moritz it's the smart-match operator
10:00 devtom30 joined 10:03 wamba joined
parv is there really no way to compile+install rakudo/star from github to get the latest rakudo/rakudo? 10:06
else, i woud need to gather & install the bits myself to add to plain rakudo install. 10:08
samcv ok this isn't going to work. using permutations. gonna have to actually write something to pack the bits myself :\ oh well
yeah i guess i can see how they can add up... 10:09
and sadly permutations is naive to repeated numbers
m: (1,1).permutations
camelia ( no output )
samcv m: (1,1).permutations.say
camelia rakudo-moar 3e28b1: OUTPUT«((1 1) (1 1))␤»
stmuk_ parv: there is a Task::Star which resembles Rakudo Star although I suspect the module is dsynced
parv stmuk_: thanks, i will check that. 10:10
geekosaur desynched and currently broken
stmuk_ there is a report on twitter that 2017.01 release doesn't work in at least VS15 (fixed after release)
doesn't compile I mean 10:11
10:13 domidumont joined
parv rakudo/star/README is frankly misleading in that "perl Configure.pl" dies noting that I tried to run it from clone of the git repo. (of course 10:13
)
samcv .tell AlexDaniel East_Asian_Width property has just been merged into MVM 10:14
yoleaux samcv: I'll pass your message to AlexDaniel.
stmuk_ parv: I don't see why it's misleading .. it's intended to catch a common mistake .. not handle people being "clever" :) 10:15
10:15 rba_ joined
moritz parv: in the early days of R*, people would regularly clone the star repo and expected it to behave like the tarball 10:16
hence the current behavior
10:20 wamba left
timotimo eco: fig 10:20
ah, it's wig!
.tell cale2 have a look at the wig module :) 10:21
yoleaux timotimo: I'll pass your message to cale2.
10:21 geekosaur left 10:22 geekosaur joined
parv well, i am back to plain rakudo then: github.com/rakudo/star/issues/28 (--xform error on FreeBSD 11) 10:22
stmuk_ you could install gmake from ports
timotimo um 10:23
parrot hasn't been in rakudo star for a few years
10:23 zakharyas left
timotimo also, if it's only to be used by the release creator, what's your problem with it? 10:24
parv timotimo: it's the tar option that causes the similar error (with MoarVM)
timotimo oh? but why do we need that?
just to throw out the version number?
stmuk_ the easiest fix is to look for gnu make and die with an error saying to install it
10:24 wamba joined
timotimo why would gnu make magically give your tar executable a --xform option? 10:25
stmuk_ because it's a gnu make only option
timotimo parv: i think you're missing the point of rakudo star
what. 10:26
parv timotimo: only the bug submitter mentions that "only to be used by the release creater" without any follow up
timotimo rakudo.org/2017/01/30/announce-raku...e-2017-01/
you download this
parv timotimo: i am aware of that release. 10:27
in any case, i am not trying any more to complile myself rokudo star.
timotimo what do you mean by "gather & install the bits"?
you can also just install rakudo manually, and then use the "install all modules" part of rakudo star to get the modules 10:28
parv find zef/panda etc.; then install it locally.
timotimo not necessarily
parv ? 10:29
timotimo oh, rakudo star does use zef for that
my apologies
10:29 wamba left
Ulti whoa tests down to 0.8s 10:31
timotimo stmuk_: i still don't understand why installing gnu make would change how the tar command works. or does gnu make also come with gnu tar?
parv stmuk_: were the gmake comments meant for me? (at least gmake 4.2.1 is installed here, FWIW) 10:32
timotimo yes, they were 10:33
10:34 labster left
stmuk_ it was a typo for gnu tar 10:35
need coffee
parv stmuk_: ah, ok.
10:37 TEttinger left 10:42 wamba joined, carl_ left
timotimo that makes more sense, then 10:43
10:44 wamba left 10:46 bjz joined 10:51 zakharyas joined, patzim joined
patzim @SmokeMachine: Wrt. implementation of P6W: github.com/zostay/Smack 10:53
10:55 ufobat joined
timotimo a nonbreaking space would be a good idea in the title 11:00
it breaks just between Perl and 6 for me %)
samcv what is the best way to iterate through a list, possibly removing items from the list 11:02
11:02 astj joined
samcv doing for ^@array.elems will stop matching up when i remove elements, but i'm not sure how to remove an item from the array by doing `for @array` 11:02
timotimo i'd just map, or even grep 11:03
jnthn samcv: I'd probably @array .= grep: { ... } and hand back False to remove
arnsholt I think I'd do a grep removing elements, and then do the map
samcv well i need to do things to those elements 11:04
process those items
not _just_ remove them
jnthn You can in a grep?
samcv ok you think that would be suited fine?
seems a little weird to me
arnsholt If the processing is disjoint from the decision to remove or not, I'd filter first and then process
(Incidentally, it might be easier to help with a bit more context about what the problem you're solving is) 11:05
samcv they are not disjointed
11:05 parv left
timotimo if by "process, not just remove" you mean that you need to change individual values, i'd go with map and return Empty when you want to remove elements 11:06
samcv ok i have an Array of numbers, and I need to go through the array of numbers, and remove all the easy numbers and put it into another array
no changing values
11:06 pyrimidi_ left, pyrimidine joined
samcv trying to write something to pack a bitfield 11:06
timotimo m: my @a = ^10; @a .= map({ $_ %% 3 ?? $_ ** 2 !! Empty }); say @a
camelia rakudo-moar 3e28b1: OUTPUT«[0 9 36 81]␤»
11:06 astj left
jnthn Maybe .categorize? 11:07
(Which is for breaking a list into sub-lists matching conditions)
samcv hmm
that may work
11:08 devtom30 left
samcv let me try categorize 11:09
maybe that'll work for finding ones that are divisible by 8 cleanly, but then i will need to go through and find any complements
such as 3 and 7 = 8 for example
such as 3 and 7 = 8 for example 11:11
oops sent that twice
DrForr www.youtube.com/watch?v=vYmhapbBrig
11:12 rba_ left
samcv categorize is pretty cool 11:13
timotimo it's very good
samcv i'm trying to think what to look up for mathematical theory on this sort of thing 11:14
timotimo hm. bin packing?
samcv i mean if i take out all 8's and 16's for example, is there any chance of me losing some packing?
well just this sort of thing 11:15
like fitting certain numbers into another number
most efficiently
also fitting like 2d shapes into the smallest size 11:16
timotimo i would have assumed they fit like 1d shapes
samcv err
yeah
1d shapes but
it would be nice to know for sure that taking out all 8's and 16's will never prohibit one best possible packing 11:17
timotimo what do you fit stuff into?
samcv pretty sure it will? but idk. there must be some way to prove it
8 bits
timotimo ah
then you can transform the problem into another problem
arnsholt Oh. You have a series of field bit-widths, and want an algorithm to find the smallest number of bytes needed to pack them 11:18
samcv pretty sure divisible by 8 things will be fine
yes
more importantly the ordering
timotimo i.e. "fit all those 1, 2, 3, 4, 5, 6, 7 wide things into N 8-wide bins"
samcv of the smallest bytes
timotimo is the same as
"fit all those 1, 2, 3, 4, 5, 6, 7, 8, or 16 wide things into N + 10 8-wide bins"
i.e. just pretend those extra bins were never even there
and just sprinkle your 8- and 16-bit wide things at the end or beginning 11:19
samcv yeah, also want to know if i take out 4+4 and 3+6, will that also definitevely be the best? 11:20
i mean i know by themself, but hmm. i'm thinking i may need to sort odd and even
timotimo you mean 3+5?
samcv yes
timotimo i'd say so
there's this dynamic programming thing
where a perfect sub-solution can be part of a perfect super-solution 11:21
i.e. a solution that has one 8-bit bin filled up with 4 + 4 can be as perfect as that sub-solution for that single 8-bit bin
samcv yeah 11:22
i want to say that is true, but some part of me wants to look at a mathematical proof for it lol 11:23
SmokeMachine patzim: thanks! 11:24
11:26 xtreak left, gregf_ joined
jast if you have M bins of size N each and ignore elements of size i*N (for integer i), that's equivalent to packing the remaining elements into M-i bins 11:27
in other words, these elements don't really contribute anything interesting to the result
Ulti samcv: so long as the number you're removing isnt prime it shouldn't be a big deal?
because there's always some box that fits a different multiple 11:28
samcv many of them will be prime. but that is a good point
so should do all the non-prime ones first
then deal with the other ones last
11:28 ufobat left
Ulti also I wasnt following what you're actually up to other than the abstract thought problem :3 11:28