🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 6 September 2022. |
|||
00:00
reportable6 left
00:03
reportable6 joined
00:36
_________ left
|
|||
Voldenet | m: Buf.new(255).decode.say | 00:37 | |
camelia | Malformed UTF-8 at line 1 col 1 in block <unit> at <tmp> line 1 |
||
00:43
_________ joined
|
|||
Voldenet | Xliff: you can easily trigger malformed utf-8 sequence by using `255` as first byte with no following bytes – it's fatal because such sequence is not valid utf8 and probably some different encoding | 00:45 | |
tellable6 | Voldenet, I'll pass your message to Xliff | ||
00:48
Sgeo_ joined
|
|||
Voldenet | m: Buf.new(255).decode("utf8-c8").say | 00:50 | |
camelia | 􏿽xFF | ||
Voldenet | ^ it's also possible to say "yeah but it's valid utf8, trust me" and get some silly bytes out of it | ||
00:51
Sgeo left
01:41
derpydoo joined
01:45
jpn joined
01:49
jpn left
|
|||
guifa | leont: wait for my TPRC talk? :-) | 01:59 | |
um Xliff: example? I think I understand but not 100% sure | 02:00 | ||
02:17
andydude joined
03:30
jpn joined
03:34
jpn left
04:19
ab5tract joined
04:25
rf left
04:42
ab5tract left
04:51
zara joined
05:04
ab5tract joined
05:06
zara left
05:15
swaggboi left
05:16
fk96 joined
05:22
ab5tract left
05:23
fk96 left
06:00
reportable6 left
06:01
reportable6 joined
06:16
_________ left,
_________ joined
06:20
squashable6 left,
squashable6 joined
06:52
squashable6 left
06:53
squashable6 joined
06:54
andydude left
07:09
jpn joined
07:12
dakkar joined
07:15
jpn left
07:18
silug left
07:20
silug joined
07:25
andydude joined
07:35
sena_kun joined
07:44
Manifest0 joined
07:57
zara joined
08:11
Sgeo_ left
08:19
zara left
08:41
jpn joined
09:28
andydude left
09:30
sena_kun left
10:31
derpydoo left
11:31
evalable6 left,
linkable6 left,
sourceable6 left,
benchable6 left,
releasable6 left,
squashable6 left,
bisectable6 left,
quotable6 left,
committable6 left,
tellable6 left,
notable6 left,
unicodable6 left,
nativecallable6 left,
shareable6 left,
coverable6 left,
greppable6 left,
nativecallable6 joined,
unicodable6 joined,
benchable6 joined
11:32
linkable6 joined,
shareable6 joined,
releasable6 joined,
sourceable6 joined
11:33
greppable6 joined,
squashable6 joined,
evalable6 joined,
tellable6 joined,
committable6 joined,
bisectable6 joined
11:34
coverable6 joined,
quotable6 joined,
notable6 joined
11:44
grondilu joined
|
|||
grondilu | Hi all | 11:44 | |
I have a sorted list of words. I would like to compress them with a bash brace expansion syntax | |||
I suspect it'd be easy to do in raku, but I'm too lazy to try it hard | 11:45 | ||
maybe one of you want to suggest a solution | |||
the bash brace expansion syntax is what turns a{b,c,d} int ab ac ad | 11:46 | ||
so I'd like to turn say <abc abd ef eg> into "ab{c,d} e{f,g}" | 11:47 | ||
braces can be nested btw | 11:49 | ||
maybe I need a Trie | 11:50 | ||
11:53
discord-raku-bot left
11:54
discord-raku-bot joined
|
|||
grondilu installs the 'Trie' module | 11:55 | ||
12:00
reportable6 left
|
|||
Anton Antonov | @grondilu I have been planning for some time to experiment which trie implementation is the fastest (over what data.) | 12:02 | |
12:03
reportable6 joined
|
|||
grondilu | Well, I can say the Trie module is not great. It only makes single character keys, for a start. And only ascii. | 12:04 | |
Anton Antonov | @grondilu ⎡I'd like to turn say <abc abd ef eg> into "ab{c,d} e{f,g}⎦ -- Speaking for "ML::TriesWithFrequencies" only : there is visualization routine/method and XML, WL, and JSON representation methods that can be adapted for this. | 12:05 | |
Voldenet | grondilu: String::Utils has this | ||
say root <abcd abce abde>; | |||
"ab" | |||
grondilu | ^that seems useful | 12:06 | |
Anton Antonov | @grondilu "It only makes single character keys,[..]" -- Well, "ML::TriesWithFrequencies" has shrinking function. (A fundamental operation for tries I would say. It is literally in the name.) | 12:07 | |
grondilu | what does ML stand for here? | ||
Voldenet | some tries module would be more complete solution, since `root` pretty much only finds roots | ||
Anton Antonov | @grondilu ML == Machine Learning, (Please, do catch up with the current trends...) | 12:08 | |
grondilu | noted | 12:09 | |
Anton Antonov | @grondilu The third visualized trie here shows shrinking: raku.land/zef:antononcube/ML::Trie...requencies | ||
@grondilu "ML" is also, sort of, a warning -- I see that module as data mining or ML tool, not so much as "just a data structure" tool. | 12:11 | ||
grondilu | that API is kind of confusing. Why a 'trie-say' function instead of defining a gist method? | 12:13 | |
Anton Antonov | @grondilu trie-say is for consistency with the other trie packages I made. And, of course, there is gist method. | 12:15 | |
grondilu | ok | ||
so I bet there is a recursive way to create the string I want from a shrinked trie. | 12:16 | ||
Anton Antonov | @grondilu Yes, there is an universal traversal function. But you can probably just use the keys of the Hash-representation. | 12:18 | |
@grondilu For example, trie-create-by-split(<abc abd ef eg>).shrink.form; | |||
@grondilu The line above is a visualization warm up only. | 12:20 | ||
grondilu | TRIEVALUE fields are the frequencies, right? | ||
Anton Antonov | @grondilu This closer to what you want: say trie-create-by-split(<abc abd ef eg>).shrink.words; | 12:21 | |
@grondilu Returns ((ab d) (ab c) (e f) (e g)) . | 12:22 | ||
@grondilu Yes, "TRIEVALUE'" is for frequencies and probabilities. | |||
Voldenet | btw, a lot of complexity in JSON/XML of that lib could be reduced by using iterators | 12:27 | |
Anton Antonov | @Voldenet Interesting! (But I am not sure what you mean... 🙂 ) | ||
Voldenet | m: sub visit-leafs($tree) { gather for $tree.kv -> $k, $v { if $v ~~ Rat { ($k, $v).take }; if $v ~~ Hash { ($k ~ $_[0], $_[1]).take for visit-leafs($v) } } }; say visit-leafs({ a => .5, b => { c => .3, d => .2 }}) | 12:28 | |
camelia | ((bc 0.3) (bd 0.2) (a 0.5)) | ||
Voldenet | took a while to write it in irc prompt | ||
`sub visit-leafs($tree) { gather for $tree.kv -> $k, $v { if $v ~~ Rat { ($k, $v).take }; if $v ~~ Hash { ($k ~ $_[0], $_[1]).take for visit-leafs($v) } } }; say visit-leafs({ a => .5, b => { c => .3, d => .2 }})` | |||
for discord readability | |||
ofc, that `($k, $v)` could become a class with properties like .depth | 12:29 | ||
it mostly abstracts away the recursion | 12:30 | ||
Anton Antonov | Ok, I will experiment with that code. | 12:32 | |
12:48
peder left
|
|||
Nemokosch | I brought a fun issue for today, not sure if I have this recorded anywhere | 12:51 | |
Anton Antonov | @Nemokosch Where? | 12:53 | |
@Voldenet "it mostly abstracts away the recursion" -- So, with that code, I should expect faster conversions to JSON or XML with smaller memory imprint? (I do occasionally produce large tries that have to be represented in JSON.) | 12:54 | ||
Voldenet | I'm not sure about faster, but it would not hold in memory anything but path taken | 12:57 | |
12:57
kybr left
12:58
kybr joined
|
|||
Voldenet | theoretically it could be faster for large tries | 13:00 | |
i'm not sure how JSON::Fast handles iterators tho | 13:01 | ||
Anton Antonov | @Voldenet Ok, good to know. I tried your code above -- it seems "bureaucratic" enough. Its full inclusion in the Trieish class, though, does not produce more concise code. | 13:05 | |
Voldenet | it isn't that it will make the whole codebase shorter | 13:07 | |
just that it will make both serialization and traversal shorter, but longer if you combine them\ | |||
but traversal could be then presented as separate method | |||
using visitor pattern here would be even more bureaucratic :D | 13:08 | ||
Anton Antonov | @Voldenet 1) Your It is instructive. 2) And, yes, there is trie traversal class in "ML::TriesWithFrequencies", I will consider using that idea there. | 13:13 | |
13:17
TieUpYourCamel joined
13:20
peder joined
|
|||
Voldenet | I see that TrieTraverse is enormously similar | 13:27 | |
Nemokosch | @Anton Antonov so here is the story | 13:32 | |
You have a set of integers, let's say | |||
you want to check values against that set - values that you receive as command-line arguments | 13:33 | ||
you notice that you never find the value in the set, even if you are certain that it exists | |||
it turns out that the input you get is not an integer - but it is an integer at the same time, from a different perspective. let me explain | 13:49 | ||
What you get passed to MAIN is an allomorph, something that can have different type aspects. I have a vague idea why somebody thought this was a good idea but wouldn't dare to say for sure. | 13:50 | ||
so here you have, say, an IntStr with 5, rather than an Int with 5 so it hashes differently | 13:51 | ||
the real problem is that you can declare your variables as Int $foo as much as you want, it won't help because IntStr satisfies that type constraint | 13:52 | ||
and from this perspective, it's funny that you can do $foo.Int explicitly and that is going to help | 13:53 | ||
if $foo ~~ Int, it seems reasonable to expect that $foo.Int is an identity | |||
however - fortunately, in this case - that's not necessarily true, as demonstrated | 13:54 | ||
lizmat | and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2023/05/22/2023-...xcinating/ | 13:58 | |
Nemokosch | is The Wibble is basically The Onion but for nerds? | 14:05 | |
Voldenet | I get it that raku is mindblowingly difficult, but what are the downsides? :> | 14:07 | |
lizmat | I'm not sure... first time I heard about it | 14:08 | |
14:08
silug6 joined
14:10
silug left,
silug6 is now known as silug
|
|||
Anton Antonov | @Voldenet Mostly: 1) Newcomers do not see -- or get rewarded -- of their knowledge of other "standard" languages. 2) Newcomers do not think of feel that their knowledge of Raku is going to transfer to other programming languages. 3) The average age of the Raku practitioners is 56. | 14:11 | |
tonyo | not sure that's entirely accurate | ||
m: multi MAIN(Int() $d = "5") { say $d ~~ IntStr; say $d ~~ Int; }; | |||
camelia | False True |
||
Anton Antonov | @Voldenet At this point I have a extensive list of why not to use Raku. (And similar lists for Python, R, and WL.) | 14:13 | |
Nemokosch | "5" is not IntStr though | ||
tonyo | looks like an Int okay | ||
Nemokosch | <5> would be | ||
Voldenet | m: multi MAIN(Int() $d = <5>) { say $d ~~ IntStr; say $d ~~ Int; }; | ||
camelia | True True |
||
Voldenet | valid point | ||
14:13
swaggboi joined
|
|||
tonyo | anton would love to see the list for python too | 14:14 | |
Voldenet | I would enumerate my list of reasons to dislike python, but I can't fit it in one line | 14:15 | |
Anton Antonov | @tonyo Dully noted. 🙂 Here is a warm-up: pythonforprediction.wordpress.com/...-projects/ | ||
Voldenet | @Anton Antonov: it's pretty funny that people see language's complexity as a downside while it obviously means that language has tons of built-in features | 14:18 | |
tonyo | i'm not a big fan of python, just curious what most people's gripes are with different languages | 14:19 | |
they all have warts, some more than others | |||
Anton Antonov | @Voldenet Yeah. At this point, a primary reason for me to learn a new programming language is to change my way of thinking (about programming.) Raku has been good about that in the last 4-5 years since I started using it. | 14:20 | |
Voldenet | ironically, I dislike python mostly because it's simple | 14:21 | |
Nemokosch | Voldenet: I think there can be several reasons - the language might be not only harder to learn but also implement or just read and reason about | ||
... or to get right with the design | |||
if you need 50% complexity overhead for, say, 20% efficiency gain, it's almost surely not worth it. Of course these are arbitrary numbers, it's more about the principle. | 14:23 | ||
Anton Antonov | @Voldenet Ahh... I thought Python is simple and stupid, and that those its biggest selling points. I writing (and documenting) a bunch of Python packages I say now that Python is "deceptively simplistic." | 14:24 | |
Nemokosch | and for Python, I frankly can't recall the sort of "simplicity" that forces you to write boilerplate. Of course, if you need a glue language for quick data processing or prototyping, it's not remotely close to Raku | ||
but for anything more stationary, I don't think the difference would be big, or even be "in the right direction" | |||
Voldenet | the only feature I like in python is coroutines | ||
14:24
Sgeo joined
|
|||
Voldenet | beating java in this game is difficult | 14:25 | |
tonyo | maybe, elsewhere it isn't difficult | 14:26 | |
learning haskell changed a lot of the way i think about programming | 14:27 | ||
Nemokosch | is "coroutines" a fancy name for async/await stuff? | 14:28 | |
Voldenet | Sort of - async/await is hiding the complexity | 14:30 | |
coroutines are underlying concept | |||
Anton Antonov | @tonyo Every Haskell programmer I met while working at Wolfram Research was way too smug about functional programming with Haskell. (And they were all from Western Europe, BTW.) | 14:33 | |
Nemokosch | I don't know about that but async-await is quite okay in the Node world | 14:35 | |
Voldenet | it's amazing how in js every respected library like jquery/underscore used to ship their own promises implementation, because there was no builtin | 14:40 | |
despite widespread adoption | 14:41 | ||
I'm not sure if underscore did ship with one | 14:44 | ||
tonyo | anton yea a lot of them are, i never got into it professionally but the way things fit together is a huge paradigm shift | 14:50 | |
Anton Antonov | @tonyo Interestingly, I got (somewhat) familiar with Haskell in order to write functional parsers libraries in other languages. Also, reading articles by Wadler on monadic programming. | 14:53 | |
tonyo | fwiw we got into it at ziprecruiter (a perl shop), and mjd was helping us navigate some of the ideas so it was more of a fun thing. i ended up writing a web crawler and json parser in it | 14:54 | |
ah nice, i was listening to a lot of bartosz | |||
i find myself getting frustrated by the type hinting in python as a result of that + writing in go for a while (which also has a terrible type system) | 14:55 | ||
Anton Antonov | @tonyo So, did you learn/used Raku while working at crossrecruiter? | 14:57 | |
tonyo | i got into raku as a result of being ostricized from nodejs (for criticising the callback pattern before it blew up), before that i was contributing to node core and writing C for time sensitive data parsing/analysis | 14:58 | |
15:01
rf joined
|
|||
rf | Morning folks | 15:01 | |
15:13
grondilu left
|
|||
Nemokosch | isn't underscore called lodash? | 15:18 | |
the library, at least | |||
tonyo | wUnderbar would've been a cool name too | 15:24 | |
sjn | hey, quick question; what's the schedule for the next language spec release? Docs website mentions 6.c being the current one, the executable says 6.d, and I'm not sure if 6.e is a work in progress... | 15:29 | |
Anton Antonov | @tonyo So, not cross-recruiting related, but blaspheming (or crucifixion) related. | 15:32 | |
I think, Raku should have a certain crucifixion routine. | |||
tonyo | deletes improperly typed code? | ||
use Zealousness; | |||
Anton Antonov | @tonyo Sounds good. 🙂 | 15:38 | |
16:06
JsExplorerNeil joined
16:35
dakkar left
17:08
jpn left
17:40
JsExplorerNeil left
17:45
sena_kun joined
17:52
squashable6 left
17:54
squashable6 joined
18:00
reportable6 left
|
|||
librasteve | I suspect that IntStr is the result of the chain (i) perl is untyped and can freely mix Int and Str, (ii) we want that flexibility in raku so that eg. '1' can be entered on the command line and later consumed as either a Str or an Int, (iii) but we don't want to lose this flexibility when we layer in some types | 18:01 | |
18:02
reportable6 joined
|
|||
lizmat | librasteve yup | 18:12 | |
librasteve | well I thought I'd check out the design docs (reading docs is not my usual first base ;-) ) design.raku.org/S02.html#Allomorph..._semantics | 18:16 | |
lizmat | and since about a year or so, all allomorphs can be typechecked with the Allomorph class | 18:17 | |
m: dd <42>.^mro | |||
camelia | (IntStr, Allomorph, Str, Int, Cool, Any, Mu) | ||
librasteve | two aspects I had not fully understood (i) <1 1/2 6.02e23 1+2i string> (or any list of words) is a really cool tool and (ii) one purpose is to retain the original text number definition in the case of over/underflow | 18:19 | |
m: <1 1/2 6.02e23 1+2i string>.map(*.^name).say | |||
Raku eval | (IntStr RatStr NumStr ComplexStr Str) | ||
librasteve | m: <1 1/2 6.02e23 1+2i string>.are.say | 18:20 | |
Raku eval | (Str) | ||
librasteve | m: <1 1/2 6.02e23 1+2i>.are.say | 18:21 | |
Raku eval | (Allomorph) | ||
leont | Does anyone know an example of a module exporting the tags of another module? | 18:55 | |
lizmat | perhaps P5builtins can be of inspiration? | 18:58 | |
leont | That doesn't do tags, only positional arguments. | 19:02 | |
I don't really understand why these are two entirely different systems | |||
It's genuinely confusing | |||
ugexe | leont: maybe github.com/LLFourn/p6-CompUnit-Uti...-exporting ? | 19:03 | |
lizmat | well, aren't the nameds in EXPORT just a way to specify an EXPORT::MODULE::namespace ? | ||
leont | lizmat: I'm not sure that parses | 19:07 | |
Apparently, «package EXPORT::foo {}; %(EXPORT::foo::) = Other::Package::EXPORT::functions::» seems to do the trick | 19:18 | ||
19:29
jpn joined
|
|||
rf | tonyo: Are you working on multiple backends for HB? | 19:30 | |
tonyo | not at the moment | 19:31 | |
rf | Kk, just wondering :) | ||
tonyo | it will probably be a another few weeks to months, kind of backed up | ||
rf | Yeah no worries | ||
I have an idea for a backend but i'll wait till your done, pretty backed up here too | 19:32 | ||
tonyo | if you get to it first it wouldn't hurt my feelings, i'm not champing at the bit for it yet | 19:38 | |
looks fairly straight forward though | |||
Anton Antonov | @rf Try to hurt the feelings of @tonyo with comments about Haskell. (I tried earlier, with no indication I succeeded.) | 19:39 | |
tonyo | i only have one feeling hidden below a layer of abstraction | 19:50 | |
Anton Antonov | I think fairies (e.g. Tinker Bell) are like that — they can “hold” only one feeling. | 19:54 | |
Nemokosch | For IntStr type of things: to a large extent, the strong operators (+, ~ sort of stuff) can provide that without introducing a new type so I suspect the whole thing was in order to emulate "weak typing" with methods | 19:58 | |
tonyo | doesn't it enable those through that type? | 19:59 | |
m: ay "A".Str + "B".Str | |||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: ay used at line 1 |
||
rf | I like Haskell | 20:01 | |
tonyo | m: say "A".Str + "B".Str | 20:03 | |
camelia | Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏A' (indicated by ⏏) in block <unit> at <tmp> line 1 |
||
20:09
dvergin joined
|
|||
Nemokosch | I mean if you have an IntStr, you have something that has the methods of an int and the methods of a string | 20:09 | |
20:10
dvergin left
20:13
jpn left
|
|||
Anton Antonov | @rf Yeah, but your way of liking Haskell might be radically different of the way @tonyo likes or hates Haskell. (I am not sure what tonyo's one feeling is on / about.) | 20:20 | |
tonyo | i usually use it for deciding which snack i'm going to eat last | 20:21 | |
rf | I use it to feel like I have a slight grasp on category theory (I don't) | 20:24 | |
Also tonyo, did you find out why siege was dying? | 20:25 | ||
Against HB | |||
20:37
teatime joined
21:00
jpn joined
21:04
jpn left
21:07
teatime left
21:08
teatime joined
21:35
swaggboi left
21:37
bluekai joined
21:40
bluekai left
21:47
swaggboi joined
|
|||
gfldex | tonyo: I like Message.defaults in Mailgun and think I can turn that into a trait. | 21:49 | |
tonyo | gfldex++ | 21:50 | |
guifa | Nemokosch: I don't think it was so much weak typing with methods, as weak typing for when you do a quoted string list (akin to perl's @foo = qw(a 13 b c 93) ) so that they always pass the string test when passing to subs | 22:01 | |
tellable6 | guifa, I'll pass your message to Nemokosch | 22:02 | |
Nemokosch | the side effects of that are quite a high price to pay, though. If that's the intention, it would be much lower cost to simply use a coercing type annotation | 22:04 | |
22:12
sena_kun left
|
|||
tonyo | gfldex: are you using that mailgun module already? | 23:05 | |
23:12
linkable6 left,
evalable6 left
23:14
evalable6 joined,
linkable6 joined
|
|||
gfldex | tonyo: no, just reading the sources to find nice things. :) | 23:56 |