Liking cljdoc? Tell your friends :D

ham-fisted.hlet

Extensible let to allow efficient typed destructuring.

Registered Extensions:

dbls and lngs will most efficiently destructure java primitive arrays and fall back to casting the result of clojure.lang.RT/nth if input is not a double or long array.

dlb-fns and lng-fns call the object's IFn interface with no interface checking. This will not work with a raw array but is the fastest way - faster than RT/nth - to get data out of a persistent-vector or map like object.

obj-fns - fast IFn-based destructuring to objects - does not work with object arrays. Often much faster than RT/nth.

This can significantly reduce boxing in tight loops without needing to result in really verbose pathways.

user> (h/let [[a b] (dbls [1 2])] (+ a b))
  3.0
user> (hamf/sum-fast (lznc/cartesian-map
                      #(h/let [[a b c d](lng-fns %)]
                         (-> (+ a b) (+ c) (+ d)))
                      [1 2 3]
                      [4 5 6]
                      [7 8 9]
                      [10 11 12 13 14]))
3645.0

See also ham-fisted.primitive-invoke, ham-fisted.api/dnth ham-fisted.api/lnth.

Extensible let to allow efficient typed destructuring.

  Registered Extensions:

  `dbls` and `lngs` will most efficiently destructure java primitive arrays and fall back to casting the result
  of clojure.lang.RT/nth if input is not a double or long array.

  `dlb-fns` and `lng-fns` call the object's IFn interface with no interface checking.  This will *not* work
   with a raw array but is the fastest way - faster than RT/nth - to get data out of a persistent-vector or map
   like object.

  `obj-fns` - fast IFn-based destructuring to objects - does not work with object arrays.  Often much faster
   than RT/nth.

  This can significantly reduce boxing in tight loops without needing to result in really verbose pathways.

```clojure
user> (h/let [[a b] (dbls [1 2])] (+ a b))
  3.0
user> (hamf/sum-fast (lznc/cartesian-map
                      #(h/let [[a b c d](lng-fns %)]
                         (-> (+ a b) (+ c) (+ d)))
                      [1 2 3]
                      [4 5 6]
                      [7 8 9]
                      [10 11 12 13 14]))
3645.0
```
  See also [[ham-fisted.primitive-invoke]], [[ham-fisted.api/dnth]] [[ham-fisted.api/lnth]].
raw docstring

extend-letclj

(extend-let sym-name code)

Code gets a tuple of [lhs rhs] must return a flattened sequence of left and right hand sides. This uses a special symbol that will look like a function call on the right hand side as the dispatch mechanism.

See source code of this file for example extensions.

Code gets a tuple of [lhs rhs] must return
a flattened sequence of left and right hand sides.
This uses a special symbol that will look like a function call on the
right hand side as the dispatch mechanism.

See source code of this file for example extensions.
raw docstring

letcljmacro

(let bindings & body)

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. Several extensions are registered by default -

  • dbls and lngs which destructure into primitive doubles and primitive longs, respectively.
  • dlb-fns and lng-fns which destructure into primitive doubls and longs but use the often faster IFn overloads to get the data - avoiding RT.nth calls.
  • obj-fns which destructure into objects using the IFn interface.
user> (h/let [[x y] (dbls (hamf/double-array [1 2]))]
        (+ x y))
3.0
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.  Several extensions are registered by default -
  * `dbls` and `lngs` which destructure into primitive doubles and primitive longs, respectively.
  * `dlb-fns` and `lng-fns` which destructure into primitive doubls and longs but use the often faster IFn overloads
     to get the data - avoiding RT.nth calls.
  * `obj-fns` which destructure into objects using the IFn interface.

```clojure
user> (h/let [[x y] (dbls (hamf/double-array [1 2]))]
        (+ x y))
3.0
```
  
raw docstring

let-extension-namesclj

(let-extension-names)

Return the current extension names.

Return the current extension names.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close