This file is indexed.

/usr/share/doc/nip2/html/nipguidese30.html is in nip2 7.38.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
  "http://www.w3.org/TR/html4/loose.dtd">  
<html > 
<head><title>Pattern matching</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
<!-- 3,html --> 
<meta name="src" content="nipguide.tex"> 
<meta name="date" content="2014-01-18 12:46:00"> 
<link rel="stylesheet" type="text/css" href="nipguide.css"> 
</head><body 
>
  <!--l. 898--><div class="crosslinks"><p class="noindent">[<a 
href="nipguidese32.html" >next</a>] [<a 
href="nipguidese29.html" >prev</a>] [<a 
href="nipguidese29.html#tailnipguidese29.html" >prev-tail</a>] [<a 
href="nipguidese29.html#tailnipguidese30.html">tail</a>] [<a 
href="nipguidech6.html#nipguidese31.html" >up</a>] </p></div>
  <h3 class="sectionHead"><span class="titlemark">6.9    </span> <a 
 id="x41-730006.9"></a>Pattern matching</h3>
<!--l. 899--><p class="noindent" ><a name="nip_label_sec:pattern"></a>
<!--l. 901--><p class="indent" >  Any time you define a name, you can use a pattern
instead. For example:
                                                 <div class="verbatim" id="verbatim-65">
  [fred,&#x00A0;petra]&#x00A0;=&#x00A0;[12,&#x00A0;13] 
</div>
<!--l. 905--><p class="nopar" >
<!--l. 907--><p class="noindent" >defines <span 
class="phvr7t-x-x-80">fred </span>to have the value 12 and <span 
class="phvr7t-x-x-80">petra </span>to have the value
13.
<!--l. 910--><p class="indent" >    A pattern describes the structure you are expecting for the
value. When the value is computed it is matched against the
pattern and, if the match is successful, the names in the
pattern are bound to those parts of the value. Our example is
exactly equivalent to:
                                                                                       

                                                                                       
  <div class="verbatim" id="verbatim-66">
temp&#x00A0;=&#x00A0;[12,&#x00A0;13];
&#x00A0;<br />fred
&#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;temp?0,&#x00A0;is_list&#x00A0;temp&#x00A0;&amp;&amp;
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;&#x00A0;is_list_len&#x00A0;2&#x00A0;temp
&#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;error&#x00A0;"pattern&#x00A0;match&#x00A0;failed";
&#x00A0;<br />petra
&#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;temp?1,&#x00A0;is_list&#x00A0;temp&#x00A0;&amp;&amp;
&#x00A0;<br />&#x00A0;&#x00A0;&#x00A0;&#x00A0;is_list_len&#x00A0;2&#x00A0;temp
&#x00A0;<br />&#x00A0;&#x00A0;=&#x00A0;error&#x00A0;"pattern&#x00A0;match&#x00A0;failed";
</div>
<!--l. 925--><p class="nopar" >
<!--l. 927--><p class="noindent" >where <span 
class="phvr7t-x-x-80">temp </span>is an invisible, anonymous symbol.
<!--l. 930--><p class="indent" >  You can pattern match on any of <span 
class="phvr7t-x-x-80">nip2</span>&#8217;s data structures and
types. You can use:
    <dl class="description"><dt class="description">
<span 
class="phvb7t-x-x-80">a:b</span> </dt><dd 
class="description">Tests for the value being a non-empty list and then
    assigns <span 
class="phvr7t-x-x-80">a </span>to the head and <span 
class="phvr7t-x-x-80">b </span>to the tail.
    </dd><dt class="description">
<span 
class="phvb7t-x-x-80">(a,b)</span> </dt><dd 
class="description">Tests  for  the  value  being  a  complex  and  then
    assigns <span 
class="phvr7t-x-x-80">a </span>to the real part and <span 
class="phvr7t-x-x-80">b </span>to the imaginary.
    </dd><dt class="description">
<span 
class="phvb7t-x-x-80">[a,b,c]</span> </dt><dd 
class="description">Tests for the value being a list of length three and
    then assigns <span 
class="phvr7t-x-x-80">a</span>, <span 
class="phvr7t-x-x-80">b </span>and <span 
class="phvr7t-x-x-80">c </span>to the three elements.
    </dd><dt class="description">
<span 
class="phvb7t-x-x-80">(</span><span 
class="cmmi-8">class </span><span 
class="cmsy-8">&minus; </span><span 
class="cmmi-8">name </span><span 
class="phvb7t-x-x-80">b)</span> </dt><dd 
class="description">Tests  for  the  value  being  an  instance
    of  the  named  class,  then  assigns  <span 
class="phvr7t-x-x-80">b  </span>to  that  class
    instance.
    </dd><dt class="description">
<span 
class="cmmi-8">constant</span> </dt><dd 
class="description">Tests for the value being equal to that constant.
    Constants are things like <span 
class="phvr7t-x-x-80">&#8221;hello world&#8221; </span>or <span 
class="phvr7t-x-x-80">12</span>.
    </dd></dl>
<!--l. 957--><p class="indent" >  You can nest patterns in any way you like. Patterns are
useful in conjunction with list comprehensions, see
<span 
class="cmsy-10">ยง</span><a 
href="nipguidese27.html#x38-680006.6.5">6.6.5<!--tex4ht:ref: sec:listsyntax --></a>.
<!--l. 960--><p class="indent" >  You can&#8217;t use patterns in function arguments in the
current version, hopefully this will added shortly.
                                           
                                                                                       

                                                                                       
  <!--l. 963--><div class="crosslinks"><p class="noindent">[<a 
href="nipguidese32.html" >next</a>] [<a 
href="nipguidese29.html" >prev</a>] [<a 
href="nipguidese29.html#tailnipguidese29.html" >prev-tail</a>] [<a 
href="nipguidese30.html" >front</a>] [<a 
href="nipguidech6.html#nipguidese31.html" >up</a>] </p></div>
<!--l. 963--><p class="indent" >  <a 
 id="tailnipguidese30.html"></a>  
</body></html>