-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update doc to include cartn_append() also rename cart2_append()
- Loading branch information
Yuhang(Steven) Wang
committed
Jun 25, 2016
1 parent
712d382
commit 98eef87
Showing
45 changed files
with
972 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
221 changes: 221 additions & 0 deletions
221
doc/_build/html/_modules/FunctionalX/src/lists/_cart2_append.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
|
||
|
||
<!DOCTYPE html> | ||
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> | ||
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
|
||
<title>FunctionalX.src.lists._cart2_append — FunctionalX.py 0.0.1 documentation</title> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="../../../../_static/css/theme.css" type="text/css" /> | ||
|
||
|
||
|
||
|
||
|
||
<link rel="top" title="FunctionalX.py 0.0.1 documentation" href="../../../../index.html"/> | ||
<link rel="up" title="Module code" href="../../../index.html"/> | ||
|
||
|
||
<script src="../../../../_static/js/modernizr.min.js"></script> | ||
|
||
</head> | ||
|
||
<body class="wy-body-for-nav" role="document"> | ||
|
||
<div class="wy-grid-for-nav"> | ||
|
||
|
||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search"> | ||
|
||
|
||
|
||
<a href="../../../../index.html" class="icon icon-home"> FunctionalX.py | ||
|
||
|
||
|
||
</a> | ||
|
||
|
||
|
||
|
||
<div class="version"> | ||
0.0.1 | ||
</div> | ||
|
||
|
||
|
||
|
||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> | ||
|
||
|
||
|
||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../../lists/toc.html">lists</a></li> | ||
</ul> | ||
|
||
|
||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> | ||
|
||
|
||
<nav class="wy-nav-top" role="navigation" aria-label="top navigation"> | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../../index.html">FunctionalX.py</a> | ||
</nav> | ||
|
||
|
||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<div role="navigation" aria-label="breadcrumbs navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../../index.html">Docs</a> »</li> | ||
|
||
<li><a href="../../../index.html">Module code</a> »</li> | ||
|
||
<li>FunctionalX.src.lists._cart2_append</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
|
||
|
||
|
||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for FunctionalX.src.lists._cart2_append</h1><div class="highlight"><pre> | ||
<div class="viewcode-block" id="cart2_append"><a class="viewcode-back" href="../../../../lists/cart2_append.html#FunctionalX.src.lists._cart2_append.cart2_append">[docs]</a><span></span><span class="k">def</span> <span class="nf">cart2_append</span><span class="p">(</span><span class="n">list1</span><span class="p">,</span> <span class="n">list2</span><span class="p">):</span> | ||
<span class="sd">"""Append items from list2 to list1 for all possible pairs.</span> | ||
|
||
<span class="sd"> Append an element from the second list to the each element from the first list</span> | ||
<span class="sd"> therefore increase the number of elements in each item in the first list.</span> | ||
|
||
<span class="sd"> :param list list1: input list 1</span> | ||
<span class="sd"> :param list list2: input list 2</span> | ||
|
||
<span class="sd"> :return: a new list.</span> | ||
<span class="sd"> :rtype: list</span> | ||
|
||
<span class="sd"> >>> cart_append([[1,2]], ['a','b']) </span> | ||
<span class="sd"> [[1,2,'a'], [1,2,'b']]</span> | ||
<span class="sd"> """</span> | ||
<span class="k">def</span> <span class="nf">others</span><span class="p">(</span><span class="n">list1</span><span class="p">):</span> | ||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">list1</span><span class="p">)</span> <span class="o"><=</span> <span class="mi">1</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="p">[]</span> | ||
<span class="k">else</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="n">list1</span><span class="p">[</span><span class="mi">1</span><span class="p">:]</span> | ||
|
||
<span class="k">def</span> <span class="nf">aux</span><span class="p">(</span><span class="n">list1</span><span class="p">,</span> <span class="n">list2</span><span class="p">,</span> <span class="n">accum</span><span class="p">):</span> | ||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">list1</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="n">list2</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="n">accum</span> | ||
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">list1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nb">list</span><span class="p">):</span> | ||
<span class="k">return</span> <span class="n">aux</span><span class="p">(</span><span class="n">others</span><span class="p">(</span><span class="n">list1</span><span class="p">),</span> <span class="n">list2</span><span class="p">,</span> <span class="n">aux</span><span class="p">(</span><span class="n">list1</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">list2</span><span class="p">,</span> <span class="n">accum</span><span class="p">))</span> | ||
<span class="k">else</span><span class="p">:</span> | ||
<span class="k">return</span> <span class="n">aux</span><span class="p">(</span><span class="n">list1</span><span class="p">,</span> <span class="n">others</span><span class="p">(</span><span class="n">list2</span><span class="p">),</span> <span class="n">accum</span> <span class="o">+</span> <span class="p">[</span><span class="n">list1</span> <span class="o">+</span> <span class="p">[</span><span class="n">list2</span><span class="p">[</span><span class="mi">0</span><span class="p">]]])</span> | ||
|
||
<span class="k">return</span> <span class="n">aux</span><span class="p">(</span><span class="n">list1</span><span class="p">,</span> <span class="n">list2</span><span class="p">,</span> <span class="p">[])</span></div> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p> | ||
© Copyright 2016, Yuhang(Steven) Wang. | ||
|
||
</p> | ||
</div> | ||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. | ||
|
||
</footer> | ||
|
||
</div> | ||
</div> | ||
|
||
</section> | ||
|
||
</div> | ||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT:'../../../../', | ||
VERSION:'0.0.1', | ||
COLLAPSE_INDEX:false, | ||
FILE_SUFFIX:'.html', | ||
HAS_SOURCE: true | ||
}; | ||
</script> | ||
<script type="text/javascript" src="../../../../_static/jquery.js"></script> | ||
<script type="text/javascript" src="../../../../_static/underscore.js"></script> | ||
<script type="text/javascript" src="../../../../_static/doctools.js"></script> | ||
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> | ||
|
||
|
||
|
||
|
||
|
||
<script type="text/javascript" src="../../../../_static/js/theme.js"></script> | ||
|
||
|
||
|
||
|
||
<script type="text/javascript"> | ||
jQuery(function () { | ||
SphinxRtdTheme.StickyNav.enable(); | ||
}); | ||
</script> | ||
|
||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.