robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

ability to list variable names #113

Closed fzipp closed 1 year ago

fzipp commented 2 years ago

Sometimes I would like to see the user-defined variables and functions, e.g. in a long-running session, or after I loaded a library or a saved session. I can list the function names with )op, but there is no way to list the variable names.

Two possible implementations come to my mind: either a new special command for variables, like )var or )vars, or list them under the )op command as "nullary" ops or simply as variables. In this case it might make sense to rename )op to a more generic name like )defs.

Dyalog APL has the commands )VARS, )FNS and )OPS.

There is another use-case for this feature: I have written a line editor wrapper for the ivy command: https://github.com/fzipp/ivy-prompt It supports among other things tab-completion for built-in keywords, but also for user-defined functions. It queries their names with the )op command. I would like to support it for user-defined variables, too.