! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators combinators.smart fry lexer quotations
-sequences slots ;
+sequences slots words ;
IN: slots.syntax
SYNTAX: slots[
SYNTAX: slots{
"}" [ reader-word 1quotation ] map-tokens
'[ [ _ cleave ] output>array ] append! ;
+
+: writer-word* ( name -- word )
+ ">>" prepend "accessors" lookup ;
+
+SYNTAX: set-slots[
+ "]" [ writer-word* 1quotation ] map-tokens
+ '[ _ spread ] append! ;
+
+SYNTAX: set-slots{
+ "}" [ writer-word* 1quotation ] map-tokens
+ [ length ] [ ] bi
+ '[ _ firstn _ spread ] append! ;