Arc Forumnew | comments | leaders | submitlogin
How do I use a library?
2 points by bh 3917 days ago | 4 comments
Simple question that for some reason I can't find the answer to. I see libraries in the lib folder. How do I use them?

Taking a guess, I tried:

    (require "lib/http.arc")
but I think this doesn't work because I'm not running arc from the arc folder. This being the case, what should I do?


2 points by malisper 3917 days ago | link

Since you are not running arc from the arc folder, you need to use either the full path, or the path relative from where you are running arc. If you are running arc in dir/foo/ and the file is in dir/bar/lib/http.arc, you could use:

  (require "../bar/lib/http.arc")

-----

1 point by akkartik 3915 days ago | link

I think you mean load?

-----

2 points by malisper 3915 days ago | link

load if one is not using anarki which supports require.

https://github.com/arclanguage/anarki/blob/master/lib/requir...

-----

1 point by akkartik 3915 days ago | link

Ha, I'd long forgotten require: https://github.com/arclanguage/anarki/blob/master/libs.arc

-----