You are on page 1of 5

Programming Languages Dan Grossman 2013

Introduction to Racket

Racket
Next two sections will use the Racket language (not ML) an the DrRacket !rogramming en"ironment (not #macs) $nstallation % &asic usage instructions on course we&site

Like ML' (unctional (ocus with im!erati"e (eatures )non*mous (unctions' closures' no return statement' etc+ ,ut we will not use !attern-matching .nlike ML' no static t*!e s*stem/ acce!ts more !rograms' &ut most errors o not occur until run-time Reall* minimalist s*ntax ) "ance (eatures like macros' mo ules' 0uoting%e"al' continuations' contracts' 1 2ill o onl* a cou!le o( these
Dan Grossman, Programming 2

Jan-Mar 2013

Racket vs. Scheme

3cheme an Racket are "er* similar languages Racket 4change its name5 in 2010 Please excuse an* mistakes when $ s!eak Racket ma e some non-&ackwar -com!ati&le changes1 6ow the em!t* list is written 7ons cells not muta&le 6ow mo ules work #tc+ 1 an man* a itions Result/ ) mo ern language use to &uil some real s*stems More o( a mo"ing target (notes ma* &ecome out ate ) 8nline ocumentation' !articular 49he Racket Gui e5
Dan Grossman, Programming 3

Jan-Mar 2013

Getting started
DrRacket 4 e(initions win ow5 an 4interactions win ow5 "er* similar to how we use #macs an a R#PL' &ut more user-(rien l* DrRacket has alwa*s (ocuse on goo -(or-teaching 3ee usage notes (or how to use R#PL' testing (iles' etc+ #as* to learn to use on *our own' &ut lecture emos will hel! :ree' well-written ocumentation/ htt!/%%racket-lang+org% 9he Racket Gui e es!eciall*' lang+org%gui e%in ex+html

htt!/%% ocs+racket-

Jan-Mar 2013

Dan Grossman, Programming

File structure
3tart e"er* (ile with a line containing onl* #lang racket (7an ha"e comments &e(ore this' &ut not co e) ) (ile is a mo ule containing a collection of definitions (&in ings)1

Jan-Mar 2013

Dan Grossman, Programming

You might also like