Arc Forumnew | comments | leaders | submitlogin

Cannot get it formatted to separate lines

Looks consistent under Windows cmd: D:\anarki>arc.cmd initializing arc.. (may take a minute) Can't understand fn arg list 5750784 context...: D:\anarki\ac.rkt:432:0: ac-complex-args [repeats 1 more time] D:\anarki\ac.rkt:418:0: ac-complex-fn D:\anarki\ac.rkt:575:0: ac-mac-call .../private/map.rkt:40:19: loop D:\anarki\ac.rkt:562:0: ac-call D:\anarki\ac.rkt:526:0: ac-args D:\anarki\ac.rkt:562:0: ac-call D:\anarki\ac.rkt:575:0: ac-mac-call [repeats 2 more times] D:\anarki\ac.rkt:374:0: ac-if .../private/map.rkt:40:19: loop D:\anarki\ac.rkt:394:0: ac-fn D:\anarki\ac.rkt:562:0: ac-call D:\anarki\ac.rkt:575:0: ac-mac-call [repeats 2 more times]

Copied directory to another drive:

  Steve@DESKTOP-0SFLH1S MINGW64 /d/anarki (master)
  $ racket -v
  Welcome to Racket v8.0 [cs].

  Steve@DESKTOP-0SFLH1S MINGW64 /d/anarki (master)
  $ ./arc.sh -n
  initializing arc.. (may take a minute)
  Can't understand fn arg list 4931584
    context...:
     D:\anarki\ac.rkt:432:0: ac-complex-args
     [repeats 1 more time]
     D:\anarki\ac.rkt:418:0: ac-complex-fn
     D:\anarki\ac.rkt:575:0: ac-mac-call
     .../private/map.rkt:40:19: loop
     D:\anarki\ac.rkt:562:0: ac-call
     D:\anarki\ac.rkt:526:0: ac-args
     D:\anarki\ac.rkt:562:0: ac-call
     D:\anarki\ac.rkt:575:0: ac-mac-call
     [repeats 2 more times]
     D:\anarki\ac.rkt:374:0: ac-if
     .../private/map.rkt:40:19: loop
     D:\anarki\ac.rkt:394:0: ac-fn
     D:\anarki\ac.rkt:562:0: ac-call
     D:\anarki\ac.rkt:575:0: ac-mac-call
     [repeats 2 more times]

The Anarki fork should work, I run it in Windows.

https://github.com/arclanguage/anarki


Ok, thanks

I have found this and it looks promising. https://coderrocketfuel.com/courses/hacker-news-clone

My only concern is that it won't use the news.arc algorithm. In that case, I think I'd take the time to learn how to set up a virtual environment.


There are a number of system calls like (system "rm ...") in news.arc and other places. These run shell commands, and most of them only work on a POSIX shell. I'm sorry to say, I'm not sure anyone has ever gone through all these calls and made them portable so that news.arc can run on Windows.

If you use the Anarki master branch, I think a few of those calls have been replaced with more portable code, but not all of them. I've at least been able to get a server started up and showing content before.

I used to use Arc on Windows quite a bit, and I tried the web server a couple of times, but I never really used the web server. Nowadays I still use Windows, but I do a lot of my programming projects inside a Linux Mint VM using VirtualBox. I think running news.arc inside a VM like that would be one of the easier ways to get it working. Of course, learning to set up a VM like that could be a lot to figure out, but at least that's something a lot of people out there have already written up tutorials for.

Another possibility is to look for one of the many Hacker News clones that people have whipped up in other languages. You probably won't get to use Arc that way, but some of those clones may be better architected and better maintained than news.arc.


Ah, news.arc doesn't work on Windows, unfortunately.

I ran (load "news.arc") this time and it prints out a list of items prefixed with * redefining and 'nil' returns after the last item.

However, nothing happens at localhost8080 and when I run (nsv) it gives this message:

  The syntax of the command is incorrect.

  The syntax of the command is incorrect.
  
  The syntax of the command is incorrect.
  
  The syntax of the command is incorrect.

  'rm' is not recognized as an internal or external command,
  operable program or batch file.

  load items: Error: "directory-list: could not open 
  directory\n  path: C:\\Users\\Hopet Ma'at 
  Amun\\Desktop\\arc3.2\\arc\\news\\story\\\n  system error: 
  The system cannot find the path specified.; win_err=3"

I run this code and check http://localhost:8080/ but nothing loads.

  arc> load "news.arc"
 
  #<procedure: load>

  arc> "news.arc"
  
  arc> nsv

  #<procedure:zz>
2 points by Jonesk79 11 days ago | link | parent | on: Arc Installation

You're a great help, thanks! I was typing in Racket before racket -f as.scm, when I don't need to
1 point by akkartik 11 days ago | link | parent | on: Arc Installation

I'm not sure where the disconnect lies. I think we might need to discuss details more explicitly. What OS are you on?

It's right inside the arc3.2.tar file. Just cd into the arc3.2 directory after you expand it, and you should see it. It looks like this: https://github.com/arclanguage/anarki/blob/official/how-to-r...
2 points by Jonesk79 11 days ago | link | parent | on: Arc Installation

I got it set up in the regular terminal by adding the path to environment variables, however, it gave me the same message as before. Is there something more I should be doing with the untarred folder, maybe?

Yes, I have experience programming from years ago and recently started learning Python until I happened across Arc. I think it's neat and would be great for my project. Where is the how-to-run news in case I don't find it myself? Thanks

Do you have much experience programming? That'll help tailor advice for your situation.

The first step is to get Arc running like you asked before. After that the next step would be to go through the steps in how-to-run-news in the Arc directory.

There's a lot involved in maintaining a site for a community at this point in time. A good language can only help so much.

2 points by akkartik 12 days ago | link | parent | on: Arc Installation

It looks like you're trying to run racket -f as.scm inside Racket. It's just a terminal command. Open a new terminal (unrelated to Racket) and type it in there.
2 points by Jonesk79 12 days ago | link | parent | on: Arc Installation

After running the command, I get the following:

  > racket -f as.scm

  ; racket: undefined;

  ;  cannot reference an identifier before its definition

  ;   in module: top-level

  ; [,bt for context]

  > ; -f: undefined;

  ;  cannot reference an identifier before its definition

  ;   in module: top-level

  ; [,bt for context]

  > ; as.scm: undefined;

  ;  cannot reference an identifier before its definition

  ;   in module: top-level

  ; [,bt for context]
I think I have to somehow cd to the untarred arc3.2 but I'm not sure how to do so in the Racket App Terminal
3 points by svk 22 days ago | link | parent | on: Arc Installation

Thank you so much, zck :) I've used a combination of your helpful suggestions, stack overflow, and cd command to get to the right folder, and now it works. I got the arc command prompt (arc>) in my terminal now. I will take my time to explore the tutorial on Arc. I feel good that this community is really helpful. Thanks everyone!
3 points by zck 22 days ago | link | parent | on: Arc Installation

The "racket -f as.scm" is supposed to be done in your terminal, you're right! DrRacket is a different thing that is very cool, but not the tool to run Arc with.

When you type it in your terminal, what does it say? If it says something like "racket not found", try downloading the racket installer from https://download.racket-lang.org/.

If it installs correctly, you should be able to type "racket" (without quotes) in your terminal, and get a message "Welcome to Racket 8.0". To quit, press Ctrl-D, or type (exit) with the parentheses, then hit enter.

If that works, you should be able to run "racket -f as.scm".

2 points by svk 22 days ago | link | parent | on: Arc Installation

I downloaded and installed racket as described on arc installation page, and I got DrRacket version 8.0. The DrRacket window says: "Welcome to DrRacket, version 8.0 [cs]. Language: No language chosen; memory limit: 128 MB. DrRacket cannot process programs until you choose a programming language. Either select the “Choose Language…” item in the “Language” menu, or get guidance. > I've tried to type racket -f as.scm, but it doesn't work. I've type the same instruction in my MacBook Terminal, it doesn't work either. I don't know what to do next. Have I got the wrong racket? Thanks, jsgrahamus, for your reply :)
3 points by jsgrahamus 23 days ago | link | parent | on: Arc Installation

I saw this:

  Steve@DESKTOP-0SFLH1S MINGW64 /d/Steve - D/Documents - 
  D/Apps/Arc/arc3.2

  $ which racket
  /c/Program Files/Racket/racket

  Steve@DESKTOP-0SFLH1S MINGW64 /d/Steve - D/Documents - 
  D/Apps/Arc/arc3.2

  $ ls
  ac.scm  app.arc  arc.arc  as.scm  blog.arc  brackets.scm  code.arc  copyright  how-to-run-news  html.arc  libs.arc  news.arc  pprint.arc  prompt.arc  srv.arc  static/  strings.arc

  Steve@DESKTOP-0SFLH1S MINGW64 /d/Steve - D/Documents - 
  D/Apps/Arc/arc3.2

  $ racket -f as.scm
  Use (quit) to quit, (tl) to return here after an interrupt.

  arc> (* 1 2 3 4 5)
  120
arc>
2 points by jsgrahamus 23 days ago | link | parent | on: Arc Installation

What did you see?

I'm sorry, I really appreciate it, but right now I have other things I need to focus on. I hope we can talk about Punctaffy in the future.

I want to think more about this and continue the conversation, but I'm worried the reply window will close first.

Since I presume your input space is relatively small (the AST of a program, which usually only has a few thousand nodes), it sounds like you have some sort of state-space explosion. Your comment about recursive matching of hypertees sounds like the biggest problem. Just a shot in the dark (having not studied what you're doing yet), but is there any chance you could use partial-order reduction, memoization, backtracking, etc. to reduce the state-space explosion?

I could be wrong, but most of the other optimizations sounded like they address constant factors, like contract checking. But then I don't know much about how contracts work; I guess the verification logic could be rather involved itself.

If the window closes, maybe we could continue at #arc-language:matrix.org

2 points by shader 54 days ago | link | parent | on: Correctness and Complexity

After reading it, it doesn't focus as much on the practical aspects of complexity vs correctness in software, but does rather thoroughly cover the theory behind the problem.

I got it from a HN thread about the safety of Zig vs Rust (https://news.ycombinator.com/item?id=26537693)

From that context, the main idea that I'm thinking about is the tradeoff between "correctness" and "complexity" in an application or language.

That is, you could add complexity (language features, tools, architecture) to ensure some kinds of correctness, but that complexity adds risks of its own.

So, is it better to have a simpler language that doesn't have as many guarantees but is easier to understand and iterate with (Zig), or a more complex language that has more guarantees but at the cost of program complexity and slower builds? (Rust and Haskell)

This is the discussion that I thought y'all would be interested in.

2 points by shader 54 days ago | link | parent | on: Correctness and Complexity

I haven't read this yet, but it looks relevant to some of our past discussions.

There are a number of factors going into what makes it slow (and what might make it faster). I'm particularly hopeful about points 4 and 5 here, basically the potential to design data structures which pay substantially better attention to avoiding redundant memory use.

By the way, thanks for asking! I'm reluctant to talk about this in depth in the documentation because I don't want to get people's hopes up; I don't know if these optimizations will actually help, and even if they do, I don't know how soon I'm going to be able to work on building them. Still, it's something I've been thinking about.

1. Contracts on the whole

Punctaffy does a lot of redundant contract checking. I have a compile-time constant that turns off contract checking[1], and turning it off gives a time reduction in the unit tests of about 70%, reducing a time like 1h20m to something more like 20m. That's still pretty slow, but since this is a quick fix for most of the issue, it's very tempting to just publish a contractless variation of the library for people who want to live on the edge.

2. Whether the contracts trust the library

Currently, all the contracts are written as though they're for documentation, where they describe the inputs and the outputs. This constrains not just that the library is being used with the correct inputs but that it's producing the correct outputs. Unless the library is in the process of being debugged, these contracts can be turned off.

(Incidentally, I do have a compile-time constant that turns on some far more pervasive contract-checking within Punctaffy to help isolate bugs.[2] I'll probably want it to control these output-verifying contracts as well.)

3. The contract `hypernest/c`

One of the most fixable aspects here is that my `hypernest/c` contract checks a hypernest's entire structure every time, verifying that all the different branches zip together. If I verified this at the time a hypernest was constructed, the `hypernest/c` contract could just take it for granted that every hypernest was well-formed.

4. Avoidable higher-dimensional redundancy in the data structure

Of course, even without contracts, 20 minutes is still a pretty long time to wait for some simple tests to compile. I don't want to imagine the time it would take to compile a project that made extensive use of Punctaffy. So what's the remaining issue?

Well, one clue is a previous implementation of hypersnippets I wrote before I refactored it and polished it up. This old implementation represented hypertees not as trees that corresponded to the nesting structure, but as plain old lists of brackets. Every operation on these was implemented in terms of hyperstacks, and while this almost imperative style worked, it didn't give me confidence in the design. This old implementation isn't hooked up to all the tests, but it's hooked up to some tests that correspond to ones that take about 3 minutes to run on the polished-up implementation. On the old list-of-brackets implementation, they take about 7 seconds.

I think there's a reason for that. When I represent a hole in a hypertee, the shape of the hole itself is a hypertee, and the syntax beyond each of the holes of that hole is a hypertee that fits there. A hypertee fits in a hole if its low-degree holes match up. That means that in the tree representation, I have some redundancy: Certain holes are in multiple places that have to match up. Once we're dealing with, say, degree-3 hypertees, which can have degree-2 hypertees for holes, which can have degree-1 hypertees for holes, which have a degree-0 hypertee for a hole, the duplication compounds on itself. The data structure is using too much space, and traversing that space is taking too much time.

I think switching back to using lists of brackets and traversing them with hyperstacks every time will do a lot to help here.

But I have other ideas...

5. Avoidable copying of the data structure

Most snippets could be views, carrying an index into some other snippet's list of brackets rather than carrying a whole new list of brackets of their own. In particular, since Punctaffy's main use is for parsing hyperbracketed code, most snippets will probably be views over a programmer's hand-written code.

6. The contract `snippet-sys-unlabeled-shape/c`

There's also another opportunity that might pay off a little. Several of Punctaffy's operations expect values of the form "snippet with holes that contain only trivial values," using the `snippet-sys-unlabeled-shape/c` contract combinator to express this. It would probably be easy for each snippet to carry some precomputed information saying what its least degree of nontrivial-value-carrying hole is (if any). That would save a traversal every time this contract was checked.

This idea gets into territory that makes some more noticeable compromises to conceptual simplicity for the sake of performance. Now a snippet system would have a new dedicated method for computing this particular information. While that would help people implement efficient snippet systems, it might intimidate people who find snippet systems to be complicated enough already.

It's not that much more complicated, so I suspect it's worth it. But if it turns out this optimization doesn't pay off very well, or if the other techniques already bring Punctaffy's performance to a good enough level, it might not turn out to be a great tradeoff.

---

[1] `debugging-with-contracts-suppressed` at https://github.com/lathe/punctaffy-for-racket/blob/399657556...

[2] `debugging-with-contracts` at https://github.com/lathe/punctaffy-for-racket/blob/399657556...


Thanks for sharing! I always like ideas that integrate previously distinct concepts into a single recursive hierarchy.

I am curious what makes it slow? Is it just an implementation detail, or something fundamental to the algorithms / concepts?


I don't think so, since OP mentioned Arc 3.2 without any Nginx. I just tried it and I'm able to reproduce this issue with just the official branch in anarki (which is identical to Arc 3.2) without any Nginx.

Arc 3.2 doesn't get very frequent updates, but we should probably fix this in the stable branch. It shows the same error, and also has some errors in the log. Unfortunately I'm not sure when I can get to this. I've been having some RSI issues and time at the computer is limited at the moment.

More