Am So., 9. Feb. 2020 um 15:02 Uhr schrieb Freeman Gilmore
<address@hidden>:
>
>
>
> 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))) ...)
Here is another example from the book, why double parenthesis
((assq 'col-darkblue colors)).
Thank for all you work here, ƒg
One pair for each single local binding, note every local binding is of
type key-value:
(let ( (key1 value1) (key2 value2) ) ...)
Every value my be a procedure call, with the need for another pair of
parenthesis:
(let ( (key1 (proc1 args1)) (key2 (proc2 args2)) ) ...)
Proper indentation increases readability:
(let (
(key1 (proc1 args1))
(key2 (proc2 args2))
)
...
)
HTH,
Harm