Skip to content

Instantly share code, notes, and snippets.

@turboMaCk
Last active September 13, 2016 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turboMaCk/8197df305cdbf6699d460b378605e80c to your computer and use it in GitHub Desktop.
Save turboMaCk/8197df305cdbf6699d460b378605e80c to your computer and use it in GitHub Desktop.
Hits for wojcek
import Html exposing (..)
import List exposing (..)
multiSnd : number -> (List (a, number) -> List (a, number))
multiSnd k =
map (\(a, b) -> (a, b*k))
multiSnd3 = multiSnd 3
multiSnd4 = multiSnd 4
permuteWithSelf : List a -> List (a, a)
permuteWithSelf list =
let
forHead h prevRes =
foldr (\a acc -> (h, a)::acc) prevRes list
in
foldr (\a acc -> forHead a acc) [] list
main : Html msg
main =
permuteWithSelf [1..100] |> toString |> text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment