61A Lecture 28Friday, November 4Friday, November 4, 2011The Logo Programming Language2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programming2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedure2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedureOnly two data types: words and sentences2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedureOnly two data types: words and sentencesCode is data: a line of code is a sentence2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedureOnly two data types: words and sentencesCode is data: a line of code is a sentenceAn elegant tagline: no threshold, no ceiling2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedureOnly two data types: words and sentencesCode is data: a line of code is a sentenceAn elegant tagline: no threshold, no ceilingA bit of fun: turtle graphics2Friday, November 4, 2011The Logo Programming LanguageA teaching language: designed for introductory programmingOne syntactic form for all purposes: invoking a procedureOnly two data types: words and sentencesCode is data: a line of code is a sentenceAn elegant tagline: no threshold, no ceilingA bit of fun: turtle graphics2DemoFriday, November 4, 2011Logo is a Dialect of Lisp3Friday, November 4, 2011Logo is a Dialect of LispWhat are people saying about Lisp?3Friday, November 4, 2011Logo is a Dialect of LispWhat are people saying about Lisp?•"The greatest single programming language ever designed." -Alan Kay (from the UI video), co-inventor of Smalltalk3Friday, November 4, 2011Logo is a Dialect of LispWhat are people saying about Lisp?•"The greatest single programming language ever designed." -Alan Kay (from the UI video), co-inventor of Smalltalk•"The only computer language that is beautiful." -Neal Stephenson, John's favorite sci-fi author3Friday, November 4, 2011Logo is a Dialect of LispWhat are people saying about Lisp?•"The greatest single programming language ever designed." -Alan Kay (from the UI video), co-inventor of Smalltalk•"The only computer language that is beautiful." -Neal Stephenson, John's favorite sci-fi author•"God's programming language." -Brian Harvey, Father of CS 61A3Friday, November 4, 2011http://imgs.xkcd.com/comics/lisp_cycles.pngLogo is a Dialect of LispWhat are people saying about Lisp?•"The greatest single programming language ever designed." -Alan Kay (from the UI video), co-inventor of Smalltalk•"The only computer language that is beautiful." -Neal Stephenson, John's favorite sci-fi author•"God's programming language." -Brian Harvey, Father of CS 61A3Friday, November 4, 2011Logo Fundamentals4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spaces4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values•A procedure returns an output (return value)4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values•A procedure returns an output (return value)•A procedure may output None to indicate no return value4Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values•A procedure returns an output (return value)•A procedure may output None to indicate no return value4? print 55Friday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values•A procedure returns an output (return value)•A procedure may output None to indicate no return value4? print 55Multiple expressions can appear in a single lineFriday, November 4, 2011Logo FundamentalsCall expressions are delimited by spacesLogo procedures are equivalent to Python functions•A procedure takes inputs (arguments) that are values•A procedure returns an output (return value)•A procedure may output None to indicate no return value4? print 55Multiple expressions can appear in a single line? print 1 print 212Friday, November 4, 2011Nested Call Expressions5Friday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5Friday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5? print sum 10 difference 7 314Friday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5? print sum 10 difference 7 314print takes one argument (input)Friday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5? print sum 10 difference 7 314print takes one argument (input)sum takes two inputsFriday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5? print sum 10 difference 7 314print takes one argument (input)sum takes two inputsFriday, November 4, 2011Nested Call ExpressionsThe syntactic structure of expressions is determined by the number of arguments required by named procedures5? print sum 10 difference 7 314print takes one argument (input)sum takes two inputsdifference
View Full Document