__monty__ has joined #nix-lang
sphalerite has joined #nix-lang
<
sphalerite>
I stand by "we have way too many channels"
<
infinisil>
The bot doesn't need a let at the beginning
<
sphalerite>
> let composeHack = x: if builtins.isFunction x then compose composeHack x else x; in composeHack (x: x+1) (x: x+2) 3
<
{^_^}>
cannot coerce a function to a string, at (string):191:101
<
sphalerite>
I don't want to define composeHack persistently though
<
infinisil>
Ah right
<
sphalerite>
> let composeHack = x: y: if builtins.isFunction y then compose x y else x y; in composeHack (x: x+1) (x: x+2) 3
<
infinisil>
> composeHack = f: x: let r = f x; in if lib.isFunction r then y: composeHack r y else r
<
{^_^}>
composeHack defined
<
sphalerite>
> composeHack (x: x+1) (x: x+5) (x: x+3) 0
<
{^_^}>
cannot coerce a function to a string, at (string):192:17
<
infinisil>
Well yours seems to work :)
<
sphalerite>
> let composeHack = ; in composeHack (x: x+1) (x: x+5) (x: x+3) 0
<
{^_^}>
error: syntax error, unexpected ';', at (string):192:19
<
sphalerite>
it doesn't recurse, so it won't work for more than two functions
<
sphalerite>
eh, composeAlt is more reasonable anyway :p
<
infinisil>
> 1 + 1
<
sphalerite>
:v composeAlt
<
sphalerite>
> :v composeAlt
<
{^_^}>
composeAlt = fs: if fs == [] then lib.id else x: (lib.head fs) (composeAlt (lib.tail fs) x)
<
infinisil>
> composeHack = a: if lib.isFunction a then b: composeHack (a b) else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack (x: x+1) (x: x+5) (x: x+3) 0
<
{^_^}>
cannot coerce a function to a string, at (string):192:17
<
infinisil>
> composeHack (x: x+1) 0
<
infinisil>
> composeHack = a: if lib.isFunction a then b: a (composeHack b) else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack (x: x+1) (x: x+5) (x: x+3) 0
<
{^_^}>
cannot coerce a function to a string, at (string):192:17
ixxie has joined #nix-lang
<
infinisil>
> composeHack = a: if lib.isFunction a then b: if lib.isFunction b then composeHack (x: b (a x)) else a b else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack = a: if lib.isFunction a then b: a (composeHack b) else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack = a: if lib.isFunction a then b: if lib.isFunction b then composeHack (x: b (a x)) else a b else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack (x: x+1) (x: x+5) (x: x+3) 0
<
infinisil>
> composeHack (x: x+1) (x: x*5) (x: x+3) 0
<
infinisil>
> composeHack = a: if lib.isFunction a then b: if lib.isFunction b then composeHack (x: a (b x)) else a b else a
<
{^_^}>
composeHack defined
<
infinisil>
> composeHack (x: x+1) (x: x*5) (x: x+3) 0
<
infinisil>
sphalerite ^
<
sphalerite>
you don't give up :D
<
infinisil>
Not as nice as I'd hopef
<
infinisil>
yeah lol
ixxie has quit [Ping timeout: 245 seconds]
ixxie has joined #nix-lang
ixxie has quit [Ping timeout: 246 seconds]
ixxie has joined #nix-lang
ixxie has quit [Ping timeout: 272 seconds]
__monty__ has quit [Quit: leaving]