-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunciones.hs
39 lines (31 loc) · 1.18 KB
/
funciones.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
elem' :: Int -> [Int] -> Bool
elem' a [] = False
elem' a x =
if(a == (head x))
then True
else
elem' a (tail x)
------------------------------------------------------------------
--Recibo la cantidad inicial, la cantidad final, y el incremento
--for' :: Int-> Int-> Int-> ()
--for' :: Int-> Int-> Int-> [Char]->IO()
for' a b c cont =
if (a>=b) then return ()
else do
putStrLn (show cont)
for' (a+c) b c cont
-------------------------------------------------------------------
for'' a b c cont =
if (a<b) then do
putStrLn (show cont)
for' (a+c) b c cont
else
return ()
--------------------------------------------------------------------
add' lista elem =
if(null lista) then return elem
else do
let cabeza = head lista
cabeza ++ (add' (tail lista) elem)
add'' lista elem = do lista ++ elem
add''' lista elem = return (lista ++ elem)