Skip to content

Commit

Permalink
Docs update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Nov 3, 2023
1 parent 15eeaa9 commit c8970fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 8 additions & 3 deletions docs/ham-fisted.hlet.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
This uses a special symbol that will look like a function call on the
right hand side as the dispatch mechanism.</p>
<p>See source code of this file for example extensions.</p>
</div></div><div class="src-link"><a href="https://github.com/cnuernber/ham-fisted/blob/master/src/ham_fisted/hlet.clj#L26">view source</a></div></div><div class="public anchor" id="var-let"><h3>let</h3><h4 class="type">macro</h4><div class="usage"><code>(let bindings &amp; body)</code></div><div class="doc"><div class="markdown"><p>Extensible let intended to allow typed destructuring of arbitrary datatypes such as primitive vectors
or point types. Falls back to normal let after extension process.</p>
</div></div><div class="src-link"><a href="https://github.com/cnuernber/ham-fisted/blob/master/src/ham_fisted/hlet.clj#L26">view source</a></div></div><div class="public anchor" id="var-let"><h3>let</h3><h4 class="type">macro</h4><div class="usage"><code>(let bindings &amp; body)</code></div><div class="doc"><div class="markdown"><p>Extensible let intended to allow typed destructuring of arbitrary datatypes such as primitive arrays
or point types. Falls back to normal let after extension process. Two extensions are registered by default -
<code>dbls</code> and <code>lngs</code> which destructure into primitive doubles and primitive longs, respectively.</p>
<pre><code class="language-clojure">user&gt; (h/let [[x y] (dbls (hamf/double-array [1 2]))]
(+ x y))
3.0
</code></pre>
</div></div><div class="src-link"><a href="https://github.com/cnuernber/ham-fisted/blob/master/src/ham_fisted/hlet.clj#L66">view source</a></div></div><div class="public anchor" id="var-let-extension-names"><h3>let-extension-names</h3><div class="usage"><code>(let-extension-names)</code></div><div class="doc"><div class="markdown"><p>Return the current extension names.</p>
</div></div><div class="src-link"><a href="https://github.com/cnuernber/ham-fisted/blob/master/src/ham_fisted/hlet.clj#L104">view source</a></div></div></div></body></html>
</div></div><div class="src-link"><a href="https://github.com/cnuernber/ham-fisted/blob/master/src/ham_fisted/hlet.clj#L112">view source</a></div></div></div></body></html>
12 changes: 10 additions & 2 deletions src/ham_fisted/hlet.clj
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,16 @@ user> (hlet [[a b] (dbls [1 2])] (+ a b))


(defmacro let
"Extensible let intended to allow typed destructuring of arbitrary datatypes such as primitive vectors
or point types. Falls back to normal let after extension process."
"Extensible let intended to allow typed destructuring of arbitrary datatypes such as primitive arrays
or point types. Falls back to normal let after extension process. Two extensions are registered by default -
`dbls` and `lngs` which destructure into primitive doubles and primitive longs, respectively.
```clojure
user> (h/let [[x y] (dbls (hamf/double-array [1 2]))]
(+ x y))
3.0
```
"
[bindings & body]
(when-not (== 0 (rem (count bindings) 2))
(throw (RuntimeException. "Bindings must be divisible by 2")))
Expand Down

0 comments on commit c8970fa

Please sign in to comment.