3 added 142 characters in body
source | link

Haskell, 42 4141 38 bytes

f u=filter(`elem`u)[minimum u[(minBound::Int)..maximum u]]

LoopLoops through all integers x from the minimum to the maximum of the input list(signed 64bit, on my machine) and keeps those that are in u and keep. Of course it if it'sdoesn't finish in reasonable time.

The previous version looped through [minimum u..maximum u] which has the same worst case running time.

Edit: @xnor saved a byte. Thanks!

Haskell, 42 41 bytes

f u=filter(`elem`u)[minimum u..maximum u]

Loop through all integers x from the minimum to the maximum of the input list u and keep it if it's in u.

Edit: @xnor saved a byte. Thanks!

Haskell, 42 41 38 bytes

f u=filter(`elem`u)[(minBound::Int)..]

Loops through all integers (signed 64bit, on my machine) and keeps those that are in u. Of course it doesn't finish in reasonable time.

The previous version looped through [minimum u..maximum u] which has the same worst case running time.

Edit: @xnor saved a byte. Thanks!

2 added 46 characters in body
source | link

Haskell, 4242 41 bytes

f u=[x|x<-u=filter(`elem`u)[minimum u..maximum u],elem x u]

Loop through all integers x from the minimum to the maximum of the input list u and keep it if it's in u.

Edit: @xnor saved a byte. Thanks!

Haskell, 42 bytes

f u=[x|x<-[minimum u..maximum u],elem x u]

Loop through all integers x from the minimum to the maximum of the input list u and keep it if it's in u.

Haskell, 42 41 bytes

f u=filter(`elem`u)[minimum u..maximum u]

Loop through all integers x from the minimum to the maximum of the input list u and keep it if it's in u.

Edit: @xnor saved a byte. Thanks!

1
source | link

Haskell, 42 bytes

f u=[x|x<-[minimum u..maximum u],elem x u]

Loop through all integers x from the minimum to the maximum of the input list u and keep it if it's in u.