Synthetica has quit [Quit: Connection closed for inactivity]
kyren has joined #nix-lang
andi- has quit [Ping timeout: 272 seconds]
andi- has joined #nix-lang
tilpner has joined #nix-lang
tilpner_ has quit [Ping timeout: 256 seconds]
ddellacosta has quit [Ping timeout: 258 seconds]
__monty__ has joined #nix-lang
Synthetica has joined #nix-lang
noonien has quit [Ping timeout: 240 seconds]
noonien has joined #nix-lang
Synthetica has quit [Quit: Connection closed for inactivity]
evanjs has joined #nix-lang
ddellacosta has joined #nix-lang
evanjs has joined #nix-lang
evanjs has joined #nix-lang
{`-`} has joined #nix-lang
__monty__ has quit [Quit: leaving]
fuzzy_id has joined #nix-lang
<
fuzzy_id>
how can i uncurry in nix? something like this: `map (x: y: { foo = x; borg = y; }) [ ("bar", "baz") ]'
<
fuzzy_id>
i guess i'd have to use nested list right?
<
infinisil>
fuzzy_id: Either that, or if it works for you you could use an attrset as input instead
<
infinisil>
> :p lib.mapAttrsToList (x: y: { foo = x; borg = y; }) { bar = "baz"; }
<
{^_^}>
[ { borg = "baz"; foo = "bar"; } ]
<
infinisil>
fuzzy_id: Second approach ^
<
infinisil>
First one would be a bit messy tbh
<
fuzzy_id>
oh, wow. i didn't expect to be guided here by the same person, who'd give me the answer. :)
<
fuzzy_id>
yeah, mapAttrsToList is a nice one
<
fuzzy_id>
but the function definition is really confusing.
<
fuzzy_id>
ah, now i got!
<
infinisil>
(though this only works if you don't have duplicate fst's
<
fuzzy_id>
how do i get 'lib' in 'nix repl', btw.
<
infinisil>
nix repl '<nixpkgs/lib>'
<
infinisil>
Or `:l <nixpkgs/lib>` when it's already started
<
fuzzy_id>
last question: is there a flipped version of mapAttrsToList? or is there a function 'flip'?
<
fuzzy_id>
with flipped version i mean a function that takes the attribute set first and then the function to apply
<
infinisil>
> lib.flip
<
infinisil>
fuzzy_id: Indeed there is flip
<
fuzzy_id>
aaah. my bad!
fuzzy_id has quit [Ping timeout: 240 seconds]