Re:Direct Clojure to C Compiler - Based on ClojureScript
by mark-probst on Monday July 09, 2012 @03:18PM
(#4219889)
This example is completely contrived, of course:
Now for
we get a function whose environment includes x and y, whereas the environment for
includes x and z. Assuming you have shallow environments, you'll have one environment [x' y] and another one [x'' z], whereas with deep environments (like in ClojureC) you'd have [[x] y] and [[x] z] where the [x] is shared between them. Now, if you call
with deep environments you only need to store the 3 once (to x), whereas with shallow environments you'll need to store to x' and x''.
[ Parent
| on HN ]
Re:Direct Clojure to C Compiler - Based on ClojureScript
by DanWaterworth on Monday July 09, 2012 @04:05PM
(#4220117)
Sure, you can come up with pathological cases for either option. For example, with deep environments, the following is inefficient:
(lambda (a) (lambda (b) (lambda (c) (lambda (d) (lambda (e) a)))))