Arc Forumnew | comments | leaders | submitlogin
3 points by akkartik 3286 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Ah, you're right. Looks great now!
4 points by zck 3286 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Yes, it's a desired feature that a suite can't contain two things with the same name -- either suites, tests, or one suite and one test. This is because I want names to be unique. Saying (test cut.finds-element-in-suite) shuld run only one test.

What you ran into is actually a bug I fixed at a meetup on Tuesday. The current error message is:

  Error: "In suite cut, there are two things named finds-element-in-string."
The commit is here: https://bitbucket.org/zck/unit-test.arc/commits/bb41b4183938.... Can you re-pull (hg pull; hg update) and see if it works then? The most recent commit is 96652e5.
4 points by akkartik 3287 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

I've updated my script to auto-upgrade Anarki tests[1], and things look pretty good. Just a couple of minor comments:

a) I see a message about redefining assert. Perhaps we should change the name in Anarki or unit-test.arc?

b) The new version complains about duplicate nested suite names inside a test suite. That seems like a reasonable idea, and I just want to confirm that it's intended.

c) If you have a duplicate test name in a suite the error is confusing. Here's the example I ran into from Anarki:

  $ cat x.arc
  (load "unit-test.arc/unit-test.arc")

  (suite cut
    (test finds-element-in-string
      (assert-same '(3 4 5) (cut '(1 2 3 4 5) 2)))
    (test finds-element-in-string        ; duplicate name
      (assert-same "cde" (cut "abcde" 2)))
  )

  (test)

  $ ./arc.sh x.arc
  Can't coerce  #<procedure: cut> string
    context...:
     anarki/ac.scm:1015:0: ar-coerce
      map1
      map1
      string
     anarki/ac.scm:1279:0: aload1
Once you switch to unique names everything works fine. But perhaps we can improve the error message?

[1] I'll post the final script here once we "launch".


I just want to point out a conversation I had with fauria on GitHub, in case others here have ideas. Currently the HN code doesn't support keeping the HN data (.../anarki/www) on a separate partition from the code (.../anarki) as Docker would like to do to maintain stateless containers. This is because any file creation which performs a create-then-rename first creates the temporary file in .../anarki/tmp. Renames then fail if .../anarki/www is in a different volume.

I'm not sure what the cleanest fix is here.

https://github.com/arclanguage/anarki/issues/59#issuecomment...

3 points by zck 3289 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Yeah, that was right. Thanks for catching the readme changes -- I guess I had made some but not all.
3 points by akkartik 3290 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Hmm, strangely I just sent you a pull request to update the Readme. I'm not too familiar with Mercurial or Bitbucket; maybe I'm doing something wrong?

https://bitbucket.org/zck/unit-test.arc/pull-requests/2/upda...

I'll play with it today or tomorrow and make sure all of Anarki's tests update correctly.

3 points by zck 3290 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Heh, no worries. It's taken me, oh, 202 days to update the dang library (I feel like my macro skills have something to be desired, or it would be easier). So no worries about taking four to see this. I was planning on pinging you in a few days if you hadn't seen this.

A coordinated launch would be cool. I'm pretty much ready here; the readme is updated (although it does not explicitly have a version number, which I should add).

But before we get into that, would you mind playing with it a little bit to see if there's anything broken or not working? Thanks.

3 points by akkartik 3290 days ago | link | parent | on: Unit-test.arc 1.0 incoming (part II)

Ooh, cool! Let me brush the bitrot off my automatic migration script to update the Anarki tests. Maybe we can do a coordinated launch :o)

(Sorry I just saw this. My muscle memory has been getting into this bad habit lately where I visit only the /newcomments page and not the /new page.)

3 points by keat 3291 days ago | link | parent | on: [Beginner question] New concepts in Arc

You might want to check out Hoon for Urbit. http://urbit.org/docs/hoon/mission/

I'm currently working on it. It's not being that easy though: https://github.com/arclanguage/anarki/issues/59

Hi,

I've reread the article and You are right, the author's intention seems to be getting rid of unnecessary constructs. I guess then that I'm looking for something that Arc is not (powerful abstractions included in the language from the get-go).

Thanks for the answer! Radek

5 points by malisper 3297 days ago | link | parent | on: [Beginner question] New concepts in Arc

I don't think there is any one particular feature that is groundbreaking in Arc, although as a whole, Arc does have some interesting qualities. For example, code in Arc is much more succinct than code in other languages. When designing Arc, Graham would write a piece of code. He would then look at that piece of code and figure out what features would allow him to make that piece of code shorter. From there, he would implement that feature and rewrite the code. Due to this process, Arc has a large number of very simple utilities (e.g. check). With all of these utilities, code in Arc is much more concise than the equivalent code in other languages.
5 points by malisper 3297 days ago | link | parent | on: [Beginner question] New concepts in Arc

"Hundred Year Language" is a bit of misnomer. Graham's original essay is a thought experiment on what the language we will be using in a hundred years will look like. Graham believed it would be useful to try and implement the language we will be using in a hundred years and in doing so, came up with Arc.
5 points by akkartik 3297 days ago | link | parent | on: [Beginner question] New concepts in Arc

Others may disagree here, but I don't think Arc was really intended to contain new concepts. The phrasing of "Hundred Year Language" was I think a nod to timelessness rather than novelty. It was an attempt to take questionable novelties out of Lisp (like hygienic macros) and to clean up ill-thought-out interfaces (the keyword choices you alluded to).

There's a nice description of this project at https://combinatorylogic.wordpress.com/2015/01/14/bootstrapp...

I haven't seen anything like that, but it should be pretty easy for someone to create such an image.
2 points by Oscar-Belletti 3319 days ago | link | parent | on: A keyword param implementation

My pleasure
3 points by mpr 3320 days ago | link | parent | on: A keyword param implementation

Thanks again!
3 points by Oscar-Belletti 3320 days ago | link | parent | on: A keyword param implementation

Now the next function returns the next index and not the next element. iter still evaluates list two times and els can cause variable capture.

    arc> (mac iter (var list . body)
          (let i (uniq)
            `(if (is nil ,list)
               nil
               (withs (els ,list
                       ,i 0
                       ,var (els ,i)
                       next (fn () (++ ,i)))
                 (while (< ,i (len els))
                   (= ,var (els ,i))
                   ,@body
                   (next))))))
    #(tagged mac #<procedure: iter>)
    arc> (iter a '(1 2 3) (prn a))
    1
    2
    3
    nil
    arc> (iter els '(1 2 3) (prn els))
    Error: "car: contract violation\n  expected: pair?\n  given: 1"
    arc> (iter a '(a b c d) (prn a ", " (next)))
    a, 1
    c, 3
    nil
This should fix the problems:

    (mac iter (var lst . body)
        (w/uniq (i elst)
          `(let ,elst ,lst
            (if (is ,elst nil)
              nil
              (withs (,i 0
                      ,var (,elst ,i)
                      next (fn ()
                             (++ ,i)
                             (= ,var (,elst ,i))))
                (while (< ,i (len ,elst))
                  (= ,var (,elst ,i))
                  ,@body
                  (++ ,i)))))))
3 points by mpr 3321 days ago | link | parent | on: A keyword param implementation

Thanks for pointing that out. I think I fixed both those problems here.

    (mac iter (var list . body)
      (let i (uniq)
        `(if (is nil ,list)
           nil
           (withs (els ,list
                   ,i 0
                   ,var (els ,i)
                   next (fn () (++ ,i)))
             (while (< ,i (len els))
               (= ,var (els ,i))
               ,@body
               (next))))))

Looks like Scala has some experimental macro feature: http://docs.scala-lang.org/overviews/macros/overview.html. I imagine people will be about as likely to use it as they've been to use previous non-lisp macros (i.e. not very likely).

OP isn't about macros because the output of the function isn't automatically evaluated. It's a step in the direction of allowing any programmer to perform compiler transformations and optimizations on his/her own code. I'm very interested in that area.


So now Scala has got macros?

Are they comparable to lisp ones? What do you think?


The key idea: turn strings to code inside quasiquote, and turn code to strings inside unquote.

https://scala-lms.github.io/tutorials/02_basics.html


Great idea! You should put your unit-test.arc in there.

Edit: added a couple of things.

4 points by zck 3327 days ago | link | parent | on: Ask Arc: How to improve the Arc ecosystem?

I think it would be useful to have things built in Arc. That way the language can feel like there's more life in it. Right now there aren't too many things built in Arc that aren't part of the language ecosystem.

To promote that, it would be useful to have a page that lists things built in Arc. I just made a page on the Anarki wiki here: https://github.com/arclanguage/anarki/wiki/Things-built-in-A...


"..I DID spot a couple of web pages.."

I was wondering which pages you're aware of, since that will help put your statements in context. Can you share a few links?

I no longer do much programming in Arc. I mostly just hang out here to talk about interesting programming language ideas, and to answer any questions from newcomers. It's unclear how much benefit there is in polishing a language nobody uses. But if you choose to create new docs I'd love to help proof-read them. Who knows, maybe I'll even be inspired to contribute.


For sure!

If you've seen something like the Rust Handbook, that would be one end-goal of documentation I would want to implement. For most other programming languages, there's a multitude of resources available for people to study and learn with. Arc just has a couple of web pages focused towards it, to be honest. We have the tutorial and the various documentation on the different functions of the Arc language.So, I DID spot a couple of web pages, but I'm not so sure if they'll be helpful for new programmers to the language.

Thoughts, criticism, complaints?


"..documentation for newbies needs to be improved HEAVILY."

Can you clarify what documentation you're thinking of?


Responding to my own post is kind of tacky, but it's a good place for me to throw out ideas.

One thing for certain is that I think documentation for newbies needs to be improved HEAVILY. For anyone starting out, they should be able to get a basic application up and running in no time. Still need to figure out a way to host it somewhere.


> I think you should be able to shadow @'s names, and then, if you need them, call them with the @.

Ah, that is a good idea! That can work

> Imagine a service which supports both int/number's actions and variable actions. [...]

I see. I really think that would be an awesome improvement of the language. I have made a git issue for it. And when I have the time I would love to branch the code and make an attempt at it.

Really appreciate your input on the language. Now I just need some spare time to do these things :)

More