I did not see this when i replied last , so let me read it i loos like it is the answer i want. Thank you,ƒg
On Sun, Feb 9, 2020 at 12:38 PM David Kastrup <d...@gnu.org> wrote: > Freeman Gilmore <freeman.gilm...@gmail.com> writes: > > > On Sun, Feb 9, 2020 at 9:33 AM Thomas Morley <thomasmorle...@gmail.com> > > wrote: > > > >> Am So., 9. Feb. 2020 um 15:02 Uhr schrieb Freeman Gilmore > >> <freeman.gilm...@gmail.com>: > >> > > >> > > >> > > >> > This is taken from the "Scheme Book". > >> > > >> > Question why double parenthesis for let ((rand (random 100))) ? > >> > > >> > Thank you, ƒg > >> > >> Well, every expression needs to be wrapped into parenthesis. > >> > >> One pair for the let-expression: > >> (let ...) > >> > >> One pair for all local-bindings: > >> (let (all-local-bindings) ...) > >> > > I understand the above and below but not this let ((rand (random 100))) > > Put in your form: (let ((rand (random 100))) ...) > > In Scheme, there is no such thing as a redundant parenthesis. Every > parenthesis has meaning. > > bla > > at top level is a variable. > > (bla) > > takes the value of the variable and calls it as a function. > > ((bla)) > > takes the value this function returns, and calls _that_ as a function. > > So the question boils down to: why was the syntax of let designed in a > way requiring so many parentheses? > > Now the basic syntax of let is > > (let [local bindings] [cmd] ...) > > In order to recognise where the first command starts, [local bindings] > can only be a single item, but since we can have more than a single > binding, we need to have it delimited, and in constructs as old as let, > there is no delimiter but parentheses. > > So now we have > > (let ([local binding] ...) [cmd] ...) > > Now how should [local binding] look? It could be [variable] [value], > making for > > (let (x 1 y 4) ...) > > but for one thing, this gets ugly to read when we have something like > > (let (x y z t) ...) > > which in actual syntax looks like (let ((x y) (z t)) ...) . And for > another, in the old ancestor Lisp, (let (x y z t) ...) actual has > separate meaning and changing that established meaning would really > confuse people. Quoting (out of laziness) from Elisp: > > let is a special form in ‘C source code’. > > (let VARLIST BODY...) > > Probably introduced at or before Emacs version 1.12. > > Bind variables according to VARLIST then eval BODY. > The value of the last form in BODY is returned. > Each element of VARLIST is a symbol (which is bound to nil) > or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of > VALUEFORM). > All the VALUEFORMs are evalled before any symbols are bound. > > [back] > > So adding one layer of parens around variable and value (if there are to > be both) seems called for. > > And that's what you get. > > > Here is another example from the book, why double parenthesis ((assq > > 'col-darkblue colors)). > > That doesn't occur in a vacuum, so it would appear that you are missing > context here. > > -- > David Kastrup > My replies have a tendency to cause friction. To help mitigating > damage, feel free to forward problematic posts to me adding a subject > like "timeout 1d" (for a suggested timeout of 1 day) or "offensive". >