Arc Forumnew | comments | leaders | submitlogin
Idioms for programming in Arc (arcfn.com)
19 points by kens 6092 days ago | 24 comments


3 points by almkglor 6092 days ago | link

Not an idiom in other Lisps, but enabled by Arc's ssyntax - the modifier: idiom.

  (breakable:while (< x length)
    (if (foo x)
        (break x))
    (++ x))
The modifier: idiom is simply a macro, modifier, which accepts a single form. This modifier essentially accepts the argument as an expression and modifies how it operates; in the case of the breakable: modifier, it creates a 'break function which exits the expression.

Another modifier in Anarki is the p-m: modifier (which needs you to (require "lib/defpat.arc")); it transforms any function-defining form into a pattern matching form:

  (p-m:mac foo
    ()  ''(the foo)
    (x) `'(the foo is ,x))
A while back I also posted a w/collect and w/mcollect macro form, which also works as a modifier: http://arclanguage.com/item?id=4390 . Macros which accept only a body will generally also work as modifiers, without, umm, modification.

-----

5 points by sacado 6092 days ago | link

It's been said many times, but your doc is really awesome. I need to use templates for what I'm doing at work (yep, I'm arcing one more time at work. Oh, god, I love my job) but I never really understood how all of that was working. Everything is clear, now. Thanks !

-----

8 points by kens 6090 days ago | link

Thanks for the encouragement. Sometimes I feel that I'm writing for the four or five remaining Arc users. It seems a bit quiet in this forum lately and the regulars seem to be disappearing, e.g. kennytilton hasn't been commenting for 40 days, pg for 22 days, byronsalty for 24 days, CatDancer for 50 days, nostrademons for 65 days. Are people losing interest, just lurking, or has the party moved somewhere else?

-----

8 points by stefano 6090 days ago | link

I see two main reasons for this. The first is obviously pg apparent disinterest in his own creature (in the sense that he seems to don't follow the forum anymore), because this makes people think "If its creator doesn't care about it, why should I?". Maybe pg is a bit too busy in this days, but I think Arc is still too young to survive if he doesn't come back soon, beacuse there are a lot of other interesting lisp projects out there that don't give the same sense of 'pause' that Arc gives (clojure is one of them). The second reason is the immature implementation that makes it difficult to write projects of moderate size in Arc, as an example think about Arc's error messages: they usually say something like 'You've got an error' and you simply don't get any hint about where it is. This is especially true about reader errors: I've read messages saying 'error at line 5234' in a file with just a few hundreds lines!

The good news is that these problems are, IMHO, fixable. Think about arc2c and how it is trying to fix the second problem to see the direction where the Arc community should go, but these solutions require time, and new users usually don't want to wait when there are other solutions already usable out there.

-----

8 points by lojic 6089 days ago | link

"The first is obviously pg apparent disinterest in his own creature..."

I think you hit the nail on the head there. I know pg has said that he does read the posts even when he doesn't reply, but let's face it, it doesn't take too long to post a comment occasionally. If he even took the time to communicate a vision to the "community", that would be helpful. I think people would be more patient if they had a clue about where this was heading.

Although it's certainly fun to pick up a new language, it also takes time and effort, and I'd like to see more evidence that Arc will continue to progress before I invest much time into it (especially since it lacks a couple "must haves" for me currently).

So, regarding the other comment about needing more publicity in terms of someone's pet project - I think there's a catch-22 there - who's going to put together a substantial application if they're unsure if the language will survive?

-----

4 points by stefano 6089 days ago | link

"who's going to put together a substantial application if they're unsure if the language will survive?"

This is true if you're writing your application for commercial use, but if you're doing it just for fun you can even use a language written by yourself that no one else know. The biggest problem is the lack of development and debugging tools. I few weeks ago I started a project to learn a bit more about compilers, and I ended up using Common Lisp because the task was very difficult by itself and I needed a good way to debug the program. Using Arc would have meant to make a difficult project even more difficult.

-----

3 points by lojic 6089 days ago | link

I think you just proved my point. I presume your project to "learn a bit more about compilers" was not commercial in nature, and yet you chose Common Lisp. Whether a project is for fun or for profit, I'd prefer to not waste my time, and it appears you feel the same.

I think the survivability (not popularity) of a programming language is closely correlated with its usefulness to programmers.

Of course, the best way to rebut my implicit assertion is to actually "put together a substantial application" with Arc instead of talking about it, right?

-----

1 point by sacado 6089 days ago | link

"(clojure is one of them)"

Come one, clojure is not a Lisp, it doesn't even have car and cdr :)

-----

3 points by stefano 6088 days ago | link

And Arc doesn't even have lambda! :)

-----

2 points by cooldude127 6087 days ago | link

arc has lambda, it's just renamed to fn (same as clojure).

clojure lacks car and cdr because it also lacks cons cells. there are other collections, but the little pairs we've come to know and love are gone.

-----

2 points by sacado 6087 days ago | link

yeah, we know, we were just kidding :)

However, seriously, clojure looks really interesting, being a cool language on the JVM and being purely functional. But does anybody know if it is possible in this language to make (easily) funny structures like circular lists, graphs, etc. ? AFAIK, that's the problem when you don't want to use set-car & set-cdr in Scheme (that's a problem in NewLisp too, for example) : you loose them. Did clojure manage to overcome this problem ?

-----

4 points by tokipin 6087 days ago | link

i'd say just take it easy. no need to hurry or anything

here's something from my experiences: a few times i have released things, and not responded to questions/comments about them for some time. not because i didn't care, but actually because i cared too much. to the people, those things were interesting curiousities, but to me they were things that my reputation was attached to. and so i felt that my statements, responses, and actions had to be well-calculated. and i had to consider the things themselves, which even by their lonesome were no walks in the park. it was somewhat daunting, which led to procrastination

not saying this is exactly the case here, but i remember this footnote: http://www.paulgraham.com/startuplessons.html#f2n

so yea, just relax imo. let the creators work things out at their own pace

-----

3 points by projectileboy 6088 days ago | link

I wouldn't be so discouraged. For my part, I'm simply in a mode where I'm working on stuff, and maybe (hopefully?) this is the case for other people as well.

FWIW, I'm trying to get a more robust version of the IntelliJ Arc plugin out the door, and I'm also working a very primitive project management tool in Arc.

-----

3 points by lojic 6089 days ago | link

"kennytilton hasn't been commenting for 40 days"

Kenny has definitely left the building :) I think he just wanted to put in his due diligence in checking out the language, but I don't think he ever bought in to Lisp-1 and is sticking with CL.

-----

2 points by mayson 6089 days ago | link

He hasn't posted on his own blog, either, so he may be doing something entirely different, like travelling: he gave a talk recently at the European Common Lisp Meeting (ECLM) in Amsterdam.

-----

2 points by lojic 6089 days ago | link

Traveling for 42 days? :) Nope. He's still active on c.l.l., and he's been pretty clear regarding his views on Arc.

-----

2 points by lojic 6089 days ago | link

Your documentation is great, but what happened to wanting to avoid karma accumulation?

http://arclanguage.com/item?id=5522

Since you returned to your original kens, I've been bumped down a notch. Not that I'm counting or anything ;)

-----

3 points by kens 6089 days ago | link

Someone named lojic said it was too confusing with kens2, etc so I went back to the original. But it looks like a tie as far as karma :-)

-----

1 point by lojic 6089 days ago | link

I'm just messin' with ya. It's definitely better to not use multiple user names IMO. And as far as the tie - that 40+ point jump looks awfully fishy to me. Two can play that game though, so knock it off :)

-----

1 point by drcode 6090 days ago | link

Yeah, it's definitely been getting a bit quiet in the arc world... I'm planning on using arc long term, so I hope the community survives...

And I second the motion that your docs are extremely useful, kens. I have a bookmark link for them on my main toolbar, along with only a handful of other essential tools on the web. No question though, your audience is unfortunately is pretty small these days...

-----

2 points by bOR_ 6090 days ago | link

Still here, but dividing my time in finishing my phd, learning to use arc to code for a pet project of mine.

Can't imagine pg just abandoning arc, but a bit more excitement from the regulars would be a good thing. Perhaps we can do something like start writing the great computer language shootout progs in arc (although not for speed, we'd be able to go for brevity and clarity)?

-----

1 point by sacado 6089 days ago | link

As for shootout , that would be a good idea, but the current implementations (arc2, arc2c or even others) aren't mature enough to compete.

I mean, arc2 takes 3 sec. to startup (and it cannot even take command line arguments) and arc2c is not meta-circular yet (and lacks a lot of things, including command-line args, but that is easy to add), so a real benchmarks would need both arcs (one to compile, the other to run the compiler). I don't know the precise status of other implementations, but I guess they aren't mature enough either.

And, that's a chicken-and-egg problem, but I don't think the shootout admins would accept to add an Arc implementation until the language is a little more popular (or there would have thousands of languages referenced).

-----

2 points by almkglor 6090 days ago | link

IMO what we need is publicity. Meaning someone's pet project, in Arc, will (by definition of "publicity") need to be done publicly. ^^

-----

2 points by bOR_ 6089 days ago | link

heh. Will work on it tonight then :), so that I at least can post about it.

-----