Arc Forumnew | comments | leaders | submit | akkartik's commentslogin
1 point by akkartik 4154 days ago | link | parent | on: Awesome Python

You should build it! It'll be a lot shorter :)

-----

2 points by akkartik 4164 days ago | link | parent | on: Bug in cut

Yeah, none of those call sites seem responsible, as far as I can see. The calls in markdown and unmarkdown only trigger if the string starts with certain chars, which it doesn't. Remind me, are you using anarki?

-----

2 points by lark 4160 days ago | link

I'm using Arc 3.1.

I should have investigated this bug further when it happened.

-----

2 points by akkartik 4159 days ago | link

Ah, you're using arc 3.1 without the mutable-pair bugfix: http://arclanguage.org/item?id=18070. Anything can happen after a race condition. Hold on, let me patch that bug to the stable branch so you can pick it up.

Edit 1 hour later: Done, https://github.com/arclanguage/anarki/commit/b683a84a68. lark, can you start using this stable branch? Should be a lot less disruptive than migrating to anarki, and will also help us better help you.

-----

2 points by lark 4157 days ago | link

Thank you for tracking down and pointing out the mutable pairs issue.

I wish there was a version of Arc that made it clear what was changed in it, and made it easy to not apply some changes. A version that consisted only of:

- the original, untouched, Arc 3.1 -- however broken it might be.

- a single Arc file called fixes.arc that contains all fixes needed as redefinitions (say, the bugfix for cut). This is different than modifying the originals; you always know what was modified.

- a collection of .patch files, to patch what can't be provided in fixes.arc (like ac.scm)

- a script called arc.sh that (a) deletes all patched files, (b) creates new copies of the original files (untouched), (c) patches them, (d) starts Arc.

About the github commit link, I don't understand what's going on with it:

- I don't know what kind of branch this is -- is this Arc 3.1 or Anarki? I want to keep using Arc 3.1.

- If it's Arc 3.1 why is it named Anarki?

- Is there a way to get a diff? If not, how do I extract this branch and then get a diff (do I need a different link, and if so which one?) Is there a way to not use git?

(Couldn't this be easier? Why is there so much work involved? I think I want a new way to organize programs.)

-----

3 points by akkartik 4157 days ago | link

You know, you don't have to switch to the entire 'stable' branch. Just apply the patch linked to in my last comment. It doesn't rely on anything outside arc3.1.

Anarki has multiple branches: http://i.imgur.com/WefAVGX.png. Notice the branches 'official' and 'stable'. 'Official' is just the various releases of arc, and 'stable' is releases + small bugfixes. To see what's changed in 'stable' since arc3.1, look at the list of commits: https://github.com/arclanguage/anarki/commits/stable. There's only 15 commits or so on that page after the arc3.1 release, and you can click on them to see what was changed. Scanning the list, really there's no other important bugfixes.

I keep a directory called arc3.1 by doing:

  $ git clone http://github.com/arclanguage/anarki arc3.1
  $ cd arc3.1
  $ git branch -a  # list all branches
  $ git checkout stable
I can then see the same list of commits by typing 'git log'. Or generate diffs by typing:

  $ git diff remotes/origin/official
This is enough information for you to create and manage a repo just how you described. I have a slightly different itch, so I have a different approach: http://github.com/akkartik/arc. Back before me, a user called aw created a new approach as well: http://awwx.ws/hackinator, which I doubt is actively maintained. You should create one too and show us. If it's substantially better we'll switch to it. Over time.

I'm sure everything could be much better. (I'm trying to create a new way to organize programs, after all: http://akkartik.name/about.) But no matter how you organize programs, people would still need to know about some baseline tools, like diff and patch and scripts in your description above. For anarki you need to learn some git at the moment.

-----

2 points by rocketnia 4156 days ago | link

If you're going to resort to patches to manage code as text, that's what source control systems like Git are good for. They also manage the emergent complexities with this approach:

- They help highlight one version of the code as the canonical one that most people are expected to be using. That way development effort isn't wasted on out-of-date code combinations that nobody cares about.

- They provide ways to merge textual changes, revert them, and otherwise apply them out of order.

What you have in mind might be a coherent alternative to the existing version control systems, so I'm not just saying to give up. :)

---

"Is there a way to get a diff?"

Git makes it easy to create diffs (using the "git diff" command with various arguments), and GitHub makes it particularly easy to view certain kinds diffs on the Web. In GitHub, if you're on the stable branch and you click the "commits" button you get to this page:

https://github.com/arclanguage/anarki/commits/stable

Clicking each commit message will take you to a page that shows the diff for that commit. For instance, here's the mutable pair bug fix:

https://github.com/arclanguage/anarki/commit/b683a84a6831fd4...

Don't bother trying to copy and paste a diff from GitHub though. I think you'd have better luck at a command line, even if it means learning several commands. (I'm not sure I know all the right commands myself though. >.> )

---

"If it's Arc 3.1 why is it named Anarki?"

There are a lot of ways to answer that question. If someone wants to make a contribution to Arc so that every other Arc user can benefit, that's what Anarki is for. However, not everyone uses Anarki, so the fantasy is that it's Arc, but the reality is that it's a specific project that we refer to by a specific name.

I'm not actually sure why that branch of Anarki exists, but it looks like it was created to support plain Arc 3.1 coding without all the extensions people made to the master branch. Its differences mostly have to do with adding text editor extensions and shell commands to support Arc 3.1 programs.

-----

1 point by akkartik 4156 days ago | link

"Don't bother trying to copy and paste a diff from GitHub though. I think you'd have better luck at a command line, even if it means learning several commands. (I'm not sure I know all the right commands myself though. >.> )"

True. I coulda sworn github had a raw view. Was that just for snapshots?

-----

2 points by rocketnia 4156 days ago | link

They have a raw view for files, but I haven't seen one for diffs.

-----

2 points by akkartik 4156 days ago | link

Yeah. BTW, the command for viewing a commit is 'git show'. In this case:

  $ git show b683a84a68

-----


Ohh, did you mean bindings for http://download.plt-scheme.org/doc/html/reference/Command-Li...?

-----

2 points by svetlyak40wt 4161 days ago | link

Yes, I mean exactly something like this :)

-----

2 points by akkartik 4161 days ago | link

Great. We still needed some way to pass args to arc, so my changes aren't totally useless.

-----


I'm still trying to get the solution to work, but the last time this came up was http://arclanguage.org/item?id=10344.

-----

1 point by akkartik 4165 days ago | link

Ok, try it now:

  anarki $ git pull  # should now have a file called 'arc'
Now an executable file like this (called say x.arc) works:

  #!/PATH/TO/arc
  (prn argv)  ; argv now contains commandline args
Try it out:

  anarki $ ./x.arc a b c
  (./x.arc a b c)
The repo is a little messy now. I had to create a new asv.scm that looks substantially like as.scm, and the 'arc' script is in addition to the older 'arc.sh' which is for interactive use (and which I don't use, preferring to directly 'racket -f as.scm'). Anybody have suggestions for either? Should we rename the old arc.sh to 'iarc'?

-----

1 point by akkartik 4160 days ago | link

I've cleaned up the messiness and duplication. The hoary as.scm is now boot.scm, and it's going to mess up all our 'racket -f as.scm' muscle memory. The top level script is now arc rather than arc.sh. Let me know if you were relying on its ability to run several arc files at the commandline. Or just revert my change :)

https://github.com/arclanguage/anarki/commit/a03a21fb84

-----

1 point by akkartik 4168 days ago | link | parent | on: Problem with auto-uniqs

Hmm, I've never seen this idea before and haven't seen any system supporting it. Does clojure?

Can you give an example where it's useful?

-----

2 points by malisper 4168 days ago | link

The idea behind autouniqs is that they remove some boilerplate code (ie w/uniq). The current implementation of autouniqs[0] is actually broken. The problem boils down to the fact that with the current implementation, macros will wind up using the same uniqs every time they are expanded. Say accum was implemented using autouniqs.

  (mac accum (accfn . body)
    `(withs (acc@ nil ,accfn [push _ acc@])
       ,@body
       (rev acc@)))
The intention is acc@ will be replaced with a uniq every time accum is expanded. With the current implementation of autouniqs, acc@ will be replaced with a single uniq in accum's definition. This leads to problems with nested use of accum.

  (accum a
    (accum b
      (...)))
What clojure does to solve the problem is combine "autogensyms" with its implementation of backquote. All the symbols ending in '#' inside of the same backquote are replaced with gensyms when the backquote is evaluated. While clojure's implementation is good for most things, it breaks down with any kind of nested backquotes [including `(... ,(... `(...)))] since the autogensyms will not be the same inside all of the backquotes. I think tying the autogensyms to backquote is a requirement due to the fact that every time the backquote is evaluated new gensyms would have to be put in to replace all of the autouniqs/gensyms (feel free to prove me wrong). This becomes obvious when one starts thinking about macros with nested backquotes and how they would expand. What I want is some version of autouniqs such that they completely eliminate the need for w/uniq.

[0] http://www.arclanguage.org/item?id=18235

-----

2 points by akkartik 4168 days ago | link

Yeah, I actually thought about this use case back when I wrote accum for wart. But there's no problem here since the two expansions also create lexical scopes. In unmodified anarki:

  arc> (mac foo (accfn . body)
         `(withs (acc@ nil ,accfn [push _ acc@])
            ,@body
            (rev acc@)))
  #(tagged mac #<procedure: foo>)
  arc> (foo a
         (each l '(1 2 3)
           (a:foo b
             (each m (list l (+ l 1) (+ l 2))
               b.m))))
  ((1 2 3) (2 3 4) (3 4 5))
Is there some other scenario that I'm not considering?

(I hadn't realized that w/uniq is superior to implicit gensyms in this regard. Thanks.)

-----

2 points by malisper 4167 days ago | link

Okay, so the example with accum actually does work fine, but, only due to lexical scoping. I'm still afraid of the possibility of macros using the same symbols and causing a collision. While it looks like it would be an extremely rare bug to find, it would be one of those bugs that are a real pain to debug.

-----

2 points by akkartik 4167 days ago | link

Agreed. Which is why we should pool resources and share the first time we encounter such a bug. Or even a possible such bug that we can then debug together.

For my part, I have had an eye out for it for three years and have yet to encounter such a bug. Here's my hand-wavy reasoning for why I think it can't happen: for it to happen, an outer macro would have to rely on a use of a specific gensym inside a nested macro. I can't imagine how that could happen short of actually trying to use a gensym:

  (macro1
    (macro1
      ..x23..))  ; brittlely relying on the gensym turning into *x23*
And if we are to worry about this we can worry about all gensyms anyway.

-----


I'm ambivalent about the feature as well, but you should be able to double @'s to insert a literal @. In anarki:

  arc> "abc@@example.com"
  "abc@example.com"

-----


Yes, posting here is best. Sorry I think I missed one of your emails? Was out of town for a while.

-----

2 points by tvvocold 4169 days ago | link

Thx,i have almost done my arc site,but when a user forgot his password and he need to reset by email,but cannot get the email...i wanna know how to add email feature in arc site? by the way,i use mailgun.com to send and they give me HTTP API.like this http://documentation.mailgun.com/quickstart.html#sending-mes...

-----

1 point by akkartik 4168 days ago | link

Anarki doesn't have mailgun support yet. It will reset passwords if your server supports sending email using the local unix sendmail command. So I can think of two options:

a) Does mailgun provide a sendmail command that you can download? If so, just installing that might be all you need.

b) Anarki has rudimentary support for GET and POST on arbitrary urls.

  arc> (get-url "http://google.com")
  ("<HTML><HEAD><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\"><TITLE>301 Moved</TITLE></HEAD><BODY><H1>301 Moved</H1>The document has moved<A HREF=\"http://www.google.com/\">here</A>.</BODY></HTML>")
Can you try to figure out the right URL to put into the get-url call or similar post-url call? They're implemented in lib/web.arc, and feel free to ask us questions to help get you on your way.

-----


As a guess you might need to use js char literals like ' ', '\n', etc. Can you try that?

-----

1 point by akkartik 4187 days ago | link | parent | on: Idea about lisp syntax.

Yeah, I'll be very interested to see where this leads.

-----

1 point by akkartik 4193 days ago | link | parent | on: Try APL

via https://news.ycombinator.com/item?id=7813204

-----

More