Anki-Import
view release on metacpan or search on metacpan
t/data/cs61.anki view on Meta::CPAN
`
#csnip
```
(first (bf '(a hard days night)))
```
evaluate to "hard"
`
#csnip
```
(first (first (bf '(she loves you))))
```
evaluates to "l"
`
#csnip
```
(define pi 3.14)
(* pi 5 5)
```
The first line sets the value of `pi` to 3.14. The second line multiplies `pi`
by 25 (5 * 5).
`
#csnip
```
(define (square x)
(* x x)
(square (+ 2 3))
```
It defines a function called `square` that takes a single argument called `x`.
The body of the function takes `x` and multiplies it by itself. The third line
calls the `square` function with result of the express `2 + 3` (or 5), which
returns an answer of 25 (5 squared).
`
#basic
Why is the `define` function considered an exception to the way scheme normally
processes arguments?
Because it does not evaluate the arguments that are passed to it.
`
#basic
Describe what we mean when we say a function is a *special form* function?
It is a function that does not process arguments the way other scheme functions
do. The `define` function is an example.
`
#cquest
What does the following code evaluate to and why?
```
(define hello (+ 2 3))
hello
```
The first line evaluates the word "hello," the function that was defined. It
does not evaluate to "5" because `define` does not evaluate its arguments. The
second line evaluates to 5, the result of the expression, 2 + 3.
`
#cquest
What is the code in bold referred to as?
```
(define (square <b>x</b>)
(* x x)
(square (+ 2 3))
```
the formal parameter, the argument that is passed to the function
`
#cquest
What is the code in bold referred to as?
```
(define (square x)
<b>(* x x)</b>
(square (+ 2 3))
```
the body
`
#cquest
What is the code in bold referred to as?
```
(define (square x)
<b>(* x x)</b>
(square <b>(+ 2 3)</b>)
```
( run in 0.689 second using v1.01-cache-2.11-cpan-96521ef73a4 )