Hi guys,
i have an assignment from collage,
the input is a list, something in the form of
'(a (b c) (d (e f) (g (h i) (j k)))))
and the function should return something like this:
(let ((g16 (b c))
(g14 (e f))
(g12 (h i))
(g11 (j k)))
(let ((g13 (g g12 g11)))
(let ((g15 (d g14 g13)))
(a g16 g15))))
any help would be greatly appreciated..
Scheme To C Compiler
-
- Posts: 447
- Joined: Sat Jun 28, 2008 7:49 am
- Location: Austin, TX
- Contact:
Re: Scheme To C Compiler
Since this posting is not user group or conference related, I'm moving it to the Scheme forum. Please categorize your posts appropriately.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
Re: Scheme To C Compiler
As it's not generating any C code, this is just the first step.
All you need to do is break out the subexpressions, bind their results to new symbols, and restate each subexpression so that it contains exactly one procedure call. It looks like one let is used for the outermost procedure call, and the other lets are used for intermediate procedure calls.
All you need to do is break out the subexpressions, bind their results to new symbols, and restate each subexpression so that it contains exactly one procedure call. It looks like one let is used for the outermost procedure call, and the other lets are used for intermediate procedure calls.