Created
December 3, 2021 15:22
-
-
Save pete-murphy/dcbc304d8182c9dbc7490c45c305fe92 to your computer and use it in GitHub Desktop.
zip3 implementation with ZipList & ado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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