Arc Forumnew | comments | leaders | submitlogin
1 point by akkartik 5234 days ago | link | parent

I decided that the json library perhaps shouldn't even be in anarki, so I've been experimenting with keeping it in my project sources. It seems useful to be able to mix arc with scheme in a project, especially for performance reasons.

Problem is, I can't do it without literally hardcoding a string literal: ($ (require (file "/path/to/json.ss")))

I've tried defining a helper function, but require must be at the top level. I've tried saying (require (file (+ dir "json.ss"))), but it seems the inside of the require form isn't lisp but some toy, bizarro universe.

This whole experience is bringing home just how much I hate the mzscheme module system. Lisp is all flowing lines; require is a brick. Just one way to use it; once you release it all it can do is sink.

Any suggestions?



1 point by aw 5234 days ago | link

A macro can expand into a ($ ...) or (ac-scheme ...) form, so try

  (= json-path "/tmp/json-scheme-20050827134102/json.ss")

  (mac load-json ()
    `($ (require (file ,json-path))))

  (load-json)

-----

1 point by akkartik 5234 days ago | link

Awesome thanks!

  (mac load-scheme(f)
    `($ (require (file ,(+ ($ start-dir*) f)))))
  (load-scheme "json.ss")

-----