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

Yeah I saw those and remember thinking they were nothing like his writings here.

Last night he started email-bombing me and others all sorts of irrelevant statements about google support, venture capital and whatnot. From midnight to 3am yesterday I received 27 emails from him. (I haven't read them all.)

-----

4 points by akkartik 4739 days ago | link | parent | on: Does Arc Support Escape Sequences?

Yes that seems right.

  arc> (prn "abc\"")
  abc"

-----

3 points by Pauan 4739 days ago | link

All of the string syntax that Arc currently uses:

http://docs.racket-lang.org/reference/reader.html?q=string%2...

Though this may change in the future, if pg switches away from Racket's reader. So I'd recommend not using any of the funky escapes.

-----


Still too big a question. It also needs elaboration. Why only? Why does efficiency matter? What are some examples of what you mean by this? How do you surmise programming might help?

-----


I'm not sure what to say. You can't judge coolness from data. Lateral thinking isn't necessary for programming. Sometimes it just takes a long time to understand; simplicity in hindsight is an illusion. What do you mean by anti-hacks?

'Paul and Robert' don't come here anymore; we hang out here, but we can't make improvements. We could setup a new site, but the issues so far seem too minor to push us to that.

You can learn more by doing, and by asking for more concrete help. I doubt I can help with the big questions, but I can try to help with smaller ones. Is there something you would like to build?

-----

[deleted]
1 point by akkartik 4741 days ago | link

Yeah you're welcome to do so. I meant only that any changes we make don't get pushed to this particular instance of the forum. But it's totally doable to say bring up a free AWS micro instance.

-----

[deleted]
2 points by akkartik 4741 days ago | link

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

You seem to be focussed on questions of the form, "Why can't an A be a B?" I ask: Why should it? Different things enrich the world and provide opportunities for future cross-fertilization.

Don't try to think just like someone else. The world needs more unique snowflakes. Sadly, and unlike what others tell us, we don't start out unique. But fortunately we can change that.

-----

[deleted]
2 points by rocketnia 4741 days ago | link

"How do math people ensure parity between what they obsess about and reality?"

I think what math people obsess about is always reality. The fact that they are obsessing about it at all is a real phenomenon, and we can think about tracing it back to its most immediate cause. That immediate cause is likely to be a very math-like problem in need of a solution. The not-so-math-like problem which inspired that math-like problem may be an awfully long way from where we started searching, but it's still connected.

Some mathematicians (the pure mathematicians) may pursue math-like curiosities without much regard for where they're going. Still, their own intuition and sense of elegance will constrain their discoveries to forms that can come in handy later on. In this case, mathematics acts as a bridge that starts from today's human intuition and elegance and connects to tomorrow's newfound human problems.

Clearly you're looking for an efficient connection, not just any connection. I suspect the only way to find that is to keep yourself in a state of perpetually looking, even as you continue with what you're doing. Be your own JIT compiler--and yet, don't let a JIT compiler be all that you are.

That's my two cents, anyway. I'm not sure this topic is concrete enough to help by much. ;)

-----

[deleted]
2 points by akkartik 4741 days ago | link

It's up to you. I prefer to bind a consistent identity everywhere.

-----

1 point by akkartik 4742 days ago | link | parent | on: Common Lisp koans

"For any aspiring koan writers, Arc and Scheme lack koans." https://news.ycombinator.com/item?id=5803678

-----


I've been maintaining a fork with keyword args: http://github.com/akkartik/arc. Wart has them as well.

-----


Racket has ways to create mutable strings: http://docs.racket-lang.org/reference/strings.html#%28def._%...

But it's not immediately clear to me how to use them in arc.

-----

3 points by dram 4749 days ago | link

Find this thread in plt-scheme mailing list that pg posted several years ago.

http://comments.gmane.org/gmane.lisp.scheme.plt/14787

It seems that this problem had once been solved, but occurred again.

-----

5 points by akkartik 4749 days ago | link

Yeah, very strange.

In ac.scm, in the arc compiler ac, arc strings are translated using ac-string. I've tried instrumenting the output of ac-string, and it seems mutable when it's encountered. And yet it's immutable by the time I return to the prompt:

  arc> ($.immutable? "abc")
  #f  # printed inside *ac-string*
  #t  # return value
Very strange.

---

I tried bisecting the git history, and the stable branch, which still requires mzscheme, has mutable strings. But sometime in 2011 when the master branch switched to using racket and stopped working with mzscheme, strings went immutable again. Still investigating..

---

Back in Feb 2011, waterhouse provided a bugfix for arc's mutable pairs. http://arclanguage.org/item?id=13616. https://github.com/arclanguage/anarki/commit/cea8a4c5e9. This change requires a racket-only lib, and so arc stopped working with the old mzscheme versions. Prior to it, modifying strings worked in mzscheme but not in racket. So it seems to be something about the move from mzscheme 372 to racket.

---

Update 34 minutes later: It seems eval in racket emits immutable strings even when given mutable strings. Since everything passes through racket's eval it doesn't matter how much arc twists and turns to avoid immutability.

  $ racket
  > (immutable? "abc")
  #t
  > (immutable? (string-copy "abc"))
  #f
  > (immutable? (eval (string-copy "abc")))
  #t

-----

4 points by dram 4749 days ago | link

Yes, That is the problem!

Here is a quick and dirty patch for arc3.1, it postpones string-copy and let it run by eval.

Not sure if it will cause some other problem.

  50,51c50,51
  <           (unescape-ats s))
  <       (string-copy s)))          ; avoid immutable strings
  ---
  >           `(string-copy ,(unescape-ats s)))
  >       `(string-copy ,s)))          ; avoid immutable strings

-----

3 points by Pauan 4748 days ago | link

Fixed in Arc/Nu:

https://github.com/Pauan/ar/commit/a2c1939936846b665eccf06d0...

Thanks for finding the bug, and the great idea for fixing it.

-----

3 points by dram 4748 days ago | link

Your fix is cleaner. :)

BTW, I think `(unescape-ats s)` also needs to be treated as the same.

So that it will not fail when atstrings is set.

-----

1 point by Pauan 4747 days ago | link

Ah yes, excellent catch:

https://github.com/Pauan/ar/commit/95f13f757a52a5d07f5467603...

-----

1 point by akkartik 4749 days ago | link

Ingenious! Do you have a github account? You should be the one to fix this in anarki :)

-----

2 points by dram 4749 days ago | link

OK.

I'd like to run some tests to make sure it does not cause much problem.

I found this one:

https://github.com/conanite/rainbow/tree/master/src/arc/lib/...

But it failed with following error when using arc3.1.

  arc> (load "unit-test.arc")
  nil
  arc> (rat)
  Error: "_dfn: undefined;\n cannot reference undefined identifier"

-----

2 points by akkartik 4748 days ago | link

That's a good idea. Did the tests pass without your changes?

I've added a few piecemeal tests over the years (all the .t files in the repo), and there's also some tests in my curated repo (http://github.com/akkartik/arc). All those seem ok..

---

Looks like dfn is a rainbow innovation: http://arclanguage.org/item?id=10539

---

Update 1 hour later: almost all rainbow tests pass! I had to disable the dfn tests, and the ssyntax tests at the bottom of core-evaluation-test were hanging. Other than that it's all good.

-----

2 points by dram 4748 days ago | link

Great!

I'll make a pull request later.

-----

2 points by akkartik 4748 days ago | link

Thanks for the commit! I've merged https://github.com/arclanguage/anarki/commit/1bc954f598 and given you commit rights to anarki.

I've also added/plagiarized rainbow's tests to the repo: https://github.com/arclanguage/anarki/commit/68be3c0f4d. Joys of the perl artistic license.

There's still a couple of syntax tests that are failing, likely because of test harness issues. And I'd like to unify all the different tests into a single framework. For future work..

---

Update 43 minutes later: it turns out rainbow's ssyntax precedence rules were different. Perhaps anarki changed at some point. Those tests are now fixed.

-----

1 point by dram 4748 days ago | link

Thanks, well done.

-----


Create a separate VirtualHost in your apache config with a ServerName of news.myname.com, etc. I haven't done this precise configuration before, but Googling brings up howtos like https://httpd.apache.org/docs/2.2/vhosts/examples.html.

-----


Wart uses the @splice notation. I've sung its praises before: http://arclanguage.org/item?id=17281

-----

3 points by shader 4762 days ago | link

This relates to yet another idea I think I've actually mentioned before.

Namely, making the lists that form the code/ast have reverse links, so you can mutate above the macro call level, instead of just insert arbitrary code in place. This wouldn't be feasible for general lists, as it is possible for a sub-list to be referenced in more than one place, but for code, each piece is generally considered unique even if it looks the same.

Anyway, this would allow for affects ranging from splicing to arithmetic and other much more evil and nefarious but possibly useful effects. I haven't thought through all of the implications, and I bet most of them are negative, but it would still be interesting to consider.

An implementation of intermediate splicing would be something like:

  (mac (list)
    (= (cdr list) (cdr (parent)))
    (= (cdr (parent)) list))
Where you replace (parent) with whatever technique would get the parent cons cell whose car is the macro call.

-----

3 points by rocketnia 4760 days ago | link

"An implementation of intermediate splicing would be something like[...]"

Which of these interpretations do you mean?

  (list 1 2 (splice 3 4) 5)
  -->
  (list 1 2 3 4 5)
  
  
  (list 1 2 (splice (reverse (list 4 3))) 5)
  -->
  (list 1 2 3 4 5)
I wrote the rest of this post thinking you were talking about the first one, but right at the end I realized I wasn't so sure. :)

---

"Namely, making the lists that form the code/ast have reverse links, so you can mutate above the macro call level, instead of just insert arbitrary code in place."

I'll make an observation so you can see if it agrees with what you're thinking of: The expression "above the macro call level" will always be a function call or a special form, never a macro call. If it were a macro call, we'd be expanding that call instead of this one.

---

For these purposes, it would be fun to have a cons-cell-like data structure with three accessors: (car x), (cdr x), and (parent x). The parent of x is the most recent cons-with-parent to have been constructed or mutated to have x as its car. If this construction or mutation has never happened, the parent is nil.

Then we can have macros take cons-with-parent values as their argument lists, and your macro would look like this:

  (mac splice list
    (= (cdr list) (cdr (parent list)))
    (= (cdr (parent list)) list))
Unfortunately, if we call (list 1 2 (splice 3 4) 5), then when the splice macro calls (parent list), it'll only see ((splice 3 4) 5). If it calls (parent (parent list)), it'll see nil.

---

Suppose we have a more comprehensive alternative that lets us manipulate the entire surrounding expression. I'll formulate it without the need to use conses-with-parents or mutation:

  ; We're defining a macro called "splice".
  ; The original code we're replacing is expr.
  ; We affect 1 level of code, and our macro call is at location (i).
  (mac-deep splice expr (i)
    (let (before ((_ . args) . after)) (cut expr i)
      (join before args after)))
If I were to implement an Arc-like language that supported this, it would have some amusingly disappointing consequences:

  (mac-deep subquote expr (i)
    `(quote ,expr))
  
  
  (list (subquote))
  -->
  (quote (list (subquote)))
  
  
  (do (subquote))
  -->
  ((fn () (subquote)))
  -->
  ((quote (fn () (subquote))))
  
  
  (fn (subquote) (+ subquote subquote))
  -->
  (fn (subquote) (+ subquote subquote))

-----


Previous submission: http://arclanguage.org/item?id=16721

-----

3 points by shader 4765 days ago | link

Not so. He restarted the wat project, with the goal this time being a super lightweight vm on which to build more useful languages. For now, the code is only ~350 lines of javascript and there's no parser or anything, it just uses json lists of strings. With the core wat-in-wat pieces, it comes up to just over 500 lines.

-----

1 point by akkartik 4765 days ago | link

Ah!

-----

More