Skip to content

Instantly share code, notes, and snippets.

@pete-murphy
Created December 3, 2021 15:22
Show Gist options
  • Save pete-murphy/dcbc304d8182c9dbc7490c45c305fe92 to your computer and use it in GitHub Desktop.
Save pete-murphy/dcbc304d8182c9dbc7490c45c305fe92 to your computer and use it in GitHub Desktop.
zip3 implementation with ZipList & ado
module Main where
import Prelude
import Effect.Console as Console
import TryPureScript (render, withConsole)
import Data.Array as Array
import Data.List.ZipList (ZipList(..))
zip3 :: Array Int -> Array Int -> Array Int -> Array (Array Int)
zip3 as bs cs = Array.fromFoldable ado
a <- ZipList (Array.toUnfoldable as)
b <- ZipList (Array.toUnfoldable bs)
c <- ZipList (Array.toUnfoldable cs)
in [ a, b, c ]
main = render =<< withConsole do
Console.logShow (zip3 [1,2,3] [4,5,6] [7,8,9])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment