Arc Forumnew | comments | leaders | submit | eds's commentslogin

I'm having trouble loading Arc3F under Windows XP (using MzScheme 352). Normally, the following would for me with Anarki.

  C:\User\Programming\Arc\arc3f\arc-f>mzscheme -mf as.scm
  current-directory: expects argument of type <complete path or string>; given #f
Any ideas?

-----

1 point by almkglor 6363 days ago | link

It's a dependency on ./arc.sh

Specifically, arc.sh sets the environment variable "arc_dir" to the installation directory.

I would suggest making a batch file which sets the environment variable arc_dir properly before launching mzscheme -af as.scm ^^

Should probably be done correctly by providing an arc.bat I suppose, although the problem is always figuring out the installation directory... haven't hacked MSDOS batch files in a long time ^^

-----

3 points by eds 6362 days ago | link

Ok, I got arc3f to work with the following:

  C:\User\Programming\Arc\arc3f\arc-f>set arc_dir=C:\User\Programming\Arc\arc3f\arc-f

  C:\User\Programming\Arc\arc3f\arc-f>mzscheme -mf as.scm
  Compiling arc.arc...
  Use (quit) to quit, (tl) to return here after an interrupt.
  <User>tl:
Unfortunately, (having learned Unix shell scripting), I never bothered to learn Windows batch files.

Also of note, arc.sh doesn't work in Cygwin:

  $ sh arc.sh
  > default-load-handler: cannot open input file: "c:/cygdrive/c/User/Programming/Arc/arc3f/arc-f/as.scm" (The system cannot find the path specified.; errno=3)

-----

2 points by almkglor 6362 days ago | link

I pushed an untested arc.bat launcher on the anarki arc-f recently, although now that I've reviewed it it seems I used the wrong flag in the mzscheme invocation (-af instead of -mf). Could I ask you to check it out, and if so, could you check it out?

As for the cygwin stuff.... hmm. Maybe I should fix my broken WinXP machine...

-----

1 point by bOR_ 6360 days ago | link

   @echo off
   set arc_dir=C:\Program Files\ARCF
   mzscheme -mf "%arc_dir%\as.scm"
This one worked for me. I'm not sure if removing the [][]'s from the file and making it windows line breaks mattered, but at least I had to move some ""'s around to get it to work.

Now just trying to get the launch-an-arc-script script working (from outside the repl). The script that is elsewhere on the website works on linux, but not windows ;). Damn pipes.

-----

1 point by bOR_ 6359 days ago | link

  Use (quit) to quit, (tl) to return here after an interrupt.
  <User>tl: (load "arc-life.arc")
  Error: "reference to undefined identifier: __<arc>car_"

Hmm. I might be doing something wrong with trying to load an arc file in ARCF.

-----

2 points by almkglor 6358 days ago | link

Hmm. Looks like a bug in some macro in Arc-F. Will find. Off the top, I can't seem to find any problems; a file like this:

  (prn "foo")
...loads fine:

  Use (quit) to quit, (tl) to return here after an interrupt.
  <User>tl: (load "test.arc")
  foo
  nil
  <User>tl:
care to send me the source you have? almkglor@gmail.com

-----

1 point by eds 6359 days ago | link

That batch file works, thanks!

-----

1 point by almkglor 6359 days ago | link

Out of curiousity: does it work even if you're on a different hard drive/directory as the installation drive/directory? The intent of that batch file is to allow you to launch Arc from anywhere, while still (1) able to access the current directory and (2) able to load library files from the arc installation directory

-----

1 point by eds 6359 days ago | link

Yes, the batch file loads fine from another drive letter.

  E:\>"C:\User\Programming\Arc\arc3f\arc-f\arc.bat"
  Use (quit) to quit, (tl) to return here after an interrupt.
  <User>tl:
That said, I am not sure how to test that it can load files in both directories... especially with the new behavior of 'using.

-----

1 point by almkglor 6358 days ago | link

Try on different directory:

  E:\> copy con tmp.arc
  (prn "hello world!")
  ^Z                       <---- that's a control-Z
  E:\> "C:\User\Programming\Arc\arc3f\arc-f\arc.bat"
  Use (quit) to quit, (tl) to return here after an interrupt.
  <User>tl: (using <files>v1)
  t
  <User>tl: (ls)
  ("tmp.arc")       <--- you should get a list of files and stuff in the current directory, including tmp.arc
  <User>tl: (load "tmp.arc")
  hello world!
  nil
  <User>tl:

-----

1 point by eds 6351 days ago | link

Works perfectly :-)

-----

1 point by eds 6370 days ago | link | parent | on: Need for a practical language

We've already got http://github.com/nex3/arc/tree/master/arc-exe.scm which creates an exe of the interpreter. And it wouldn't be difficult to use my http://common-lisp.net/~eslaughter/darcs/blackthorn/install.... to create a Windows installer for it.

-----

1 point by eds 6370 days ago | link | parent | on: M-Expression Syntax

Is this implemented as its own reader, or does it mutate the arc reader when loaded?

Have you seen http://arclanguage.org/item?id=2610 and http://github.com/nex3/arc/tree/master/lib/infix.arc ?

-----

1 point by rincewind 6370 days ago | link

1. It is implemented as its own reader, but it uses arc/mzscheme-read for symbols and quotation syntax (the version at http://placebo.hpi.uni-potsdam.de/~robert.pfeiffer/arc/mexpr... also handles quasiquotation-syntax on its own, but is less well tested)

You can load a file in m-expression format with "(load-m filename)" (or "load-m[filename];").

2.Yes I have. The M-Expr reader converts into prefix form at read time, so the read forms look like arc code. M-Expressions are just a skin for S-Expressions, therefor I tried not to break anything by changing the run-time semantics of Arc (unlike infix.arc, which makes numbers callable, which my break drcodes currying (or my idea for automatically converting numbers in functional position into Church Numerals)).

-----

1 point by eds 6371 days ago | link | parent | on: Looking for advice

Interesting idea, but I'm having a hard time visualizing how it would work. How do you patch source code after it is compiled and being used in a running image? I am aware of the existing (let old foo (def foo (...) (bar (old ...)))) pattern, but you seem to be implying something more that this... Or am I completely off on that aspect of it?

-----

2 points by eds 6387 days ago | link | parent | on: (serve 8080) trouble

I can't duplicate your error on Anarki. I am running Windows XP SP 3 with MzScheme 352 (http://download.plt-scheme.org/mzscheme/v352.html), using the newest Anarki (http://github.com/nex3/arc/zipball/master).

If the master branch still doesn't work for you, you could also try the stable branch, which should only contain bug fixes (http://github.com/nex3/arc/zipball/stable).

-----

2 points by bOR_ 6387 days ago | link

Ha! Got it. I was using the Anarki stable download at http://github.com/nex3/arc/tree/stable . Now I just downloaded the master and it works. Gracias.

-----

1 point by eds 6387 days ago | link | parent | on: (serve 8080) trouble

Specifically, MzScheme 4+ uses immutable lists, which don't work well with Arc. You might be able to try http://arclanguage.org/item?id=3954, but I personally have no experience in doing so.

-----

2 points by eds 6389 days ago | link | parent | on: Asv or serve broken

1. You could also use Anarki (see http://arcfn.com/2008/02/git-and-anarki-arc-repository-brief...), which contains many other bug fixes and enhancements.

2. Lynx works fine for my site (hosted on Ubuntu 8.04).

-----

2 points by eds 6410 days ago | link | parent | on: Show and Tell: elliottslaughter.net

Another thing (which I feel I really ought to already know the answer for...), how do you format floating point numbers (say, to three decimal places)? I could do this trivially with #'format in CL, but I don't see anything in the Arc docs to help me, and I don't know enough about Scheme to hack around it with ($ ...).

-----

2 points by almkglor 6410 days ago | link

Arc doesn't have any.

If it's always N decimal places of a reasonable number, you can do magic stuff like:

  (def to-N-places (f (o N 3))
    (with (fact (let rv 1
                  (repeat N (zap * rv 10))
                  rv)
           float [+ _ 0.0])
      (pr:/ (float:floor:* f fact) (float fact))))
It won't pad though.

-----

3 points by eds 6410 days ago | link

Your version doesn't round.

  arc> (do (to-N-places 5.123456789 5) (prn))
  5.12345
  nil
But the following function will.

  (def to-N-places (f (o N 3))
    (let s (string (to-nearest f (expt 10.0 (- N))))
      (cut s 0 (min (+ N 1 (pos #\. s)) (len s)))))

  arc> (to-N-places 5.123456789 5)
  "5.12346"
(That said, there may be other problems with it.)

Personally, I think we really need CL-style format.

-----

1 point by eds 6406 days ago | link

After a bit more searching, I finally found a page on printing numbers in the scheme cookbook (http://schemecookbook.org/Cookbook/NumberPrinting), specifically the first example which uses SRFI 48 for some basic formatting support (http://srfi.schemers.org/srfi-48/srfi-48.html). The following to works in Anarki/MzScheme 352.

  arc> ($ (require (lib "48.ss" "srfi")))
  #<void>
  arc> (def format args ($ (format ,@args)))
  #<procedure: format>
  arc> (format "~4,4F" (sqrt 2))
  "1.4142"
Enjoy ;-)

-----

2 points by tokipin 6410 days ago | link

'to-nearest might help:

http://arcfn.com/doc/math.html#to-nearest

-----

1 point by eds 6410 days ago | link

  arc> (to-nearest 5.123 .1)
  5.1000000000000005
Um...

-----

1 point by eds 6410 days ago | link | parent | on: Show and Tell: elliottslaughter.net

Thanks for the reminder, I had forgotten about that.

I'm still not sure that's a complete solution though... you don't really prevent access to the port, you just send an access denied message instead of serving the request. (But I don't know that much about web security, so maybe that really is sufficient.)

-----

1 point by almkglor 6410 days ago | link

Not sure either. It depends on whether the Arc Server is secure/{not dumb} enough such that it won't be fooled by someone pretending to be from 127.0.0.1 , for example.

-----

1 point by eds 6410 days ago | link

Couldn't you just make Apache or Linux firewall port 8080 so all attempts to access it from outside are blocked? (That said, I wouldn't know how to do that off the top of my head.)

-----

2 points by gnaritas 6408 days ago | link

Yes, and that's the right approach. See http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-p... and scroll down to iptables to see how to setup a firewall on Linux.

-----

1 point by eds 6402 days ago | link

Thanks! That was a really useful article, and not only for setting up firewalls.

-----

2 points by eds 6419 days ago | link | parent | on: Revisiting arc's gensyms

I recently found a partial attempt to fix arc's gensyms on Anarki. I say partial because although 'uniq now returns uninterned symbols, 'ac-global-name still automatically interns them (in order to add "__" to the front) when they are evaluated. Thus name capture is still possible:

  arc> (w/uniq g
         (prn g)
         (eval `(= ,g 5))
         (prn (eval g))
         (= g1802 6)
         (prn (eval g)))
  g1802
  5
  6
  6
I believe the appropriate fix is to keep 'ac-global-name from automatically interning gensyms. I posted one possible (though ugly) solution at http://arclanguage.org/item?id=5104, but didn't commit the change because people didn't seem terribly enthusiastic at the time. Considering that someone else seems to be concerned with Arc's gensyms, I may commit a fix if I have time.

-----

2 points by eds 6419 days ago | link

Done.

http://github.com/nex3/arc/commit/d2eb6dde7811f33035acc44eca...

  arc> (w/uniq g
         (prn g)
         (eval `(= ,g 5))
         (prn (eval g))
         (= g1802 6)
         (prn (eval g)))
  g1802
  5
  5
  5
  arc> g1802
  6

-----

More