I struggled to install it on my own too, but GPT 4 fixed that issue splendidly. I highly recommend you try: create a free account on chat.openai.com if you haven't already (GPT 3.5 is free, GPT 4 costs $20/mo), and then give it a prompt similar to this:
"Help me understand how to install arc. When I try to install in racket it says:
racket: undefined; cannot reference an identifier before its definition >"
initializing arc.. (may take a minute)
serving from C:\Users\user\anarki\apps\news
starting app news
load items:
ranking stories.
ready to serve port 8080
To quit:
arc> (quit)
(or press ctrl and 'd' at once)
For help on say 'string':
arc> (help string)
For a list of differences with arc 3.2:
arc> (incompatibilities)
To run all automatic tests:
$ ./arc.sh
arc> (load "tests.arc")
If you have questions or get stuck, come to http://arclanguage.org/forum.
Arc 3.2 documentation: https://arclanguage.github.io/ref.
arc>
Read around a bit and found a community maintained fork which seems to be a bit more updated (https://github.com/arclanguage/anarki), is that what people tend to use?
Getting back after arc is not the problem; even if I didn't have cd history set up a simple `cd -` would handle that.
Simple problem: I have a file containing a program written in Arc. I want to run it from the shell. How do I do that? I can fire up arc and `(load)` the file, but then the file needs to be in the arc2.3 dir or else I have to load it by absolute path, even if I was just in the same directory it's in.
For now I've just switched to using Anarki; I can run its `arc.sh` start script from anywhere in the filesystem and feed it a locally-relative pathname and it will run. Although it does seem to take quite a lot longer to start up than arc.
I ran (load "news.arc") this time and it prints out a list of items prefixed with * redefining and 'nil' returns after the last item.
However, nothing happens at localhost8080 and when I run (nsv) it gives this message:
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
'rm' is not recognized as an internal or external command,
operable program or batch file.
load items: Error: "directory-list: could not open
directory\n path: C:\\Users\\Hopet Ma'at
Amun\\Desktop\\arc3.2\\arc\\news\\story\\\n system error:
The system cannot find the path specified.; win_err=3"
I got it set up in the regular terminal by adding the path to environment variables, however, it gave me the same message as before. Is there something more I should be doing with the untarred folder, maybe?
Yes, I have experience programming from years ago and recently started learning Python until I happened across Arc. I think it's neat and would be great for my project. Where is the how-to-run news in case I don't find it myself? Thanks
> racket -f as.scm
; racket: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
> ; -f: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
> ; as.scm: undefined;
; cannot reference an identifier before its definition
; in module: top-level
; [,bt for context]
I think I have to somehow cd to the untarred arc3.2 but I'm not sure how to do so in the Racket App Terminal
Thank you so much, zck :)
I've used a combination of your helpful suggestions, stack overflow, and cd command to get to the right folder, and now it works. I got the arc command prompt (arc>) in my terminal now. I will take my time to explore the tutorial on Arc.
I feel good that this community is really helpful. Thanks everyone!
I downloaded and installed racket as described on arc installation page, and I got DrRacket version 8.0. The DrRacket window says: "Welcome to DrRacket, version 8.0 [cs].
Language: No language chosen; memory limit: 128 MB.
DrRacket cannot process programs until you choose a programming language.
Either select the “Choose Language…” item in the “Language” menu, or get guidance.
>
I've tried to type racket -f as.scm, but it doesn't work. I've type the same instruction in my MacBook Terminal, it doesn't work either. I don't know what to do next. Have I got the wrong racket?
Thanks, jsgrahamus, for your reply :)
I was a bit shocked when I saw this and wondered how they’d handled tail call optimization since there’s no nice way to do a computed jump in web assembly. It turns out it relies on the new tailcall extension to web assembly that isn’t enabled yet in most browsers.
Still this is pretty cool! A lot of languages have web assembly compilers but few seem to make self hosting a priority.
He wants it to be a little more like scheme wherein:
(define (f)
(define v 10)
...)
creates v as a local variable. In Arc, and most lisps, you need to do:
(defun f ()
(let ((v 10))
...))
Additionally, Arc has the wrinkle (i think, i haven't used Arc recently) where if you do:
(defun f ()
(= v 10)
...)
you create a global variable and assign 10 to it, instead of the python default which creates v in local scope. Basically, he's trying to use imperative programming and doesn't want to declare local variables using let.
Thanks! And yes I'm on windows, although that command didn't work at first -- protip, you can't run it from a powershell prompt, it has to be a cmd prompt. Weird.
update: having it self evaluate (or evaluate to a hashtable with quoted keys and non-quoted values maybe) instead of a syntax error seems like a better choice
I think you should have to quote them. Like how you have to quote lists:
'(foo bar)
is just a list, but
(foo bar)
will either call the function foo or error if it doesn't exist.
So in a similar way
{foo "bar"}
should give a syntax error, but maybe it can have some kind of semantic meaning later. I've been considering that square brackets could be used for assignment/local binding, to cut down on the need for LET (not necessarily in arc just in lisp in general).
Didn't consider a double `%then` or `%else`, thanks. Raises some interesting problems.
Generally the plan is to have a special character control whether it gets bound or inlined, probably `!`. So say `%test!` would get inlined like right now, while using `%test` would bind (and doing both would also be possible). But for a `%then` you'd generally only want to bind if there's 2+ so I could count usages instead.
Author here. Glad to see some interest, sometimes I lurk here and now I feel bad not having submitted here myself.
Interestingly the "%else" would actually be cataphoric, as you refer to what comes next rather than before. So "co-referential macros" would be more fitting if you want to stick with the linguistics analogy. But that'd be too exotic of a term.
And yes as akkartik notes, it causes multiple evaluations right now, mostly just laziness and indecision on my part.
I'll probably be giving control over this. Here's a real example of code where you actually want current behavior: