I'm with Dan, but I'm posting here so the question can be marked as answered. Another thing to understand about the code you posted is that it uses let*
, which imposes an ordering on the variable assignments so that the value of bds
assigned in the 2nd line of the let is available for use in the 3rd and 4th lines of the let*
.
In a normal (let ((...
, the ordering of assignments is not guaranteed, so the values of begin
and end
might be set to nil if those lines are evaluated before the 2nd line that sets the value of bds
.
Update
Sorry that I was not clear in my writing. As Jean-Pierre points out, the doc string does indeed say that all variables (right hand side) are evalled before any symbols (the left hand side) are bound. But the doc string does not say anything about the order in which the variables are bound, which was my point above.
As I understand it, the implementation of a standard (let
is under no obligation to bind the variables in top to bottom order, as a code writer might expect. The implementation may or may not do the binding in the "right" order.
Not that it matters what order is used to bind the variables. Since all right hand side VALUEFORMS are evalled before any of the left hand side variables are bound, the values that actually get assigned to the left side variables are cast in stone before the first left side variable gets bound. So binding them top to bottom or bottom to top or in some other order won't make any difference to the final values each left side variable receives.
In a standard (let
, the value of the left hand side bds
variable above on line 2 is undefined at the time the right hand bds
sides of lines 3 and 4 are evalled. So they must eval to nil, I would think.
Finally, the whole point of introducing a different kind of let, the (let*
version, is to provide a let that does have the obligation to eval and bind the successive variables in a (let*
sequentially. So with a (let*
, the code in the original posting will eval+bind the bds, begin, and end variables in proper sequential order, completing each line before starting the next line, thereby guaranteeing valid right-hand bds
values for lines 3 and 4.
Hopefully this update adds more clarity. The (let*
doc string says:
Each VALUEFORM can refer to the symbols already bound by this VARLIST.
let
-bound variable. Judging from the fact that it contains the result of a function called...-boundaries
, I'd saybds
is an abbreviation for "boundaries". – Dan Jul 17 '16 at 14:07