]> gitweb.factorcode.org Git - factor.git/blob - extra/slots/syntax/syntax-docs.factor
Add a parsing word to output slots to the stack instead of to an array
[factor.git] / extra / slots / syntax / syntax-docs.factor
1 ! Copyright (C) 2010 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax ;
4 IN: slots.syntax
5
6 HELP: slots[
7 { $description "Outputs several slot values to the stack." }
8 { $example "USING: kernel prettyprint slots.syntax ;"
9            "IN: slots.syntax.example"
10            "TUPLE: rectangle width height ;"
11            "T{ rectangle { width 3 } { height 5 } } slots[ width height ] [ . ] bi@"
12            """3
13 5"""
14 } ;
15
16 HELP: slots{
17 { $description "Outputs an array of slot values from a tuple." }
18 { $example "USING: prettyprint slots.syntax ;"
19            "IN: slots.syntax.example"
20            "TUPLE: rectangle width height ;"
21            "T{ rectangle { width 3 } { height 5 } } slots{ width height } ."
22            "{ 3 5 }"
23 } ;
24
25 ARTICLE: "slots.syntax" "Slots syntax sugar"
26 "The " { $vocab-link "slots.syntax" } " vocabulary provides an alternative syntax for taking a sequence of slots from a tuple." $nl
27 "Syntax sugar for cleaving slots to the stack:"
28 { $subsections POSTPONE: slots[ }
29 "Syntax sugar for cleaving slots to an array:"
30 { $subsections POSTPONE: slots{ } ;
31
32 ABOUT: "slots.syntax"