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

You can also configure Apache to serve static files without going through Arc, which is probably faster.

See http://arclanguage.com/item?id=3486 for an example configuration.

-----

5 points by eds 5996 days ago | link | parent | on: Connect to running instance?

GNU screen. http://www.gnu.org/software/screen/

As for editing code and having it get reloaded into a running Arc automatically when you change the file, you might want to look at http://arclanguage.org/item?id=2739 .

-----

3 points by eds 6003 days ago | link | parent | on: Does memo work right?

> You could write a more complicated check within memo that examined whether the arguments had been passed before.

This is exactly what memo does right now: it just stores the args to 'f in a hash table and looks them up whenever 'f gets called.

  (def memo (f)
    (let cache (table)
      (fn args
        (or (cache args)
            (= (cache args) (apply f args))))))
The problem which prevents this from working nicely with nil is that hash tables in Arc do not distinguish between the value nil and a key simply not being there. The workaround is to use a default value (generally a symbol returned by (uniq)) to guarantee uniqueness for the case when the key does not exist.

See http://arclanguage.org/item?id=8566 for more information.

-----

2 points by zhtw 6002 days ago | link

Actually I know why it happens and how to fix that. The question was more like "is it a bug or a feature?" I remember that PG suggested (but forgot where I read that) to store cons' in a table when you need to distinguish nil and absence of an element but why doesn't he use that technique (or any other) himself?

-----

2 points by skenney26 6001 days ago | link

I think the simple answer is that he hasn't needed that feature. 'memo and 'defmemo are used in 5 places in news.arc and it doesn't look like any of those uses would benefit from allowing nil as a value.

If someone created an application that benefited from that feature then perhaps there would be reason to redefine 'memo.

This seems to be an important part of the Arc philosophy: add a feature only when its absolutely needed.

-----

1 point by zhtw 5999 days ago | link

Only now I realized that you treat memo as some kind of the way to improve performance (do you?). What I used memo for is to make sure that function won't be called twice:

  (mac delay (e)
    `(memo (fn () ,e)))

  (def force (d) (d))
When I use lazy sequences (of symbols read from input port for example) based on these definitions I can't be sure that readc somewhere inside will never be called twice if I call force for an element of this sequence twice.

So I treat this as a bug. Or maybe I'm just wrong about what memo is for at all. Am I?

-----

1 point by aaronla 5988 days ago | link

I'd venture to guess that memo creates a new cache for each invocation, so two calls

  (map (lambda (f)  ;; invokes f 3 times
               (f) (f) (f) )
       (list (delay (foo bar)) 
             (delay (foo bar))))
I think thiw will call foo exactly twice, because each memo invokation produces a new cache, but I may be mistaken.

[pardon the syntax... this is in scheme. i have only just installed arc and (def hello-world ...) is as far as i've gotten]

-----

1 point by absz 5988 days ago | link

The real problem is that if you do

  (let d (delay (foo bar))
    (force d)
    (force d))
, then there's no guarantee that (foo bar) will be run exactly once---if (foo bar) returns nil, then it won't be cached.

-----


What exactly are you looking for? A guide on installing Arc, or a guide on setting up a web server?

If you are looking for the latter, a good guide is http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-p... .

For the former, I know there are guides out there, I just can't seem to find any right now. But I'll try to summarize below:

You ought to be able to install mzscheme with just

  apt-get install mzscheme
although you may have to be careful about which version you get. Version 352 is the recommended, although 372 should work (at least with Anarki). Anything newer will require modifying the Arc source, and is not recommended.

Next, I would suggest downloading Anarki, the community git repo with bug fixes and enhancements. See http://arcfn.com/2008/02/git-and-anarki-arc-repository-brief... for instructions.

Start Arc using

  $ arc.sh
You can start the server in a thread so that you can still access the REPL afterwards.

  > (= app (thread (asv))) ; or (nsv), as the case may be
This should run Arc on port 8080. To serve port 80, I suggest using Apache. (http://arclanguage.com/item?id=3498 is an example of an Apache configuration for Arc.)

Finally, I would suggest using Screen (http://www.gnu.org/software/screen/) for detaching and reattaching your Arc sessions.

Hope this helps.

-----

1 point by eds 6013 days ago | link

Here's the guide I mentioned earlier. It may be more thorough than my earlier post.

http://plpatterns.blogspot.com/2008/05/arc-news-forum.html

-----

1 point by sebg 6012 days ago | link

Thank you very much! The arc part was what I was looking for...and you were very helpful. take care!

-----

1 point by eds 6013 days ago | link

Another thing you might find convenient is autoreloading:

http://arclanguage.org/item?id=2739

-----

1 point by eds 6043 days ago | link | parent | on: lib/graph.arc, table misfeatures

> Arc does not distinguish between a key mapping to nil in a table and the same key being absent entirely.

  (def get (tab key (o default))
    ($ (hash-table-get ',tab ',key ',default)))
  
  (= tab (table))
  (= absent-entirely (uniq))
  (get tab 'key absent-entirely)
  
  (defcall table (tab key (o default))
    (get tab key default))
  
  (tab 'key absent-entirely)
;-)

-----

1 point by rntz 6043 days ago | link

It's true, I can override this. But this would change the language for any consumer of my library, as well; and however bad it may be to have absent keys map to nil, it's even worse to face the possibility of breaking the language for someone else. Sure, it's an optional parameter here... but what happens if someone else has their own idea about adding an extra parameter and what it should do? Your idea is probably the right design (though 'len and 'keys and the setter for tables would have to be changed as well to fit it), but it's not the way arc currently works. Hopefully pg will pick it up and run with it, though.

-----

7 points by eds 6045 days ago | link | parent | on: Where are we going?

I think part of the reason we were all hoping for more frequent releases was because, despite the fact that pg explicitly described arc as a 100-year language, he also stated that his design philosophy involved rapid iterations.

"I like to find (a) simple solutions (b) to overlooked problems (c) that actually need to be solved, and (d) deliver them as informally as possible, (e) starting with a very crude version 1, then (f) iterating rapidly." http://www.paulgraham.com/newthings.html

I actually think was a good plan, I just wish pg were able to follow it ;-) Even small improvements or bug fixes would make the community feel engaged.

-----

1 point by eds 6049 days ago | link | parent | on: Two things " : " " | | "

I don't think right parentheses are a problem for the following reasons:

* I don't type right parens. If you use Emacs and haven't tried Paredit (http://mumble.net/~campbell/emacs/paredit.el), I would highly suggest it.

* I don't read right parens, at least not in the multiline case. Instead, I read the indentation and the contents of the line, so the parens really don't get in the way at all.

I do think the : operator is an interesting idea for the single line case, when you might have something like

  (foo a (bar b (baz c))) => (foo a : bar b : baz c)
in the middle of a line.

-----

1 point by czoon 6046 days ago | link

and once get used to that , its addictive.

-----

1 point by eds 6053 days ago | link | parent | on: Public Arc Git Repositories

http://arclanguage.org/item?id=8421 http://repo.or.cz/mob.html

This has the disadvantage that someone needs to merge the mob and main branches regularly, which may make it a little less like a true wiki. But I still think http://repo.or.cz/ is a good option.

-----

2 points by eds 6053 days ago | link | parent | on: New user: some general Arc questions

> 5. Any Emacs advice for arconauts? Is everyone using http://zardoz.net/arc.el?

I use arc.el and inferior-arc.el from http://github.com/nex3/arc/tree/master/extras. These are probably the same as the ones you listed, I don't really know.

I also highly suggest Paredit from http://mumble.net/~campbell/emacs/paredit.el.

-----

1 point by eds 6053 days ago | link | parent | on: New user: some general Arc questions

> However, none of the rest of us can figure out how to make our own github-based repositories fully open (i.e. publicly writeable).

The easiest way to host a open source repository is probably http://repo.or.cz/, which allows setting up a "mob" user to allow wiki-style pushing like we currently have under Anarki. Obviously the same is possible in github, but I don't know how to set it up.

-----

More