Skip to content

Instantly share code, notes, and snippets.

@lucamolteni
Created January 11, 2019 08:28
Show Gist options
  • Select an option

  • Save lucamolteni/913645b1e07d1764800964a173f7227b to your computer and use it in GitHub Desktop.

Select an option

Save lucamolteni/913645b1e07d1764800964a173f7227b to your computer and use it in GitHub Desktop.
module Main where
import Data.List.Zipper
import Prelude(IO, (==), mod, print)
main :: IO ()
main = print (filter' (\x -> x `mod` 2 == 0) zipper)
myList = [1..100]
zipper = fromList myList
filter' p = foldrz (\z xs -> if (p (cursor z))
then ((cursor (left z)), (cursor z)) : xs
else xs) []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment