Arc Forumnew | comments | leaders | submitlogin
1 point by absz 5763 days ago | link | parent

/ would be problematic, though, as we already have things like w/uniq, w/stdin, /, etc. I like Scheme's convention, so what about

  (add-ssyntax-bottom ; Or perhaps -top
    #\! (sym:string 'L #\!))
? This would allow us to use !s in the final position of a function name, e.g. join!.


1 point by almkglor 5763 days ago | link

This makes:

  (join! foo bar)
into:

  ((sym:string 'join #\!) foo bar)
which doesn't seem to be what you want.

As an aside, you might want to try this on Anarki:

  (require "ssyntaxes.arc")
  (def foo! (x)
    (= (cdr x) 42)
    x)
  (= bar '(1 2))
  (foo! bar)

-----

1 point by absz 5763 days ago | link

That's what I would have thought, but it appeared to work. Though it may only have worked because of your second observation. And given that, I will repeat my desire for the destructive! custom. I like it because it doesn't interfere with any name (e.g. how alist could be association list or the "is the object a list?" predicate [though that's a bad example, you get the idea]), it has seen use in multiple languages, and it pretty clearly says what it means (assuming you want to encourage functional programming, as I think we do).

-----

2 points by almkglor 5762 days ago | link

I suggest running a poll on this - of course, pg probably won't care either way, but we can integrate his code into Anarki next time he bothers to release an update, ne?

I think this convention is good; I'm just somewhat concerned with the fact that foo!bar is plenty overloaded.

edit: IIRC this has been suggested a few times before already, so I think there'll be good support for this - but it means we will then have to formally standardize the ssyntaxes too.

-----

2 points by stefano 5762 days ago | link

Poll added :)

-----