Arc Forumnew | comments | leaders | submit | zck's commentslogin
1 point by zck 5122 days ago | link | parent | on: Subdirectories under static/

A quick thought: on Linux, '/' is the root directory, similarly to "C:\" on Windows. Perhaps this was the reason it's verboten. An opening slash should either be disallowed, or treated as a relative link.

-----

2 points by akkartik 5122 days ago | link

static-filetype always gets a path that is appended to staticdir, so you don't have to worry about absolute paths.

-----

1 point by zck 5121 days ago | link

Well, then I'm stuffed. Disallowing .. makes perfect sense, though.

-----

4 points by zck 5150 days ago | link | parent | on: How to get Racket to run arc?

Two notes:

1. Get http://ycombinator.com/arc/arc3.1.tar instead of arc3.tar

2. Run the command racket -f as.scm . No -m flag.

-----


Yes, macros aren't functions, unfortunately. Thinking of them as such is a rather leaky abstraction.[1] If you post the code that's breaking, we should be able to help you. Is it a stock hn install, or have you edited it? The stock install has worked every time I've tried it.

[1] For example, this code won't work: (apply obj (list "steve" "steve's value"))

-----

4 points by zck 5155 days ago | link | parent | on: Http requests in arc?

You'll have to hack ac.scm to add a new function to arc. Racket's tcp-connect is the useful function here. I'm not at a computer where I've done this, but it's a matter of adding something like this:

    (require racket/tcp)
    
    ;; xdef takes its second arg, which is Scheme code,
    ;; and binds itto the name given as the first arg.
    ;; The name is accessible only from Arc code, I think.
    (xdef tcp-connect (lambda (hostname port)
                          (let-values (((from-server to-server)
                                        (tcp-connect hostname port)))
                            (list from-server to-server))))
    
Then you use it as follows, in Arc code:

    (let (from-server to-server) (tcp-connect "google.com" 80)
         (disp "GET / HTTP/1.1\nHost: google.com\n\n" to-server)
                 ;; I believe 'disp is the correct function
                 ;; This, I believe, is a correct HTTP request. It works, at least.
         (close to-server) ;; you won't be able to know when the response is done
                           ;; unless you close the input port.
         (whilet line (readline from-server)
                 (prn line)) ;; or whatever you want to do with the results.
         (close from-server) ;; it'll work without it, but close your ports anyway.
Again, this is untested code; parts of it are from memory, and parts are from a previous comment: http://arclanguage.org/item?id=14817 . I'll check this when I get home; tryarc.org is down.

-----

1 point by alexpogosyan 5155 days ago | link

It worked, thank you so much.

I only had to remove (require racket/tcp) line because it was causing 'collection not found' error.

-----

1 point by zck 5155 days ago | link

You're welcome! Weird, though -- I thought the 'require line had to be there so that racket would know what 'tcp-connect is. Apparently I'm wrong; I'll have to try my code without it.

Good luck with the rest of it, though -- this doesn't provide any sort of http header creation, which is somewhat annoying, but if you write some functions for it, I'm sure we'd be interested in seeing them.

-----

1 point by alexpogosyan 5155 days ago | link

Maybe it's because I'm using mzscheme 4.2.5 and not racket?

-----

1 point by zck 5155 days ago | link

Ah, I didn't actually need it either -- I was thinking of some other code I was writing. To call Racket's 'HMAC-SHA1, you need:

  (require web-server/stuffers/hmac-sha1)
  (require net/base64)
But not for tcp-connect. If you make a library for Amazon interaction, that might be useful to other people. I'd be interested in seeing the code, at least.

-----

3 points by zck 5198 days ago | link | parent | on: Mzscheme vs PLT Scheme vs Racket

Arc3.1 works with Racket. You can get Arc3.1 here: http://ycombinator.com/arc/arc3.1.tar . I don't know why the "install" page hasn't been updated.

-----

3 points by akkartik 5198 days ago | link

http://sites.google.com/site/arclanguagewiki is really the front page of the project at this point, for all intents and purposes.

-----

1 point by zck 5198 days ago | link

I should probably poke around there, then. For whatever reason, the only Arc documentation I've used is arcfn.com, which isn't up to date with Arc3.1 anyway.

-----

1 point by rocketnia 5197 days ago | link

Only documentation I've used too. ^_^ With Arc documentation as it is today, part of Arc programming is being prepared to read the source code to get the whole story. The Arcfn documentation is still a good place to get to know the essential utilities.

Anarki provides "help" functionality too, in case that, uh, helps.

-----

3 points by zck 5215 days ago | link | parent | on: Rainbow in JavaScript! (currently very buggy)

I think it's an emoticon: https://secure.wikimedia.org/wikipedia/en/wiki/XD

-----

2 points by zck 5215 days ago | link | parent | on: possible bug involving len and nil?

Interesting...we're getting comments plagiarized from elsewhere in the page similar to how reddit was spammed: http://www.reddit.com/r/reportthespammers/comments/i78c2/red...

However, these aren't amazon affiliate links.

-----

3 points by zck 5219 days ago | link | parent | on: [noob] install arc forum on vps?

You first need to install the Scheme host that Arc runs on top of. If you're running Arc3, it's MzScheme v372; if you're running Arc3.1, Racket.

Then download and run Arc. I don't have Arc in front of me, but if I recall correctly, you start the news server with (nsv). There's a file distributed with Arc called how-to-run-news, or something like that. Read it; it's quite useful.

You can call (thread (nsv)) if you want the repl to come back so you can make further changes while the server's running.

That'll get it running, but you may have to open up ports in the firewall to let people connect from outside. You'll also need to customize some variables, like the name of the site, and colors, and the favicon.

-----

1 point by zck 5220 days ago | link | parent | on: Remove-if-not

Please, please, please give us more information when you have a question. If you want a 'readline exactly like Common Lisp's 'read-line, you'll have to write it yourself. If you want specific features, tell us what they are. It's hard to help when we have to guess what you actually want.

Arc code can be terse; English shouldn't be unnecessarily so.

-----

1 point by ly47 5220 days ago | link

Hi zck Yes, I mean read-line like common lisp. As I'm only learning arc, it will be not easy to me to write it, but I will try as i will be more familiar with Arc. I like arc as it's code is simpler than common-lisp and is more readable. ly

-----

1 point by zck 5221 days ago | link | parent | on: Arc, Emacs, and SLIME

Re-reading, I don't know how I missed that the first line of output is a 'progn statement. Obviously arc will barf on it. I don't know what won't work because SLIME wasn't able to load 'swank and start it.

-----

1 point by zbeane 5221 days ago | link

Everything that makes SLIME worth using will not work.

-----

2 points by shader 5213 days ago | link

What makes you say that? What features would you consider "make it worth using", and why won't they work? It's quite possible that all that needs to be done is change a few variables or replace a few functions to use arc names instead of CL names. Case in point being progn -> do, etc.

-----

1 point by HankR 5200 days ago | link

swank is the lisp package that does all of the slime heavy lifting on the lisp runtime. It manages threads, executes code, interfaces with the debugger, does various reference/definition lookups, etc. It consists of a large CL package with a smaller, environment specific set of functions that are defined for each lisp environment (SBCL, Clozure, etc.) In addition, slime and swank are tightly bound, and changes to one requires changes to the other. One or the other change fairly frequently. Porting swank to work with something like ARC would be a major undertaking, maintaining it would probably be worse. It's probably not worth the effort. It would probably be just as fast to create a new arc editing interface.

-----

More