Arc Forumnew | comments | leaders | submit | kinnard's commentslogin
1 point by kinnard 831 days ago | link | parent | on: How Lisp is going to save the world!

This is awesome.


1 point by kinnard 849 days ago | link | parent | on: ASK: How to read user input?

I believe what you're looking to do is assign what's "read" in to a variable e.g.:


(def getUserPrompt ()

    (= msg readline)

    (pr msg)



1 point by mpr 849 days ago | link

Yes, but I'm using the msg arg as the prompt text. Example:

    arc> (= x (prompt "> "))
    > this is the user text
    arc> x
    "this is the user text"
I ended up hacking the ac.scm file to throw away the first newline after an expr is (read). It works for now.


2 points by kinnard 849 days ago | link

I think I understand. You want a function that prints arbitrary user prompts and then takes in user inputs?

You should share your hack!


3 points by mpr 848 days ago | link

Yep, thats the idea. Anyway, here is my hack, in all its hackish glory:

    (define (trash-line c)
      (if (equal? c #\newline)
        (trash-line (read-char))))

    (define (tl2 interactive?)
      (when interactive? (display "arc> "))
      (on-err (lambda (c)
                (set! last-condition* c)
                (parameterize ((current-output-port (current-error-port)))
                  ((error-display-handler) (exn-message c) c)
                (tl2 interactive?))
        (lambda ()
          (let ((expr (read)))

            ;; HACK located here
            (trash-line (read-char)) ; throw away until we hit the newline

            (if (eof-object? expr)
                 (begin (when interactive? (newline))
            (if (eqv? expr ':a)
                (let ((val (arc-eval expr)))
                  (when interactive?
                    (write (ac-denil val))
                  (parameterize ((current-namespace (main-namespace)))
                    (namespace-set-variable-value! '_that val)
                    (namespace-set-variable-value! '_thatexpr expr))
                  (tl2 interactive?)))))))
So I call the trash-line function after the expr is read, but before it is eval'd by arc, so that there is not leading #\newline in the input buffer.

This does seem to work for the readline'ing I was doing yesterday. Probably doesn't handle all cases.

As akkartik mentioned above, this hack is obviated by running scripts in batch mode.


Edit: this change is in my ac.scm file around line 1250


2 points by akkartik 848 days ago | link

I like it! I don't think it'll break anything; can you send a pull request? Then we'll be able to run such code reliably at the repl! That would be sweet.

Edit 38 minutes later: hmm, there's one issue. Right now you can type multiple expressions in on a single line, but this change would drop everything after the end of the first expression. A better approach would be to drop only whitespace and stop at the very first non-whitespace character.


2 points by mpr 848 days ago | link

Thanks! Yeah, I am aware of that bug, and was kind of ignoring it ;) I'll implement your suggested fix then send a pull request.


3 points by mpr 848 days ago | link

Pull request submitted


1 point by kinnard 849 days ago | link | parent | on: ASK: What is Lisp Enlightment?

I now disagree: I realized my cognitive process might actually be the lambda calculus.


Surprised this story got no love. It's providing a powerful new medium/platform for lisping . . . I expect it to have a big impact on the size and character of the lisp community.


1 point by akkartik 849 days ago | link

Seemed like PR:


5 points by kinnard 851 days ago | link | parent | on: Can't access my server

This is a stab in the dark but have you opened the port to receive connections from other "machines". Maybe the firewall is blocking incoming connections.

Also, it might help if you copy exactly your terminal input.

Additionally, the github is another resource though I'm not sure this is an arc issue:


2 points by ca 851 days ago | link

Many thanks for helping with this.

This is what the terminal looks like when I run ./run-news

$ ./run-news rm: cannot remove 'www/news/story/*.tmp': No such file or directory load items: ranking stories. ready to serve port 8080

To quit: arc> (quit)

  (or press ctrl and 'd' at once)
For help on say 'string':

  arc> (help string)
For a list of differences with arc 3.1:

  arc> (incompatibilities)
To run all automatic tests:

  $ hg clone

  $ ./arc

  arc> (load "tests.arc")
If you have questions or get stuck, come to

Arc 3.1 documentation:



4 points by kinnard 850 days ago | link

I believe that error occurs because the news app is attempting to `rm` a temporary dir that hasn't been created yet:

It may be related to what's being discussed here:

But I am able to successfully visit http://localhost:8080/ after running `./run-news`. Alternatively the (nsv) command also works for me.

So I'm not able to reproduce the error that you're getting.

Any luck investigating your firewall?


4 points by ca 848 days ago | link

It's up!

The issue was network (firewall) related. I simply destroyed the firewall (it's on VM so am not concerned about security on this one). On ubuntu that amounted to removing the IPtable rules.

Am looking forward to putting this behind Nginx and seeing how that goes.

Thanks for sticking with me kinnard. It's very much appreciated. Have a great week.


1 point by kinnard 847 days ago | link

Haha, happy to help, would love to see what you're building.

Pay it forward.


Anyone down to develop an arc scripting language for VR?


1 point by kinnard 852 days ago | link | parent | on: Why Lisp?

Analysis of homoiconicity by comparing S-expressions, json, and xml is pretty compelling compared to all the other lisp evangelism I've read.


This sounds like stack based LISP as opposed to "list" based "LIS"P


2 points by akkartik 852 days ago | link

Yes, my impression is that "stack-based lisp" describes to a 't'. In Factor you can throw code on the stack by a process called.. quoting. And then invoke it inside some other higher-order function.


I found this most salient: "This is totally subjective, but I think we're at a point where the language ecosystem is much more important than the actual language. This was probably not the case when pg was writing software for Viaweb and there wasn't nearly as much FOSS that you could just use. At that point in time the LANGUAGE was probably much more important because there was not a lot of differentiation beyond that. Now, we're at a point where the language isn't as important and the ECOSYSTEM around it is much more powerful that then language itself."


1 point by kinnard 853 days ago | link | parent | on: ASK: Multiline comments?

Thanks! Does this appear in Arc's documentation anywhere?