Skip to content
/ lutil Public

LFE Utility Modules (successor to lfe-utils)

License

Notifications You must be signed in to change notification settings

lfex/lutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lutil

Build Status LFE Versions Erlang Versions Tags

Utility functions for LFE

Project Logo

Contents

Introduction

lutil offers several modules and macros with convenience functions that can be easily incorporated into projects without having to re-implement these little functions all the time.

lutil also explores new LFE functions and macros that may be of interest to LFE-proper; if they fare well here, we will submit proposals for inclusion.

Note that with the release of 0.14, many deprecated functions and macros that have either been moved into LFE itself or other LFE libraries were removed and are no longer available in the library. The last version with those functions present is 0.13.5.

Dependencies

As of version 0.7.0, this project assumes that you have rebar3 installed somewhere in your $PATH. It no longer uses the old version of rebar. If you do not wish to use rebar3, you may use the most recent rebar2-compatible release of lutil: 0.6.7.

Installation

In your rebar.config file, update your deps section to include lutil:

{deps, [
  {lutil, "0.15.0"}}}
]}

Usage

Modules

For the modules, usage is the same as any other Erlang or LFE library :-)

Some example usage:

> (lutil-math:dot-product '(1 2 3) '(4 5 6))
32

> (lutil-tuple:cat (tuple 1 2) (tuple 3 4))
#(1 2 3 4)
> (lutil-tuple:cat (list (tuple 1 2) (tuple 3 4) (tuple 5 6)))
#(1 2 3 4 5 6)

lfe> (lutil-list:chunks (lists:seq 1 32) 8 #(by-parts))
((1 2 3 4)
 (5 6 7 8)
 (9 10 11 12)
 (13 14 15 16)
 (17 18 19 20)
 (21 22 23 24)
 (25 26 27 28)
 (29 30 31 32))
lfe> (lutil-list:chunks (lists:seq 1 32) 8 #(by-length))
((1 2 3 4 5 6 7 8)
 (9 10 11 12 13 14 15 16)
 (17 18 19 20 21 22 23 24)
 (25 26 27 28 29 30 31 32))

Macros

lutil offers the create-table macro for use with more easily working generating Mnesia tables. Example usage is available here.

If you are looking for the Clojure macros which used to be in lutil, they have an interesting history: they were first moved to their own project, and then added to the LFE stdlib!

License

BSD 3-Clause License

Copyright © 2013-2024, Duncan McGreggor <[email protected]>
Copyright © 2016, Eric Bailey <[email protected]>
Copyright © 2015, arpunk <[email protected]>
                  osense <[email protected]>
Copyright © 2014, Torbjorn Tornkvist <[email protected]>
                  Døkkarr Hirðisson <[email protected]>
                  Dreki Þórgísl <[email protected]>\
Copyright © 2009, Tim Dysinger <[email protected]>