Arc Forumnew | comments | leaders | submitlogin
2 points by krapp 4 days ago | link | parent | on: Noob resources for Arc/Anarki?

>I install packages (although I think the only ones I use are ones I've created) by downloading the file, then calling `(load "/path/to/file")`.

To be fair, though... when most people say they want to "browse and install packages" for a language, they don't mean including local files through a REPL. Although that is the best we can do in Arc for now.

3 points by zck 6 days ago | link | parent | on: Noob resources for Arc/Anarki?

I can't help with #1, as I'm not on Windows.

> 2. Browse and install packages.

I install packages (although I think the only ones I use are ones I've created) by downloading the file, then calling `(load "/path/to/file")`.

> 3. Write code with syntax highlighting.

I use Emacs. I use the same syntax highlighting as Common Lisp with this line in my Emacs config: https://bitbucket.org/zck/.emacs.d/src/de1b94f07f5d89fb88e1b....

There is an Arc editing mode that ships with Anarki (https://github.com/arclanguage/anarki/blob/9e53a1f2ed0158869...), but I've never tried it. I should!


> Robert Tappan wrote the server code of the small company in Common Lisp.

Probably should reference Robert with his last name Morris? I imagine not that many people would know his middle name. I know I didn't.


Did some digging after running into this forum. Perhaps these articles are of interest to some of you.
3 points by waterhouse 11 days ago | link | parent | on: Show Arc: Serializable Closures

It's possible to record the fact that some cons cells (or other structures) are identical. The Lisp reader's #n= notation can be used for this, although usually it's only used to print circular lists. Common Lisp's print-circle can be used to demonstrate this:

  * (let ((x (cons 1 2))) (princ (list x x)) nil)
  ((1 . 2) (1 . 2))
  NIL
  * (let ((*print-circle* t)) (let ((x (cons 1 2))) (princ (list x x))) nil)
  (#1=(1 . 2) #1#)
  NIL
Now, if you have a running process, and you want it to seralize a closure (or, generally, an object) that points to a cell that happens to be identical to something else in the process, and you want to read the closure back in and have its pointed-to cell continue to be identical to that other thing... you'll need something more sophisticated. If each object is given some unique id, that would be one approach; that sounds like the mailboxes thing. Another approach would be... say, if the other cell is the 5th element of a list identified with the global name 'blah, then conceivably that could be a good syntax. This might be useful for modules, separate compilation, and/or saving arbitrary process state.
3 points by rain1 12 days ago | link | parent | on: Show Arc: Serializable Closures

what needs explained?
2 points by whitten 13 days ago | link | parent | on: Show Arc: Serializable Closures

Could you elaborate on this or give me pointer what we re it is discussed?

As a side question. Does anyone understand why they have both an arc news app and a discord forum? Seems to me like that would just separate the community.

I don't 'discord' so maybe someone else has insight?

I do wonder how much activity occurs in one vs. the other as it could be a good measure to determine which one is more appealing to a general audience.

2 points by rocketnia 17 days ago | link | parent | on: Running in DrRacket?

Thanks. I'm afraid I've never encountered something like that, but I can suggest a few things just in case....

Since arc.cmd is practically a one-line script, what do you get if you try to run the `racket` executable directly, like so?

  racket -t boot.rkt -e "(anarki-windows-cli)"
I've found pretty much just one thread online where people reported a similar issue (https://github.com/Microsoft/WSL/issues/2323). People attempted various fixes in the thread, and they didn't work for everyone.

Some of the approaches they took:

- There's a diagnostic tool which some people found limited success with. It would fix the location of their temp folder. Then a few days later it would break again. Here's a link to the comment that links to that tool: https://github.com/Microsoft/WSL/issues/2323#issuecomment-31...

- One person gave detailed instructions for diagnosing and fixing permission issues, in case that's what it is: https://github.com/Microsoft/WSL/issues/2323#issuecomment-41...

- It seems it might be some difference depending on whether the account you're doing this with is roaming or an administrator. At least, a lot of people in the thread thought it would make a difference. Maybe your command prompt works with Arc because it's a different user.

If you find out any more about what's going on, I hope you'll keep us in the loop. :)

Of course, since you already have this working via the command prompt, it's understandable if you prefer not to mess with it.


Yup, that's right.

IIRC, Laarc (https://www.laarc.io) (Hacker News Clone) is running Arc (don't quote me on that though).
2 points by akkartik 17 days ago | link | parent | on: Noob resources for Arc/Anarki?

On a tangent, I'm curious what bits you find are included with Python :) I use it for my dayjob, while it has lots of libraries I can't think of what IDE or commandline tools you're thinking of.
2 points by krapp 17 days ago | link | parent | on: Noob resources for Arc/Anarki?

>I've heard of foreign function interfaces, does Arc have one of those?

If Racket interop counts, then yes, albeit not seamlessly.

>it's an amazing core but not much else.

Yeah, it's mostly News and some random experiments. Fun to mess around with, though.

2 points by nupa 17 days ago | link | parent | on: Noob resources for Arc/Anarki?

Thanks for the advice! I figured I was just missing something, but if it doesn't exist yet then that's reasonable enough.

I've heard of foreign function interfaces, does Arc have one of those?

Regardless, I'm sort of getting the impression that Arc is something I should come back to someday when I'm able to contribute tooling to it -- it's an amazing core but not much else.

3 points by krapp 17 days ago | link | parent | on: Noob resources for Arc/Anarki?

In Windows, the install instructions in the readme should work. You may or may not have to set environment variables, I don't remember if I had to do that, but I don't remember having any issues. You'll probably want Git and MinGW as well.

If by "browse and install packages" you mean for Arc, you can't, yet.

I use Sublime Text with the syntax set to Lisp (which works well enough) and the terminal plugin, so I can open a Powershell prompt with Ctrl-Alt-T.

2 points by nupa 17 days ago | link | parent | on: Running in DrRacket?

Apologies, I just saw this reply now. It looks like this:

    PS C:\git\anarki> .\arc
    Program 'arc.cmd' failed to run: Access is deniedAt line:1 char:1
    + .\arc
    + ~~~~~.
    At line:1 char:1
    + .\arc
    + ~~~~~
        + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
        + FullyQualifiedErrorId : NativeCommandFailed

Just in case anyone might care, the current version of news deprecates npage and the subpage templates for a single layout macro and no longer uses the table layout, so that all news pages have a consistent look and navigation. I'll get around to finishing my vague plans to clean up and update the HTML eventually, since there are still some inline styles and font color tags and such that need to be gotten rid of.

Also, there's no longer any (gen-css-url) or votejs*, those have been moved entirely to external js and css files (except for the topbar color.)

Also eventually, I'm hoping to separate the layout stylesheet from the color stylesheet so that the latter can be swapped out as themes.

[0]https://github.com/arclanguage/anarki/blob/master/apps/news/...

3 points by uu 18 days ago | link | parent | on: Variables & scoping complaint

Thank you, that's 100% on point!

Setting local variables should be simpler (or equivalent to) setting global variables. It's so much easier to do (= v 10) than (let ((v 10) ...)) despite "let" / "with" arguably being preferable to "=" in most cases.

2 points by rocketnia 21 days ago | link | parent | on: Variables & scoping complaint

Oh, right, here's another reason I don't like the CoffeeScript/Ruby/MATLAB approach where a variable is declared automatically at the outermost point where it's assigned: I like to be able to declare local variables that shadow variables from outer scopes. When `=` declares non-shadowing variables only (since the rest of the time it acts as an assignment rather than a declaration), shadowing is more cumbersome to do.

Is this thread part of a conversation happening somewhere else?

I'm curious what _unwriter's response would be

It's in the same place. Try adding some text outside the table tag. For example:

  (mac npage (title . body)
    `(tag html
       (tag head
         (gen-css-url)
         (prn "<link rel=\"shortcut icon\" href=\"" favicon-url* "\">")
         (prn "<meta name=\"viewport\" content=\"width=device-width\">")
         (prn "<base target=\"_blank\">")
         (tag script (pr votejs*))
         (tag title (pr ,title)))
       (tag body
         (center
           (tag (table border 0 cellpadding 0 cellspacing 0 width "85%"
                       bgcolor sand)
             ,@body)
           (prn "Copyright blah blah")))))

This seems like egregious hype mongering. Two examples:

a) "Pure functions are easily parallelizable since they encourage immutable data structures which reduce the side-effects that make code hard to run on multiple processors. This is how Bitcoin will reach its infinite scalability."

Pretty abrupt transition there from a sentence that had me nodding along to one that gives me whiplash. Wait, wha? Pure functions are used in lots of places outside Bitcoin. None of them brags infinite scalability. So perhaps you need more than pure functions?

b) "@TensorFlow uses the functional programming paradigm of lazy evaluation. A tensor flow graph exists separately to the computation of that graph.

"Bitcoin can and will be used to create true artificial intelligence."

I don't think I need to say anything about the last sentence. For the rest, the author needs to make up their mind whether the paradigm is functional programming or lazy evaluation. Lazy eval is just a mechanism. Tensorflow uses it in the part of the system that is stateless. Other parts of ML are incredibly (and incredibly subtly[1]) stateful.

My homebrew blog server has a part with lazy evaluation. It's a few lines of code. It's not going to give me infinite scalability anytime soon.

[1] Since many ML systems don't explain their models, there's a state dependency from any results they provide to all training data they've ever seen.


Saw this on HN and was going to print it off to read later. But its 38 pages discouraged such and I bookmarked it.

Looks interesting though.

2 points by rain1 25 days ago | link | parent | on: Variables & scoping complaint

point [2] sounds like a problem of non-hygienic macros. perhaps it can be reconsidered now that there's syntax objects.
3 points by rocketnia 25 days ago | link | parent | on: Using Arc in Production

I totally forgot this too. XD
2 points by rocketnia 25 days ago | link | parent | on: Variables & scoping complaint

In your example, the variables in scope inside `f` are exactly the same as the variables in scope outside of it. You're implying the "current scope" has changed, but if the set of variables in scope hasn't changed, then what other part has?

I think you were expecting a concept that Arc doesn't have. Adding an unnecessary concept to Arc would make the language more complicated for newcomers who weren't expecting it, right?

Of course, if users do consistently come in with the same intuition, it's pointless to design against it. Often we've gotta design for complex realities rather than simple principles. :) If you think it's a case like that, I can sympathize, and maybe someday I'll see it.

Sometimes I feel like general-purpose plain text programming language is such a specific topic that it leads to only one possible language design. Feeling that way is probably the only way I'll design a single language at all, rather than designing a lot of half-languages and never finishing any of them!

In this case, I actually _don't_ feel like there's _no_ potential to alternative notions of lexical scope or variable assignment, but I think Arc's at a sweet spot, and I've some extensive reasoning as to why....

---

"We can't assume that it's more likely new users will be familiar with lisp idioms."

If not some other language's idioms, where did you get the idea of there being a "current scope"?

It's true that many popular languages have features where they infer a variable declaration at some notion of "current scope" around innermost point (Python) or outermost point (CoffeeScript, Ruby, MATLAB) where a variable is assigned. Newcomers to Arc from to those languages might expect this. (I think uu must be bringing in Python experience.)

I think some languages (R, Kernel, maybe some Scheme interpreters) represent the lexical scope as a run time data structure, and variable assignments can add new variables to the local scope that were previously looked up from an outer scope. They have lexical scope, but arguably not static scope.

I also want to mention PHP, which is off doing its own thing where there's hardly any implicit inheritance between lexical scopes at all. Every variable lookup or assignment is restricted to the current function unless there's an explicit `use` or `global` declaration to imply otherwise. I kind of admire PHP's willingness to make the interaction between scopes explicit like this; it means PHP could evolve to have different parts of the code written in different languages, with explicit marshalling of values between all of them.

Newcomers coming in from any of these languages might have different expectations. And that's not to mention newcomers from JavaScript, Perl, Scheme, Common Lisp, Clojure, Erlang, Haskell, Elm, Java, C#, etc., who probably expect Arc's scoping to work exactly as it already does (or who raise completely unrelated issues, like objections to Arc's unhygienic macros :-p ).

So let's look at Arc as its own language.

Thanks to Arc's lexically scoped `fn`, it's basically an extension of the lambda calculus, and it has easy access to all known lambda calculus techniques for Turing-complete computation. This means Arc programmers basically don't have to use assignment at all unless they want to.

In Python, those lambda calculus techniques are possible to use in theory, but every nontrivial lambda must be named and pulled out onto its own line, giving us something a lot like `goto` label spaghetti.

In PHP, every nontrivial lambda must have a `use` declaration to pull in all the variables it captures. This can get to be particularly verbose, eventually to the point where it might be easier to pass around explicit context objects.

Even using lambda calculus techniques a little bit in Python or PHP means we start to have trouble with mutable variables. Lambda calculus uses functions for control flow, but using functions in Python or PHP means creating new scopes, which means we can't easily assign to outer variables from inside our conditionals and loops. Most uses of mutable variables involve some kind of conditional or loop (or variable capture for its own sake), since that's what makes them anything more than a sequence of variables that happen to share the same name. So the more we use lambda-calculus-style conditionals and loops, the less we effectively have access to mutable variables in the programs we're writing.

In both Python and PHP, it just takes a little more boilerplate to work around this: We give up on mutable variables altogether and simulate them with immutable variables that refer to mutable objects. (There's also `use (&$foo)` in PHP and `nonlocal foo` in Python, if you prefer not to give up on mutable variables, but they amount to far more boilerplate.)

The standard boilerplate for these things in Arc is pretty much less than zero, thanks to macros. An Arc programmer can write a custom conditional operator as a higher-order function, and then when they're tired of putting the conditional branches in `fn` every time they use it, they can write a macro that generates the `fn` automatically.

Since Scheme and Common Lisp were already well-worn combinations of lexically scoped `lambda`, mutation (`set!`/`setq`), and macros, all of this could pretty much be predicted when Arc was designed.

Nevertheless (or maybe out of having different goals than I'm expressing here), Paul Graham and co. tried out automatic local variables anyway. It was implemented for an early, unreleased version of Arc.[1] Then they pulled this feature out because they realized they kept introducing or removing lexical contours by mistake and breaking parts of their code.[2] I bet this is because they were implementing some of their control flow macros in terms of `fn`.

Could it be possible to follow through on their experiment without recognizing all the same mistakes and pulling the plug again? Yes, I bet it is.[3]

But I think Arc's local variable scoping rules and variable assignment behavior are exactly what they need to be:

- Implicit inheritance of lexical scope to enable lambda calculus techniques (unlike PHP).

- The easy ability to mutate variables in outer scopes so mutation can work together with lambda-calculus-style control flow (unlike Python, R, and Kernel).

This still leaves the CoffeeScript/Ruby/MATLAB approach on the table, where only the outermost assignment is treated as a declaration. I don't particularly like this approach, and that's because I prefer for the outermost level to be relatively seamless with the rest of the language. That way it's easier to break parts of the language off into optional libraries when it turns out they're not as helpful as expected. Arc's top level already isn't seamless with the rest of the language, but I think this would be a step in the wrong direction.

In summary: If users come in with incorrect ideas about Arc's variable assignment behavior based on their experience with other languages, I think that's most likely a place where other languages could learn something from Arc rather than the other way around. The higher-order techniques of lambda calculus are a sweet spot in language design, and Arc's system for local variable scope is well tailored to that. The Arc designers originally did try automatic local variables. They found them to be unnecessarily complex to work with, and I agree.

---

[1] http://www.paulgraham.com/arcll1.html "Here is a big difference between Arc and previous Lisps: local variables can be created implicitly by assigning them a value. If you do an assignment to a variable that doesn't already exist, you thereby create a lexical variable that lasts for the rest of the block. (Yes, we know this will make the code hard to compile, but we're going to try.)"

[2] http://paulgraham.com/arclessons.html "In Arc we were planning to let users declare local variables implicitly, just by assigning values to them. This turns out not to work, and the problem comes from an unforeseen quarter: macros. [...] In a language with implicit local variables and macros, you're always tripping over unexpected lexical contours. You don't want to create new lexical contours without announcing it. [...] It seemed to us a bad idea to have a feature so fragile that its own implementors couldn't use it properly. So no more implicit local variables."

[3] In Racket, the `racket/splicing` module (https://docs.racket-lang.org/reference/splicing.html) has a few rough edges, but it's a good example of how the choice of whether a macro changes the "current scope" can be controlled deliberately, even in a language with lambdas and macros. I didn't bring up Racket or Scheme's notion of "current scope" with all the other examples because it doesn't interact with variable assignment, but I think even that notion is a kind of ill-conceived complexity that I'm glad Arc doesn't have. It's handy to have local syntax that roughly resembles the top level to aid in refactoring, but on the one hand the resemblance isn't required to be perfect (and isn't perfect in Racket), and on the other hand the Scheme top level isn't very easy to make modular, so it's not even a good thing to resemble.

3 points by jsgrahamus 25 days ago | link | parent | on: Using Arc in Production

Thanks for this, "Thaddeus".

Regarding db integration, I recently read a bit on Jarc (arc on Java - http://jarc.sourceforge.net/), and the author specifically added in that ability.

2 points by akkartik 25 days ago | link | parent | on: Using Arc in Production

Ah! Sorry, my memory's not so great these days.
3 points by i4cu 25 days ago | link | parent | on: Using Arc in Production

Yep... I thought you knew..

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

More