Carp icon indicating copy to clipboard operation
Carp copied to clipboard

Crash when calling a stored function composition in global variable

Open eriksvedang opened this issue 3 years ago • 2 comments

To reproduce:

> (def g (comp Int.inc Int.inc))
> (g 10)

eriksvedang avatar Jun 08 '21 21:06 eriksvedang

The problem here seems to be that the function should have its argument symbol replaced by the gensym value, but currently it doesn't.

(let [x (gensym)]                                                                                                                                                                                                                                                           
    (list 'fn [x] (comp-internal x fns))))  

instances of x should be replaced by gensym-foo in the let body, but I think that's currently not happening.

Likely an evaluator regression from recent changes.

scolsen avatar Jun 16 '21 14:06 scolsen

The bug does not happen here:

(defn g [x] ((comp Int.inc Int.inc) x))

So there's something with def, it seems.

eriksvedang avatar Oct 15 '21 13:10 eriksvedang