Arc Forumnew | comments | leaders | submitlogin
7 points by absz 6068 days ago | link | parent

On Anarki, you can add the ssyntax:

  (add-ssyntax-top
    ".." (range L r))
Then you have

  arc> 1..10
  (1 2 3 4 5 6 7 8 9 10)
.

EDIT: Actually, it's slightly nicer to do

  (add-ssyntax-top
    ".." (range ...))
so that you can then specify the step size:

  arc> 1..10
  (1 2 3 4 5 6 7 8 9 10)
  arc> 1..10..2
  (1 3 5 7 9)

.


1 point by almkglor 6067 days ago | link

As an aside, this appears to be popular, it might be possible to add this to the ssyntax extension.

As an aside, I suspect that much of the slowdown from the new ssyntax/ssexpand comes from scheme-side 'ac emitting a lot of 'ar-eval calls, but I'm not sure, since I haven't studied 'ac output much yet.

-----

1 point by almkglor 6068 days ago | link

Where'd you implement 'add-ssyntax-top ? I can't seem to find it anywhere in Anarki.

-----

1 point by absz 6068 days ago | link

Whoops, forgot about that. It's just a thin wrapper around a-ssyntax-top:

  (mac add-ssyntax-top body
    `(a-ssyntax-top ',(pair body [list (string _1) _2])))
. It's just quoting and pairing things. It'd be nice to have a-ssyntax-bottom, too...

-----

1 point by almkglor 6067 days ago | link

I suggest you push this onto Anarki (and possibly implement a-ssyntax-bottom). ^^

-----

1 point by absz 6067 days ago | link

I will do so soon, and hopefully when I get a chance to study ssyntax.arc a little more, I will add a-ssyntax-bottom.

What might be nice would be to have numerical precedence levels (reals, not integers), so that you could add an operator later with the right precedence without redefining everything.

-----

1 point by sacado 6068 days ago | link

Oh, great, I forgot this one...

-----

1 point by absz 6068 days ago | link

I'm not sure what you mean by this: forgot that this functionality existed?

-----

1 point by sacado 6068 days ago | link

yep, that's it. I never used the ssyntax-definer, so I forgot it was existing. Sorry, but it's a little late here, so I can hardly even understand myself :)

-----