Tuple slots can be declared immutable with the read-only word:
TUPLE: foo { a read-only } ;
I suppose if you wanted the entire tuple, you could do something like:

SYNTAX: IMMUTABLE-TUPLE: parse-tuple-definition
     [ dup array? [ read-only suffix ] [ read-only 2array ] if ] map
     define-tuple-class ;

Arrays and quotations are both forms of immutable sequences.

Michael Kohout wrote:
> Hi All-
> 
> While I've long been interested in Factor(I was at the TC Lisp meeting last
> year), with this new release I've put a bit more effort into learning how to
> use it effectively.  Anyways, most of the tools that I'm using
> (Scala/F#/OCaml/and Common Lisp) have immutable collections and immutable
> tuple types either built in or available as a library.
> 
> Does Factor have any support for immutable types?  If not, are there plans
> to provide one?
> 
> thanks, and nice work with the new stable release!
> Mike Kohout
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to