add singleton classes

db4
Doug Coleman 2008-03-05 21:35:08 -06:00
parent b8eb5abd13
commit 6fe9e6f1ce
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,14 @@
USING: help.markup help.syntax ;
IN: singleton
HELP: SINGLETON:
{ $syntax "SINGLETON: class"
} { $values
{ "class" "a new tuple class to define" }
} { $description
"Defines a new tuple class with membership predicate name? and a default empty constructor that is the class name itself."
} { $examples
{ $example "SINGLETON: foo\nfoo ." "T{ foo f }" }
} { $see-also
POSTPONE: TUPLE:
} ;

View File

@ -0,0 +1,9 @@
! Copyright (C) 2007 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel parser quotations tuples words ;
IN: singleton
: SINGLETON:
CREATE-CLASS
dup { } define-tuple-class
dup construct-empty 1quotation define ; parsing