I'd like to override Arc's dot ssyntax and be able to use the period as a variable, as in (= . 5)
or at least (= |.| 5)
How would you go about doing this?I've tried using aw's scheme macro [1] to redefine ac.scm's ssyntax functions, but no dice. I was able to use his extend-readtable to succeed at a similar operation for square brackets and curly braces: (mac read-normal (x)
`(extend-readtable ,x
(fn (port)
(sym:string
,x
(let c (peekc port)
(unless (or (whitec c) (ssyntax c) (in c #\( #\) ))
(read port)))))))
(read-normal #\[)
(read-normal #\])
(read-normal #\{)
(read-normal #\})
; now I can do things like make `{` an alias for obj...
arc> (= { obj)
#(tagged mac #<procedure: obj>)
arc> ({ a 1 b 2)
#hash((a . 1) (b . 2))
But alas, it doesn't work for the dot: arc> (read-normal #\.)
#<void>
arc> (= . 4)
Error: "list->string: expects argument of type <list of character>; given #\\."
arc> (= |.| 4)
Error: "list->string: expects argument of type <list of character>; given #\\."
I found mentions in old posts [3] about a "ssyntaxes.arc" in Anarki that lets you do things like this, but it's not in my lib/. Nor do I see it on the github [4].Please save me, Arc brethren! --- [1] http://awwx.ws/scheme0 [2] http://awwx.ws/extend-readtable0 [3] http://arclanguage.org/item?id=10329 [4] https://github.com/nex3/arc/tree/master/lib/ |