Arc Forumnew | comments | leaders | submit | almkglor's commentslogin
2 points by almkglor 6427 days ago | link | parent | on: arc2c update

minor correction: s/arc2c\.sh/arc2c\.arc/

To be specific:

  $ 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>

-----

2 points by kens 6426 days ago | link

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)".

-----

1 point by almkglor 6426 days ago | link

a) Yes, you need the Boehm GC. What I do is, I comment out gc.h and add #define GC_MALLOC malloc #define GC_INIT()

b) That's a bug

-----

2 points by kens 6425 days ago | link

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.)

-----

1 point by sacado 6425 days ago | link

You're on the collaborators' list now. Just push again, and everything should be working.

-----

1 point by stefano 6425 days ago | link

You'll have to ask sacado to add you to the list of committers.

-----

1 point by almkglor 6427 days ago | link | parent | on: Anarki worked 1 time, but not anymore

are you running Arc by running as.scm?

What, exactly, are the steps (double-click that file, drag that file, etc.) you made to run it?

-----

1 point by globalrev 6427 days ago | link

normal Arc im running by running as.scm yes.

Anarki i run by arc-exe.scm

have tried as.scm too though.

i have tried both doubleclick-starting them and openeing DrScheme then open arc-exe then running it.

normal Arc works both ways.

this is really annoying becuse i justw anna get going with WebApps and it doesnt work ont he normal Arc-version on Windows.

-----

1 point by almkglor 6427 days ago | link

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.

-----

1 point by globalrev 6427 days ago | link

mzscheme -m -f as.scm 'mzscheme' is not recognized...

this is what i get when trying to run as.scm in DrScheme:

procedure application: expected procedure, given: #f; arguments were: #<struct:fun-syntax> #<syntax:C:\Users\saftarn\Desktop\myanarki\nex3-arc-20af2f3fe921faeca2048d1d932abcdae2a916b4\ffi.scm:18:14>

i tried running as.scm from the DOS-window and it generated the same problem.

the file loads up in DrScheme. then i click Run to start Arc right?

this again: procedure application: expected procedure, given: #f; arguments were: #<struct:fun-syntax> #<syntax:C:\Users\saftarn\Desktop\myanarki\nex3-arc-20af2f3fe921faeca2048d1d932abcdae2a916b4\ffi.scm:18:14>

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?

-----

1 point by almkglor 6427 days ago | link

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.

-----

1 point by globalrev 6427 days ago | link

ty very very much it is finally working.

-----

1 point by almkglor 6428 days ago | link | parent | on: git, anarki, windows and ark.help!

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.

-----

2 points by almkglor 6428 days ago | link | parent | on: arc2c update

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.

-----

1 point by sacado 6428 days ago | link

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.

-----

3 points by almkglor 6428 days ago | link

Then someone redefines '+ so that it doesn't just add numbers or concatenate strings. Say (+ 1 2 "asdf") becomes "3asdf".

Further, what if we need to pass '+ as a function to another function?

  (def hmm (op)
    (op 1 2 3 4 5))

-----

1 point by sacado 6428 days ago | link

Oh, yes, so that wasn't really a good idea...

-----

2 points by almkglor 6430 days ago | link | parent | on: Hash tables are unnecessary

  (alref foo 'x)
     vs.
  foo!x

-----

1 point by sacado 6429 days ago | link

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 ?

-----

4 points by almkglor 6432 days ago | link | parent | on: Hash tables are unnecessary

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 point by almkglor 6432 days ago | link | parent | on: source of rainbow (arc in java)

> - continuations can be re-entered in a different thread - don't know if this is supposed to be possible, although it seems useful.

I believe this is supposed to be possible

-----

3 points by almkglor 6432 days ago | link | parent | on: Hash tables are unnecessary

Re: ropes - here's a discussion of them http://www.google.com/url?sa=t&ct=res&cd=1&url=h...

-----

6 points by almkglor 6432 days ago | link | parent | on: Hash tables are unnecessary

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.

-----

1 point by almkglor 6432 days ago | link | parent | on: Reducing Parentheses

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:

  (mac do body
    (w/uniq rv
      (let (desc . body) (if (isa (car body) 'string) body (cons (uniq) body))
        `(let ,rv nil
            (profile-enter ,desc)
            (after (= ,rv ((fn () ,@body)))
                   (profile-leave ,desc)
                   ,rv)))))
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?

-----

More