»ö« 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. |
|||
00:07
vrurg joined
00:31
aindilis left
00:33
noisegul joined
00:37
noisegul left
00:49
aindilis joined
00:50
aborazmeh joined,
aborazmeh left,
aborazmeh joined
00:52
aborazmeh left
01:08
Manifest0 left
01:10
lucasb left
01:16
Manifest0 joined
01:19
Sgeo left
01:20
Sgeo joined
01:27
mowcat joined
01:37
Manifest0 left
01:40
Manifest0 joined
01:48
wu_ joined
01:50
sono__ joined
01:51
zakharyas joined,
Black_Ribbon left
01:55
wu_ left
01:56
hythm joined
01:58
squashable6 left
01:59
squashable6 joined,
ChanServ sets mode: +v squashable6
02:30
eseyman left
02:31
eseyman joined
02:38
mowcat left
03:14
hythm left
03:28
SCHAPiE left
03:35
matiasli1a joined
03:36
SCHAPiE joined,
noisegul joined
03:41
noisegul left
03:43
webstrand left
03:44
webstrand joined
03:53
webstrand left
03:56
oodani left,
oodani joined
03:57
webstrand joined
04:04
matiasli1a left
04:08
matiasli1a joined
04:09
matiasli1a left
04:10
matiaslina joined
04:15
kaare__ left,
kaare__ joined
04:19
holyghost left,
holyghost_ is now known as holyghost
04:34
AlexDaniel left
04:38
noisegul joined
04:42
noisegul left
04:43
curan joined
04:50
abraxxa joined,
abraxxa left,
abraxxa joined
04:54
nadim joined
04:55
abraxxa left,
abraxxa joined
05:00
nadim left
05:12
sauvin joined
05:30
cgfbee left,
nadim joined
05:31
abraxxa left,
abraxxa joined
05:32
abraxxa left
05:35
nadim left,
iviv left
05:36
iviv joined,
peteretep left,
spycrab0 left,
scott left,
reu left
05:37
peteretep joined,
scott joined
05:38
spycrab0 joined
05:39
reu joined
05:42
nadim joined
05:43
cgfbee joined
05:47
nadim left
05:49
squashable6 left
05:51
squashable6 joined
06:17
antoniogamiz joined
06:30
patrickb joined
06:33
Summertime left
06:34
Summertime joined
06:39
rindolf joined
06:50
ZzZombo_ joined
06:52
ZzZombo left,
ZzZombo_ is now known as ZzZombo
07:01
goon_ left
07:09
leont joined
07:12
adu left
07:13
adu joined
|
|||
holyghost | I have bettered Game::Bayes but it seems it still has some serious bugs | 07:16 | |
antoniogamiz | while{ {once {some code}} } and while { some code } has any differences? | ||
holyghost | I'm writing a game of risk with risk-o-matic, which takes time | ||
antoniogamiz | (notice the extra curly braces surrounding the once block) | 07:17 | |
holyghost++ | |||
holyghost: what's the theme of the game? | 07:18 | ||
07:19
domidumont joined
|
|||
holyghost | a game of risk, the tabletop game | 07:19 | |
in a terminal | |||
without ncurses TBH | 07:20 | ||
07:23
noisegul joined
|
|||
antoniogamiz | aahhh I had understood it was a game where you must take risks haha | 07:24 | |
risk is a very good game | |||
ncurses? | |||
holyghost | ncurses/curses, the terminal window and widget set | 07:25 | |
risk is perfect for risk functions, although this sounds odd | |||
antoniogamiz | yep haha | 07:26 | |
holyghost | It's a test for Game::Bayes | ||
from rogue-o-matic => risk-o-matic | |||
where rogue is a precessor of nethack | |||
nethack.org | |||
07:27
crouton joined
|
|||
antoniogamiz | uoh a little CSS could be used | 07:27 | |
holyghost | It's an ancient game, I know :-) | ||
antoniogamiz | » is that a regex operator? | 07:31 | |
07:32
cpan-p6 left
07:33
dakkar joined
07:34
sono__ left,
Black_Ribbon joined
07:35
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined
07:40
rindolf left
|
|||
moritz | » can be used in a regex, and means "right word boundary" | 07:42 | |
outside of regexes, it can be used to apply an operation to a list of items | |||
m: say <a b c>».uc.join(', ') | 07:43 | ||
camelia | A, B, C | ||
antoniogamiz | thanks moritz! I should look up in the docs before asking this kind of questions | ||
07:44
abraxxa joined
07:46
adu left
|
|||
antoniogamiz | moritz: what should be the proper subkinds of a routine? | 07:46 | |
(I know you did this a long time ago, sorry for asking so many questions) | 07:47 | ||
moritz | antoniogamiz: if a routine exists as just one variant (sub, method, regex), then that | 07:48 | |
otherwise, "routine" | |||
iirc | |||
07:48
rindolf joined
|
|||
antoniogamiz | mmm and are you sure is done like in find-definitions? | 07:50 | |
the last part I mean | |||
like that in* | 07:51 | ||
07:51
aindilis left
|
|||
moritz | no, not sure | 07:52 | |
antoniogamiz | For instance, in Any.pm6 there's only one routine defined as multi sub and multi method, and it gets the subkind "sub" instead of routine | ||
07:52
aindilis joined
08:04
veesh left
08:10
veesh joined
08:11
zakharyas left
|
|||
moritz | hm | 08:21 | |
08:26
dolmen joined
08:29
crouton left
08:30
pecastro joined,
grumble left
|
|||
moritz | I'd still say that "routine" would be correct | 08:31 | |
08:35
grumble joined
|
|||
antoniogamiz | mmm ok :) | 08:40 | |
08:40
antoniogamiz left
|
|||
lizmat clickbaits p6weekly.wordpress.com/2019/06/17/...es-of-int/ | 08:42 | ||
08:48
Cabanossi left
08:49
Cabanossi joined
08:57
goon_ joined
09:04
squashable6 left
09:08
squashable6 joined,
ChanServ sets mode: +v squashable6
09:19
nadim_ joined
09:28
nadim_ left
09:51
pecastro_ joined
09:54
pecastro left
09:58
pecastro joined
10:01
pecastro_ left
10:07
ChoHag left
10:21
domidumont left
10:28
pmurias joined
|
|||
pmurias | wheren doing a use chalk:from<node.js> from where should the node.js modules be looked up? | 10:28 | |
10:41
pmurias left
|
|||
moritz | pmurias from node? I don't quite understand your question. Do you mean from which paths? | 10:52 | |
10:53
pmurias joined
10:55
dolmen left
11:39
pmurias left,
Black_Ribbon left
11:41
wamiks left
11:43
dolmen joined
11:51
vrurg left
12:05
ravenousmoose_ joined,
vrurg joined
12:07
ravenousmoose left
12:14
vrurg_ joined
12:15
vrurg left,
vrurg_ is now known as vrurg
12:17
domidumont joined
12:20
ThePacketBender joined
12:25
ilogger2 joined,
ChanServ sets mode: +v ilogger2
|
|||
SmokeMachine | should it do the same as it would `require("chalk")` on node.js? | 12:28 | |
yoleaux | 16 Jun 2019 14:45Z <vrurg> SmokeMachine: Sorry, I saw your replies but was preparing/commuting and now attending the conference. Will asnwer ASAP. | ||
lizmat | weekly: blogs.perl.org/users/damian_conway/...olset.html | ||
notable6 | lizmat, Noted! | ||
vrurg | SmokeMachine: I still don't have time to concentrate on the right answer. But I thought that relationship columns are kind of lazy attributes and are fetched upon request. | 12:31 | |
12:39
vrurg joined,
vrurg left
12:49
vrurg joined
13:03
lucasb joined
13:07
k-man joined
|
|||
lucs | Is there a more idiomatic way to say this?: $s.defined && $s.length > 0 | 13:08 | |
(er, 'chars', not 'length') | 13:12 | ||
lizmat | .defined && .length > 0 with $s | 13:14 | |
actually | |||
.length with $s | |||
the "with" takes care of the defined check | |||
lucs | Aha, cool :) | ||
Th | |||
lizmat | .chars > 0 with $s | ||
yoleaux | $ 0 > h i s t w | ||
lucs | Thanks | 13:15 | |
13:16
nadim_ joined,
pmurias joined
|
|||
ugexe | if $x.?chars { } | 13:28 | |
i guess that doesn't work for some things like native typed vars | 13:29 | ||
m: my int $x; say $x.chars | |||
camelia | 1 | ||
ugexe | although maybe it does work for you since its defined either way | 13:30 | |
pmurias | moritz: yes | 13:33 | |
moritz | pmurias: can't that be configured through environment variables? | 13:34 | |
or maybe a "use lib"-like mechanism? | |||
pmurias | SmokeMachine: you mean it should look it up relative to the Perl 6 file which has the use statement | ||
moritz: use lib is trash because it screws up precompilation | 13:35 | ||
ugexe | i assumed it would go to $HOME/.npm-global/lib/node_modules | ||
maybe it is possible to avoid recompilation for those cases. like instead of "if any repo id changes re-precompile" do "if any PERL6 repo id changes re-precompile" | 13:36 | ||
nine: ^ ? | |||
pmurias | ugexe: is installing modules globally for use by rakudo.js something that we want to do/encourage? | 13:38 | |
ugexe | pmurias: it would match what we do for Inline::Perl5 at least | ||
and is what I would expect from inline Perl5 code (not sure what I expect from js) | |||
pmurias | ugexe: the issue with matching Inline::Perl5 is that in node.js they handle dependencies a lot differently | 13:39 | |
they tend to be installed per project (in a node_modules that's resolved relatively to which file the require is in) | 13:40 | ||
13:41
antoniogamiz joined
|
|||
ugexe | per-project dependencies used via `use lib "..."` though | 13:41 | |
er, exposed rather | |||
SmokeMachine | pmurias: yes... | 13:43 | |
ugexe | for instance: use lib "js#./ | 13:44 | |
if re-precompilation is the only thing stopping you from that then maybe we should see if re-precompilation is required when non-perl6 repos change | |||
pmurias | use lib "js#./" ~ $?FILE.IO.parent.add("node_modules"); | 13:46 | |
use lib "js#" ~ $?FILE.IO.parent.add("node_modules"); actually | |||
ugexe | yea, although better is | ||
use lib "js#" ~ $*PROGRAM.parent.add("node_modules").absolute; | 13:47 | ||
lucs | ugexe: Thanks (re. $x.?chars) | 13:48 | |
13:48
farcas82regreg joined,
dakkar joined
|
|||
pmurias | ugexe: isn't re-precompilation required if the Perl 6 modules that where precompiled used a js dependency at compile time | 13:49 | |
ugexe | pmurias: yeah i suppose it would | 13:51 | |
13:52
vrurg left
|
|||
antoniogamiz | what's the best form of completely flatening an array with sub arrays? | 13:54 | |
I have seen the flatenning semicolons in the doc but I think should be another way | 13:56 | ||
pmurias | ugexe: also I think we should aim at being able to specify node.js depedencies in META6.json | ||
do we have a spec for that somewhere? | |||
design.perl6.org/S22.html#META6.json is broken | 13:57 | ||
ugexe | pmurias: no, but we seem to be moving towards just defining them in depends like everything else: "foo:from<node.js>" | ||
pmurias | ugexe: I meant a spec for META6.json | 14:00 | |
ugexe | yes, that is what i mean | ||
same as Perl6 modules | |||
except for Perl6 modules the :from<Perl6> is implied | |||
depends contains "use" strings | 14:01 | ||
antoniogamiz: if you know the depth of your data structure you can use tree. here is an example that flattens up to 3 levels: @foo.tree(*.Slip, *.Slip, *.Slip) | 14:02 | ||
pmurias | github.com/perl6/specs/blob/master...format.pod - this is the META6.json specification? | 14:03 | |
14:04
skids joined
|
|||
ugexe | the META6.json specULATIONs yeah | 14:04 | |
i.e. there is obviously no github.com/perl6/specs/blob/master...onlocaltar | |||
pmurias | so we have no META6.json spec? :( | 14:05 | |
antoniogamiz | ugexe: thank you | ||
ugexe | the META6.json isn't being designed waterfall style. its being handled in a more... agile manner | 14:06 | |
pmurias | that's terrible :( | 14:07 | |
ugexe | that is what happens when you release based on a specific date instead of when something is ready | ||
pmurias | (the not having a specification part, not the not waterfall part) | 14:08 | |
is anything other from tuits stopping us from having a link to a description of what META6.json actually does in the docs? | 14:11 | ||
ugexe | what it does depends on what is consuming it | 14:12 | |
rakudo doesn't care about depends field period | |||
rakudo ultimately cares about name, version, api, auth, provides. thats it | 14:14 | ||
resources | |||
those things *are* documented | 14:15 | ||
pmurias | so the current situation is that module writers should cargo-cult a META6.json without being able to look up what the fields are supposed to be? | ||
doc.perl6.org/language/modules - that's our module creations docs | |||
docs.npmjs.com/files/package.json - example from node.js how things should be documented | 14:16 | ||
ugexe | if you want to use fields that we have not fully thought out or implemented, then yes you will need to cargo cult. if you are using fields that are fully thought out (and hence likely documentet) then no | 14:17 | |
nine | ugexe: a repo has full control over its own id. So if a repo does not contain anything that should affect precompilation, the id may just stay constant | 14:18 | |
ugexe | a repo can affect the id of the repo prior | ||
github.com/rakudo/rakudo/blob/f05b...em.pm6#L43 | 14:19 | ||
pmurias | ugexe: if we don't have META6.json documentation nothing is documented | 14:20 | |
kawaii | timotimo: something reminded me, I never got a chance to try your patch | ||
timotimo: can you link me the gist again please Sir? :) | |||
ugexe | pmurias: but it is documented on the page you linked | 14:21 | |
maybe not in the format you like, but it describes the fields that rakudo understands | |||
pmurias | ugexe: you mean in doc.perl6.org/language/modules? | ||
ugexe | yes | 14:22 | |
nadim_ | afternoon, how do I get a method (taking args) reference and call it? is it documented with a simple example somewhere? | 14:25 | |
ugexe | pmurias: also im not familiar enough with js to say for sure, but is that spec specific to npm? if i create an alternative installer (yarn, etc) and add custom fields is that part of the spec too? | ||
moritz | m: my $method = 4.find_method('sqrt'); say $method(9) | 14:26 | |
camelia | No such method 'find_method' for invocant of type 'Int' in block <unit> at <tmp> line 1 |
||
moritz | m: my $method = 4.^find_method('sqrt'); say $method(9) | ||
camelia | 3 | ||
moritz | nadim_: ^^ | ||
nadim_ | moritz++ | ||
moritz | note that the method is not curried (so not tied to the invocant) | ||
m: my $method = 4.^find_method('sqrt').assuming(4); say $method() | 14:27 | ||
camelia | 2 | ||
nadim_ | so it needs to be called with an object, right? I need to decided between two methods when I am inside a method (to avoid code duplication) | 14:28 | |
moritz: did you reallly mean _not_ tied to the invoquant? | 14:29 | ||
moritz | yes | ||
you can see that I call $method(9), where 9 is the invocant | 14:30 | ||
compared by pthon's method = obj.methodname; method() | |||
where method contains a reference to obj right away | |||
nadim_ | but the example you called gave 2 as an answer when it was called without argument | ||
moritz | that's because of the extra .assuming(4) step | ||
which does the currying | 14:31 | ||
nadim_ | ok | ||
14:31
vrurg joined
|
|||
moritz | sorry, too much information at once is not always helpful :D | 14:31 | |
nadim_ | not too much, it was two examples and I thought the first comment was aout the second example :) | 14:32 | |
moritz: what's the difference betwen ^find and ^lookup? | |||
pmurias | ugexe: what's stopping taking an already implemented by zef subset of the META6.json speculations and using it as description of how things are? | ||
moritz | nadim_: I don't remember the specifics; I think it has something to do with roles, where .^lookup returns something subtly different or so | 14:35 | |
I'm sure jnthn++ knows | |||
docs.perl6.org/routine/lookup "Note that lookup is supposed to be used for introspection, if you're after something which can be invoked you probably want to use find_method instead." | 14:36 | ||
that's good enough for me right now | |||
14:37
vrurg_ joined,
vrurg left,
vrurg_ is now known as vrurg
|
|||
nadim_ | the only answer, with details, I found was this stackoverflow.com/questions/480803...in-perl-6, an example in the docs would be nice | 14:37 | |
tobs | m: my $meth = 4.^find_method('sqrt'); say 25.$meth # do you take sugar? | 14:39 | |
camelia | 5 | ||
14:41
vrurg_ joined
14:42
vrurg left,
vrurg_ is now known as vrurg
|
|||
moritz | .oO( $meth heads all around :D ) |
14:42 | |
pmurias | nadim_: I looked at lookup source | ||
nadim_: and it behaves differently with submethods (it finds submethods from parent classes) | 14:43 | ||
moritz | m: role R[A] {method x() { }}; say R.^lookup('x'); say R.^find_method('x') | 14:44 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Invalid typename 'A' in parameter declaration. at <tmp>:1 ------> 3role R[A7⏏5] {method x() { }}; say R.^lookup('x'); |
||
moritz | m: role R[$A] {method x() { }}; say R.^lookup('x'); say R.^find_method('x') | 14:45 | |
camelia | x No appropriate parametric role variant available for 'R' in block <unit> at <tmp> line 1 |
||
moritz | that's the difference I was thinking of | ||
pmurias | nadim_: and when there is a FALLBACK lookup finds nothings while find_method returns the fallback | ||
nadim_ | pmurias++ | 14:46 | |
pmurias | nadim_: honestly the submethod difference looks like just a bug | 14:47 | |
14:48
AlexDaniel joined,
ravenousmoose_ joined
|
|||
pmurias | nine: is there a way from CompUnit::Repository to load stuff relative to the file where the 'use statement' is in? | 14:48 | |
nine | pmurias: now, that just doesn't sound right | 14:53 | |
pmurias | nine: I thinking about replicating the node.js module finding semantics: nodejs.org/api/modules.html#module...es_folders | 14:59 | |
nine: but this seems like mixing up the Perl 6 and node.js ways of doing stuff together in a horrible manner | 15:00 | ||
daxim | ᴞ # help, I've fallen and can't get up | 15:02 | |
pmurias | btw what's the state of the Perl 6 docs google summer of code projects | ||
afk & # will backlock | 15:03 | ||
15:04
ravenousmoose_ left
|
|||
nine | pmurias: I think it'd be ok for us to require the user to add the repos with -I or use lib. | 15:06 | |
15:10
pmurias left
15:30
vrurg left
15:31
vrurg joined
|
|||
timotimo | kawaii: gist.github.com/timo/b5fedaf5bea40...57addb25d0 | 15:32 | |
kawaii | ah! thank you! | ||
15:35
debprav joined
15:39
[particle]1 joined
15:40
spycrab0 joined,
scott joined
15:42
reu joined
15:45
JosefZetaOsiris joined
15:51
dha joined
16:02
vrurg left
16:04
patrickb joined
16:05
dha left
16:07
debprav left
|
|||
lizmat | weekly: www.youtube.com/channel/UC7y4qaRSb...8cCHOsKZDw | 16:10 | |
notable6 | lizmat, Noted! | ||
lizmat | Video of TCPiP | ||
16:16
molaf joined
|
|||
ugexe | pmurias: we could, i guess. but there are still details that exist now but probably shouldnt | 16:16 | |
like depends can have either a module name or a distribution name. that exists right now, but maybe it shouldnt | 16:17 | ||
if we document it then its even harder to fix/change later | |||
if someone wanted to write a document for it i could review it and say what should be left out. | 16:18 | ||
however i am mostly incapable of writing that document myself because i get bogged down in the endless details i have in my head | 16:19 | ||
El_Che | lo | 16:22 | |
lizmat: are you in the US? | 16:32 | ||
16:35
dakkar left
|
|||
Geth | doc: 7ad9cd108f | (Moritz Lenz)++ | doc/Type/Metamodel/MethodContainer.pod6 Document difference between find_method and lookup |
16:36 | |
synopsebot | Link: doc.perl6.org/type/Metamodel::MethodContainer | ||
16:37
molaf left
|
|||
lizmat | El_Che: no | 16:48 | |
lizmat will not visit the US until the orange blob is gone, and possibly not after that either | |||
El_Che | yeah, I have a similar feeling | 16:52 | |
16:54
ChoHag joined
16:59
vrurg joined
|
|||
nadim_ | lizmat++ | 17:02 | |
timotimo: (other are welcome with an opinion too of course) I implemented coloring per level in DDT, it's a different way to present data, I put some examples here distracted-gates-4eb889.netlify.com/ | 17:04 | ||
It's a larger patch, not sure I include it or not | |||
17:07
alexghacker joined
17:08
antoniogamiz left
|
|||
timotimo | nadim_: i would prefer more muted colors, but it does seem helpful for very big things | 17:09 | |
17:11
alexghacker left
|
|||
nadim_ | you get to chose your color of course :) | 17:12 | |
timotimo | i assumed so d) | 17:13 | |
:) | |||
nadim_ | rendering a christmas tree is of no help but you can control what gets colored or not, in the example it is by level but you can chose to highlight classes or specific instances | ||
timotimo | that's how i interpreted the later examples | ||
nadim_ | but thiis mode is for rendering with :!color, as you can see in the last examples the color rendering stops the background coloring, because it makes little sense | 17:15 | |
timotimo | yeah, that could turn out pretty unreadable | ||
nadim_ | I actually wrote this for very large rendering where only a few pieces are important | 17:17 | |
timotimo | ah, yeah, i can see how that would be useful | 17:18 | |
i wonder how complicated it is to write something in js that when scrolling downwards will pin the pieces of the tree that make up the path towards the root to the top | 17:19 | ||
inspired by twitter.com/jckarter/status/1140131108564062213 and the "frame editor" further below in that thread | |||
17:21
guifa joined
|
|||
nadim_ | timotimo: that's cool. the latest DDT has a flatten example where the path is added and the elements are rendered separated with tabs so you can use a bash pipeline on the data structure | 17:23 | |
timotimo | yes, i remember! | 17:26 | |
nadim_ | timotimo: pinning up the part of the tree could be made quite easy if the path is put in the html for each entry so you can display it or have a have a popup display it | 17:30 | |
if you need it, and write the part that display the path in the web page (I suck at this stuff), I'll add the path to the generated html | 17:35 | ||
timotimo | i should concentrate on other stuff at the moment :( | 17:37 | |
17:38
lgtaube joined
|
|||
nadim_ | sure :) just say if you need it and help with it | 17:38 | |
17:39
vrurg left
|
|||
timotimo | thanks :) | 17:39 | |
nadim_ | thank you for the feedback | ||
timotimo | NP | 17:41 | |
17:44
vrurg joined
17:46
alexghacker joined
17:47
vrurg_ joined
17:48
vrurg left,
vrurg_ is now known as vrurg
17:50
alexghacker left
|
|||
guifa | Well that was a ridiculously easy code golf | 17:53 | |
codegolf.stackexchange.com/a/187050/30284 | |||
17:54
Cabanossi joined
17:57
molaf joined
18:02
Exodist joined
18:16
vrurg left
18:22
vrurg joined
18:26
SCHAPiE joined
18:31
dha joined
18:37
dylanwh left,
khisanth_ joined
18:39
mowcat joined
|
|||
Geth | ¦ problem-solving: AlexDaniel assigned to jnthn Issue require with non-sigiled arguments github.com/perl6/problem-solving/issues/43 | 18:43 | |
18:49
john_parr joined
18:58
molaf left
19:39
vrurg left
|
|||
AlexDaniel | guifa: I'm not satisfied with its performance though :) | 19:43 | |
guifa: .comb.unique.permutations in numeric context shouldn't even generate any elements, I think | |||
Elronnd | is there a way to block until *one* item is available from a supply? | 19:44 | |
AlexDaniel | and there is a mathy way to make the answer right, I think | ||
Elronnd: not sure, but what about .Channel.receive ? | 19:45 | ||
19:45
vrurg joined
|
|||
lizmat | Elronnd: make sure the first item on a supply is a Promise, and await that ? | 19:45 | |
Elronnd | AlexDaniel: I think that would work | 19:46 | |
AlexDaniel | Elronnd: also maybe `react whenever $supply { …; done }` | ||
19:56
pmurias joined
20:04
adu joined
|
|||
guifa | AlexDaniel: I don’t follow. The numeric context applies to the result of the *.comb.etc. It gets parsed as (+) (*.comb.etc) which is similar to +@foo.list-ops, where @foo.list-ops is evaluted first, and then numified: | 20:09 | |
p6: my @a = <a b b>; say +@a.permutations | |||
camelia | 6 | ||
AlexDaniel | guifa: yes but for permutations».join.unique you'll actually need to generate all permutations and keep them in memory | ||
timotimo | Elronnd: i think you can $supply.head actually? | ||
guifa | AlexDaniel: sure, but it’s code golf. Who cares about performance? :-) | 20:10 | |
AlexDaniel | guifa: yes :) | ||
though I'd also like to see a golfed version that actually works for bigger strings :) | |||
guifa | There’s a formula, which is probably the best next option. I tried golfing it to P6 but it was longer | 20:11 | |
AlexDaniel | “permutations” is a really long word, however, maybe avoiding the builtin is a way to go… | ||
guifa: speaking of code golf, have you tried code-golf.io/ ? | 20:12 | ||
guifa: also there's github.com/AlexDaniel/raku-golf-cheatsheet | |||
guifa | Actually I just realized that .Set can be shorter than .unique and accomplish the same. | 20:16 | |
timotimo | true. if you just need the number, that's the same. otherwise you'd need .Set.keys to get the same thing | 20:18 | |
guifa | I just need the number so ha. | 20:22 | |
timotimo | m: say +(1, 2, 3,4) .perl | 20:24 | |
camelia | 4 | ||
timotimo | m: say +(1, 2, 3,4).perl | ||
camelia | Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5(1, 2, 3, 4)' (indicated by ⏏) in block <unit> at <tmp> line 1 |
||
timotimo | ^- cool trick | ||
guifa | Although does make me think, surely there’s quite a few common combinations of methods that could be optimized (like the .permutations.unique). Would there be a way to potentially capture that and override with a more efficient method? | 20:25 | |
timotimo | hm. so it'd want to first build a Bag and treat things that are in there multiple times as the same value | 20:26 | |
though .Bag doesn't allow the same parameters as .unique | |||
surely there's some smart algorithm for this case | 20:31 | ||
tobs | m: ('A' .. 'z').permutations.elems.say | 20:32 | |
camelia | Cowardly refusing to permutate more than 20 elements, tried 58 in block <unit> at <tmp> line 1 |
||
guifa | Ha! | 20:33 | |
tobs | so this could use a PredictiveIterator or how it's called | ||
but .unique… | |||
timotimo | PredictiveIterator is for when .elems can be done very easily, yeah | ||
tobs | sounds like a fun project going through the builtins and spotting predictable iterators | 20:34 | |
20:35
skids left
|
|||
guifa | It feels like there ought to be some way to let .permutations be both lazy and hoarder-less, and pass its values one by one to unique, but not needing to store them. Kinda…sounds like a channel lol. And yet I can’t think how that would work in practice | 20:37 | |
tobs | huh, that coward error is in the CORE.setting | ||
timotimo | unique will still need to store stuff | 20:38 | |
worst case, the exact same amount that .permutations.eager would | |||
lizmat | m: dd +<a b c b a>.Set # guifa | 20:47 | |
camelia | 3 | ||
guifa | @lizmat that’s what I’m using now :-) | ||
20:49
dylanwh joined
|
|||
guifa | I think the issue is that .permutations at some point must store all of it in memory at once. But if we know we’re going to eventually grep/unique/whatever it (and permutations can be deterministically generated, e.g., given fully predictable determinative), it seems silly to generate and store all of them in memory. A lazy list could prevent needing to get all of the permutations until used, but wouldn’t get rid of the memory issue. | 20:50 | |
(not that this is unique to P6 at all) | |||
pmurias | do we have something like Carton for Perl 6? | 20:58 | |
20:59
vrurg left
|
|||
pmurias | nine: I guess -I will have to do | 20:59 | |
20:59
vrurg joined
|
|||
pmurias | nine: I don't feel like recommending 'use lib' as it seems to be very harmful garbage | 20:59 | |
21:00
cpan-p6 joined,
cpan-p6 left,
cpan-p6 joined
|
|||
pmurias | nine: as it both kill precompilation and takes paths relative to the current working directory by default | 21:01 | |
21:03
lucasb left
|
|||
tobs | guifa: the permutations are lazily produced already and apparently the iterator is even predictive already. It's just that there is a `die` blocking you from passing arguments which are too large for a certain native int counter used in the algorithm. | 21:07 | |
MasterDuke | lizmat: still around? | 21:14 | |
21:24
vrurg left
21:35
vrurg joined
21:37
farcas82regreg left
21:40
vrurg left
21:41
dha left,
sno joined
|
|||
lizmat | MasterDuke: not really | 21:45 | |
MasterDuke | heh. then i'll ping later | 21:46 | |
21:48
vrurg joined
21:49
vrurg left
22:11
pmurias left
22:19
ChoppedBacon joined
22:20
Black_Ribbon joined
22:30
vrurg joined
22:44
mowcat left
23:28
patrickb left
|