Arc Forumnew | comments | leaders | submit | absz's commentslogin
1 point by absz 6400 days ago | link | parent | on: Are strings useful ?

In fact, many languages (or at least their large libraries) do have accommodations for sounds, images, etc. This is because most languages have some sort of "class" mechanism, and create classes for those things (in their standard library or in a very common one). And sometimes, what you are working on is a string parsing/manipulating/generating program, where strings do belong.

-----

4 points by absz 6400 days ago | link | parent | on: Learning Arc?

Why is what's popular popular in general? The biggest obstacles to popularity for Lisp, as I see it (and I'm not an expert) are the prefix syntax and its attendant parentheses; the history of having been chiefly used for AI, which is rather esoteric; and the (undeserved) reputation for slowness. Paul Graham has more to say in http://www.paulgraham.com/iflisp.html . None of these are intrinsically bad, but they are often perceived as such.

The interviewers are surprised because Lisp isn't popular, as you observed, and nobody expects it to be used for anything big.

Is Lisp impractical? Not really. As I understand it, the one problem it has is lack of libraries. Why? Because it's not popular. Even so, most things you want to do are probably librarified already, as "lack" here is relative.

Is Arc impractical? Not in the abstract, but it sounds like it will be for you. I don't think that Arc should be the first language you pick up, for a few reasons. It is still in a state of flux; it is missing certain features; it is designed for experience hackers; and, most importantly, there is a real paucity of documentation. http://arcfn.com/ has some great stuff, but that's about it. Starting in Arc would, therefore, be difficult.

Learning another Lisp would be a good idea, however; I would recommend learning Scheme. You might try working through How To Design Programs (http://www.htdp.org/) in Dr. Scheme (http://www.plt-scheme.org/); as I learned Scheme as a later language, I never worked through it, but from what I see and what I hear, it seems like a very good text. (I've never used Common Lisp, so I don't feel qualified to talk about it, but if someone wants to put in a good word for it, that might be helpful.) After you get a handle on that, you would almost certainly be able to pick up Arc in its undocumented state.

And if you really want a challenge, of course, you could always jump right into Arc; sometimes that is the best way to learn something.

Hope that helps!

-----

4 points by eds 6400 days ago | link

Personally, when learning Lisp, syntax wasn't a big issue. While the infix syntax of most languages is fairly intuitive, the rest of syntax (of e.g. C++ or Perl) is scary compared to Lisp's parens. (Although perhaps what puts people off is the frightening simplicity of Lisp's lack of syntax after using a conventional language.)

I started learning Lisp with Common Lisp, so I can make a couple of points there. pg's ANSI Common Lisp (http://paulgraham.com/acl.html) and Peter Seibel's Practical Common Lisp (http://gigamonkeys.com/book/) are both good texts, and go a long way toward getting you into Lisp. I also like Pascal Costanza's Highly Opinionated Guide to Lisp (http://p-cos.net/lisp/guide.html) and Steve Yegge's Lisp Wins (I think) (http://steve.yegge.googlepages.com/lisp-wins).

One the things that proved difficult about learning Lisp was choosing an implementation. There is no canonical implementation and as such I had to try several out before I learned which ones I enjoyed using. This survey of CL implementations (http://common-lisp.net/~dlw/LispSurvey.html) helped me when deciding which implementations to try. I recommend both CLISP (http://clisp.cons.org/) and SBCL (http://www.sbcl.org/), but that is just personal preference.

Also, the IDE was a difficult issue. I eventually settled on emacs with slime (http://common-lisp.net/project/slime/), although I have occasionally used Cusp, a Lisp plugin for Eclipse (http://bitfauna.com/projects/cusp/index.html). The main problem here was a lack of (thourough, easy to follow, up to date) instructions. Over the last couple of years I have gradually found good instructions on slime, but I can't seem to find any of them right now...

-----

2 points by absz 6400 days ago | link

I wasn't saying that the prefix syntax was an issue, just that it hampered popularity. Perception ≠ reality, after all. I too quite like the prefix syntax. I still slightly miss the simplicity of some of the Ruby code that I wrote, but the prefix syntax always wins me over; its benefits (macros) outweigh the minor downsides. Especially with []s and ssyntax.

And thanks for the CL thoughts! Regarding IDEs, I myself have ended up working just from the Mac OS X text editor TextMate (using Visor, which puts Terminal on a hotkey), and haven't found it problematic.

-----

2 points by Zak 6399 days ago | link

I'll second the recommendation for Scheme in general and PLT Scheme in particular. Arc is built on top of PLT Scheme at the moment. Another great book is The Structure and Interpretation of Computer Programs (http://mitpress.mit.edu/sicp/).

-----

3 points by absz 6400 days ago | link | parent | on: let redundant to with?

This is actually fairly simple to write (first defining butlast for convenience):

  (def butlast (seq)
    " Returns every element of `seq' but the last one.
      See also [[last]] [[cut]] "
    (cut seq 0 -1))
  
  (mac letn parms
    " Simultaneously ssigns the given (unparenthesized) local variables in the
      one-statement body.
      See also [[let]] [[with]] [[letns]]"
    `(with ,(butlast parms) ,(last parms)))
  
  (mac letns parms
    " Sequentially assigns the given (unparenthesized) local variables in the
      one-statement body.
      See also [[let]] [[with]] [[letn]]"
    `(withs ,(butlast parms) ,(last parms)))
Then letn is like with, but unparenthesized, and letns is like withs, but unparenthesized. (letn = "let n variables".) And yes, destructuring works.

-----

2 points by eds 6400 days ago | link

Perhaps these should be added to Anarki?

-----

1 point by absz 6400 days ago | link

Probably would make sense, but I'd rather wait until we had better names (I don't particularly like these.) Thoughts?

-----

2 points by almkglor 6398 days ago | link

'where ?

  (where foo (some-expression)
         bar (hmm that)
    (some-fn foo bar))

  (wheres val    (another-expression)
          grind  (grr val)
    (that-fn val grind))

-----

3 points by absz 6398 days ago | link

That's not bad... given?

  (given s1 (zebda oualalaradime)
         s2 (cake  symphony in c)
    (play s1 s2))
  
  (givens arc (language-by             pg)
          mzs (implementation-language arc)
    (run-in arc mzs))

-----

3 points by skenney26 6398 days ago | link

Okay, for some reason I can't get this out of my head.

What if "let" becomes "as", given becomes "let", and givens becomes "lets"?

-----

1 point by absz 6398 days ago | link

I would be reluctant to change let, since it's a standard operation in arcN.tar. Otherwise, there's probably some merit to that.

-----

3 points by eds 6398 days ago | link

And now we're back to waiting for pg to do something ;)

-----

1 point by almkglor 6398 days ago | link

Heck no. We can do this ourselves. Remember, the textual transformation to transform let's is just that: a textual translation. It should be possible to create an automated translation tool (based off raymyers' treeparse) that will handle this for us.

Let the old version of 'let be Arc2Let, and the proposed new let be Arc2.7Let. Let the old version of 'with and 'withs be Arc2With and Arc2Withs, respectively. We need to determine if each Arc2Let in the source is composed of a single expression in the body. If it is, we leave it as-is. If it isn't, we simply replace it with Arc2.7As.

For each Arc2With we determine if the body is composed of a single expression. If it is, we replace it with Arc2.7Let, removing the parens around the Arc2With bindings. If it isn't, we leave it as-is. Ditto for Arc2Withs, replacing it with Arc2.7Lets.

We define an expression simply as a sequence of whitespace, base-expression, and whitespace. We define whitespace as being either a comment (either #||# or ;) or ordinary whitespace.

A base-expression is simply a symbol, a number, a character, a string, a quote-expression, a comma and comma-at expression, or a list. A quote-expression is simply the ' quote or ` backquote character followed by maybe whitespace, followed by an expression; comma and comma-at are defined similarly. A list is composed of an opening parenthesis followed by many expressions, followed by a closing parens.

We can determine if a 'let form has several expressions by defining two variants of a 'let form. An Arc2Let is composed of ( <maybe whitespace> let <whitespace> <expression> <expression> <expression> [many <expression>]), and that we have to transform to Arc2.7As (by filtering out the let expression using treeparse 'filt). An Arc2.7LetCompatible is composed of just (let <expression> <expression> <expression>), which we do not transform.

----

Of course, this does represent a veritable fork of the Arc code ^^.

-----

1 point by absz 6398 days ago | link

I would leave with and withs alone, so that we have the option of the implicit do (also because it makes it easier to implement given/Anarki-let :P). And why not use a code-tree-walker if we want to do this—isn't that the point of Lisp?

Still, I don't quite think the fork is worth it….

-----

2 points by almkglor 6397 days ago | link

Actually the point of messing with the existing 'with / 'withs is to force the programmer to consider using the new form of 'let. ^^

The problem of using a code-tree walker is: you lose the comments, which are arguably about 50% the value of the code.

-----

1 point by absz 6397 days ago | link

Right, comments. Just a little important, aren't they? :P

You raise a good point... it's the same number of parentheses either way. But in that case, why not just have let and lets (as given(s)), and be done with it?

-----

3 points by almkglor 6397 days ago | link

> let and lets (as given(s))

Done and on the git ^^

Edit: as an aside, given that pg has said that he'll modify Arc as if there's nobody else programming in it, and that he does not appear to be using Anarki, eventually when Arc3 does come around, it is very possible that Anarki will be incompatible with Arc3. We may very well need to build a converter program in the future to transform Arc2-base Anarki to Arc3-base Anarki, so my abstract nonsense may very well be necessary in the future.

-----

1 point by absz 6397 days ago | link

Thanks!

And general abstract nonsense is almost always a good thing... still, that is worrisome.

-----

1 point by almkglor 6398 days ago | link

'given looks good - I think it's better than 'where.

-----

1 point by almkglor 6400 days ago | link

'these?

  (these x y
         r v
    (foo x r))
Of course it turns into 'theses ....

-----

2 points by skenney26 6399 days ago | link

Interesting idea. I like "as".

-----

2 points by almkglor 6399 days ago | link

  (as var x
      foo 42
    (something var foo))
Hmm...

But how about withs ?? == ass? ^^

-----

1 point by skenney26 6398 days ago | link

Think of it as short for assign :)

-----

1 point by skenney26 6398 days ago | link

How about "as" and "az"?

-----


The best thing to do is to install the Anarki version: it runs on all mzschemes and is more active, with a bunch of enhancements. It's a git repository that anyone can push to and pull from. More information here: http://arclanguage.org/item?id=4951

-----

3 points by onegaishimasu 6400 days ago | link

Thanks, it works great! Nice to be doing Arc again. Also, looks like the bug where it repeats all kinds of things is not from scheme or arc but is rlwrap and ssh fighting. Because if I drop either one, it works again. Not yet finished documenting the bug.

Thanks for the link.

-----

1 point by absz 6400 days ago | link

No problem. And for what it's worth, I don't use rlwrap, I use mzscheme's builtin readline: in ~/.arcshrc, I have the line

  ($ (dynamic-require '(lib "rep.ss" "readline") (zero? 1)))
, which provides readline functionality.

-----

3 points by onegaishimasu 6395 days ago | link

Thank you! That works wonderfully. It even saves readline history across (quit) and restart. The prompt shows up at different times now, but that seems cosmetic.

-----

3 points by absz 6395 days ago | link

Glad to have been of assistance.

Oh, you're having the problem where you get

  arc> 
  (user-input (goes 'here))
instead of

  arc> (but:user-input (should-go 'here))
? I though I was the only one with that problem, and I hadn't realized that the readline was causing it. Unfortunately, I don't know enough about mzscheme to even know where to begin looking to fix it... I've seen it in other mzscheme things, though, so it's not just Arc.

-----

2 points by onegaishimasu 6394 days ago | link

Exactly! But let me try something. Okay, if I skip ssh that doesn't help at all. Readline moves the prompt like you described. Rlwrap does it, and so does the .arcshrc thing.

Funny thing is, debian's mzscheme + arc2.tar are fine, no problem at all. So it must be my mzscheme.

-----

2 points by absz 6394 days ago | link

Well, it's mine too (Mac OS X, v372)—I wonder what the root cause is?

-----

2 points by absz 6401 days ago | link | parent | on: Why Arc is bad for exploratory programming

Nitpick: Anarki is the git repo, Arkani is the wiki written in Arc.

-----

2 points by jmatt 6401 days ago | link

Yeah thanks for pointing that out. My bad. Those damn names are so similar and I have my gits all scripted.

-----

4 points by eds 6400 days ago | link

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

-----

4 points by absz 6401 days ago | link | parent | on: let redundant to with?

You yourself gave an example. The fact that Arc allows destructuring (that is, writing (let (a b) lst ...)) means that the presence of a list is not an adequate indicator of whether you're letting or withing. And without that, how do you know when you're done defining variables? If you don't parenthesize them, they could go on forever. The only other option is to remove the implicit do in let/with; that way, only the last statement would be run, and the first n would be variable bindings; to run more than one, you would use do.

-----

2 points by bOR_ 6401 days ago | link

Got it :)

  arc> (= b "abba")
  "abba"
  arc> (let (a b) (list 1 2) (pr a b))
  121
  arc> b
  "abba"
  arc> (with (a b) (list 1 2) (pr a b))
  abbaabba"abba"
  arc>

-----

2 points by absz 6401 days ago | link | parent | on: let redundant to with?

withs is actually fundamentally different in that the binding order is different; something defined later can refer to something defined earlier.

-----

2 points by absz 6401 days ago | link | parent | on: let redundant to with?

let is a convenience for binding one variable; it allows you to leave out the parentheses of with. Do you need them both? No. But they're nice. (After all, you don't need either; both are equivalent to function calls.)

-----

2 points by absz 6402 days ago | link | parent | on: using scheme libraries

It depends. In arc2.tar, there is not. In the Anarki version, there is: the seval primitive function evaluates its argument in mzscheme, e.g.

  arc> (seval '(zero? 1))
  #f
The $ macro, also on Anarki, is a wrapper around that:

  arc> (let x 3.1415926 ($ (asin ,x)))
  5.35897931700532e-08
It implicitly quasiquotes its arguments, so to embed Arc values, use unquote (which is the same as ,).

-----

2 points by skenney26 6402 days ago | link

Wouldn't it be more intuitive if $ returned a scheme function and applied it to the arguments?

  ($ asin x)

-----

5 points by absz 6401 days ago | link

To get that, you can write

  ($.asin x)
; in fact, that's often what I do. But being able to write snippets of Scheme can be important, if you need to work with things (for instance, datatypes like the boolean) which don't exist in Arc.

-----

1 point by tokipin 6401 days ago | link

is there any way to implicitly quasiquote in arc2.tar? curious because that would be useful for one of my macros

-----

3 points by absz 6393 days ago | link

From Anarki:

  (mac $ body
    " Allows access to the underlying Scheme. "
    (list 'seval (cons 'quasiquote body)))
In other words, it generates a literal list containing 'quasiquote; when this is evaluated, it looks like (seval (quasiquote body0 body1 ... bodyN)). This technique is perfectly valid Arc2.

-----

1 point by absz 6402 days ago | link | parent | on: Dual syntax for Arc

The ssyntax system cannot do this: it's limited to working on symbols. You would need access to the readtables in mzscheme to make this work.

-----

More