infinisil changed the topic of #nix-lang to: Channel for discussing Nix as a language - https://nixos.org/nix/manual/#chap-writing-nix-expressions - Logs: https://logs.nix.samueldr.com/nix-lang/
ddellacosta has quit [Ping timeout: 268 seconds]
__monty__ has joined #nix-lang
<puck> > builtins.isPath (builtins.toPath "/")
<{^_^}> false
<puck> no comment
tilpner has joined #nix-lang
<puck> :p builtins.split ".*" "foo"
<puck> > :p builtins.split ".*" "foo"
<{^_^}> [ "" [ ] "" [ ] "" ]
<puck> this really shouldn't match twice, i'd say?
<__monty__> Isn't it matching three times?
<puck> it's matching twice
<puck> > :p builtins.split "(1|2)" "a1b2c3d"
<{^_^}> [ "a" [ "1" ] "b" [ "2" ] "c3d" ]
<__monty__> Hmm, why is it not matching characters?
<puck> it is, group 0 is just not shown
<puck> > :p builtins.split "(.*)" "foo"
<{^_^}> [ "" [ "foo" ] "" [ "" ] "" ]
<__monty__> Well, empty string *does* match .* : >
<tilpner> Hi, is anyone aware of an existing base* decoder in Nix?
<puck> tilpner: ... i have a base16 -> byte array decoder
<puck> and a nix-base32 encoder
<tilpner> Could I look at it, please?
<puck> the best way i found to do this is literally a large chain of if/else
<puck> note that nix's base32 is reverse, and with a non-standard charset
<tilpner> Yeah, I don't need any particular encoding, just any
<__monty__> Reverse?
<tilpner> I'll try to follow through your gist, thanks
<__monty__> tilpner: Please stick to the existing one for hashes. Let's not make the situation worse than it already is.
<tilpner> Not a hash
<__monty__> Nix hashes are usually base32 encoded.
<__monty__> I'm talking about the base32 encoding.
<puck> i'm not entirely sure why nix's base32 hashes are reverse from the "standard" encoding
<__monty__> What does reverse mean though?
<__monty__> Like little endian?
<puck> yeah. normally, base32 encoding starts at the first byte of the bytestring, and continues onwards. Nix's hash is the exact opposite and starts at the end
<__monty__> Huh, TIL.
<__monty__> That's really weird.
<__monty__> Sounds like an accidental thing tbh.
<puck> i think it's more of a "scholar" view of the whole computering thing
<puck> parsing the entire hash as a "base256-encoded" little-endian integer, etc
<__monty__> Are the hexadecimal hash representations backwards too?
<puck> no
<__monty__> Sounds more to me like appending to a string from the wrong end or something tbh.
<puck> the nix phd thesis i think mentions it, and mentions it being "backwards" i think?
<__monty__> Hmm, I should read that once upon a time.
<__monty__> If only I had a bag of round tuits.
ddellacosta has joined #nix-lang
infinisil has quit [Quit: Configuring ZNC, sorry for the joins/quits!]
infinisil has joined #nix-lang
ddellacosta has quit [Ping timeout: 255 seconds]
ddellacosta has joined #nix-lang
__monty__ has quit [Quit: leaving]