Arc Forumnew | comments | leaders | submitlogin
1 point by almkglor 6116 days ago | link | parent

Sorry, I've been studiously avoiding Python. Can you give better examples, such as a module being used by another module?


3 points by pau 6116 days ago | link

File 'a.arc':

  (set spam 1)
  (def myfun (x) (prn x))
File 'b.arc':

  ;; Uses 'a'
  (use 'a)
  (a@myfun "hi!")
File 'c.arc':

  ;; Uses all in 'a'
  (use* 'a)
  (myfun "hy!")
File 'd.arc':

  ;; Use 'a' as 'z'
  (useas 'z 'a)
  (z@myfun "ho!")
In Arc's repl:

  arc> (use 'a)
  t
  arc> a@spam
  1
  arc> (set a@spam 5)
  5
  arc> (use 'a)
  t
  arc> a@spam
  5
  arc> (use 'd)
  ho!
  t
  arc> (use 'b)
  hi!
  t

-----