123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812 |
- <?xml version="1.0" encoding="utf-8" ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <!-- This file is generated by Nim. -->
- <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>std/packedsets</title>
- <!-- Google fonts -->
- <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
- <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
- <!-- Favicon -->
- <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
- <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
- <!-- CSS -->
- <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
- <!-- JS -->
- <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
- </head>
- <body>
- <div class="document" id="documentId">
- <div class="container">
- <h1 class="title">std/packedsets</h1>
- <div class="row">
- <div class="three columns">
- <div class="theme-select-wrapper">
- <label for="theme-select">Theme: </label>
- <select id="theme-select" onchange="setTheme(this.value)">
- <option value="auto">🌗 Match OS</option>
- <option value="dark">🌑 Dark</option>
- <option value="light">🌕 Light</option>
- </select>
- </div>
- <div id="global-links">
- <ul class="simple-boot">
- <li><a href="manual.html">Manual</a></li>
- <li><a href="lib.html">Standard library</a></li>
- <li> <a id="indexLink" href="theindex.html">Index</a></li>
- <li><a href="compiler/theindex.html">Compiler docs</a></li>
- <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
- <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
- </ul>
- </div>
- <div id="searchInputDiv">
- Search: <input type="search" id="searchInput"
- oninput="search()" />
- </div>
-
- <ul class="simple simple-toc" id="toc-list">
- <li><a class="reference" id="see-also_toc" href="#see-also">See also</a></li>
- <li>
- <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
- <ul class="simple simple-toc-section">
- <li><a class="reference" href="#PackedSet" title="PackedSet[A] = object">PackedSet</a></li>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
- <ul class="simple simple-toc-section">
- <ul class="simple nested-toc-section">$
- <li><a class="reference" href="#%24%2CPackedSet%5BA%5D" title="`$`[A](s: PackedSet[A]): string">`$`[A](s: PackedSet[A]): string</a></li>
- </ul>
- <ul class="simple nested-toc-section">*
- <li><a class="reference" href="#%2A%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`*`[A](s1, s2: PackedSet[A]): PackedSet[A]">`*`[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">+
- <li><a class="reference" href="#%2B%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`+`[A](s1, s2: PackedSet[A]): PackedSet[A]">`+`[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">-
- <li><a class="reference" href="#-%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`-`[A](s1, s2: PackedSet[A]): PackedSet[A]">`-`[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section"><
- <li><a class="reference" href="#%3C%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`<`[A](s1, s2: PackedSet[A]): bool">`<`[A](s1, s2: PackedSet[A]): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section"><=
- <li><a class="reference" href="#%3C%3D%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`<=`[A](s1, s2: PackedSet[A]): bool">`<=`[A](s1, s2: PackedSet[A]): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">==
- <li><a class="reference" href="#%3D%3D%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`==`[A](s1, s2: PackedSet[A]): bool">`==`[A](s1, s2: PackedSet[A]): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">=copy
- <li><a class="reference" href="#%3Dcopy%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="`=copy`[A](dest: var PackedSet[A]; src: PackedSet[A])">`=copy`[A](dest: var PackedSet[A]; src: PackedSet[A])</a></li>
- </ul>
- <ul class="simple nested-toc-section">assign
- <li><a class="reference" href="#assign%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="assign[A](dest: var PackedSet[A]; src: PackedSet[A])">assign[A](dest: var PackedSet[A]; src: PackedSet[A])</a></li>
- </ul>
- <ul class="simple nested-toc-section">card
- <li><a class="reference" href="#card%2CPackedSet%5BA%5D" title="card[A](s: PackedSet[A]): int">card[A](s: PackedSet[A]): int</a></li>
- </ul>
- <ul class="simple nested-toc-section">clear
- <li><a class="reference" href="#clear%2CPackedSet%5BA%5D" title="clear[A](result: var PackedSet[A])">clear[A](result: var PackedSet[A])</a></li>
- </ul>
- <ul class="simple nested-toc-section">contains
- <li><a class="reference" href="#contains%2CPackedSet%5BA%5D%2CA" title="contains[A](s: PackedSet[A]; key: A): bool">contains[A](s: PackedSet[A]; key: A): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">containsOrIncl
- <li><a class="reference" href="#containsOrIncl%2CPackedSet%5BA%5D%2CA" title="containsOrIncl[A](s: var PackedSet[A]; key: A): bool">containsOrIncl[A](s: var PackedSet[A]; key: A): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">difference
- <li><a class="reference" href="#difference%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="difference[A](s1, s2: PackedSet[A]): PackedSet[A]">difference[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">disjoint
- <li><a class="reference" href="#disjoint%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="disjoint[A](s1, s2: PackedSet[A]): bool">disjoint[A](s1, s2: PackedSet[A]): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">excl
- <li><a class="reference" href="#excl%2CPackedSet%5BA%5D%2CA" title="excl[A](s: var PackedSet[A]; key: A)">excl[A](s: var PackedSet[A]; key: A)</a></li>
- <li><a class="reference" href="#excl%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="excl[A](s: var PackedSet[A]; other: PackedSet[A])">excl[A](s: var PackedSet[A]; other: PackedSet[A])</a></li>
- </ul>
- <ul class="simple nested-toc-section">incl
- <li><a class="reference" href="#incl%2CPackedSet%5BA%5D%2CA" title="incl[A](s: var PackedSet[A]; key: A)">incl[A](s: var PackedSet[A]; key: A)</a></li>
- <li><a class="reference" href="#incl%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="incl[A](s: var PackedSet[A]; other: PackedSet[A])">incl[A](s: var PackedSet[A]; other: PackedSet[A])</a></li>
- </ul>
- <ul class="simple nested-toc-section">initPackedSet
- <li><a class="reference" href="#initPackedSet" title="initPackedSet[A](): PackedSet[A]">initPackedSet[A](): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">intersection
- <li><a class="reference" href="#intersection%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="intersection[A](s1, s2: PackedSet[A]): PackedSet[A]">intersection[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">isNil
- <li><a class="reference" href="#isNil%2CPackedSet%5BA%5D" title="isNil[A](x: PackedSet[A]): bool">isNil[A](x: PackedSet[A]): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">len
- <li><a class="reference" href="#len%2CPackedSet%5BA%5D" title="len[A](s: PackedSet[A]): int">len[A](s: PackedSet[A]): int</a></li>
- </ul>
- <ul class="simple nested-toc-section">missingOrExcl
- <li><a class="reference" href="#missingOrExcl%2CPackedSet%5BA%5D%2CA" title="missingOrExcl[A](s: var PackedSet[A]; key: A): bool">missingOrExcl[A](s: var PackedSet[A]; key: A): bool</a></li>
- </ul>
- <ul class="simple nested-toc-section">symmetricDifference
- <li><a class="reference" href="#symmetricDifference%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="symmetricDifference[A](s1, s2: PackedSet[A]): PackedSet[A]">symmetricDifference[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">toPackedSet
- <li><a class="reference" href="#toPackedSet%2CopenArray%5BA%5D" title="toPackedSet[A](x: openArray[A]): PackedSet[A]">toPackedSet[A](x: openArray[A]): PackedSet[A]</a></li>
- </ul>
- <ul class="simple nested-toc-section">union
- <li><a class="reference" href="#union%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D" title="union[A](s1, s2: PackedSet[A]): PackedSet[A]">union[A](s1, s2: PackedSet[A]): PackedSet[A]</a></li>
- </ul>
- </ul>
- </details>
- </li>
- <li>
- <details open>
- <summary><a class="reference reference-toplevel" href="#15" id="65">Iterators</a></summary>
- <ul class="simple simple-toc-section">
- <ul class="simple nested-toc-section">items
- <li><a class="reference" href="#items.i%2CPackedSet%5BA%5D" title="items[A](s: PackedSet[A]): A">items[A](s: PackedSet[A]): A</a></li>
- </ul>
- </ul>
- </details>
- </li>
- </ul>
- </div>
- <div class="nine columns" id="content">
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L1" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
- <div id="tocRoot"></div>
-
- <p class="module-desc"><p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">packedsets</span></span></tt> module implements an efficient <tt class="docutils literal"><span class="pre"><span class="Identifier">Ordinal</span></span></tt> set implemented as a <span id="sparse-bit-set_1">sparse bit set</span>.</p>
- <p>Supports any Ordinal type.</p>
- <h1><a class="toc-backref" id="see-also" href="#see-also">See also</a></h1><ul class="simple"><li><a class="reference external" href="sets.html">sets module</a> for more general hash sets</li>
- </ul>
- </p>
- <div class="section" id="6">
- <h1><a class="toc-backref" href="#6">Imports</a></h1>
- <dl class="item">
- <a class="reference external" href="since.html">since</a>, <a class="reference external" href="hashes.html">hashes</a>, <a class="reference external" href="assertions.html">assertions</a>
- </dl>
- </div>
- <div class="section" id="7">
- <h1><a class="toc-backref" href="#7">Types</a></h1>
- <dl class="item">
- <div id="PackedSet">
- <dt><pre><a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">object</span></pre></dt>
- <dd>
-
- An efficient set of <tt class="docutils literal"><span class="pre"><span class="Identifier">Ordinal</span></span></tt> types implemented as a sparse bit set.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L46" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L46" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </dl>
- </div>
- <div class="section" id="12">
- <h1><a class="toc-backref" href="#12">Procs</a></h1>
- <dl class="item">
- <div id="$-procs-all">
- <div id="$,PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%24%2CPackedSet%5BA%5D"><span class="Identifier">`$`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
- <dd>
-
- Converts <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> to a string.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="StringLit">"{1, 2, 3}"</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L595" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L595" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="*-procs-all">
- <div id="*,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%2A%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`*`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Alias for <a class="reference external" href="#intersection,PackedSet[A],PackedSet[A]">intersection(s1, s2)</a>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L522" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L522" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="+-procs-all">
- <div id="+,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%2B%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`+`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Alias for <a class="reference external" href="#union,PackedSet[A],PackedSet[A]">union(s1, s2)</a>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L518" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L518" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="--procs-all">
- <div id="-,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#-%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`-`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Alias for <a class="reference external" href="#difference,PackedSet[A],PackedSet[A]">difference(s1, s2)</a>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L526" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L526" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="<-procs-all">
- <div id="<,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%3C%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`<`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> is a proper subset of <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p>A strict or proper subset <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> has all of its elements in <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>, but <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt> has more elements than <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt>.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator"><</span> <span class="Identifier">b</span>
- <span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Punctuation">(</span><span class="Identifier">b</span> <span class="Operator"><</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Punctuation">(</span><span class="Identifier">c</span> <span class="Operator"><</span> <span class="Identifier">b</span><span class="Punctuation">)</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L571" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L571" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="<=-procs-all">
- <div id="<=,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%3C%3D%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`<=`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> is a subset of <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p>A subset <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> has all of its elements in <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>, but <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt> doesn't necessarily have more elements than <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt>. That is, <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> can be equal to <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span> <span class="Operator"><=</span> <span class="Identifier">b</span>
- <span class="Identifier">assert</span> <span class="Identifier">b</span> <span class="Operator"><=</span> <span class="Identifier">b</span>
- <span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Punctuation">(</span><span class="Identifier">c</span> <span class="Operator"><=</span> <span class="Identifier">b</span><span class="Punctuation">)</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L552" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L552" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="==-procs-all">
- <div id="==,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%3D%3D%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`==`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- Returns true if both <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt> have the same elements and set size.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Identifier">assert</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L587" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L587" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="=copy-procs-all">
- <div id="=copy,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#%3Dcopy%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">`=copy`</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">src</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- Copies <tt class="docutils literal"><span class="pre"><span class="Identifier">src</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt> does not need to be initialized by the <a class="reference external" href="#initPackedSet">initPackedSet proc</a>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L410" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L410" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="assign-procs-all">
- <div id="assign,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#assign%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">assign</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">dest</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">src</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span></span>.}</pre></dt>
- <dd>
- <div class="deprecation-message">
- <b>Deprecated</b>
- </div>
- Copies <tt class="docutils literal"><span class="pre"><span class="Identifier">src</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">dest</span></span></tt> does not need to be initialized by the <a class="reference external" href="#initPackedSet">initPackedSet proc</a>.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">)</span>
- <span class="Identifier">b</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="DecNumber">7</span><span class="Punctuation">)</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">assign</span><span class="Punctuation">(</span><span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L441" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L441" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="card-procs-all">
- <div id="card,PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#card%2CPackedSet%5BA%5D"><span class="Identifier">card</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- <p>Alias for <a class="reference external" href="#len,PackedSet[A]">len()</a>.</p>
- <p>Card stands for the <a class="reference external" href="https://en.wikipedia.org/wiki/Cardinality">cardinality</a> of a set.</p>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L545" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L545" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="clear-procs-all">
- <div id="clear,PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#clear%2CPackedSet%5BA%5D"><span class="Identifier">clear</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">result</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- Clears the <tt class="docutils literal"><span class="pre"><span class="Identifier">PackedSet</span><span class="Punctuation">[</span><span class="Identifier">A</span><span class="Punctuation">]</span></span></tt> back to an empty state.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">clear</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L382" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L382" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="contains-procs-all">
- <div id="contains,PackedSet[A],A">
- <dt><pre><span class="Keyword">proc</span> <a href="#contains%2CPackedSet%5BA%5D%2CA"><span class="Identifier">contains</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">A</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>This allows the usage of the <tt class="docutils literal"><span class="pre"><span class="Keyword">in</span></span></tt> operator.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">type</span> <span class="Identifier">ABCD</span> <span class="Operator">=</span> <span class="Keyword">enum</span> <span class="Identifier">A</span><span class="Punctuation">,</span> <span class="Identifier">B</span><span class="Punctuation">,</span> <span class="Identifier">C</span><span class="Punctuation">,</span> <span class="Identifier">D</span>
- <span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="DecNumber">3</span> <span class="Keyword">in</span> <span class="Identifier">a</span>
- <span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">contains</span><span class="Punctuation">(</span><span class="DecNumber">8</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="DecNumber">8</span> <span class="Keyword">notin</span> <span class="Identifier">a</span>
- <span class="Keyword">let</span> <span class="Identifier">letters</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="Identifier">A</span><span class="Punctuation">,</span> <span class="Identifier">C</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">A</span> <span class="Keyword">in</span> <span class="Identifier">letters</span>
- <span class="Identifier">assert</span> <span class="Identifier">C</span> <span class="Keyword">in</span> <span class="Identifier">letters</span>
- <span class="Identifier">assert</span> <span class="Identifier">B</span> <span class="Keyword">notin</span> <span class="Identifier">letters</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L182" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L182" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="containsOrIncl-procs-all">
- <div id="containsOrIncl,PackedSet[A],A">
- <dt><pre><span class="Keyword">proc</span> <a href="#containsOrIncl%2CPackedSet%5BA%5D%2CA"><span class="Identifier">containsOrIncl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">A</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Includes <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> in the set <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> and tells if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> was already in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>The difference with regards to the <a class="reference external" href="#incl,PackedSet[A],A">incl proc</a> is that this proc returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> already contained <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt>. The proc will return false if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> was added as a new value to <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> during this call.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#incl,PackedSet[A],A">incl proc</a> for including an element</li>
- <li><a class="reference external" href="#missingOrExcl,PackedSet[A],A">missingOrExcl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">containsOrIncl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">containsOrIncl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">containsOrIncl</span><span class="Punctuation">(</span><span class="DecNumber">4</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L276" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L276" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="difference-procs-all">
- <div id="difference,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#difference%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">difference</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>Returns the difference of the sets <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p>The same as <a class="reference external" href="#-,PackedSet[A],PackedSet[A]">s1 - s2</a>.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">difference</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L486" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L486" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="disjoint-procs-all">
- <div id="disjoint,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#disjoint%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">disjoint</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- Returns true if the sets <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt> have no items in common.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">disjoint</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
- <span class="Identifier">assert</span> <span class="Identifier">disjoint</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">c</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L530" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L530" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="excl-procs-all">
- <div id="excl,PackedSet[A],A">
- <dt><pre><span class="Keyword">proc</span> <a href="#excl%2CPackedSet%5BA%5D%2CA"><span class="Identifier">excl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">A</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Excludes <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> from the set <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>This doesn't do anything if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is not found in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#incl,PackedSet[A],A">incl proc</a> for including an element</li>
- <li><a class="reference external" href="#excl,PackedSet[A],PackedSet[A]">excl proc</a> for excluding a set</li>
- <li><a class="reference external" href="#missingOrExcl,PackedSet[A],A">missingOrExcl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">excl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">excl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">excl</span><span class="Punctuation">(</span><span class="DecNumber">99</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L311" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L311" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="excl,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#excl%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">excl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">other</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Excludes all elements from <tt class="docutils literal"><span class="pre"><span class="Identifier">other</span></span></tt> from <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>This is the in-place version of <a class="reference external" href="#-,PackedSet[A],PackedSet[A]">s - other</a>.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#incl,PackedSet[A],PackedSet[A]">incl proc</a> for including a set</li>
- <li><a class="reference external" href="#excl,PackedSet[A],A">excl proc</a> for excluding an element</li>
- <li><a class="reference external" href="#missingOrExcl,PackedSet[A],A">missingOrExcl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">excl</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
- <span class="Identifier">assert</span> <span class="DecNumber">5</span> <span class="Keyword">notin</span> <span class="Identifier">a</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L329" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L329" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="incl-procs-all">
- <div id="incl,PackedSet[A],A">
- <dt><pre><span class="Keyword">proc</span> <a href="#incl%2CPackedSet%5BA%5D%2CA"><span class="Identifier">incl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">A</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Includes an element <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>This doesn't do anything if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> is already in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#excl,PackedSet[A],A">excl proc</a> for excluding an element</li>
- <li><a class="reference external" href="#incl,PackedSet[A],PackedSet[A]">incl proc</a> for including a set</li>
- <li><a class="reference external" href="#containsOrIncl,PackedSet[A],A">containsOrIncl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="DecNumber">3</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">1</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L213" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L213" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- <div id="incl,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#incl%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">incl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">other</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span></pre></dt>
- <dd>
-
- <p>Includes all elements from <tt class="docutils literal"><span class="pre"><span class="Identifier">other</span></span></tt> into <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>This is the in-place version of <a class="reference external" href="#+,PackedSet[A],PackedSet[A]">s + other</a>.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#excl,PackedSet[A],PackedSet[A]">excl proc</a> for excluding a set</li>
- <li><a class="reference external" href="#incl,PackedSet[A],A">incl proc</a> for including an element</li>
- <li><a class="reference external" href="#containsOrIncl,PackedSet[A],A">containsOrIncl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">2</span>
- <span class="Identifier">assert</span> <span class="DecNumber">5</span> <span class="Keyword">in</span> <span class="Identifier">a</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L243" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L243" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="initPackedSet-procs-all">
- <div id="initPackedSet">
- <dt><pre><span class="Keyword">proc</span> <a href="#initPackedSet"><span class="Identifier">initPackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>Returns an empty <tt class="docutils literal"><span class="pre"><span class="Identifier">PackedSet</span><span class="Punctuation">[</span><span class="Identifier">A</span><span class="Punctuation">]</span></span></tt>. <tt class="docutils literal"><span class="pre"><span class="Identifier">A</span></span></tt> must be <tt class="docutils literal"><span class="pre"><span class="Identifier">Ordinal</span></span></tt>.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#toPackedSet,openArray[A]">toPackedSet proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">0</span>
- <span class="Keyword">type</span> <span class="Identifier">Id</span> <span class="Operator">=</span> <span class="Keyword">distinct</span> <span class="Identifier">int</span>
- <span class="Keyword">var</span> <span class="Identifier">ids</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">Id</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">ids</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="FloatNumber">3.</span><span class="Identifier">Id</span><span class="Punctuation">)</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L160" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L160" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="intersection-procs-all">
- <div id="intersection,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#intersection%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">intersection</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>Returns the intersection of the sets <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p>The same as <a class="reference external" href="#*,PackedSet[A],PackedSet[A]">s1 * s2</a>.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">intersection</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">1</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L469" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L469" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="isNil-procs-all">
- <div id="isNil,PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#isNil%2CPackedSet%5BA%5D"><span class="Identifier">isNil</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> is empty, false otherwise.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Identifier">initPackedSet</span><span class="Punctuation">[</span><span class="Identifier">int</span><span class="Punctuation">]</span><span class="Punctuation">(</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">isNil</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">incl</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Keyword">not</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">isNil</span>
- <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">excl</span><span class="Punctuation">(</span><span class="DecNumber">2</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">isNil</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L398" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L398" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="len-procs-all">
- <div id="len,PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#len%2CPackedSet%5BA%5D"><span class="Identifier">len</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Returns the number of elements in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">3</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L347" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L347" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="missingOrExcl-procs-all">
- <div id="missingOrExcl,PackedSet[A],A">
- <dt><pre><span class="Keyword">proc</span> <a href="#missingOrExcl%2CPackedSet%5BA%5D%2CA"><span class="Identifier">missingOrExcl</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">key</span><span class="Other">:</span> <span class="Identifier">A</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a></pre></dt>
- <dd>
-
- <p>Excludes <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> from the set <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> and tells if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> was already missing from <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.</p>
- <p>The difference with regards to the <a class="reference external" href="#excl,PackedSet[A],A">excl proc</a> is that this proc returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> was missing from <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>. The proc will return false if <tt class="docutils literal"><span class="pre"><span class="Identifier">key</span></span></tt> was in <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> and it was removed during this call.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#excl,PackedSet[A],A">excl proc</a> for excluding an element</li>
- <li><a class="reference external" href="#excl,PackedSet[A],PackedSet[A]">excl proc</a> for excluding a set</li>
- <li><a class="reference external" href="#containsOrIncl,PackedSet[A],A">containsOrIncl proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">var</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">missingOrExcl</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">false</span>
- <span class="Identifier">assert</span> <span class="Identifier">a</span><span class="Operator">.</span><span class="Identifier">missingOrExcl</span><span class="Punctuation">(</span><span class="DecNumber">5</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="Identifier">true</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L361" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L361" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="symmetricDifference-procs-all">
- <div id="symmetricDifference,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#symmetricDifference%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">symmetricDifference</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- Returns the symmetric difference of the sets <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">symmetricDifference</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L503" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L503" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="toPackedSet-procs-all">
- <div id="toPackedSet,openArray[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#toPackedSet%2CopenArray%5BA%5D"><span class="Identifier">toPackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>Creates a new <tt class="docutils literal"><span class="pre"><span class="Identifier">PackedSet</span><span class="Punctuation">[</span><span class="Identifier">A</span><span class="Punctuation">]</span></span></tt> that contains the elements of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>.</p>
- <p>Duplicates are removed.</p>
- <p><strong>See also:</strong></p>
- <ul class="simple"><li><a class="reference external" href="#initPackedSet">initPackedSet proc</a></li>
- </ul>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span> <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">5</span><span class="Punctuation">,</span> <span class="DecNumber">6</span><span class="Punctuation">,</span> <span class="DecNumber">7</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">,</span> <span class="DecNumber">8</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">assert</span> <span class="Identifier">len</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="DecNumber">4</span>
- <span class="Identifier">assert</span> <span class="Operator">$</span><span class="Identifier">a</span> <span class="Operator">==</span> <span class="StringLit">"{5, 6, 7, 8}"</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L260" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L260" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- <div id="union-procs-all">
- <div id="union,PackedSet[A],PackedSet[A]">
- <dt><pre><span class="Keyword">proc</span> <a href="#union%2CPackedSet%5BA%5D%2CPackedSet%5BA%5D"><span class="Identifier">union</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s1</span><span class="Other">,</span> <span class="Identifier">s2</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span></pre></dt>
- <dd>
-
- <p>Returns the union of the sets <tt class="docutils literal"><span class="pre"><span class="Identifier">s1</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">s2</span></span></tt>.</p>
- <p>The same as <a class="reference external" href="#+,PackedSet[A],PackedSet[A]">s1 + s2</a>.</p>
- <p><strong class="examples_text">Example:</strong></p>
- <pre class="listing"><span class="Keyword">let</span>
- <span class="Identifier">a</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">b</span> <span class="Operator">=</span> <span class="Punctuation">[</span><span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span>
- <span class="Identifier">c</span> <span class="Operator">=</span> <span class="Identifier">union</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">)</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span><span class="Operator">.</span><span class="Identifier">len</span> <span class="Operator">==</span> <span class="DecNumber">5</span>
- <span class="Identifier">assert</span> <span class="Identifier">c</span> <span class="Operator">==</span> <span class="Punctuation">[</span><span class="DecNumber">1</span><span class="Punctuation">,</span> <span class="DecNumber">2</span><span class="Punctuation">,</span> <span class="DecNumber">3</span><span class="Punctuation">,</span> <span class="DecNumber">4</span><span class="Punctuation">,</span> <span class="DecNumber">5</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toPackedSet</span></pre>
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L454" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L454" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- </dl>
- </div>
- <div class="section" id="15">
- <h1><a class="toc-backref" href="#15">Iterators</a></h1>
- <dl class="item">
- <div id="items-iterators-all">
- <div id="items.i,PackedSet[A]">
- <dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CPackedSet%5BA%5D"><span class="Identifier">items</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="packedsets.html#PackedSet"><span class="Identifier">PackedSet</span></a><span class="Other">[</span><span class="Identifier">A</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">A</span> {.<span class="Identifier">inline</span>.}</pre></dt>
- <dd>
-
- Iterates over any included element of <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt>.
- <a href="https://github.com/nim-lang/Nim/tree/devel/lib/std/packedsets.nim#L138" class="link-seesrc" target="_blank">Source</a>
- <a href="https://github.com/nim-lang/Nim/edit/devel/lib/std/packedsets.nim#L138" class="link-seesrc" target="_blank" >Edit</a>
- </dd>
- </div>
- </div>
- </dl>
- </div>
- </div>
- </div>
- <div class="twelve-columns footer">
- <span class="nim-sprite"></span>
- <br>
- <small style="color: var(--hint);">Made with Nim. Generated: 2025-02-03 14:57:22 UTC</small>
- </div>
- </div>
- </div>
- <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
-
- </body>
- </html>
|