Arc Forumnew | comments | leaders | submitlogin
3 points by akkartik 3172 days ago | link | parent

I think you're misusing defvar. You can read about defvar at https://awwx.ws/defvar2. In short, to invoke your prompt function everytime you refer to x, say this:

  arc> (defvar x (fn() (prompt "> ")))
For example:

  arc> (len x)
  > abc
  3
BTW, I tend to avoid using the interactive repl when I'm performing raw I/O because of the need for the (readc) hack you mentioned. I'd rather just write my code in a script and run it in batch mode.


2 points by mpr 3172 days ago | link

I was using defvar where I should have been using =. But the idea in my post was just to store the result of (prompt) in the variable x, which is meant to be a string.

And yes, now that I am moving past the experimental phase of my script, I will be running things in batch mode.

Thanks for the advice.

-----