Arc Forumnew | comments | leaders | submitlogin
2 points by krapp 2300 days ago | link | parent

I'm hoping to have some functionality for this wired into an update of prompt.arc and pushed soon.

It might be useful to be able to write app scripts and attach them or detach them from hooks. That seems like it would be a decent basis for a plugin system.

Or not, I don't know. We'll see I guess.



3 points by krapp 2298 days ago | link

OK, I have a stupid question. How do I remove an item from a table?

Apparently it's (rem test table) but everything I've tried fails with "Can't take car of #hash(("foo" . (app-run "foo")))" I also thought I might have to assign nil to it but that returns an error as well. Here is my current code if it helps... it's just minor edits of prompt.arc, assignment and running an app in a hook all work:

    (def app-unhook (user app)
      (do ((rem !app hooks*) 
          (editor-page user "Hook removed from " app))))

    (def app-hook (user app) 
      (if (file-exists (app-filepath app))
        (do ((= (hooks* app) `(app-run ,app))
            (editor-page user "Hook applied to " app)))
        (editor-page user "Error: No application " app)))
I feel like I'm probably missing something obvious.

-----

3 points by i4cu 2298 days ago | link

rem only works on seqs, you need to set the value to nil:

  (= (mytable 'key) nil)
and tables don't hold nil valued entries so it works.

-----

2 points by krapp 2298 days ago | link

thanks!

-----