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

Seemed like PR: http://paulgraham.com/submarine.html

-----


Ack yes I was thinking about downvoting stories, but that's not on HN either.

-----

2 points by akkartik 3507 days ago | link | parent | on: The Theory of Concatenative Combinators

Yes, my impression is that "stack-based lisp" describes http://factorcode.org 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.

-----


No I don't believe so. I think downvotes came to HN late in life, and this forum hasn't gotten that update (and probably others)

-----

2 points by akkartik 3509 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 3509 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

-----

3 points by akkartik 3509 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 rocketnia 3509 days ago | link

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)

-----

3 points by Styx 3509 days ago | link

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 Styx 3509 days ago | link

Hey thanks Akkartik, I'll give it a go.

-----

2 points by akkartik 3512 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 akkartik 3513 days ago | link | parent | on: ASK: Arc Language Slack?

"It gets lonely around here."

There you go again trying to solve social problems with technical solutions :) You'll fit right in with Lisp.

-----

2 points by akkartik 3513 days ago | link | parent | on: The Lisp Curse

Lots of great past discussion: https://hn.algolia.com/?query=The%20Lisp%20Curse&sort=by...

-----

More