Functional Problem Solving (CSC 151 2013F) : EBoards

CSC151.02 2013F, Class 07: Writing Your Own Procedures


Overview

Admin

How do I do CSC 151 work from my own computer?

Why define your own procedures?

What is a procedure?

Why write them?

How to define your own procedures

   (define *procname*
     (lambda (*inputs*)
       *expression*))

For example

    (define um
      (lambda (question)
        "um"))

    (define square
      (lambda (num)
        (* num num)))

    (define make-a-circle
      (lambda (x y radius)
        (drawing-shift (drawing-scale drawing-unit-circle (* 2 radius))
                       x y)))

Questions:

I am defining a procedure named procname that takes as input inputs and computes its result by evaluating expression.

Lab


Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2013 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.