scheme - Question about define syntax -


I am new to programming, I am doing my work through SICP, and I love it. Although I am a bit confused about the definition of the plan, primarily, what is the difference between:

  (define foo bar)  

And:

  (define (foo) bar)  

What time does the bar only fu and execute it? While the second phone allocates and waits for?

If you ask to call the function within another function, say within a statement,

  (if (Foo) ...) < / Code> 

or

  (if foo ...)  

The first version creates a variable named foo and it specifies the context of the bar. Nothing else is executed.

The second edition creates a function with the body bar. The function is not executed, it is filed (guess what 'waiting' is?).

You always call a function by making it the first item in the list and evaluating the list.

Create a variable

  & gt; (Define 1) & gt; One 1  

make other variable references to other variables

  & gt; (Defined b) & gt; B1  

create a function that

  & gt; (Defined (c) a)> gt; C # & lt; Process: C & gt;  

Evaluation of functions

  & gt; (C) 1  

Write a function that evaluates another function and returns the result

  & gt; (Define (d) (if (strange? A) (c) 0)) gt; (D) 1  

function c

  & gt; (Defined) (if (strange? A) c))) gt; (D) # & lt; Process: C & gt;  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -