$ ls
arc2c/ arc-wiki/
$ cd arc-wiki/
$ cp -r ../arc2c/* .
$ ./arc.sh
Use (quit) to quit, (tl) to return here after an interrupt.
arc> (load "arc2c.arc")
nil
arc> (compile-file "t.arc")
<lots of stuff>
Yes, that's what I was looking for: where to put arc2c in the tree.
My next arc2c problems are a) gc.h is missing; do I need to download it somewhere? and b) ‘QUOTE_CONSTANTS’ undeclared - I can't figure out where it gets declared. I'm trying to compile simply "(+ 1 1)".
How do I push changes to the git? "git push" gives me "fatal: The remote end hung up unexpectedly". I set up a ssh public key. Do I need to get authorization from you guys? (I've never done a git push before, so assume I may be doing something stupid.)
arc-exe.scm is supposed to be compiled, not run directly. Are you sure you ran the Anarki version by double clicking as.scm, and as.scm, only?
Try doing this: Start Menu | Run Program
Then type "cmd" and press enter. This brings up a terminal.
Then find your path. First go to the drive you installed it. For example if it's in drive C, type "C:" and then enter. Then find your path. Go to your windows explorer and explore from there to where you kept Anarki (have to use Windows Explorer specifically, because it's just better than the default view), then select the address bar and press ctrl+c to copy it. Then go back to the terminal, type "cd " (include the space, but don't press enter yet), then rightclick the terminal's title bar and select Edit | Paste, which should paste the path to your terminal, and press enter.
(my knowledge of Windows is starting to embarass me)
Then try the following command:
mzscheme -m -f as.scm
If commandline doesn't work for you, I'll try to replicate the problem on my XP box, which I, like, don't use except for playing Starcraft and DotA, because I can't get Wine to run in fullscreen properly without scrolling into Gnome.
weirdest thing is it actually worked the first time i ran anarki.
i dont remember exactly what i did, is it possible that the first execution could have changed something?
or i happened to change some code?
what is the GIT really doing? is it just for downloading new versions? not something i actually will use when programming?
Good, we're getting somewhere. Try editing as.scm in notepad (open notepad and drag it into it). Then find the following line and add a ";" before it:
(load "ffi.scm")
Then try running it again.
Don't know why FFI isn't working on you, since the line being referenced doesn't actually get used in normal Anarki.
> what is the GIT really doing? is it just for downloading new versions?
Yes, although that's in your case currently.
> not something i actually will use when programming?
Depends. It's what's called a "revision control software". It's like CVS or Subversion (you might have used those). It lets you keep track of changes in your software, and lets you manage the development. For example, you can automatically create versions of software, which you can revert (for example, if a bug is reported by a user in the latest version, you can get a copies of succeedingly older versions until you see the bug disappear. Then you can get the difference between the version-without-bug and the first version-with-bug and see what exactly you changed that could be causing the problem). Up to you to use while programming. Any revision control software is good; git is considered one of the better ones.
Anarki is the nickname of the repository at http://github.com/nex3/arc/tree/master . It's still Arc (just a more-often-updated version) and it's still started using the same technique to start arc.
re: GC - I think you're not properly handling sharedvar's (but then I don't have much time to read it). Specifically I think you're not properly marking sharedvar's. Since your GC needs to know the structure, you might need to put type tags on sharedvar's after all.
re: primitives: I think it's better to split the primitives: %+ for numeric addition, %string+ for string addition. Then define in lib-ac.scm.arc:
(set +
(fn (a b)
(if (and (is (type a) 'int) (is (type b) 'int))
(%+ a b)
(if (and (is (type a) 'string) (is (type b) 'string))
(%string+ a b)
(%err "+: type mismatch")))))
We can even define the above as $+ and define + as variadic, reducing the input using $+, as in canonical Arc.
Yep, I did not try to handle sharedvars at all with my GC. I will eventuelly need to give them a type tag, but I deferred that to the next release :) Splitting polymorphic functions is something that has to be done too.
As for variadic +, I don't know : if we transform (+ a b c d) in (+ a (+ b (+ c d))) during the first phase of compilation, we obviously handle variadic +, but at the end (in the generated code), the ADD() primitives only handles + with 2 args, which I guess would be more efficient ? And, that way, we could translate (+ a 1 b 2) into (+ a (+ 3 b)), and (+) to 0, which will eventually have to be done.
Hmm, right, but that's just a design issue. If pg wanted to simplify the axioms, he could remove hash tables, make alists behave the way I explained and make the syntax foo!x look for the 'x key in the alist 'foo.
Edit : There would be a problem however if we try foo!3 : do we mean the third element, or the element associated to the key 3 ?
2) In theory, the length of the vector could be stored by the memory manager anyway (possibly as a start and end address), which after all has to know how big to deallocate when the vector is GC'ed. In fact if the metadata is interspersed with the allocated memory it probably will be just a length, since the current address is known.
1) http://arclanguage.com/item?id=4146 . Might actually implement this in arc2c if I stop being lazy some time soon. And definitely after implementing arc2c macros.
What arc needs is a concept of "sequence", not separate array and list types. Yes, I know, I know, "lists are cons cells". Hahahaha. Well, 'map, 'some, 'all, 'keep, 'rem don't work on improper lists anyway. Improper lists are rarely used, and the implementation I propose can support them anyway, just not as efficiently. So some loss of efficiency in 'scdr is acceptable, at least you get O(n/m) index time, with O(1 + C) if m > n.
2) Sounds interesting. You could implement this using Arc lists as base, and use my lib/settable-fn.arc extension (or lib/settable-fn2.arc, which is fractionally more likely to get added into ArcN and which I intend to use for arc2c in lieu of my settable-fn) to support some of the mutation stuff. See also my "Create your own collection" series.
as far as I can tell, `(insert your macro code here ,@body) is the generalized solution form of that design pattern. Just template the code: insert this part here, insert that part there.
The nice thing about templating is that you reasonably arbitrarily insert various bits of code:
Of course, Arc does indeed try to provide specific, shorter solutions for the most common cases, such as single-argument functions ([... _ ... ] syntax), single-variable 'let (let syntax), and anaphoric macros.
Perhaps we can define mac-sym?
(mac-sym foob
'(insert your code here))
(foob
niaw
woof
arf)
==
(insert your code here
niaw
woof
arf)
(mac mac-sym (name . body)
(w/uniq m-body
`(mac ,name .m-body
(join (do ,@body) ,m-body))))
Or is what is bothering you something else entirely?