GithubHelp home page GithubHelp logo

eigenhombre / cl-oju Goto Github PK

View Code? Open in Web Editor NEW
18.0 4.0 2.0 163 KB

Some Clojure-ish thingies for Common Lisp

License: MIT License

Common Lisp 88.36% Shell 5.95% Dockerfile 4.85% Makefile 0.84%
clojure common-lisp lisp

cl-oju's Introduction

cl-oju

build

What is oju? A Mysterious Sauce used as a special ingredient sourced (some would say pilfered) from an advanced civilization thirty years in the future (far beyond the late 1980's).

cl-oju: a few idioms, mostly relating to sequences, that I miss when writing Common Lisp.

There are many more comprehensive utility libraries out there, such as Serapeum. This one is focused on a fairly narrow goal: to provide fairly simple equivalents to core Clojure functions. Since I frequently reach for (and write) these out of habit, I wanted a place to put them.

I haven't needed to worry too much about comprehensiveness or performance, though PRs to improve either will be gratefully reviewed. I typically add functions here when I reach for them out of habit while working in Common Lisp.

Note that I stick to the functional interface of familiar Clojure expressions, but do not worry about immutable data structures or laziness in this library.

If you're new to Common Lisp coming from Clojure, it may be better to learn "the Common Lisp way" of doing things than to rely on these functions; but this library can still be a reference point to see a way of doing things you're used to.

Supported operators:

comment
comp
drop
filter
frequencies
group-by
if-not
interleave
interpose
juxt
neg?
not=          (based on #'EQUAL)
partial
partition-all
partition-by
partition-n   (called "partition" in Clojure)
pos?
rand-int
rand-nth
range
repeatedly
slurp
sort-by
spit
str
take
take-while
when-not

Usage

Available on Quicklisp or Ultralisp:

(ql:quickload :cl-oju)

Example:

(in-package :cl-oju)

(mapcar (juxt (comp #'length #'str)
              #'identity)
        (repeatedly 10 (lambda () (rand-int 1000))))
;;=>
'((3 717) (3 508) (3 238) (3 366) (2 50) (3 564) (3 395) (2 18) (3 446) (3 935))

Testing / Building

make test should be sufficient to run the tests using SBCL, or make test-ecl for ECL. You can also run them in Docker (make docker), which is what the CI for this project does. You'll obviously need make and Docker installed for this.

License

MIT

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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.