pozorvlak: (Default)
pozorvlak ([personal profile] pozorvlak) wrote2008-01-30 11:04 am
Entry tags:

Arc's out!

http://arclanguage.org/

Well, that makes the "which language shall I learn next" question rather easier...

First impressions (based on reading the tutorial rather than playing with it): I like it. It embodies PG's philosophy that a language should get out of your way and let you shoot yourself in the foot because one day, you might need to do tarsal surgery and only have a pistol to hand. In many respects, it's the anti-Haskell: it encourages you to put off the decision of how to represent your data as long as possible. Here's a feature along those lines that I liked: indexes into data-structures are indistinguishable from function calls. So if I write
(foo 0)
you have no way of knowing if foo is a list, a string or a function. Evaluation is strict by default, which I think is a net loss (but you've got macros, so it's swings and roundabouts, I suppose). The anaphoric (pronoun-introducing) macros from On Lisp are included by default - I've found pronouns to be very useful in Perl, so this can only be a Good Thing. I was amused to see that most of the language is defined in Arc, and that PG seems to think that this is a bold and novel experiment :-)

[identity profile] pozorvlak.livejournal.com 2008-02-04 09:47 pm (UTC)(link)
That's actually quite a fun challenge - I was doodling Perl versions of the code on envelopes over dinner, and I'm going to try to write a version in Arc and blog about it. But what bugs me is this: why didn't he just use grep?

*furkles through man grep. Gives up on grep's broken regex syntax*

OK, why didn't he use perl -ne 's/--.*//; print "$_\n" foreach /\b\w*widget\b/gi' | sort | uniq?

[identity profile] pozorvlak.livejournal.com 2008-02-04 09:51 pm (UTC)(link)
Or in pure Perl:

perl -e 'while (<>) { s/--.*//; $widgets{$_}++ foreach /\b\w*widget\b/gi } print join "\n", keys %widgets'