Arc Forumnew | comments | leaders | submitlogin
1 point by shader 5362 days ago | link | parent

Neat!

This seems to complement 'help, 'sig, and 'src fairly well.

If I remember correctly though, this will only work for global variables (such as globally defined functions and macros, and variables used on the repl). Local variables are handled by scheme lsmabdas, and don't actually undergo any symbol transformation.

How hard and useful do you think it would be to try and get it to work for local vars as well?



2 points by waterhouse 5361 days ago | link

I would normally use 'apropos when I'm sitting at the REPL trying to remember the name of a function (or, more rarely, a global variable bound to a hash-table or something). For 'apropos to work on local variables, I assume you would have to use 'apropos within the lexical environment in which the variable exists. I.e. you would go

  (let thingamajig 2
    (do-stuff)
    ;hmm, what was that variable again? thing-something.
    (aps thing))
Which seems a bit useless to me, as the local variables are printed right there within the block of code you're currently writing. I suppose one could have some macro that creates a huge lexical environment, or something... am I missing your meaning? At any rate, 'namespace-mapped-symbols appears to be blind to local variables:

  > (let ((ach 2))
      (member 'ach (namespace-mapped-symbols)))
  #f
To obtain a list of local variables, I think you would have to hack with ac.scm. Or write a macro that searches/walks your code for lexical variables.

-----