spellhouse / clairvoyant

Flexible tracing for ClojureScript
147 stars 11 forks source link

inspects inside collections for javascript functions #9

Closed stumitchell closed 9 years ago

stumitchell commented 9 years ago

Often in our code we use vectors with functions in them

[(fn [] (print "hello")) :something-else]

This patch looks into the contents of vectors to determine if there are any functions and replaces them.

stumitchell commented 9 years ago

I have added the pr-str function as requested. letfn would be nice but I couldn't figure out how to do the last two sets well.

stumitchell commented 9 years ago

Done, but I'm not sure why you wanted that anonymous function named but not the others in the same let block

noprompt commented 9 years ago

Sorry I don't think I'm being clear here. There should only be one pr-val in the let block and it should look like that. There's no reason for two.

noprompt commented 9 years ago

The reason to name is so that it can be called recursively, hence the need for only one pr-val.

stumitchell commented 9 years ago

right I re-factored it for you to call recursively, note I had to change from prewalk to walk and I had to move the pr-str outside the function. I used pr-val* to avoid shadowing.