🦋 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.
grondilu How could I classify a list of words by longest prefixes? 09:15
grondilu searches rosettacode 09:17
lizmat grondilu: raku.land/zef:lizmat/String::Utils provides a "root" function 09:38
raku.land/zef:lizmat/String::Utils#root 09:39
Geth planet.raku.org: cb42a0a252 | (Elizabeth Mattijsen)++ (committed using GitHub Web editor) | perlanetrc
Add John Haltiwanger's website
11:00
lizmat DarthGandalf: re yesterdays discussion: github.com/Raku/problem-solving/issues/406 11:08
DarthGandalf lizmat: cool, will subscribe to it :) I don't have much to add to the discussion there 11:50
grondilu I'm a bit confused about unicode normalization. docs.raku.org/language/unicode#Normalization How do I prevent normalization, exactly? 12:47
Like what do I do if I have un-normalized string literals that I want to process without any normalization whatsoever? 12:48
grondilu m: put q{ábaco}.encode('UTF8-C8') 12:49
camelia Stringification of a Blob[uint8] is not done with 'Str'. The 'decode'
method should be used to convert a Blob[uint8] to a Str.
in block <unit> at <tmp> line 1
grondilu m: dd q{ábaco}.encode('UTF8-C8') 12:50
camelia Blob[uint8].new(195,161,98,97,99,111)
grondilu m: say q{ábaco}.encode('UTF8-C8')>>.fmt("%02X")
camelia (C3 A1 62 61 63 6F)
grondilu m: say q{á}.encode('UTF8-C8')>>.fmt("%02X") 12:51
camelia (C3 A1)
grondilu I think the unormalized string should be (61 CC 81) 12:52
m: say q{á} 12:53
camelia á
grondilu also on my terminal this gives a weird looking string: a􏿽xCC􏿽x81 12:54
lizmat m: say "á".NFC; say "á".NFD 12:58
camelia NFC:0x<00e1>
NFD:0x<0061 0301>
lizmat grondilu: ^^ perhaps that's what you're looking for ?
grondilu looks it up in the doc 12:59
how do I print these? 13:04
oh, `put` seems to work 13:06
grondilu m: put 'á'.NFC 13:06
camelia á
lizmat yeah, Uni is Stringy 13:09
tbrowder__ Hi! I'm working on a more robust release of module CSV-Autoclass and would love to have someone submit a PR with a test case using non-ASCII characters for the csv file name and class name and csv content. The WIP is on branch "next-rel" at github.com:tbrowder/CSV-Autoclass. 13:34
nemokosch I'm porting Python code, and it has sys.maxsize written. It's apparently the maximum pointer value on the platform. How can I write it in Raku? 15:47
It is simply used for computation, to construct a number that doesn't fit into the platform's native integer type
librasteve 32-bit: the value will be 2^31 – 1, i.e. 2147483647 64-bit: the value will be 2^63 – 1, i.e. 9223372036854775807 16:22
^^^ from www.geeksforgeeks.org/sys-maxsize-in-python/
nemokosch yes; for now, I did that as a workaround, just hardcoded 2**63 - 1 16:24
I wonder if there is a high-level way to at least get the "native int size" 16:25
lizmat m: dd int64.Range 16:26
camelia -9223372036854775808..9223372036854775807
lizmat m: dd uint64.Range
camelia 0..18446744073709551615
lizmat nemokosch ^^
m: dd Int.Range 16:27
camelia -Inf^..^Inf
lizmat m: dd UInt.Range
camelia 0..^Inf
librasteve m: dd int.Range 16:32
evalable6 -9223372036854775808..9223372036854775807
Raku eval -9223372036854775808..9223372036854775807
librasteve m: say int.Range.max == 2**63-1 16:33
Raku eval True
evalable6 True
librasteve I extrapolated from Liz answer since int is the one that varies with the machine native size (in the very odd case that you are running raku on a 32-bit architecture) 16:34
Announced in October 2011,[14] Armv8-A (often called ARMv8 while the Armv8-R is also available) represents a fundamental change to the ARM architecture. It adds an optional 64-bit architecture named "AArch64" and the associated new "A64" instruction set. 16:42
ah - now I see why raku needed to handle both 32- and 64-bit words when it was designed!
lizmat technically I think Rakudo still supports 32bit architectures 16:43
nemokosch okay, thank you 16:45
looks good
apparently I don't get how Test is supposed to work, though
in my mind, if I have 10 subtests and do skip 'NYI', 10, as long as the code compiles, no tests should fail, even if they throw exceptions internally 16:46
it should be all silenced
librasteve well there are still some new CPU cores at 32-bit like SiFive essential series 16:47
nemokosch and is doesn't tend to complain, that much is true
but is-deeply hits hard
suman While passing an array from Raku to C, I need to do @array>>.Num. 18:34
As every element is converted to Num independently, how to do it in parallel utilizing all cores?
In case of billion elements in array, how to do it in parallel using all cores of CPU in Raku? Is it possible? 18:35
m: my @array = [-1, -0.777778, -0.555556, -0.333333, -0.111111, 0.111111, 0.333333, 0.555556, 0.777778, 1]; say @array».Num
camelia [-1 -0.777778 -0.555556 -0.333333 -0.111111 0.111111 0.333333 0.555556 0.777778 1]
nemokosch in fact, >>.Num already does that
well, not sure with what presets but it's called a "hyper meta-operator" for a reason
Xliff . 19:00
[Coke] If you want to be more explicit about it, I think it's @array.hyper.map({.Num}) 19:17
then you can pass args to hyper() if you want to control how hyper it is.
m: my @a=1..100; dd @a.hyper.map(*.Str) 19:20
camelia HyperSeq.new(configuration => HyperConfiguration.new(batch => 64, degree => 3))
[Coke] m: my @a=1..100; dd @a.hyper.map(*.Str).list
camelia ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "…
[Coke] (So you get something that will give you the values, then you can flatten it with .list, or iterate over it yourself)
[Coke] ... and they've been gone for a while already, haven't they. 19:21
nemokosch well, maybe the IRC logs can still come useful 19:29
librasteve suman: suggest you also try @array>>.num (ie. native Num) ... maybe also worth looking at the ingestion phase and coercing to Num|num when you do the csv parse or whatever 22:08
tellable6 librasteve, I'll pass your message to suman
grondilu So, I have something that I had a hard time reproducing with a small code. I now have something I think I can show. 22:32
m: say "cañón rubí abdomen petróleo borrar feliz gloria mojar mujer tema bodega".encode("utf8
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in double quotes; couldn't find final '"' (corresponding starter was at line 1)
at <tmp>:1
------> ia mojar mujer tema bodega".encode("utf8⏏<EOL>
expecting …
grondilu hang on 22:33
m: say "cañón rubí abdomen petróleo borrar feliz gloria mojar mujer tema bodega".encode("utf8-c8").subbuf(0, 9)
camelia Blob[uint8]:0x<63 61 C3 B1 C3 B3 6E 20 72>
grondilu m: say "cañón teatro famoso donar catre máscara júpiter flauta metro cara pez".encode("utf8-c8").subbuf(0, 9)
camelia Blob[uint8]:0x<63 61 C3 B1 C3 B3 6E 20 74>
grondilu god damn it doesn't work anymore 22:34
well nevermind, I'll try again later 22:38