File: all-doc.m2

package info (click to toggle)
macaulay2 1.25.05%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 172,152 kB
  • sloc: cpp: 107,824; ansic: 16,193; javascript: 4,189; makefile: 3,899; lisp: 702; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (73 lines) | stat: -rw-r--r-- 2,633 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- status: DRAFT
--- author(s): L.Gold
--- notes: 

document { 
     Key => all,
     Headline => "whether all elements satisfy a specified condition",
     SeeAlso => { "scan", "apply", "select", "any", "member" },
     Subnodes => {
	 TO (all, BasicList, Function),
	 TO (all, BasicList, BasicList, Function),
         },
     }
document { 
     Key => {(all,BasicList,Function),(all,ZZ,Function),(all,BasicList)},
     Headline => "whether all elements of a list satisfy a specified condition",
     Usage => "all(L,f)",
     Inputs => {
	  "L" => {"or ", ofClass {ZZ}, ".  If an integer is given, then the sequence ", TT "0..L-1", " is used."},
	  "f" => {"which returns true or false. If omitted, the ", TO identity, " function is used"}
	  },
     Outputs => {
	  Boolean => {TO "true", " if ", TT "f", " returns true when applied to every element of ", TT "L", 
	       " and ", TO "false", " otherwise"}
	  },
     EXAMPLE {
	  "all({1,2,3,4}, even)",
	  "all({2,4,6,8}, even)",
	  "all{true,true,true}",
	  "all{true,true,false}",
	  "all{}",
	  "all(7, x -> x < 10)"
	  },
     SeeAlso => { "scan", "apply", "select", "any", "member" }
     }
document { 
     Key => (all,BasicList,BasicList,Function),
     Headline => "whether all corresponding elements of a pair of lists satisfy a condition",
     Usage => "all(v,w,f)",
     Inputs => {
	  "v" => BasicList,
	  "w" => BasicList,
	  "f" => Function => "a function of two variables that returns true or false"
	  },
     Outputs => {
	  Boolean => {TO "true", " if ", TT "f", " returns true when applied to every pair ", TT "(x,y)", " of corresponding elements of ", TT "v", " and ", TT "w", ",
	       and ", TO "false", " otherwise"}},
     EXAMPLE lines ///
	  all((1,2,3,4),(2,3,4,5), (i,j) -> i<=j)
	  all((1,2,5,4),(2,3,4,5), (i,j) -> i<=j)
	  all((1,2,5,4),(2,3,4,5), x -> (print x; false))
	  all((1,2,5,4),(2,3,4,5), x -> (print x; true))
	  ///,
     SeeAlso => { "scan", "apply", "select", "any", "member" }
     }
document { 
     Key => (all,HashTable,Function),
     Headline => "whether all key/value pairs in a hash table satisfy a specified condition",
     Usage => "all(H,f)",
     Inputs => {
	  "H" => HashTable,
	  "f" => Function => ", which returns true or false"
	  },
     Outputs => {
	  Boolean => {TO "true", " if ", TT "f", "returns true when applied to all key/value pairs of ", TT "H",
	       " and ", TO "false", " otherwise"}
	  },
     EXAMPLE {
	  "all(hashTable{1=>3, 2=>2, 3=>1}, (a,b) -> a == b)",
	  "all(hashTable{1=>1, 2=>2, 3=>3}, (a,b) -> a == b)"
	  },
     SeeAlso => { "scan", "apply", "select", "any", "member" }
     }