Giter VIP home page Giter VIP logo

loom's Introduction

The primary goal of LOOM is to provide Common Lisp standard functions as generic functions. This is useful, for example, to do things like extend mathematical operators to work on new classes.

The downside of this is the overhead of dispatch. To help mitigate this, LOOM is divided into multiple packages (one for each chapter in the spec) that can be used individually. Each package has two versions, one is prefixed with cl. and just passes through the CL symbols, and the other is prefixed with loom. and contains all the generic definitions.

With this partitioning, you can manually load any combination of CL and LOOM packages like so:

(defpackage foo
  (:documentation "This package defines some methods on number functions.")
  (:use #:loom.numbers #:cl.conses #:cl.objects)
  ...)

However, most people don't care about selectively importing CL symbols โ€“ you mostly want to import all CL symbols and just override a few with LOOM symbols. LOOM offers a function to help with this:

(defpackage bar
  #.(loom.utilities:use-with-cl :numbers :environment)
  (:use #:some-other-package)
  ...)

That form will use loom.numbers and loom.environment along with cl.objects, etc.

You can also (use-package #:loom), but the overhead from that is probably way more than you want to deal with. (in-package #:loom-user) is the parallel to cl-user, for playing around with the system.

Additional Symbols

To make it possible to define useful methods, we need to export a few new symbols in some cases. In loom.numbers, the symbols binary-=, binary-<, binary-<=, binary-*, binary-+, unary--, binary--, unary-/, binary-/, binary-max, binary-min, binary-gcd, and binary-lcm allow methods to be made on pairwise combinations of classes.

Examples

The math-extensions library uses loom.numbers to add additional numerical classes (quaternions, intervals, etc.) to Common Lisp.

loom's People

Contributors

sellout avatar

Watchers

Tadeusz Kurpiel avatar

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.