Arc Forumnew | comments | leaders | submitlogin
1 point by rocketnia 4891 days ago | link | parent

  (fn nil (with (eof (uniq) f (infile "arc.arc") l
  *** redefining no
  *** redefining map1
  *** redefining pr
  *** redefining list
  nil 
  repl in 110995ms
  arc> (list 1 2 3)
  (1 2 3)
  arc> (java-invoke window 'eval (list "navigator.
  "Mozilla/5.0 (Linux; U; Android 2.2.2; en-us; MB
  arc>
Copy and paste from my phone's browser is terrible. here's the full input line:

  (java-invoke window 'eval (list "navigator.userAgent"))


2 points by rocketnia 4891 days ago | link

I haven't been using the wiki, but I just started it off as a scratch area for compatibility status: https://github.com/rocketnia/rainbow-js/wiki

Turns out I broke Opera compatibility at some point, whoops!

-----

1 point by akkartik 4891 days ago | link

How does that line demonstrate autoload? Is the definition of list being loaded on demand?

-----

2 points by rocketnia 4891 days ago | link

Well, the "* redefining..." lines technically demonstrate it on their own. :-p But yes, 'list is defined in arc.arc.

...Oh, that particular line was intended to "prove" I was on Android.

-----

1 point by akkartik 4891 days ago | link

Perhaps you should complete the first line of code ^_^

-----

1 point by rocketnia 4891 days ago | link

Lol, apparently this is a case where a visual example doesn't explain much of anything.

That first line is kind of an implementation detail for now. The code that initializes the REPL is here: https://github.com/rocketnia/rainbow-js/commit/10a171557ef65...

It uses an "e" option in its call to Console.mainAsync(). This corresponds to Java Rainbow's -e command line parameter, and it takes an Array of strings, each string containing a single Arc command to evaluate. The results are printed as part of the initial output, the part before the first prompt shown.

The first Arc command passed into "e" is (assign load-from-web (fn ...)), which results in the big (fn ...) at the beginning of the output.

The second, which is only passed in when auto-loading the libraries, is (load-from-web), and that performs all the libraries' own side effects (visible as the "* redefining..." lines) and finally results in nil.

-----