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/
andi- has quit [*.net *.split]
andi- has joined #nix-lang
mpickering has quit [*.net *.split]
mpickering has joined #nix-lang
ldlework has joined #nix-lang
<ldlework> infinisil: these are fun
ekleog has joined #nix-lang
<ekleog> o/
<infinisil> :D
<infinisil> I've done this quiz in another channel already, but here goes:
<infinisil> > fun = n: { ${n} = 1; ${n} = 2; }
<{^_^}> fun defined
<infinisil> Call this function with an argument such that it doesn't error
teto has joined #nix-lang
teto has left #nix-lang ["WeeChat 2.0"]
<ekleog> oh, already got that one :°
<infinisil> Ahh
<infinisil> Then it's for ldlework and others in this channel :P
<ekleog> yup :D
<infinisil> ekleog: Ohh and here's a previous one for you, which I think you missed:
<ldlework> i don't know how to answer that one
<ldlework> some sort of value that has side effects lol
<infinisil> The question is: What does `let x = "foo"; in ({ x ? x }: x) {}` evaluate to?
<ldlework> "foo" ?
<infinisil> ldlework: It's a rather quirky thing of Nix, I'll reveal it
<infinisil> > fun null
<{^_^}> { }
<infinisil> null as an attribute value doesn't set the attribute at all :)
<infinisil> s/value/name
<infinisil> ldlework: And the "foo" is unfortunately not correct, I wish it was
<infinisil> Alright but I'll sleep now, the solution to the second one can be gotten easily :)
<ekleog> infinisil: indeed, I missed that previous one :)
<ekleog> aaaand I wrong-guessed it, though it does make sense for eg. let x = "foo"; in ({ x ? "bar", y ? x }: y) {} :)
<infinisil> ekleog: yeah
<infinisil> function arguments are like a rec attrset in a way
__monty__ has joined #nix-lang
__monty__ has quit [Quit: leaving]