From e8c503d7b6da08e67867cd7e3bb6b75b17669d75 Mon Sep 17 00:00:00 2001 From: Aleksey Zubakov Date: Thu, 24 Nov 2022 03:46:54 +0300 Subject: [PATCH] Rename haskell seminar --- {07 => 07_haskell}/Main.hs | 0 {07 => 07_haskell}/Second.hs | 11 +++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) rename {07 => 07_haskell}/Main.hs (100%) rename {07 => 07_haskell}/Second.hs (69%) diff --git a/07/Main.hs b/07_haskell/Main.hs similarity index 100% rename from 07/Main.hs rename to 07_haskell/Main.hs diff --git a/07/Second.hs b/07_haskell/Second.hs similarity index 69% rename from 07/Second.hs rename to 07_haskell/Second.hs index c4ee758..c63f011 100644 --- a/07/Second.hs +++ b/07_haskell/Second.hs @@ -20,8 +20,15 @@ len' :: [a] -> Integer len' xs = helper 0 xs -inv :: [a] -> [a] -inv _ = _ +inv :: [a] -> [a] -> [a] +inv acc (x:xs) = inv (x : acc) xs +inv acc [] = acc + +rev :: [a] -> [a] +rev xs = inv [] xs + +-- 1 : 2 : 3 : [] +-- 3 : 2 : 1 : [] getF :: Name -> Maybe Name