Arc Forumnew | comments | leaders | submitlogin
1 point by Jesin 6131 days ago | link | parent

Why is everyone opposed to foop for predicates? I understand the opposition to foo? (it involves an awkward shift-/ and swallows up one of the most potentially-useful ssyntax characters), but foop is easy to type, easy to read once you've used it for a couple hours, and easy to say. I like CL's last-character naming conventions. They make it easier to see what the code does, and they are quicker and easier to use than Scheme's set! and integer?

Note: this is not coming from a nostalgic Common Lisper. I'm somewhat new to Lisp, and the only Lisps I'm comfortable with are Scheme and Arc. I just think CL naming conventions make a lot of sense.

(I also like the idea of having a function called intp embedded in the language (if you don't know what I mean, look it up).)



2 points by absz 6130 days ago | link

As another new-ish Lisper, comfortable with only Scheme and Arc, I have to disagree. I find appending a character which might anyway occur at the end of a predicate to be a confusing way of expressing predicates. What about a type called, say, tem (a template, perhaps): what's temp? Is it tem predicate or temporary? I actually prefer the "a..." style to the "...p" style, but I think "...?" is still better.

-----

1 point by Jesin 6130 days ago | link

Who would ever use 'tem for anything? A template type would more likely be called temp, and the predicate would be tempp. Usually when p is the next letter, it's included in the variable name, and when a p at the end of a name is part of a word, it is not usually read as predicate. This sort of collision is very rare, and when it does happen, it usually takes no more than a second to figrue out.

On the other hand, asomething in Arc sometimes means anaphoric-something and sometimes means isa-something. This inconsistency is much more common, and a- collisions are no better than -p collisions.

Then there is the foo? of Scheme. Every time I see foo? it interrupts my reading. I don't know about you, but I think of ? followed by a space as a terminator, and putting it between a function name and its arguments throws me off. The ? character also has a lot of potential for ssyntax, and in that position any break it would cause would most likely coincide with a conceptual break. I have no problem with punctuation separating symbols, but when it's punctuation followed by a space, that looks like a pause and throws me off.

-----

2 points by absz 6130 days ago | link

I used tem because I couldn't think of another word quickly, and everyone has seen temp used as a variable name. Your point about anaphoric- versus isa-, though, is a good one; I'd forgotten that, and that's just another reason I like ...? as the terminology. Using single characters can lead to collisions.

When I see (even? n), I read the "even?" as "even" with an upwards tone, not as "even" followed by a separator. Thus, the predicate call reads as a question in my head, which is what it's supposed to be. On the other hand, I find that #'foop reads like the word "foop," which doesn't mean anything. It's less severe with something like #'numberp, but nevertheless, I find ...p to be where the semantic collision lies.

And though you're worried about the removal of ...? as ssyntax, as nex3 pointed out (http://arclanguage.org/item?id=4849), one could explicitly allow a ? at the end, while still allowing it as ssyntax.

-----

1 point by Jesin 6127 days ago | link

And where does most ssyntax go? At the end of identifiers.

Also, consider that

  (foo? 'baz)
can be written as

  foo?!baz
Mixing punctuation like this gets weird.

-----

3 points by absz 6127 days ago | link

Actually, we right now have no ssyntax that goes at the end of identifiers. Arc has ten pieces of syntax. () and [] are circumfix. ' ` , ,@ and ~ are prefix. : . and ! are infix. The two syntax requests I recall off the top of my head were (1) being able to write $(...) for some reason, which is prefix; and (2) being able to write ($f ...) for (map f ...), which is also prefix. So from a preliminary study (admittedly, with very few data points, but that's all there are), it appears that prefix syntax is the most common.

And as for the foo?!baz observation? Don't do that then :) Seriously, I don't think that's a problem. Just because we can write something like ~+:/.3.1@-2.5!-1 doesn't mean we should. (If you're curious, that is currently legal and expands to (compose (complement +) (/ 3 1@-2 5 '-1)) [r@q is notation for the complex number with magnitude r and angle q, just in case you haven't seen it before.]).

EDIT: Used to say "that's actually probably a bug, since I was expecting it to expand to (compose (complement +) (/ 3.1@-2.5 '-1)), but how often will we be putting complex numbers inside ssyntax?," but that was wrong (see http://arclanguage.org/item?id=5090).

-----

2 points by eds 6127 days ago | link

That expansion isn't a bug. You just can't put floating point numbers into ssyntax.

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

-----

1 point by absz 6127 days ago | link

D'oh. How'd I miss that? Thanks.

-----