Arc Forumnew | comments | leaders | submitlogin

I was doing a deep-`iso` comparison I called `same`, because in Arc, hash tables are not the same. In Arc3.1:

  arc> (iso (obj) (obj))
  nil
  arc> (iso (obj 1 2) (obj 1 2))
  nil
So I made a function that iterated over the key/value pairs and compared them. In some unit tests, I used that on a hash table that contained functions. Yesterday, I refactored the unit tests to instead make sure the keys were right.

Interestingly, it seems that Anarki can compare hash tables:

  arc> (iso (obj) (obj))
  't
  
  arc> (iso (obj 1 2) (obj 1 2))
  't
Anyway, this should fix the unit test tests in the Anarki repo.

At one point, years ago, I relied on every lambda returning a newly allocated object. I think I brought it up as a bug in Rainbow that the [] expressions in my Arc code were generating the same lambda-lifted result instead of creating unique objects each time.

But I think this was never something I could rely on in the original, Racket-based Arc either. The Racket docs don't specify whether a lambda expression returns a new object or reuses an existing one, and in fact they explicitly allow for the possibility of reusing one:

"Similarly, evaluation of a lambda form typically generates a new procedure object, but it may re-use a procedure object previously generated by the same source lambda form."

That sentence has been in the reference since the earliest versions I can find online:

The latest docs, currently for 8.1 (2021): https://docs.racket-lang.org/reference/Equality.html#%28part...

5.0 (2010): https://download.racket-lang.org/docs/5.0/html/reference/eva...

4.0.0.1 (2008): https://web.archive.org/web/20080620030058/http://docs.plt-s...

3.99.0.13 (2008): https://web.archive.org/web/20080229164003/http://docs.plt-s...

I'm not sure if the bug you're referring to had to do with making the same mistake I was making back then, or if you're talking about making the opposite assumption (expecting two procedures to be equal), but it's probably best not to expect stability either way.


Updated unit-test.arc to the latest. PR at https://github.com/arclanguage/anarki/pull/205

Hrm, this should have been failing for a while. It comes down to functions never being able to be `iso` to each other.

  arc> (iso (fn ()) (fn ()))
  'nil
I suspect this might've changed in the new Racket? I hope this hasn't snuck through for so long.

Anyway, working on a fix now.


It's printing out the two values it's comparing. Not sure yet why they're not the same.

It makes more sense when you see an error message like "should be 3 but instead was 2".


>should be nil but instead was nil

I'm sorry, what?


Not on you. I know we forked it as well a while ago.

Oh jeez, let me take a look.

I also see some failures in unit-test.arc:

    (require 'lib/unit-test.arc/unit-test.arc)
    (load "lib/unit-test.arc/tests.arc")
    (test-and-error-on-failure)

    unit-test-tests.suite-creation.add-tests-to-suite.tests-are-wrapped-to-create-test-result-template failed: (isa result (quote table)) should be nil but instead was nil
    unit-test-tests.remove-thing.remove-nothing-from-single failed: (remove-thing (quote (not-found)) single-suite) should be (obj (single #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((nested . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash())))) but instead was (obj (single #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((nested . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash()))))
    unit-test-tests.remove-thing.remove-nested-test failed: (remove-thing (quote (single double one)) two-nested-tests) should be (obj (single #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash((double . #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((two . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash()))))) (suite-name . suite-with-no-name) (tests . #hash())) #hash())))) but instead was (obj (single #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash((double . #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((two . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash()))))) (suite-name . suite-with-no-name) (tests . #hash())) #hash()))))
    unit-test-tests.remove-thing.remove-one-of-two-suites failed: (remove-thing (quote (first)) two-suites) should be (obj (second #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((nested . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash())))) but instead was (obj (second #s(ar-tagged tem (suite #hash((full-suite-name . suite-with-no-full-name) (nested-suites . #hash()) (suite-name . suite-with-no-name) (tests . #hash((nested . #s(ar-tagged tem (test #hash((suite-name . test-with-no-suite-name) (test-fn . #<procedure: g5264>) (test-name . test-with-no-name)) #hash())))))) #hash()))))

Hrm. The tests definitely were faster. They weren't as fast as I'd wanted, but certainly not this slow. It just took three minutes for me to load that file. It's slightly complicated by that file loading _and_ running the tests, but again, it wasn't that slow before. For reference, I'm on Ubuntu running Racket 8.1.

One thing that definitely has changed is that now, Anarki requires Racket >=7.7. I just had to update my Racket from 7.2, which worked the last time I ran Anarki, Perhaps this is related?


Odd that downloading it again caused it to work.

I downloaded a new version, and it started just fine. Thanks.

Thanks for checking in. The dates of the files in the directories is 2018. I downloaded recent version and gave it a spin: It took about a minute to start up and then I ran (app-start "news") and it started the news app.

Thanks again.

Steve

1 point by krapp 1444 days ago | link | parent | on: Trouble running Anarki on Windows 10 Home

If you're on Windows, try starting it with arc.cmd.

Then to run Anarki (app-start "news") at the prompt.


It does work on my Mac with Racket v8.0. I'm at commit 009a8d9388 in the Anarki repo (May 9)

I'm not sure what's going on! Did it used to work for you on Windows 10? How long is the possible window of breakage?


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 1456 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 1456 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 1456 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
More