Arc Forumnew | comments | leaders | submitlogin
2 points by palsecam 5608 days ago | link | parent

as-fast.scm:

   (require mzscheme) ; promise we won't redefine mzscheme bindings

   (require "ac.scm") 
   (require "brackets.scm")
   (use-bracket-readtable)

   (parameterize ((current-directory (current-load-relative-directory)))
     (load "compiled/arc_arc_scm.zo")  
    ; yeah, should chdir to ./compiled/ directly, but don't want 
    ; to fight w/ MzScheme now. And yeah, the filenames are dirty
     (load "compiled/strings_arc_scm.zo")
    ; (load "compiled/pprint_arc_scm.zo")
    ; Commented, 'cause bug in mzc or smthg (at least on my machine):
    ; compiled/pprint_arc_scm.zo::2989: read (compiled): ill-formed code [...]
    ;
    ; (aload "pprint.arc")  
    ; ^ and this commented 'cause it'd make `arc' take more than 1s, + unused by me.
    ; Uncomment if you need it, my machine is an eeePC, so on a Core 2 Duo
    ; or the like, I suppose you'll still be under 1 sec. No cheat here
     (load "compiled/code_arc_scm.zo")
     (load "compiled/html_arc_scm.zo")
     (load "compiled/srv_arc_scm.zo")
     (load "compiled/app_arc_scm.zo")
   ; Ah yeah, and I don't load prompt.arc, since a long time, useless to me.
   ; Add it here and in alc.pl, loading it will not kill perf I think (loading
   ; bytecode is fucking fast on this fucking good MzScheme).
   )

   (let ((args (vector->list (current-command-line-arguments))))
     (if (not (empty? args))  ; cmdline args are script filenames
         (for-each (lambda (f) (if (string=? f "-") (tl) (aload f))) args)
         (tl)))

Ah yeah, and 'tl2 in ac.scm needs to get back the ':a' stuff (thanks rntz for pointing this is out on the "Arc usable on Unix" thread):

   [...]
   (if (eof-object? expr)
     (when interactive? (display "(quit)") (newline))
     (if (eqv? expr ':a)
       'done
       (let ((val (arc-eval expr)))
    [...]
alc.pl is 56 lines of code, not copied here, grab it at http://dabuttonfactory.com/res/alc.perl

arc(.sh):

   #!/bin/sh

   ## arc: launcher for Arc. Put in your $PATH.

   ARC_DIR="/home/paul/arc/3.1/"  # change this

   alc.pl $ARC_DIR;
   rlwrap mzscheme -qr ${ARC_DIR}as-fast.scm $@
Note you have no manual work to do when modifying one of arc.arc or the libs, alc.pl is good enough to detect changes and do all the work for you (.arc -> .scm -> .zo). But, and this sucks, if you want to add the loading of, say prompt.arc, you should take care to modify alc.pl and as-fast.scm. And also no work if you hack ac.scm, 'cause as previously said, mzcheme will detect this.

Note all of this is not dependant of my previous patch to make Arc OK on Unix, but you'll have to change some things by yourself if you don't use this patch.

Note 1 sec is still very long. Compare to the 0.012 secs of alc.pl.

There is this quote "On the Internet, if it's not instant, it's too long." Well, it's true in computing in general. I still have to wait before the Arc prompt to show, and this sucks.

Note you should not delete libs.arc or as.scm because alc.pl use them to bootstrap.