Haskell + hgl, 14 bytes
jn m<rv.^dW<fe
Try it online!
(.^
has been renamed to <<
since this was posted)
Explanation
To start we want to do the much simpler:
f x y=rv$dW(fe x)$rv$dw(fe x)y
This drops all things in x
off the front, reverses it, then drops all things in x
off the new front and reverses it back.
From here we can start by removing the y
.
f x=rv<dW(fe x)<rv<dw(fe x)
Now we have the expression rv<dW(fe x)
twice so let's fix that. jn
will take a function on two arguments and pass the same value as both of its arguments.
f x=(rv<dW(fe x))<(rv<dW(fe x))
f x=jn m(rv<dW(fe x))
Now x
is at the end so we can eta-reduce it away as well:
f x=jn m<rv.^dW<fe
Reflection
Usually I would use Rv
to reverse a list however .^
next to Rv
breaks the Haskell parser, so I had to use rv
instead. I've been aware of this danger for a while now and this was a pretty close call. I will probably rename .^
to <<
.
"Compose a function with itself" achieved here with jn m
is something that should probably have it's own name. It would have saved a byte here at least.