/[guile]/guile/guile-core/doc/ref/scheme-ideas.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-ideas.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.2 by ttn, Tue Jan 8 09:22:37 2002 UTC revision 1.1.2.3 by ossau, Tue Mar 12 20:51:25 2002 UTC
# Line 178  references. Line 178  references.
178    
179  @itemize @bullet  @itemize @bullet
180  @item  @item
 @xref{Internal Definitions}, to read about using @code{define} other  
 than at top level in a Scheme program, including a discussion of when it  
 works to use @code{define} rather than @code{set!} to change the value  
 of an existing variable.  
   
 @item  
181  @ref{Lambda Alternatives}, to read about an alternative form of the  @ref{Lambda Alternatives}, to read about an alternative form of the
182  @code{define} syntax that can be used when defining new procedures.  @code{define} syntax that can be used when defining new procedures.
183    
# Line 191  of an existing variable. Line 185  of an existing variable.
185  @ref{Procedures with Setters}, to read about an alternative form of the  @ref{Procedures with Setters}, to read about an alternative form of the
186  @code{set!} syntax that helps with changing a single value in the depths  @code{set!} syntax that helps with changing a single value in the depths
187  of a compound data structure.)  of a compound data structure.)
188    
189    @item
190    @xref{Internal Definitions}, to read about using @code{define} other
191    than at top level in a Scheme program, including a discussion of when it
192    works to use @code{define} rather than @code{set!} to change the value
193    of an existing variable.
194  @end itemize  @end itemize
195    
196    
# Line 384  this: Line 384  this:
384  @end lisp  @end lisp
385    
386  @noindent  @noindent
387  This is a valid procedure invocation expression, whose result is the  This is a valid procedure invocation expression, and its result is the
388  string @code{"Name=FSF:Address=Cambridge"}.  string @code{"Name=FSF:Address=Cambridge"}.
389    
390  It it more common, though, to store the procedure value in a variable ---  It it more common, though, to store the procedure value in a variable ---
# Line 756  answers yes. Line 756  answers yes.
756    
757  If the outermost @code{(if @dots{})} expression here was a procedure  If the outermost @code{(if @dots{})} expression here was a procedure
758  invocation expression, the expression @code{(delete-file file)}, whose  invocation expression, the expression @code{(delete-file file)}, whose
759  effect is to actually delete a file, would already have been executed  side effect is to actually delete a file, would already have been
760  before the @code{if} procedure even got invoked!  Clearly this is no use  evaluated before the @code{if} procedure even got invoked!  Clearly this
761  --- the whole point of an @code{if} expression is that the  is no use --- the whole point of an @code{if} expression is that the
762  @dfn{consequent} expression is only evaluated if the condition of the  @dfn{consequent} expression is only evaluated if the condition of the
763  @code{if} expression is ``true''.  @code{if} expression is ``true''.
764    
# Line 815  expressions, simply so that you will rec Line 815  expressions, simply so that you will rec
815  when you see it.  For a full description of each of these syntaxes,  when you see it.  For a full description of each of these syntaxes,
816  follow the appropriate reference.  follow the appropriate reference.
817    
818  @code{if} and @code{cond} (@pxref{if cond case}) provide conditional  @code{lambda} (@pxref{Lambda}) is used to construct procedure objects.
 evaluation of argument expressions depending on whether one or more  
 conditions evaluate to ``true'' or ``false''.  
   
 @code{case} (@pxref{if cond case}) provides conditional evaluation of  
 argument expressions depending on whether a variable has one of a  
 specified group of values.  
   
 @code{define} (REFFIXME) is used to create a new variable and set its  
 initial value.  
819    
820  @code{set!} (REFFIXME) is used to modify an existing variable's value.  @code{define} (@pxref{Top Level}) is used to create a new variable and
821    set its initial value.
822    
823  @code{lambda} (@pxref{Lambda}) is used to construct procedure objects.  @code{set!} (@pxref{Top Level}) is used to modify an existing variable's
824    value.
825    
826  @code{let}, @code{let*} and @code{letrec} (@pxref{Local Bindings})  @code{let}, @code{let*} and @code{letrec} (@pxref{Local Bindings})
827  create an inner lexical environment for the evaluation of a sequence of  create an inner lexical environment for the evaluation of a sequence of
# Line 842  same as a procedure which returns its la Line 835  same as a procedure which returns its la
835  evaluation of a procedure invocation expression does not guarantee to  evaluation of a procedure invocation expression does not guarantee to
836  evaluate the arguments in order.  evaluate the arguments in order.
837    
838    @code{if} and @code{cond} (@pxref{if cond case}) provide conditional
839    evaluation of argument expressions depending on whether one or more
840    conditions evaluate to ``true'' or ``false''.
841    
842    @code{case} (@pxref{if cond case}) provides conditional evaluation of
843    argument expressions depending on whether a variable has one of a
844    specified group of values.
845    
846  @code{and} (@pxref{and or}) executes a sequence of expressions in order  @code{and} (@pxref{and or}) executes a sequence of expressions in order
847  until either there are no expressions left, or one of them evaluates to  until either there are no expressions left, or one of them evaluates to
848  ``false''.  ``false''.
# Line 1312  It can only be accessed indirectly via @ Line 1313  It can only be accessed indirectly via @
1313  -25  -25
1314  @end lisp  @end lisp
1315    
1316  A detail here is that the @code{get-balance} and @code{deposit}  An important detail here is that the @code{get-balance} and
1317  variables must be set up by @code{define}ing them at top level and then  @code{deposit} variables must be set up by @code{define}ing them at top
1318  @code{set!}ing their values inside the @code{let} body.  Using  level and then @code{set!}ing their values inside the @code{let} body.
1319  @code{define} within the @code{let} body would not work: this would  Using @code{define} within the @code{let} body would not work: this
1320  create variable bindings within the local @code{let} environment that  would create variable bindings within the local @code{let} environment
1321  would not be accessible at top level.  that would not be accessible at top level.
1322    
1323    
1324  @node Callback Closure  @node Callback Closure

Legend:
Removed from v.1.1.2.2  
changed lines
  Added in v.1.1.2.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26