Questions tagged [let]

In Lisp-like and functional languages, introduces a list of local variables, each (possibly optionally) with its initial value.

In Lisp-like and functional languages, introduces a list of local variables, each (possibly optionally) with its initial value. It is illegal to refer to any of the new variables while calculating their initial values ( lets you do that), though in Haskell it is legal (its let is actually letrec).

LET is a special form in Common Lisp, Scheme, Clojure and other Lisp dialects which introduces a list of local variables as pairs of name-value bindings, for use within its body. For instance, in this expression:

(let ((variable1 (+ 1 1)))
  variable1)

variable1 gets bound to the 2 value, and the whole expression returns 2 as a result.

728 questions
-3
votes
1 answer

How to mute the warning of "never mutated" in Swift?

Regarding duplicate flag: This question is different from the flagged question as I am asking about how to mute the warnings as I was not aware of the concept of Swift. The provided below answer helps me understand the very basic nature of Swift.…
Hemang
  • 26,840
  • 19
  • 119
  • 186
-3
votes
2 answers

Not able to use let in Racket

I am trying a modification of sort code on http://home.adelphi.edu/~siegfried/cs270/270rl10.html where I am using let for the insert function: (define (mysort alon ) (let insert ((n n) (alon alon)) (cond [(empty? alon) (cons n…
rnso
  • 23,686
  • 25
  • 112
  • 234
-3
votes
1 answer

Can someone explain to me or link me to a good guide that explains let and where in Haskell

I have never used these two keywords in anything I have programmed because I don't really understand them or when they should be used, if they can be used together etc.
James
  • 161
  • 1
  • 8
-4
votes
2 answers

let behavior in a for loop

In the following example, how does the for loop know that it has to assign a new value to each i and not just assign the last i three times likes var does? for (let i = 0; i < 3; i++) { setTimeout(function() { console.log(i) }, 100); } Also,…
user10869882
-4
votes
1 answer

Racket syntax error using 'let star'

In the program listed below, I'm getting the error message: let*: bad syntax (not an identifier and expression for a binding) in: pokemon1inPokedex I'm not sure why, any advice would be appreciated! my code (define (in-order? pokemon1name…
-4
votes
1 answer

Scheme and let errors

I can't for the life of me find out why this code produces the error. Here's the error: let*: bad syntax (missing body) in: (let* ((tempp2 (p2) (letrec ((mloop (p1 p2) (if (= (length p1) 0)) (else if ((= (length p2) 0) ((set! p2 (pn)) (multiloop…
-4
votes
2 answers

Convert Let-form to procedure form

I'm having trouble converting the following from let form to procedure ( let (( a 5) b (* 5 2)) (let (b (* a b) (c 10)) (+ b c)))
ryan
  • 625
  • 3
  • 10
  • 23
1 2 3
48
49