-4

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

2 Answers2

0

A let expression is just syntactic sugar for lambda.

For example:

(let ((a 1)
      (b 2))
  (* a b))

is the same as

((lambda (a b) (* a b)) 1 2)
turingcomplete
  • 2,128
  • 3
  • 16
  • 25
0

First, you must fix it.

( let (( a 5)
(b (* 5 2)))
(let ((b (* a b))
(c 10))
(+ b c)))

definition of let is

(let (( variable-name1 value1)
 (variable-name2 value2)
 (variable-namen valuen))
 body)

convert to lambda is

((lambda (variable-name1 variable-name2 variable-namen) body) value1 value2 valuen)
Vojta Matras
  • 69
  • 1
  • 8