You are on page 1of 7

ARMIEET

ALAMURI RATNAMALA
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Alamuri Ratnamala
rste of Engjinerng And Techralogy Run by Koti Vidya Charitable Trust)
(A Hindi Linguistic Minority Institute)

Module 2

Define an three unctioocu Progaamminq ContepiS


n oletail

PuGGeFunctioo These fuasdions have two maio


aecties *isst hey aathinqels e

Se.coodlythe heve neaide


e-effect ie theq do not ody
dny amgae ts o locel/globol vastable an inpLatcudput

lnder opesty is aled ummutabilty The s tuntions


only ESult dhethe Value oeturoS They dedelasnper
eipgAdoog USlagtunetioncs PstoqKamminq
daha
debuabecause Puze nchioos bove n d e cifet ar
hiddena o Puse dunctionS when heCcde i6 cUatten
ia thiS l e d mart ampiler_aa do_paaayhina
T Can Pacsalleli2 e due nstuctions t o evaluate
TeSults hen needi.aqthem dadmemeri2 ae
AeSults SlnCe he TeSuH nevEN chang cis loag
asdhe 0 ddesnf_chanae-

f Qume funckion
SumCoc,y
aeturo y

Page No,
ARMIET
ALAMURI RATNAMALA
INSTITUTE OF ENGINEERING AND TECHNOLO0GY
Alcmuri Rotnomalo (Run by Koti Vidya Charitable Trust)
sedEngoeerngAediechroogy (A Hindi Linguistic Minority Institute)

e Cunsioo here dae n o t a or while leop


t era+ioo_o fuoctHonal
in Functionallaaguages
anguege3 imple.mernteod thzough recussioo
Recussiva tunctions Epeatecd ly Co hemsulves
uatil t oreaches the base Case

`omple of he ecuTslo tuncHon

f n 4e)
Teturo 1
else
eturo fib (n1+fib o-2);

RefesectialtansDan enCy To unctignc Poq aMS


vaziables caCe_detinesk olo ndt change the Vetl u chenae
thughtiut_ he Pacgam tuacAlonalPoqramSdo not
hae assianmentSake ments Ttwe hoNe to &tose
Same alue a e deoe e Vaicles j0stesdThs-
eliminades dny chanceS cf Sde gttects betaube ly
amale a be eQlaced cth s ctu
Value at _any Gol0t_at
exeCutton SHatx_ef cly
vaisble 1S_CaNstctAt_ dny inart

Eg E t l /Hats chen 1c e value as5 tanod do


50 H eress ioa is not efrcataly

Page No,
ARMIET
ALAMURI RATNAMALA
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Alomuri Ratnomala
rstaute of Engnenng And lechnology Ryun by Koti Vidya Charitable Trust)
(A Hindi Linguistic Minority Institute)

plain Moads wth ezcmp|es


L Mcnads ese ialnall_ i a atrqosy De of he
hiqhest and most abstra Þranc hes mcdhernolics
put yATe USed 0 uArtiont P nsanrOing-
To undextand menads aurselt, you Could um o
CcaOTY nd O mexr_miaht_eVen Want
S0 but O mOSt_ PhoarCAMMmeS- there nas

At fProammer's L Klo, hawe leaxoeddo


hut
lo_ot tanples xam difeent Daucs
narammesa have attenTealluasad atCSilently
abadsan etdmples f6 mple meat eLatl u h e t
hey
hey CerelaoKinq fox_ubile ianoring most of he
Sunsundinq- PAplanttion

A ist_ Monae

A^ance monad 1 where


La

) (a2 Ca-z(>)_ -2]1


XS z2= f ocat (map f xs)

Page No,
ARMIET
ALAMURI RATNAMALA

ENGINEERING AND TECHNOLOGV


INSTITUTE OF
Charitable Trust)
Alomuri Rotnomola (Run by Koti idyaMinority Institute)
s of fapnmenng And lechra
(A Hindi Linguistic

aCortajmex
Remembher A lit iS uaeclaS
a
M a b e is M0Mad
where
iastaace mncis maybe
TeurO : a-7 Mcuy be
getuo JuSt_A

22=) May be -7 (a 7 MayhL)-2 m.


Nothina 22 =f=NOhing_
ust f f

ven this usless hina Moacdd.

atauSeless a hiaa-
aghaace Moad uSeless ahere.
etusm C 2 useleSS O

etun Thing
2=2 uSeless a - l g
useles s
2 uSelessb
Tin g
ARMIET
ALAMURI RATNAMALA
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Alamuri Ratnomala
Run by Kpti vidya Chanitable Trust)
(A Hindi Linguistic Minority Institute)

2.1unte shont0te on Lambda caloulus


ambda calclusis dfsamecKsk dlaveloped bu
Ac20 Churcho 1930s to study CoanpuAatians with funciiors

Suncdion Coecetsn church tndndua the notadinn


E_to to de noBe a tunctton i0ohich i s a
a dument andf is he undiona body
hese uncdisas Can_be of wthout names an
Single ATquMedts

D achioadlapplicddloa. chLch USedthe olelton


ffato
to_denaheheapptcatlon cffuncdioo E
-Ads an meatE And hefunchioas_ase
aa agle-

ylesof Lambda Calalus3

Lambel a alcalus iacluses Ahsee dtfesent


epxessians e
E astesle)

CuncHo app liccud-bo )


Ceefion)

Page No,
ARMIET
ALAMURI RATNAMALA

AND TECHNOLOC
INSTITUTE OF
ENGINEERING AY
Charitable Trust)
Alomuri Ratnomala Run by Koti VidyaMinority Institute)
Linguistic
nsthe of Enginering And Techrology
(A Hindi

hiqher ors e stunctio n8 io o t o


4 Eaplaio

s_amdex fuacAton 1 a functi oO hat Aak1s


A hight getugos C
atuacttan aS_an crqum
ot 0
funcdion Haher OsdeT fuocbon is Cont
fuo cAicn9 hich_don't 4,
ta first ade
uncti on AS eO olarqu0ent- A e t u m _ a
functioo as Outpt_

Far lies we Saw eramples ofnap (2 and .filtr


Bo4h cf them take c unctroo ad otO_craumr
Th're bo:thhinher_otedes functionS
et's ooka eo ezample of
functto 0 twhich ftllesS a he -1etes uovdg
zam a liat f LuoTds

Const Censas E words


Const flter d =L3
Cense oCcops
for e t is0 length gasP
AoT ds f leaqth itt) shout Su
Censt wo re Cworol LiTI
f Cugrd. length_
4
fitred .push Cword)
L shout S

Page
ARMIET
ALAMURI RATNAMALA
INSTITUTE OF ENGINEERING AND TECHNOLOGY
Alomuri Rotnamola
simte df Eagane nmg And lechnology (Run by Koti Vidya C'hanitable Trust)
(AHindi
Linguistic Minority Institute)

No hak if w a a t to Slecd l l he wur


had beqia h 's we could angth eS
functi oo

Const Stevs uths_ wrds

=(
lengh
wads lenen i+)
woTS i ) _
if_ue rd Shea ris wih ('s'))
filke re Qush word)

etur A flhere

StartswthS ( ooops gas? shouz Sun


shaut Sun

Page No,

You might also like