Arc Forumnew | comments | leaders | submitlogin

I just gitclone it,so it should be the latest version,and no change.

Thx.


Thx,you are also right. And the following is the 'df' output:

  Filesystem     1K-blocks    Used Available Use% Mounted on

  /dev/sda5       10787760 7165852   3067260  71% /
  udev             1961728       4   1961724   1% /dev
  tmpfs             787996     972    787024   1% /run
  none                5120       0      5120   0% /run/lock
  none             1969984    1032   1968952   1% /run/shm
  /dev/sda7       28373184 8822232  18103336  33% /home

Thanks you for your help.

1. "...So I'm guessing you're in a situation like that."

Yes,you are right.

2. "- Somehow change what temp directory Arc uses."

I don't know how to.

3. "- Somehow change your partitions so the home directory and temp directory are in the same one."

This worked.

BTW, I have tried the old arc3.1 version, but it didn't have the problem.


Ack, accidental downvote. So the 'presence indicator' should really be 3.

The error "Invalid cross-device link" happens if you're trying to move a file across partitions. Apparently sometimes people have set up their home directory in a separate partition, even without realizing it.[1] So I'm guessing you're in a situation like that.

Other languages seem to recover from this particular error and do a copy and unlink instead:

Python: https://mail.python.org/pipermail/python-list/2005-February/...

Ruby: http://stackoverflow.com/questions/403239/how-do-i-move-a-fi...

Racket's reference for 'rename-file-or-directory states that it can move files to other paths "on the same disk"[2], and it goes into detail about atomicity guarantees, so this behavior is probably by design.

So the way you can find resolution here might be:

- Somehow change what temp directory Arc uses.

- Put the Arc directory elsewhere on your filesystem.

- Somehow change your partitions so the home directory and temp directory are in the same one.

- We should probably update Arc to recover from this somehow. :)

---

[1] http://www.linuxquestions.org/questions/linux-newbie-8/inval... (Warning: This page has lots of ads, and there's some flaming with harsh language.)

[2] http://docs.racket-lang.org/reference/Filesystem.html


Hmm, is /home or /var mounted as a separate device in your setup? Can you show us the output of the following command?

  $ df

The error message indicates you're running anarki. What version are you running? Did you make any changes to it?

Yeah, no luck: https://github.com/akkartik/arcueid/commit/ae31b82540

Thanks!

Does it make sense to resize it on the fly when we discover we've overflowed the stack? Or are there potentially continuation pointers into the stack that would be non-trivial to track down?


src/vmengine.h:236:

#define TSTKSIZE 65536

Increase it as high as you like. :)


That was what I thought :) Is there a place where I can increase the size of the fixed stack? I looked for the limit in the code, but couldn't find it.

The assertion error is a stack overflow. :) At present Arcueid makes use of a fixed-size stack within its virtual machine, and since the compiler still can't properly optimise tail recursion, your code overflows the stack.

Well, thanks for the bug report. Well, I'll look into it when I have the time: the work which pays my bills has caught up with me once again and I don't have a lot of time to do hobby development. :)
3 points by zck 4624 days ago | link | parent | on: Listtab

Glad to help out!

Also, it looks like you're new here. Welcome! Feel free to post any questions or thoughts about Arc; this forum is really welcoming to newcomers, and I'd like the community to grow bigger.

2 points by cacplate 4624 days ago | link | parent | on: Listtab

Those are pretty good points thanks.
2 points by akkartik 4624 days ago | link | parent | on: Listtab

In addition to zck's points: obj is built using listtab, and there's several cases in arc where 'internal' helpers are not distinguished from the external interface. That gives users the option to use it in the rare situations where it's more helpful.
2 points by zck 4624 days ago | link | parent | on: Listtab

If nothing else, you can use 'listtab to convert an association list (http://arclanguage.github.io/ref/assoc.html) to a table:

    arc> (= al '((k1 v1) (k2 v2)))
    ((k1 v1) (k2 v2))
    arc> (alref al 'k2)
    v2
    arc> (listtab al)
    #hash((k1 . v1) (k2 . v2))
And it is more readable for long argument lists:

    arc> (obj 1 2 3 4 5 6 7 8 9 0 a 2 b 3 r 4) ;; Is 0 a key or a value?
    #hash((r . 4) (1 . 2) (b . 3) (3 . 4) (a . 2) (5 . 6) (7 . 8) (9 . 0))
    arc> (listtab '((1 2) (3 4) (5 6) (7 8) (9 0) (a 2) (b 3) (r 4))) ;; a val.
    #hash((r . 4) (1 . 2) (b . 3) (3 . 4) (a . 2) (5 . 6) (7 . 8) (9 . 0))

Thank you. But now I think it would be wise not to complain about the issue on the forum, but rather to create an issue on the project's github. Will do it now.

Update: done — https://github.com/dido/arcueid/issues/60


I think all the errors you're seeing are due to running out of heap. How much memory do you have? Is there some per-process limit, perhaps to RLIMIT_AS?

Edit 35 minutes later. I can reproduce that it dies for me at the precise same iteration as you. And RLIMIT_AS is infinity, so that's not the issue. I've pinged the author for comment.


Recursive code like this:

  (def my-loop ((o i 0)) (prn "Still going: " i) (my-loop (++ i)))
  (my-loop)
Performs much better. It fails only after 21799 iteration:

  Still going: 21799
  arcueid: env.c:83: __arc_mkenv: Assertion `(((struct vmthread_t *)(((struct cell *)(thr))->_obj))->spr) > (((struct vmthread_t *)(((struct cell *)(thr))->_obj))->stkbase)' failed.
  Still going: zsh: abort      ~/tmp/arcueid-base/bin/arcueid
:(

Well, actually, even without threading, arcueid running code:

  (let i 0 (while t (prn "Still going: " i) (++ i)))

Fails with exception:

  arcueid: cont.c:58: __arc_mkcont: Assertion `(((struct vmthread_t *)(((struct cell *)(thr))->_obj))->spr) > (((struct vmthread_t *)(((struct cell *)(thr))->_obj))->stkbase)' failed.
after 7266 iterations.

I've changed the test to count iterations:

  (thread (let i 0 (while t (prn "Still going: " i) (++ i))))
and it every time broke on 7270 iteration.

Tried arcueid. It is unstable. For example, running this simple code:

  (thread (while t (prn "Still going")))
Ends very quickly with error like this:

  arcueid: cont.c:54: __arc_mkcont: Assertion `(((struct vmthread_t *)(((struct cell *)(thr))->_obj))->spr) > (((struct vmthread_t *)(((struct cell *)(thr))->_obj))->stkbase)' failed.
  zsh: abort      ~/tmp/arcueid-base/bin/arcueid
1 point by akkartik 4630 days ago | link | parent | on: How do I use a library?

Ha, I'd long forgotten require: https://github.com/arclanguage/anarki/blob/master/libs.arc
2 points by malisper 4630 days ago | link | parent | on: How do I use a library?

load if one is not using anarki which supports require.

https://github.com/arclanguage/anarki/blob/master/lib/requir...

1 point by akkartik 4630 days ago | link | parent | on: How do I use a library?

I think you mean load?

Well, I haven't tried to run crawler with large depth setting yet. I discovered, that it have strange problems with threading and almost unable to process in parallel. Then I tried to investigate why. Will make a separate post on it, when will get some valuable information.

Does this tool find Arcueid? :) That project's on GitHub too.

https://github.com/dido/arcueid

2 points by rocketnia 4631 days ago | link | parent | on: An update on wart

Okay, I'll give that a try. Let's say we're defining a function and using it like this:

  > (def foo '(a b)
      (list a b))
  > (foo (+ 1 1) (+ 2 2))
  ((+ 1 1) (+ 2 2))
Let's vary some things here:

  '(a b)             ; the parameter list
  (a b)              ; the args to (list ...)
  ((+ 1 1) (+ 2 2))  ; the args to (foo ...)
  ((+ 1 1) (+ 2 2))  ; the result
  
  (baz)
  (baz)
  ((+ 1 1))
  ; Error! Can't make the function call (2).
  
  '(a b c)
  (a b c)
  ((+ 1 1) :c (+ 3 3) (+ 2 2))
  ((+ 1 1) (+ 2 2) (+ 3 3))
  
  '(a :b b c)
  (a b c)
  ((+ 1 1) (+ 2 2))
  ; Error! Unbound variable b in expression (list a b c).
So I have some more kinks to work out, lol. I finally appreciate your predicament. :)

The (baz) issue is caused by the complexity of the fact that in a normal function call, each of the arguments should be evaluated, but the list of arguments shouldn't. So if the traditional Arc parameter list (baz) is a pattern, it should destructure an unevaluated list in such a way that the baz pattern inside operates on an evaluated version of the list's first element.

It would be a lot simpler if we wrote this argument list differently:

  > (def foo (baz) ...)  ; doesn't work
  > (def foo `(,baz) ...)
  > (def foo (arg-list baz) ...)
      ; where (arg-list ...) is a pattern special form
I think that last one is promising, because then we can just write (baz) and the macroexpansion of (def ...) can insert that into (arg-list baz) for us. Then we get to have slight differences between how parameter lists work and how list destructuring works.

As for the "unbound variable b" issue, I think that could be solved by having each pattern take an optional current expr, rather than a mandatory one. My exact implementation of this would probably vary substantially based on what else I was trying to do. I might want a guarantee of which variables will be bound by a pattern long before there's an actual argument list to match it against, for compilation purposes and such.

1 point by rocketnia 4631 days ago | link | parent | on: An update on wart

I found another mistake I made. In the two rules that use <before...> and <rest>, that <before...> should be used whenever the rule matches the remainder of the expr.

In particular, for symbols to work as positional args whenever there isn't a keyword, the symbol rule needs to fall back to (<before...> <str> ... <rest>), reflecting the original location of the symbol in the pattern. I just had it falling back to (<str> ... <rest>) for some reason.

---

  (<before...> <k> <v> ... <rest>)
    ; where <before...> is any number of non-keyword, non-symbol
    ; elements; <k> is a keyword; and <rest> could be anything,
    ; especially an improper list
This pattern treats the current expr as an unevaluated improper list, looking for the first occurrence of <k> with another element after it (which we will refer to as the value expr).

If the keyword binding is found: Matches <v> against the value expr. Matches <rest> against an alteration of the current expr, changed to remove the keyword and the value expr. Uses all variable bindings produced by <v> and <rest>, preferring the bindings in <rest>.

If the keyword binding is not found: Matches the pattern <rest> against the entire expr. Uses those variable bindings.

  (<before...> <s> ... <rest>)
    ; where <before...> is any number of non-keyword, non-symbol
    ; elements; <s> is a symbol; and <rest> could be anything,
    ; especially an improper list
Let <k> be the keyword with the same name as the symbol <s>, and let <str> be this name as a string. This pattern treats the current expr as an unevaluated improper list, looking for the first occurrence of <k> with another element after it (which we will refer to as the value expr).

If the keyword binding is found: Matches <str> against the value expr. Matches <rest> against an alteration of the current expr, changed to remove the keyword and the value expr. Uses all variable bindings produced by <str> and <rest>, preferring the bindings in <rest>.

If the keyword binding is not found: Matches the pattern (<str> ... <rest>) against the entire expr. Uses those variable bindings.

---

After this fix:

---

  (<before...> <k> <v> ... <rest>)
    ; where <before...> is any number of non-keyword, non-symbol
    ; elements; <k> is a keyword; and <rest> could be anything,
    ; especially an improper list
This pattern treats the current expr as an unevaluated improper list, looking for the first occurrence of <k> with another element after it (which we will refer to as the value expr).

If the keyword binding is found: Matches <v> against the value expr. Matches the pattern (<before...> ... <rest>) against an alteration of the current expr, changed to remove the keyword and the value expr. Uses all variable bindings produced by <v> and (<before...> ... <rest>), preferring the bindings in the latter.

If the keyword binding is not found: Matches the pattern (<before...> ... <rest>) against the entire expr. Uses those variable bindings.

  (<before...> <s> ... <rest>)
    ; where <before...> is any number of non-keyword, non-symbol
    ; elements; <s> is a symbol; and <rest> could be anything,
    ; especially an improper list
Let <k> be the keyword with the same name as the symbol <s>, and let <str> be this name as a string. This pattern treats the current expr as an unevaluated improper list, looking for the first occurrence of <k> with another element after it (which we will refer to as the value expr).

If the keyword binding is found: Matches <str> against the value expr. Matches the pattern (<before...> ... <rest>) against an alteration of the current expr, changed to remove the keyword and the value expr. Uses all variable bindings produced by <str> and (<before...> ... <rest>), preferring the bindings in the latter.

If the keyword binding is not found: Matches the pattern (<before...> <str> ... <rest>) against the entire expr. Uses those variable bindings.

More