Arc Forumnew | comments | leaders | submitlogin
1 point by kinnard 3739 days ago | link | parent | on: The Theory of Concatenative Combinators

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

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

https://news.ycombinator.com/item?id=11469790

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

Thanks! Does this appear in Arc's documentation anywhere?
3 points by rocketnia 3739 days ago | link | parent | on: ASK: Multiline comments?

Arc's own codebase doesn't implement comments of any sort, but it relies on Racket's line comments, so those at least are reliable across Arc implementations.

  ; A line comment:
  ; foo bar baz
The Racket-based Arc implementations inherit Racket's other kinds of comments as well, which are documented here: http://docs.racket-lang.org/reference/reader.html#%28part._p...

  ; A multi-line comment (nestable):
  #|foo bar
     baz|#
  
  ; A commented-out s-expression:
  #;(foo bar
      baz)
  
  ; A commented-out s-expression which happens to be a string:
  #;"foo bar
      baz"
  
  ; A commented-out s-expression which happens to be a symbol:
  #;|foo bar
      baz|
  
  ; A shebang comment
  #! foo bar \
       baz
3 points by rocketnia 3740 days ago | link | parent | on: Lisp Beginner

That version of `atom?` always returns nil, so I'll offer a correction.

Here's a very direct transliteration:

  (= atom?
    (fn (x)
      (and (no (acons x)) (no (no x)))))
The equivalents for `not` and `null?` in Arc are both `no`, because the empty list is the only falsy value. Scheme uses dedicated values for true and false, `t` and `#f`, but Arc uses the symbols `t` and `nil`, and `nil` doubles as the empty list.

Here's a version that uses the utilities Arc provides out of the box:

  (= atom? ~alist)
1 point by kinnard 3740 days ago | link | parent | on: Lisp Beginner

You know . . . I have no idea . . :)
3 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Also, from an outside perspective, I think your idea for a "Arc for Scheme" primer would be a great idea. The Little Schemer is widely recommended, so it could potentially result in more people finding their way into Arc.
2 points by akkartik 3741 days ago | link | parent | on: Lisp Beginner

I'm not sure how many people here follow the github account, so if you have questions just post them here. Don't worry about creating too many posts or comments, it's not like there's a lot of contention here :) Just do what works best for your learning, and we'll let you know if we want you to scale back.

If you see something broken or have suggestions to improve the documentation, post them on Github.

1 point by akkartik 3741 days ago | link | parent | on: N-queen puzzle in 4 lines of Scala

Yeah, somebody should write one and also add it to http://rosettacode.org/wiki/N-queens_problem
2 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Hey thanks Akkartik, I'll give it a go.
1 point by Styx 3741 days ago | link | parent | on: Lisp Beginner

Also, how much effort would it take to do something similar in Arc?
2 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Right. I created one in Ruby not too long ago. Then I decided I wanted to see it in the browser, so I used something called Opal to convert my Ruby code to JS. Then I built up the necessary html/css.

It's over at https://rawgit.com/Styx-/personal_website/master/index.html under projects if you want to see it.

3 points by akkartik 3741 days ago | link | parent | on: Lisp Beginner

I think you can go pretty far treating Arc as a dialect of Scheme. Arc is basically like Scheme + Lisp-style macros. So until you start dealing with macros things should correspond pretty closely. The names change, as you already noticed, so () is nil and not is no[1]. A second point of difference is that Arc tends to have fewer parens, so for example this Scheme code:

  (let ((x 3) (y 4))
    ...)
turns into this in Arc:

  (with (x 3 y 4)
    ...)
Kinnard is right that the atom primitive is pretty much what you want. The exact transliteration of your definition would be:

  (def atom? (x)
    (and (no x) (no (alist x))))
Or, with more syntactic sugar:

  (def atom? (x)
    (and no.x (~alist x)))
[1] Hmm, somebody should write a "Arc for Scheme programmers" primer, just with a quick cheatsheet of common names and their equivalents. Any takers?
3 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

That would be cool! "Chess engine" means no graphics, right?
3 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Well, I was thinking about building a chess engine in it at some point. But then, I intended to read a few books between now and then.
2 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

It's definitely worth the read. It's the "Foundation" and nothing can beat knowing the axioms cold. That article was my red pill.

Arc isn't exactly living up to the vision: [1] https://github.com/arclanguage/anarki/issues/40#issuecomment... [2] http://arclanguage.org/item?id=19492

And the vision is questionable to begin with: http://arclanguage.org/item?id=19554

1 point by Styx 3741 days ago | link | parent | on: Lisp Beginner

Ah, well, I skimmed it yesterday. Which I guess skimming is the last thing to do when it comes to a document of that sort ^.^

Essentially, I want to learn Lisp because the colloquial "they" recommend it to gain a better understanding of programming in general.

I want to learn Arc because it seems to take the lisp philosophy to heart the most out of the lisps.

And generally, I'm the type of person that can withstand some amount of "jumping into the deep end." Although, I may be in a bit too deep this time. Heh.

I'll probably continue to lurk around here until I've got a bit more experience under my belt, and thoughts to contribute.


This took me about 3 hrs by the way
3 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

Is there something you have in mind to build?
2 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

I see. Yeah his essays are very seductive. I got pulled in.

Have you read the Roots of Lisp: http://lib.store.yahoo.net/lib/paulgraham/jmc.ps

2 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Mostly pg's essays. I'm actually fairly new to programming in general, though I have a ton of interest.

I'm coming from a Ruby background and I was just admitted to a coding bootcamp, for reference.

2 points by Styx 3741 days ago | link | parent | on: Lisp Beginner

Yeah I figured that would be the deal getting into it, but I'm still willing to learn it. I think the whole philosophy is really neat.

I think what I'm going to try to do is continue to play around with Arc, while also learning on something a bit more established. Maybe Scheme or Clojure.

Thanks for the advice.

2 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

What attracted you to LISP? And to Arc? If you don't mind my asking.
3 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

This might not be really helpful because the arc "atom" isn't quite the same as the lisp "atom"[1][2]

arc> (src atom)

(from "arc.arc")

(def atom (x)

  (in type.x 'int 'num 'sym 'char 'string))
==================================================

(define (ar-type x)

  (cond ((ar-tagged? x)     (vector-ref x 1))

        ((pair? x)          'cons)

        ((symbol? x)        'sym)

        ((null? x)          'sym)

        ((procedure? x)     'fn)

        ((char? x)          'char)

        ((string? x)        'string)

        ((exint? x)         'int)

        ((number? x)        'num)     ; unsure about this

        ((vector? x)        'vector)

        ((hash-table? x)    'table)

        ((output-port? x)   'output)

        ((input-port? x)    'input)

        ((tcp-listener? x)  'socket)

        ((exn? x)           'exception)

        ((thread? x)        'thread)

        ((thread-cell? x)   'thread-cell)

        ((keyword? x)       'keyword)

        (#t                 (err "Type: unknown type" x))))
(xdef type ar-type)

[1] https://github.com/arclanguage/anarki/issues/40#issuecomment...

[2] http://arclanguage.org/item?id=19492

2 points by kinnard 3741 days ago | link | parent | on: Lisp Beginner

Welcome!!! Best place to pester might be the github: https://github.com/arclanguage/anarki/issues.

Though I think a real stack exchange community is in order.

As to your question, I'm not qualified to answer, but it depends on your goals. What are your goals?

EDIT: Probably not though. Arc is intended to be "powerful"[1] not "educational" and Arc doesn't behave the way scheme does in(I believe) a lot of cases, e.g.: https://github.com/arclanguage/anarki/issues/48

[1] http://paulgraham.com/power.html

2 points by jsgrahamus 3741 days ago | link | parent | on: N-queen puzzle in 4 lines of Scala

These kinds of articles fascinate me for showing what is possible.

APL/K/J seem to epitomize this kind of code golf. Tried the J example on my phone and it worked. Don't have a clue as to how it works or what it is saying. From the comments on HN:

  queenst =: (, #: I.@,@(</)&i.)~ (] #"1~ [ */@:~:&(|@-/) {)&.|: ! A.&i. ]
This is the calculation, and you can output all 92 solutions for the 8 queens problems like this:

  queenst 8

  0 4 7 5 2 6 1 3
  0 5 7 2 6 3 1 4
  0 6 3 5 7 1 4 2
  ....
each column is a row number, and the integer is which column the queen is in, or vice versa on rows and columns. ,or print how many solutions $queens 92 8 $ gives the 'shape' of the array, that is 92 rows (solutions) x 8 columns (8-queens problem).

I wonder what the arc equivalent would be?

3 points by kinnard 3742 days ago | link | parent | on: ASK: Arc-Language Forum Reliability

Hmmm, that's interesting but I don't think it's what I'm running into. I get it on a first visit. I don't think my housemates are visiting the arc-forum at all . . .
4 points by rocketnia 3743 days ago | link | parent | on: ASK: Arc-Language Forum Reliability

I don't know if this is the same as what you're seeing, but there's a feature of Arc application servers that does this. It's meant for rate-limiting people who might be attempting denial-of-service attacks against the site:

https://github.com/arclanguage/anarki/blob/master/lib/srv.ar...

The default settings throttle anyone who's doing 30 requests in 10 seconds. Each page load does 5 or 6 requests to get images and such, so we can get throttled if we reload or follow links 7 times in 10 seconds. When I try it on Arc Forum, it seems to be doing exactly that.

At Hacker News... if I go a few pages into the recent comments and hit F5 approximately 30 times in 10 seconds, I get an Nginx error page. Hacker News probably lets Nginx serve its static files rather than having every request go through the Arc server's throttle, but otherwise its configuration seems to be pretty similar.

Maybe you're navigating 7 times in 10 seconds by hand, but there are other possibilities too. If you're on the same external IP address as others who are accessing the Arc Forum, you might all be under a single rate limit.

2 points by akkartik 3744 days ago | link | parent | on: Clojure from the ground up: welcome

This is great! The description of quoting using signifier and signified, the description of trees be evoking the nested nature of natural language, .. (still reading)
2 points by kinnard 3744 days ago | link | parent | on: The Lisp Curse

What had you wondering about this?
More