Giter Club home page Giter Club logo

clj's Introduction

clj

DEPRECATED: This library is no longer maintained! Nor is it useful, since the functionality it provides has been moved into LFE-proper (see the clj module).

Clojure functions and macros for LFE

Contents

Introduction

The clj library offers a collection of functions and macros that you may find useful or enjoyable in LFE if you've come from a Clojure background.

This library is in the process of extracting the Clojure functionality that made its way into the lutil LFE library

Dependencies

As of version 0.3.0, this project assumes that you have rebar3 installed somwhere 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 clj: 0.2.1.

Installation

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

  {deps, [
    ...
    {clj, ".*",
      {git, "[email protected]:lfex/clj.git", {tag, "0.3.0"}}}
      ]}.

Usage

TBD

(We are changing the functions and macros from what they were in lutil, so usage has not yet stabilized. If you want to be an alpha tester/user, be sure to look at the unit tests and code comments, both in the modules and in the include files.)

Future

The future of the clj library is quite bright :-) In a couple posts on the LFE mail list, Robert Virding has offered to bring Clojure functionality into LFE-proper:

The rest is up to us :-) As such, I will be creating a series of tickets in this repo targeted against a branch of Robert's LFE repo. Anyone in the community may make a contribution to this branch -- simply sumbit a PR. Once we have critical mass on Clojure-inspired functions and macros, I will submit a PR to upstream LFE, and all of our work will be included :-)

Here's the branch:

Here are the tickets you can chose from to implement your favourite Clojure bits in LFE (if you don't see the one you want, add it!):

IMPORTANT: Even though these tickets are in the lfex/clj repo, you will be working against a branch of oubiwann/lfe! Do not submit PRs against lfex/clj -- submit them against the add-clojure-lib branch of oubiwann/lfe.

Now go forth, and help these two worlds to collide :-D

clj's People

Contributors

oubiwann avatar dokkarr avatar yurrriq avatar

Stargazers

tyoc213 avatar João Fernando Apel Miguel avatar Prokopiy N. Stelmash avatar hamlet avatar dem avatar  avatar George Plymale II avatar  avatar Chen avatar Gal Dolber avatar ontofractal avatar Mark Farrell avatar Claudia Doppioslash avatar Max Penet avatar Federico Carrone avatar Piotr Limanowski avatar Angus H. avatar Dan avatar Sean Jensen-Grey avatar Juan Facorro avatar Christoffer Sawicki avatar Josh Teneycke avatar  avatar coder (π³) avatar Steffen Dienst avatar Sébastien Arnaud avatar  avatar Wojtek Gawroński avatar

Watchers

Robert Virding avatar James Cloos avatar  avatar  avatar Prokopiy N. Stelmash avatar  avatar

clj's Issues

Unable to build

lfe/lfe@d9a4e4d
b935818
lfe-rebar3/compile@6d7a824

rebar 3.0.0+build.3378.refc619921 on Erlang/OTP 18 Erts 7.3
===> Uncaught error: {case_clause,
                             {error,
                              [{error,
                                [{"/path/to/my_project/_build/default/lib/clj/src/clj-seq.lfe",
                                  [{3,lfe_lint,
                                    {redef_fun,
                                     {'LFE-EXPAND-EXPORTED-MACRO',3}}}]}],
                                []}],
                              [],[]}}

Update predicates with improvements from Tim Dysinger

@dysinger created some nice implementations of various functions and macros in his lfesl project (so far only his thrushing macros have been copied over). In particular, I think I've seen a couple improvements there over what I've done for one or two predicates. That should be reviewed more carefully and then updated with his code.

See https://github.com/dysinger/lfesl/tree/master/include

See the older version of this issue for more context:

Error compiling with v1.0 of LFE

@rvirding below is the issue I was referring to in the lfe/lfe#201 ticket. I haven't dug into it yet, but I wanted to get this issue created in case you had time before I got to it later today,

Here's the output of compiling (with rebar3):

 ~~>    Compiling ./src/clj-seq.lfe ...
===>        Compiling
            "/home/oubiwann/lab/lfe/clj/src/clj-seq.lfe"
            to "/home/oubiwann/lab/lfe/clj/_build/default/lib/clj/ebin/clj-seq.beam" ...
===>        Config: [{outdir,
                                     "/home/oubiwann/lab/lfe/clj/_build/default/lib/clj/ebin"},
                                 debug_info,debug_info,
                                 {i,"include"},
                                 return,verbose]
===>    Compile results: {error,
                                  [{error,
                                    [{"/home/oubiwann/lab/lfe/clj/src/clj-seq.lfe",
                                      [{3,lfe_lint,
                                        {redef_fun,
                                         {'LFE-EXPAND-EXPORTED-MACRO',3}}}]}],
                                    []}],
                                  [],[]}
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace
===> Uncaught error: {case_clause,
                             {error,
                              [{error,
                                [{"/home/oubiwann/lab/lfe/clj/src/clj-seq.lfe",
                                  [{3,lfe_lint,
                                    {redef_fun,
                                     {'LFE-EXPAND-EXPORTED-MACRO',3}}}]}],
                                []}],
                              [],[]}}

Implement when-let

(when-let [result (foo x)]
  (do-something-with result)
  (do-something-more-with result))

Clojure threading macros

Hi there,

Nice work bringing some of the great parts of Clojure to LFE.

I'm not sure whether it is even feasible but it would be great to see some of Clojure's threading macros introduced to this library. In particular the -> thread-first and ->> thread-last macros.

Another comparison would be Elixir's |> pipe operator.

How are we going to map clojure to LFE?

A question is how we are going to map clojure data structures to LFE/erlang? With the CL module we sort of did it but not with everything, for example booleans. Another is how far we want to go with the clojure concurrency types which except for agents don't really map well to LFE.

Add transducers?

Need to spend some more time reading about them, but so far it seems that it could provide a nice means of using a single set of functions for map, foldl, filter, take, etc., without having to write a different one for each type (lists, maps, dicts, tulpes, sets, etc.).

We'll see.

Reading:

For full context, see the discussion here:

Implement codnp

Possibly as an alias for case?

(condp = x
  10 :ten
  20 :twenty
  30 :forty
  :dunno)

Implement doto?

I've got an implementation of doto lying around. Should we include it?

Implement if-let

(if-let [result (foo x)]
  (something-with result)
  (something-else))

Remove dependency upon ltest

Per @arpunk's ticket in the ltest project (see lfex/ltest#34), I'm going to be removing the dep for ltest in clj. But we'll also need a long-term solution (as long as the clj project exists outside of LFE-proper). As such, this ticket has two parts:

  1. Break the cyclic dependency experienced by ltest (and projects that wish to use ltest and clj as a dep)
  2. Provide along-term solution for bringing ltest into the clj project (mostly for developers and contributors of the clj project)

There are several other approaches we can use. As we bump into a need for pulling down the dep, we can work around it. I'll leave ticket open until that second half is addressed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.