https://github.com/gsscoder/cup
CUP | ConfigUration Package for Erlang with LFE
https://github.com/gsscoder/cup
Last synced: 4 months ago
JSON representation
CUP | ConfigUration Package for Erlang with LFE
- Host: GitHub
- URL: https://github.com/gsscoder/cup
- Owner: gsscoder
- Created: 2015-06-09T19:15:39.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-10T16:15:32.000Z (about 10 years ago)
- Last Synced: 2024-12-28T15:34:16.028Z (6 months ago)
- Language: Erlang
- Size: 129 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cup
CUP | ConfigUration Package for Erlang with LFEThe name is a tribute to [LFE](http://lfe.io/) logo.
## Acknowledgements:
From a Stackoverflow [discussion](https://groups.google.com/forum/#!topic/lisp-flavoured-erlang/S5s6c5DovEE)
followed by a [deepening](https://groups.google.com/forum/#!topic/lisp-flavoured-erlang/S5s6c5DovEE) in the LFE Google group.Thanks to Duncann McGreggor and Robert Virding.
## Example
This is nothing more than explorative programming for learning. Anyway...
```erlang
%% using a list
LL = cup:lambda_list(["'get-timeout (lambda() (* 3 1000))", "'get-endpoint (lambda() (list '\"localhost\"))"]),
Lambda = cup:lambda_by_atom(LL, 'get-timeout'),
Timeout = Lambda(). % =:= 3000%% reading from file
{ok, LL} = cup:consult("testconf.lfe"),
Lambda = cup:lambda_by_atom(LL, 'get-endpoints'),
EndPoints = Lambda(). % =:= ["localhost", "127.0.0.1"]
```There's a lot to do from now... View this repository as the continuation of the discussion.