CSC 151 - Writing your own procedures
As you may recall from the introduction to algorithms, the ability to write subroutines is one of the key components of algorithm design. Subroutines typically have a name that we use to refer to the subroutine, zero or more parameters that provide the input to the subroutine, and a set of instructions (an expression in Scheme) for doing the computation. That is, a subroutine is just an algorithm that has been named and “parameterized”. For example, we might want to define a procedure, square, that takes as input a number and computes the square of that number. As you may have noted, square can have multiple meanings. An aside note: when we choose names in Scheme, we should try not to conflict with existing names (here square is an existing name in Scheme). Sometimes Scheme will stop us from reusing a name; other times it will blithely move along, letting us break things through such reuse. So, how do we define these procedures? Read on and see. Scheme provides a variety of mechanisms
CSC 151 - Writing your own procedures Writing your own procedures Due Wednesday, 10 September 2025 --> Summary We explore why and how to define your own procedures in Scheme. Writing your own procedures In today’s reading, we explore why and how to define your own procedures in Scheme. Introduction As you may recall from the introduction to algorithms, the ability to write subroutines is one of the key components of algorithm design. Subroutines typically have a name that we use to refer to the subroutine, zero or more parameters that provide the input to the subroutine, and a set of instructi
Explore this link on the map →related reading
- CSC 151 - Anonymous procedureseikmeier.sites.grinnell.edu
- CSC 151 - Procedures and mental models of computationeikmeier.sites.grinnell.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- CSC 151 - Naming values with local bindingseikmeier.sites.grinnell.edu
- Lambda calculus - Wikipediaen.wikipedia.org
- CSC 151 - Code Formatting and Styleeikmeier.sites.grinnell.edu
- CSC 151 - Analyzing procedureseikmeier.sites.grinnell.edu
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu
- CSC 151 - Coding Challenge 1eikmeier.sites.grinnell.edu
- Palmström: The Lambda Calculus for Absolute Dummies (like myself)palmstroem.blogspot.com
- Structure and Interpretation of Computer Programsmitp-content-server.mit.edu