Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
arunpatro committed Jul 13, 2024
1 parent 1ad9bf0 commit 3d734b0
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ wheels/
dev/
requirements-dev.lock
requirements.lock

# custom
.vscode
2 changes: 1 addition & 1 deletion _docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A simple way to program declaratively in python.

## Usage
1. Easily create lambdas
1. Create lambdas with arrow notation
```python
from declo.tools import d_lambda

Expand Down
34 changes: 18 additions & 16 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -354,23 +354,25 @@ <h1 id="declo">declo</h1>
<p>A simple way to program declaratively in python.</p>
<h2 id="usage">Usage</h2>
<ol>
<li>Easily create lambdas</li>
</ol>
<pre><code class="language-python">from declo.tools import d_lambda

add_one = d_lambda(&quot;x =&gt; x + 1&quot;)
assert add_one(1) == 2 # True
</code></pre>
<ol>
<li>Create named functions globally</li>
<li>
<p>Create lambdas with arrow notation
<div class="language-python highlight" style="background: #2E3440"><pre style="line-height: 125%;"><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span style="color: #81a1c1; font-weight: bold">from</span> <span style="color: #8fbcbb">declo.tools</span> <span style="color: #81a1c1; font-weight: bold">import</span> <span style="color: #d8dee9">d_lambda</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a>
</span><span id="__span-0-3"><a id="__codelineno-0-3" name="__codelineno-0-3" href="#__codelineno-0-3"></a><span style="color: #d8dee9">add_one</span> <span style="color: #81a1c1; font-weight: bold">=</span> <span style="color: #d8dee9">d_lambda</span><span style="color: #eceff4">(</span><span style="color: #a3be8c">&quot;x =&gt; x + 1&quot;</span><span style="color: #eceff4">)</span>
</span><span id="__span-0-4"><a id="__codelineno-0-4" name="__codelineno-0-4" href="#__codelineno-0-4"></a><span style="color: #81a1c1; font-weight: bold">assert</span> <span style="color: #d8dee9">add_one</span><span style="color: #eceff4">(</span><span style="color: #b48ead">1</span><span style="color: #eceff4">)</span> <span style="color: #81a1c1; font-weight: bold">==</span> <span style="color: #b48ead">2</span> <span style="color: #616e87; font-style: italic"># True</span>
</span></code></pre></div></p>
</li>
<li>
<p>Create named functions globally
<div class="language-python highlight" style="background: #2E3440"><pre style="line-height: 125%;"><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a><span style="color: #81a1c1; font-weight: bold">from</span> <span style="color: #8fbcbb">declo.tools</span> <span style="color: #81a1c1; font-weight: bold">import</span> <span style="color: #d8dee9">run</span>
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a>
</span><span id="__span-1-3"><a id="__codelineno-1-3" name="__codelineno-1-3" href="#__codelineno-1-3"></a><span style="color: #616e87; font-style: italic"># this creates a function foo in the global name space. </span>
</span><span id="__span-1-4"><a id="__codelineno-1-4" name="__codelineno-1-4" href="#__codelineno-1-4"></a><span style="color: #d8dee9">run</span><span style="color: #eceff4">(</span><span style="color: #a3be8c">&quot;let foo = x =&gt; x + 1&quot;</span><span style="color: #eceff4">)</span>
</span><span id="__span-1-5"><a id="__codelineno-1-5" name="__codelineno-1-5" href="#__codelineno-1-5"></a>
</span><span id="__span-1-6"><a id="__codelineno-1-6" name="__codelineno-1-6" href="#__codelineno-1-6"></a><span style="color: #81a1c1; font-weight: bold">assert</span> <span style="color: #d8dee9">foo</span><span style="color: #eceff4">(</span><span style="color: #b48ead">5</span><span style="color: #eceff4">)</span> <span style="color: #81a1c1; font-weight: bold">==</span> <span style="color: #b48ead">6</span>
</span></code></pre></div></p>
</li>
</ol>
<pre><code class="language-python">from declo.tools import run

# this creates a function foo in the global name space.
run(&quot;let foo = x =&gt; x + 1&quot;)

assert foo(5) == 6
</code></pre>
<h2 id="thoughts">Thoughts</h2>
<ol>
<li>Can we introduce synctatic sugar with pre-processing?</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/search/search_index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"declo","text":"<p>A simple way to program declaratively in python.</p>"},{"location":"#usage","title":"Usage","text":"<ol> <li>Easily create lambdas</li> </ol> <pre><code>from declo.tools import d_lambda\n\nadd_one = d_lambda(\"x =&gt; x + 1\")\nassert add_one(1) == 2 # True\n</code></pre> <ol> <li>Create named functions globally</li> </ol> <pre><code>from declo.tools import run\n\n# this creates a function foo in the global name space. \nrun(\"let foo = x =&gt; x + 1\")\n\nassert foo(5) == 6\n</code></pre>"},{"location":"#thoughts","title":"Thoughts","text":"<ol> <li>Can we introduce synctatic sugar with pre-processing?</li> <li>Can we dynamically create native objects using <code>ast</code>, <code>compile()</code> or <code>types.FunctionDef</code>?</li> <li>What are the hard things - like closures?</li> <li>How do we handle linting?</li> </ol>"}]}
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"declo","text":"<p>A simple way to program declaratively in python.</p>"},{"location":"#usage","title":"Usage","text":"<ol> <li> <p>Create lambdas with arrow notation <pre><code>from declo.tools import d_lambda\n\nadd_one = d_lambda(\"x =&gt; x + 1\")\nassert add_one(1) == 2 # True\n</code></pre></p> </li> <li> <p>Create named functions globally <pre><code>from declo.tools import run\n\n# this creates a function foo in the global name space. \nrun(\"let foo = x =&gt; x + 1\")\n\nassert foo(5) == 6\n</code></pre></p> </li> </ol>"},{"location":"#thoughts","title":"Thoughts","text":"<ol> <li>Can we introduce synctatic sugar with pre-processing?</li> <li>Can we dynamically create native objects using <code>ast</code>, <code>compile()</code> or <code>types.FunctionDef</code>?</li> <li>What are the hard things - like closures?</li> <li>How do we handle linting?</li> </ol>"}]}
27 changes: 26 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,29 @@ theme:
repo: fontawesome/brands/github
font:
text: Inter
code: Source Code Pro
code: Source Code Pro
palette:
scheme: slate
primary: 'black'
accent: 'indigo'

# Extensions
markdown_extensions:
- admonition
- def_list
- attr_list
- md_in_html
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
noclasses: True
pygments_style: monokai
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true
- pymdownx.inlinehilite
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg

0 comments on commit 3d734b0

Please sign in to comment.