# pure functions

A = 5

def impure_carp(B):
    return B*A

def pure_carp(A,B):
    return A*B


impure_carp(6)

pure_carp(4,6)

A = 9



# =============================================================================
# # vectorized operations
# =============================================================================



a = [1,2,3,4]
b = [2,3,4,5]

ab = []

for i in range(0,len(a)):
    ab.append(a[i]*b[i])

ab


import numpy as np

a = np.array([1,2,3,4])
b = np.array([2,3,4,5])

a*b





# isimsiz fonksiyonlar


def eski_carp(a,b):
    return a*b

eski_carp(1,3)

yeni_carp = lambda a,b: a*b

yeni_carp(1,3)

sirasiz_liste = [("b",3),("a",8),("d",12),("c",1)]

sorted(sirasiz_liste, key = lambda x : x[1])





# =============================================================================
# #map
# =============================================================================




v = [1,2,3,4,5]

list(map(lambda x : x+10,v))


# filter

v = [1,2,3,4,5,6,7,8,9,10]

list(filter(lambda x : x%2==0,v))


list(filter(lambda x : x%2==1,v))



#reduce


from functools import reduce



v = [1,2,3,4,5,6,7,8,9,10]


75fc23ff77f8b53f55404aadd2b473d01f6392be
<mask token>


def eski_carp(a, b):
    return a * b


<mask token>

<mask token>


def impure_carp(B):
    return B * A


<mask token>


def eski_carp(a, b):
    return a * b


<mask token>

<mask token>


def impure_carp(B):
    return B * A


def pure_carp(A, B):
    return A * B


impure_carp(6)
pure_carp(4, 6)
<mask token>
for i in range(0, len(a)):
    ab.append(a[i] * b[i])
ab
<mask token>
a * b


def eski_carp(a, b):
    return a * b


eski_carp(1, 3)
<mask token>
yeni_carp(1, 3)
<mask token>
sorted(sirasiz_liste, key=lambda x: x[1])
<mask token>
list(map(lambda x: x + 10, v))
<mask token>
list(filter(lambda x: x % 2 == 0, v))
list(filter(lambda x: x % 2 == 1, v))
<mask token>

A = 5


def impure_carp(B):
    return B * A


def pure_carp(A, B):
    return A * B


impure_carp(6)
pure_carp(4, 6)
A = 9
a = [1, 2, 3, 4]
b = [2, 3, 4, 5]
ab = []
for i in range(0, len(a)):
    ab.append(a[i] * b[i])
ab
<mask token>
a = np.array([1, 2, 3, 4])
b = np.array([2, 3, 4, 5])
a * b


def eski_carp(a, b):
    return a * b


eski_carp(1, 3)
yeni_carp = lambda a, b: a * b
yeni_carp(1, 3)
sirasiz_liste = [('b', 3), ('a', 8), ('d', 12), ('c', 1)]
sorted(sirasiz_liste, key=lambda x: x[1])
v = [1, 2, 3, 4, 5]
list(map(lambda x: x + 10, v))
v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
list(filter(lambda x: x % 2 == 0, v))
list(filter(lambda x: x % 2 == 1, v))
<mask token>
v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# pure functions

A = 5

def impure_carp(B):
    return B*A

def pure_carp(A,B):
    return A*B


impure_carp(6)

pure_carp(4,6)

A = 9



# =============================================================================
# # vectorized operations
# =============================================================================



a = [1,2,3,4]
b = [2,3,4,5]

ab = []

for i in range(0,len(a)):
    ab.append(a[i]*b[i])

ab


import numpy as np

a = np.array([1,2,3,4])
b = np.array([2,3,4,5])

a*b





# isimsiz fonksiyonlar


def eski_carp(a,b):
    return a*b

eski_carp(1,3)

yeni_carp = lambda a,b: a*b

yeni_carp(1,3)

sirasiz_liste = [("b",3),("a",8),("d",12),("c",1)]

sorted(sirasiz_liste, key = lambda x : x[1])





# =============================================================================
# #map
# =============================================================================




v = [1,2,3,4,5]

list(map(lambda x : x+10,v))


# filter

v = [1,2,3,4,5,6,7,8,9,10]

list(filter(lambda x : x%2==0,v))


list(filter(lambda x : x%2==1,v))



#reduce


from functools import reduce



v = [1,2,3,4,5,6,7,8,9,10]

