Here is an arc version of the struquine macro:
(mac strq (name . slots)
(withs (bname
(coerce (string name "#") 'sym)
creator `((def ,(coerce (string name "?") 'sym) (thing) (is (car thing) ',bname))
(def ,bname ,slots (cons ',bname (list ,@slots))))
accessors nil)
(on arg slots
(= accessors (cons `(def ,(coerce (string name "-" arg) 'sym) (thing) (thing ,(+ index 1))) accessors)))
(cons 'do (join accessors creator))))
I had to use "#" instead of "!" since that is used for special function access in arc, but the effect of this code is pretty much what was written about in the blog post. It creates a constructor for the struquine with name#, accessors for each arg of the form name-arg, and "type" checker of the form name?. For example: arc> (strq point x y)
#<procedure: point#>
arc> (= mypoint (point# 1 2))
(point# 1 2)
arc> (point? mypoint)
t
arc> (point-x mypoint)
1
arc> (point-y mypoint)
2