]> gitweb.factorcode.org Git - factor.git/blob - core/classes/intersection/intersection-docs.factor
Solution to Project Euler problem 65
[factor.git] / core / classes / intersection / intersection-docs.factor
1 USING: generic help.markup help.syntax kernel kernel.private
2 namespaces sequences words arrays help effects math
3 layouts classes.private classes compiler.units ;
4 IN: classes.intersection
5
6 ARTICLE: "intersections" "Intersection classes"
7 "An object is an instance of a intersection class if it is an instance of all of its participants."
8 { $subsection POSTPONE: INTERSECTION: }
9 { $subsection define-intersection-class }
10 "Intersection classes can be introspected:"
11 { $subsection participants }
12 "The set of intersection classes is a class:"
13 { $subsection intersection-class }
14 { $subsection intersection-class? }
15 "Intersection classes are used to associate a method with objects which are simultaneously instances of multiple different classes, as well as to conveniently define predicates." ;
16
17 ABOUT: "intersections"
18
19 HELP: define-intersection-class
20 { $values { "class" class } { "participants" "a sequence of classes" } }
21 { $description "Defines a intersection class with specified participants. This is the run time equivalent of " { $link POSTPONE: INTERSECTION: } "." }
22 { $notes "This word must be called from inside " { $link with-compilation-unit } "." }
23 { $side-effects "class" } ;
24
25 { intersection-class define-intersection-class POSTPONE: INTERSECTION: } related-words
26
27 HELP: intersection-class
28 { $class-description "The class of intersection classes." } ;