00:31
lichtkind left
01:35
hulk joined
01:36
kylese left
01:37
RandalSchwartz joined,
RandalSchwartz left
02:15
hulk left,
kylese joined
03:50
stanrifkin joined
03:52
stanrifkin_ left
|
|||
disbot8 | <simon_sibl> is there a more efficient way to do this ? | 04:39 | |
<simon_sibl> my @jobs = @str_jobs.map({my %h; %h<title submit process priority> = .split(','); %h}); | |||
<simon_sibl> basically splitting a string by "," and add the field in a hashmap | |||
05:09
Guest81 joined
05:10
Guest81 left
05:36
bd3i left,
bd3i joined
05:39
Aedil joined
05:41
kylese left
05:42
kylese joined
07:16
Aedil left
07:21
japhb left,
japhb joined
07:28
librasteve_ joined
|
|||
disbot8 | <librasteve> my first idea is to make a sub vv | 07:28 | |
librasteve_ | www.irccloud.com/pastebin/wg6riNEj | 07:31 | |
tellable6 | 2025-08-29T23:18:53Z #raku <wayland76> librasteve Where should I have logged this ticket? github.com/Raku/doc-website/issues/463 | ||
07:32
japhb left
07:33
japhb joined
|
|||
disbot8 | <librasteve> then I put it back together like this (since map takes a Callable anyway)... | 07:34 | |
<librasteve> my @jobs = @str_jobs.map: { <title submit process priority> Z=> .split(',') }; | |||
<librasteve> oops - need %() to make the Hash | 07:35 | ||
<librasteve> my @jobs = @str_jobs.map: { %( <title submit process priority> Z=> .split(',') ) }; | |||
Voldenet | simon_sibl: don't make a hash in the first place, use the array directly | 07:36 | |
if by efficient you mean "fast" | |||
disbot8 | <simon_sibl> looks good thanks ! indeed cleaner xD | 07:46 | |
<simon_sibl> I meant a cleaner way, easier to read xD 🙏 | 07:47 | ||
<simon_sibl> array are more efficient but not easy to follow in the code | |||
07:50
human-blip left
07:52
human-blip joined
08:00
Sgeo_ joined
08:01
hudo_ joined
|
|||
Voldenet | heh, not necessarily, there are ways around it | 08:01 | |
you could make a header first and then return object that would access header first and array later | 08:02 | ||
08:03
phogg` joined,
kjp left,
avar left,
phogg left,
jdv left,
hudo__ left
08:04
Sgeo left,
broquaint left
08:05
broquaint joined
08:06
kjp joined
08:07
rba_ joined,
rba left,
rba_ is now known as rba
|
|||
Voldenet | m: my @str_jobs = <aaa,2,proc1,high bbb,3,proc2,low>; sub make-header(*@f) { my %i = @f.antipairs; class X { has $.v; method AT-KEY($k) { $!v[%i{$k}] }}; return -> *@v { X.new(:@v) } }; my &make-job = make-header <title submit process priority>; my @jobs = @str_jobs.map: { make-job(.split(',')) }; .<title>.say for @jobs; | 08:09 | |
camelia | aaa bbb |
||
08:10
avar joined
|
|||
Voldenet | it may seem long, but array to job mapping is not that long | 08:10 | |
> my &make-job = make-header <title submit process priority>; my @jobs = @str_jobs.map: { make-job(.split(',')) }; | |||
08:10
jdv joined
|
|||
Voldenet | %(… Z=> …) solution is a lot easier to read though | 08:11 | |
you could get it shorter | 08:13 | ||
my @jobs = @str_jobs.map: { %=<title submit process priority> Z .split(',') }; | |||
eh, nevermind, I've tested it and it doesn't work as I hoped | 08:15 | ||
my @jobs = @str_jobs.map: { hash <title submit process priority> Z .split(',') }; | 08:18 | ||
disbot8 | <librasteve> ok - I have added the US dollar Currency to Physics::Unit but tbh I think the first pass is suboptimal ... it uses sub postfix:<$> (Real:D $x) is export { do-postfix($x,'$') } so you can currently type 3.00$ --- just like you can type 4.2l BUT boy would that be nicer as $3.00 | 09:14 | |
<librasteve> at first I was hopeful that I could just go sub prefix:<$> (Real:D $x)... with the idea that there is no valid raku (afaik) that combines the $ followed by a number literal - this didn't wok - not suprising really since $ is used for quite a lot of stuff already | 09:16 | ||
lizmat | librasteve_: the problem is that $1 is valid syntax for $/[1] | 09:17 | |
disbot8 | <librasteve> is this the sort of thing that RakuAST would help with? any thoughts on how to make this workable? | ||
<librasteve> ah, I had forgotten match capture deref | 09:18 | ||
<librasteve> just have to stick to € | 09:19 | ||
lizmat | perphaps US$ CAN$ AUS$ ? | 09:20 | |
as prefixes | |||
m: sub prefix:<US$>($a) { say $a }; US$ 42 | 09:21 | ||
camelia | 42 | ||
lizmat | seems to work ? | ||
m: sub prefix:<US$>($a) { say $a }; US$42 # works even without space inbetween | |||
camelia | 42 | ||
disbot8 | <librasteve> yeah - its just that typing US$ is a bit more work - let me mull | 09:23 | |
lizmat | I guess, in this geopolitical situation, it's good to be specific :-) | 09:24 | |
disbot8 | <librasteve> yeah - there is actually a need to distinguish when eg doing currency conversions | 09:25 | |
Voldenet | how about using iso codes for currencies | 09:27 | |
lizmat | m: sub prefix:<USD>($a) { say $a }; USD42 | 09:28 | |
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared name: USD42 used at line 1 |
||
lizmat | m: sub prefix:<USD>($a) { say $a }; USD 42 | ||
camelia | 42 | ||
lizmat | that would require spacing :-( | ||
disbot8 | <librasteve> bear in mind that there are 2 ways to make a unit --- the general way is ^<value unit> (ie the ^ caret as prefix following by some quoting) and the shorthand way | 09:30 | |
09:30
Geth left
|
|||
disbot8 | <librasteve> so 4.2l is another way to spell ^<4.2 l> or ^<4.2 liters> | 09:30 | |
Voldenet | ah, it's this kind of problem, imo using codes is necessary | 09:31 | |
09:31
Geth joined
|
|||
Voldenet | because some countries have multiple currencies | 09:31 | |
disbot8 | <librasteve> I will use ISOP as the internal definition - like this Currency: - {names: [USD, US$, $, dollar], defn: 'USD' } | ||
<librasteve> (sorry YAML alert) | 09:32 | ||
Voldenet | Venezuela has VEB (old) VED and VES | ||
disbot8 | <librasteve> so anything in the names list will match in the general ^ syntax - this question is what is the subset of shorthands to export as prefix/postfix | 09:33 | |
<librasteve> Voldenet++ since I am thinking MAY be nice to auto select the home currency (ISO) from the locale [thats likely not to be in the first release] | 09:34 | ||
Voldenet | some countries (like Poland) use postfix notation, so "15zł" is "PLN 15" | 09:35 | |
otoh eur would use prefix notation | |||
m: sub prefix:<€>($n){ }; €15 | |||
camelia | ( no output ) | ||
disbot8 | <librasteve> yes, so we can make the shorthands be quite colloquial | ||
Voldenet | and it works, ootb, in fact $ is special | ||
disbot8 | <librasteve> (sadly can go with $) | 09:36 | |
Voldenet | m: sub prefix:<$>($n){ }; $20 | ||
camelia | ( no output ) | ||
Voldenet | …huh? | ||
disbot8 | <librasteve> I mean cant go without $ | ||
lizmat | Voldenet: $20 parses as $/[20] | 09:37 | |
Voldenet | m: sub prefix:<$>($n){ say "ah, I see" }; $20 | ||
camelia | ( no output ) | ||
Voldenet | Right, of course | ||
lizmat | ﹩$💲 # or use one of the other dollar signs | ||
but that would just be even more difficult typing :-) | 09:38 | ||
Voldenet | but then usefulness of that is very limited, I guess | ||
lizmat | indeed | ||
disbot8 | <librasteve> nah - this is for fast typing - had enough pain with ♎️ | ||
<librasteve> chatgpt.com/share/68b41862-f328-80...1c60887009 | 09:39 | ||
Voldenet | > const prefix = colloquialMap[currency] || currency + "$"; | 09:41 | |
EUR$ :> | |||
disbot8 | <librasteve> lol | ||
09:44
Sgeo_ left
|
|||
Voldenet | though it's informative, Intl.NumberFormat in js is pretty amazing and it's built-in | 09:47 | |
disbot8 | <librasteve> console.log(new Intl.NumberFormat("en-IN").format(number)); // "12,34,567.89" (Indian English) | 09:48 | |
Voldenet | it seems that € in it uses prefix notation for en-US locale but postfix for de-DE | 09:49 | |
09:59
apac joined
10:01
lichtkind joined
10:03
cpli left,
cpli joined
|
|||
Voldenet | btw, you need currency in js | 10:05 | |
> console.log(new Intl.NumberFormat("en-IN", { style: 'currency', currency: 'INR' }).format(24)) | |||
> ₹24.00 | |||
disbot8 | <librasteve> Its interesting to see that JS is very complete in this regard ... however, since App::Crag got the lizmat treatment, getting a nice, colloquial tool is my current focus - happy to backport to anything like Intl.Number that comes to raku land | 10:06 | |
<librasteve> thanks for all the feedback... | 10:11 | ||
Voldenet | the completness in js comes from here github.com/unicode-org/icu/tree/ma.../data/curr | 11:04 | |
and here… perhaps, I have no idea what these codes mean github.com/unicode-org/icu/blob/ma...cCodes.txt | 11:06 | ||
lizmat | feels like indices into an array somewhere? | 11:07 | |
Voldenet | it says on top of some files that they were generated from cldr | 11:08 | |
that looks useful github.com/unicode-cldr/cldr-numbe...ncies.json | |||
and not pain to parse too | |||
11:09
phogg` left
|
|||
lizmat | sadly that is for cldr 37, we're at 64 now | 11:11 | |
*46 | |||
Voldenet | ah, different repository is more up-to-date github.com/unicode-org/cldr-json/b...ncies.json | 11:13 | |
11:18
lichtkind_ joined,
lichtkind left
11:21
phogg joined
11:29
wayland left,
wayland76 joined
12:18
apac left
|
|||
disbot8 | <simon_sibl> this is god sent: termbin.com/z3f3 | 13:34 | |
guifa | librasteve: I will eventually be getting around to a currency formatting | 14:02 | |
you can get the raw data in Intl::CLDR tho | |||
although I think I might have held off for some reason with putting in the string format for it --- not sure why it's not showing up atm | 14:06 | ||
but `use Intl::CLDR; cldr<en><numbers><currencies><EUR><symbol>` for instance returns € | 14:07 | ||
aaah | 14:21 | ||
cldr<en>.numbers.currency-formats.latin.standard.pattern , although for some reason I'm just getting an empty string back right now. Will check my code | 14:25 | ||
the result should be though `¤#,##0.00` for standard, and `¤#,##0.00;(¤#,##0.00)` for accounting | 14:26 | ||
I'll investigate and try to push out an Intl::Format::Currency | 14:33 | ||
disbot8 | <librasteve> .oO | ||
<librasteve> guifa: the source link for Intl.CLDR on raku.land is broken (guess this comes from the META6.json) | 14:40 | ||
<librasteve> github.com/alabamenhu/Intl-CLDR/pull/6 | 14:46 | ||
14:51
derpydoo joined
|
|||
guifa | ugh def some stuff I need to update in there | 14:53 | |
14:53
lichtkind_ left
|
|||
guifa | I've been too involved lately in the C /Obj-C world trying to get UI::HTMLWindow working even better | 14:53 | |
disbot8 | <librasteve> yeah - btw way I just zef installed Intl::CLDR on my macOS - the issue with 256 file limit did not arise, so I suggest to remove the cary warning in the README ;-) | 14:54 | |
librasteve_ | s/cary/scary/ | 14:55 | |
disbot8 | <librasteve> for now, this is all that I need `raku -e 'use Intl::CLDR; cldr<en><numbers><currencies>.say' | 14:57 | |
guifa | thank the $DEITY | 15:05 | |
I finally properly forked off | |||
guifa is learning so much new stuff trying to create the html ui | 15:06 | ||
a tricky one was getting the dylib executable path. we've deprecated %?RESOURCE<foo>.absolute, but I need such a path for properly calling exec*. And of course, macOS has to be special lol | 15:22 | ||
15:58
derpydoo left
16:02
lichtkind joined
16:25
elcaro left,
elcaro joined
16:45
derpydoo joined
17:10
Aedil joined,
apac joined
17:22
librasteve_ left
17:26
derpydoo left
17:55
apac left
18:57
guifa left
19:19
Sgeo joined
19:21
Aedil left
19:31
melezhik joined
|
|||
tbrowder | hi, how does one get the default srand number for an os? | 20:04 | |
the docs say the number depends on the os | 20:05 | ||
ah, maybe this... | 20:06 | ||
m: say Num.rand | 20:07 | ||
camelia | Invocant of method 'rand' must be an object instance of type 'Num', not a type object of type 'Num'. Did you forget a '.new'? in block <unit> at <tmp> line 1 |
||
tbrowder | m: my $n = Num.new; say $n.rand | 20:08 | |
camelia | 0 | ||
tbrowder | m: my $n = Num(10000000000000000000).rand | 20:12 | |
camelia | ( no output ) | ||
destroycomputers | m: say rand | 20:15 | |
camelia | 0.9184466250639097 | ||
tbrowder | m: say (1..69).roll | 20:16 | |
camelia | 57 | ||
tbrowder | that's the "ticket" | ||
i just want some control over the srand, or at least see what the default is | 20:17 | ||
m: say (1..69).roll; say (1..69).roll | 20:18 | ||
camelia | 52 19 |
||
tbrowder | m: for 1..5 {say (1...69).roll} | 20:20 | |
camelia | 69 54 2 7 58 |
||
tbrowder | florida powerball is 1+ BILLION usd | 20:21 | |
draw tomorrow (1 sep) at 2300 EDT | 20:23 | ||
m: for 1..5 {say (1..69).roll}; say (1..26).roll | 20:24 | ||
camelia | 5 45 3 6 40 21 |
||
tbrowder | the "21" at the end is the "power ball" pick | 20:25 | |
i 💗 raku | 20:26 | ||
El_Che | . | 21:36 | |
tellable6 | 2025-08-28T22:16:42Z #raku-dev <jdv> El_Che 2025.08 happened | ||
El_Che | damn, I need to be more active on irc | 21:37 | |
I will release tomorrow | |||
21:41
melezhik left
|
|||
tbrowder | [Coke]: see my comment on irc #raku.land | 22:06 | |
#raku-land that is... | |||
22:09
lichtkind left
22:57
stanrifkin left
22:58
wayland76 left
23:25
sftp joined,
sftp left,
sftp joined
23:26
arkiuat joined
|
|||
arkiuat | tbrowder, for lotto games I think you want .pick, not .roll | 23:26 | |
[Coke] | tbrowder: I see no comment anywhere. | 23:49 |