Arc Forumnew | comments | leaders | submitlogin
3 points by eds 6072 days ago | link | parent

Oh, I didn't see your note about multiple newlines separating forms. That is an interesting approach, and removes the need for meaningful whitespace. But I have to wonder if it might get a little tiresome at the repl, since you would always have to add an extra newline to all your one line forms (unless you reverted to outer parens again).

And I now see what piping does, although I agree with you that the notation doesn't look very nice.

Perhaps external symbols could be used to do infix math? Although that might make it difficult to distinguish from when you want to do (for example):

  (map + '(1 2 3) '(4 5 6))


2 points by tokipin 6072 days ago | link

yea for the REPL i'm not exactly sure. i think it would have to be limited to 1-liners. for multiple lines then you'd have to use outer parens. where it would get wack is, say, copy & pasting code into the REPL, and if that code isn't using outer parens, how would it be parsed? it wouldn't be a problem if it was pasted and read in a 'chunk', but i think in my console it's pasted line-by-line or parsed line-by-line as if manually input. i'm not sure. hmmm. we might have to say "use outer parens if you're going to paste the code into the REPL"

however, that's the behavior as it is now in the scheme REPL. a custom Arc REPL would be able to handle things like pastes appropriately (maybe. i'm not familiar with console mechanics, but even if it wasn't 'purely' possible, a timer could be used so that if the delta between the last and currently entered lines is less than X, then it would be safe to assume the sequence was pasted)

for infix math it might be best to have a marker that says "the following form is infix"

  #( (3 + 2) / 8 )     ->     (/ (+ 3 2) 8 )
some other thoughts are notations for pattern matching/RE's

  @([aA][rR][cC])

-----

5 points by eds 6072 days ago | link

I'm really uncomfortable about making the repl and file readers differ, especially to the point of being incompatible.

About a custom console, I am not sure there is any reliable way to detect when a user has pasted code into the console. (That sort of thing is probably very OS dependent.)

Even if you did set up a timer like you propose, what would it do if the user recalled some lines from a multiline entry in history? I think most consoles would only pull up one line of history at a time, so the user would have to go through each line and enter it individually. And the timing would be such as to be indistinguishable from direct input from the user.

As for infix math, if you created an infix marker like

  #( (3 + 2) / 8 )
then you really aren't saving anything over

  (# (3 + 2) / 8)
at which point you could just use a macro.

-----

1 point by tokipin 6072 days ago | link

yea that's true. i'm new to lisp so a lot of these things don't occur to me right away (well, that's my excuse at least)

-----

2 points by Jesin 6056 days ago | link

What happens if you want to interpolate @([aA][rR][cC]) into a quasiquote?

  (foo ,@([aA][rR][cC]) ,baz)
See the problem?

-----

0 points by Jesin 6056 days ago | link

What happens if you want to interpolate @([aA][rR][cC]) into a quasiquote?

  (foo ,@([aA][rR][cC]) ,baz)
See the problem?

-----