🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
Maxdamantus Does it seem strange that this 243 KiB UTF-8 string requires more than 16 GiB of memory? 08:15
$ jq -n -j 'range(0, 50000) | [., 768] | implode' | raku -e 'slurp;'
Killed
Maxdamantus eval: my @a; for 0..50000 { @a.push($_, 0x301); }; @a.chrs; 08:22
evalable6 (signal SIGHUP) «timed out after 10 seconds»
MasterDuke committable6: releases my @a; for 0..50000 { @a.push($_, 0x301); }; @a.chrs; 08:28
committable6 MasterDuke, gist.github.com/2fde89e2dc1b1367bb...e05054f85e 08:38
Voldenet it doesn't seem strange, printing it out to the terminal is also painfully slow 12:19
btw, jq uses ; as args separator, not , 12:22
so `jq -n -j 'range(0; 50000) | [., 768] | implode' | raku -e 'slurp;'` 12:23
gfldex lolibloggedalittle: gfldex.wordpress.com/2022/01/16/fo...omplexety/ 12:49
lizmat s/complexety/complexity/ ? 12:50
gfldex fixed, thanks 13:18
Voldenet last time i checked things like `sub infix:<notnilor>` really slowed down the script 13:19
> sub notnilor(\maybenil, \alternative) { … }; .&needle.&notnilor(Empty) 13:24
this would be a lot faster to initialize, because grammar doesn't change
moon-child isn't notnilor just //?
Voldenet not exactly 13:25
m: say Any =:= Nil 13:26
camelia False
moon-child ah, sure 13:27
but I don't think that matters in this particular case
Voldenet you can check that it does have very different performance characteristics 13:29
in fact, having it as operator is a lot faster 13:30
nevermind, I read numbers wrong 13:31
gfldex In a module precomp takes care of that and our grammar engine is not optimised at all. 13:53
Geth ¦ doc: tbrowder self-assigned Create a tutorial on practical exception handling github.com/Raku/doc/issues/4016 13:55
Anton Antonov I assume there are at least a few packages/modules that generate Raku module/package folder structure and some of the files. Any links or recommendations? (I found "Ddt" and some related ones...) 15:11
tbrowder discord-raku-bot: are you looking to build new module? if so, see module App::Mi6 16:30
highly recommended (with the --zef option) 16:31
it's favored by lizmat
lizmat is just lazy :-) 16:32
tbrowder no, energy conserving for more productivity!
it's primarily for use with github. yr mileage may vary with other git servers 16:35
Anton Antonov <@755062053282119803> Thanks! 16:50
<@755062053282119803> "are you looking to build new module?" -- I want create quickly "disposable" modules that are in fact "data packages". Here by "data package" I mean a Raku module that (1) has certain data in the "resources" folder, (2) has functions for data retrieval and metadata descriptions in the "lib" folder, and (3) likely to have tests for certain invariants that are satisfied by the data. 16:53
lizmat a simple module exposing %?RESOURCES should do the trick ? 17:03
Anton Antonov @lizmat Yes, I think so. Basically, I am making a conversational agent for data acquisition. After the user has selected the dataset I want the system to generate a data package that makes the use of that dataset convenient. In Raku this means have (most likely) a CSV file in "resources" folder and a module function that reads that CSV file. 17:11
I think I am repeating myself, but I hope it is more clear I am trying to do...
lizmat are you going to generate that CSV file ? 17:12
Anton Antonov: if that is the case, then maybe it makes more sense to generate Raku source-code, and have that pre-compiled 17:19
it makes developing and installing such a module a bit of a pain, but it will make startup so much faster :-) 17:20
Anton Antonov @lizmat The dataset it is retrieved with the package `Data::ExampleDatasets`. And yes, pre-compilation would make sense, at least for small dataset.
lizmat see raku.land/zef:lizmat/uniname-words for this approach
Anton Antonov The process I after is demonstrated / outlined here: www.youtube.com/watch?v=eJ7355AJSP4#t=885 . 17:22
BTW, that is what I am working for my FOSDEM22 Raku presentation...
Basically, I am preprogramming the Mathematica-and-Raku conversational agent I presented last year the Wolfram Technology Conference into a "completely Raku" conversational agent. 17:24
@lizmat I definitely have to use BEGIN in my other conversational-agent-related packages. Thanks for providing an example! 17:33
lizmat you're welcome :-)
Anton Antonov @lizmat This article of yours is both concise and instructive: opensource.com/article/18/10/how-p...ork-perl-6 17:53
lizmat Anton Antonov: thank you 18:36
tbrowder i just added a practical example of using CATCH at Raku/doc issue #4016. i would appreciate any comments on it 18:56
moon-child tbrowder: it feels a bit contrived to die inline and catch right away. I wasn't initially sure what or where the error handling was 19:05
what about something like this? ix.io/3Mui/perl6
tbrowder moon-child: much better example for sure. my immediate goal was to use the right forms and syntax to fit my real problem. but i think yours is the way to go for the docs (and it looks like an easier drop-in, too). thanks! 19:10
moon-child :)
Voldenet tbrowder: i'd ditch nested for 19:12
tbrowder why? 19:13
that's a common idiom for us simple coders 19:14
Voldenet it makes reading, writing and debugging code harder 19:16
I've changed it a little bit: ix.io/3Mun/perl6 19:17
in real life processing a sheet is long and difficult
lizmat one note: there's currently a bug in the return value of a scope, if CATCH is the last element of a scope 19:18
since it doesn't matter where it is located in a scope, I always suggest to put the CATCH block at the start
Voldenet that makes sense
and it may help people get rid of the assumption that it's like try/catch 19:19
tbrowder Voldenet: ok, i think i see what you mean, and it is more like my actual use.
japhb Just had failure installing Cairo module on Rakudo HEAD. Currently building again from scratch to see if it's flaky or hard fail. 19:20
moon-child Voldenet: actually processing a sheet involves a graph traversal. I think a nested for-loop is fine in this case, since the interesting computation will happen on cells (rather than rows) anyway 19:20
Voldenet + sheet is 2d grid of cells 19:21
moon-child (or--depends how clever you are. If I were making a spreadsheet, I would make its representation columnar and semi-sparse) 19:21
Voldenet if I were making a spreadsheet I'd write rdbms and then ditch the project before even getting into spreadsheet part ;) 19:24
all important problems were solved before spreadsheets anyway
moon-child yes
spreadsheets are dumb
still a better operational model than unix™ 19:25
tbrowder i'm not trying to solve the world's probs at the top level, just mine,one at a 19:26
moon-child tbrowder: see, that's your mistake 19:27
tbrowder time and hope it helps another
moon-child you're likely to actually _get_ somewhere with that sort of strategy
Voldenet True, to write perfect spreadsheets, you first need to solve world poverty problem 19:27
moon-child and what's the point of getting places and doing things??
Voldenet seriously though, especially when things are targeted to beginners - smaller function better 19:28
tbrowder no srgument here, but this problem is to hide unnecessary stuff from the use 19:29
but use good practice while doing it if i can 19:30
Voldenet and good CATCHes are good in locating errors as well, encapsulating them in subroutines makes the whole experience smoother later on
tbrowder thanks for the useful comments. i'll improve the example and ask for review again. 19:31
Anton Antonov @moon-child "[...] If I were making a spreadsheet, I would make its representation columnar and semi-sparse" -- Interesting statement. Can you expand on it? 19:41
tbrowder note the Perl reader allows for that, but I turn missing or empty cells into '' for convenience 19:57
at least i plan that for my initial handling. i have to deal with some weird formats from inexperience spreadsheet creators 19:59
*inexperienced 20:00
with weird cell values sometimes.
or invalid values
moon-child @Anton Antonov not sure what more there is to say. Columnar means cells which are immediately above or below one another are stored contiguously. Semi-sparse means we make an attempt not to store empty cells 20:01
tbrowder anyway, i rearranged Voldenet's example per lizmat's comments, made a few other tweaks, and will update the issue example momentarily... 20:04
Anton Antonov @moon-child So, you would use the so called long format? (Which corresponds to a certain sparse array scheme.) 20:11
moon-child yes. Column stores rock 20:12
Anton Antonov @moon-child Do you consider having heterogenous value types in a column? 20:13
tbrowder ok, so updated. notice i was able to eliminate the "next" statements, possibly due to moving the CATCH blocks per lizmat.
moon-child sure. That would just be a part of the sparse representation
'run of n packed integers; run of m spaces; a string; run of p floats'
tbrowder yes, the original Excel xlsx files use such a format, and Perl's Spreadsheet::Read preserves it, but I don't 20:15
moon-child yeah 20:16
as I said, I wouldn't make a spreadsheet; but if I _were_ to do so...
tbrowder anyhoo, interested parties please review doc issue #4016 20:17
Voldenet looks good 20:18
Voldenet I'm not sure whether `say "" ~ .Str` or `say "", .Str` is better 20:18
moon-child why do you need more than say .Str? 20:19
Voldenet that's an excelent question - have you ever debugged a program where the error is just
"Invalid argument"? :D
without a stack trace, no less
tbrowder ah, you folks are now point out good hints that would go toward make a good Raku post or a docs chunk ;-D 20:20
*pointing *making 20:21
moon-child Voldenet: oh, you mean like say "..." ~ .Str
Voldenet Ah, right
tbrowder gotta get back to real world
bye
moon-child not literally an empty string :P 20:22
tbrowder: cya
tbrowder thanks all, cya2 20:22
Hydrazer ~ looks cooler
moon-child for me , is less mental overhead
Voldenet I use ~ more because it works in the context where you need to just pass the string 20:24
moon-child yeah. ~ is more general, , is more specific
more specific methods require less context to parse
Voldenet well I've checked and it more or less doesn't matter 20:31
github.com/rakudo/rakudo/blob/21a7...rs.pm6#L97 20:32
[Coke] (columnar data) wonder if we support parquet 21:42