Giter VIP home page Giter VIP logo

utils.reverse's Introduction

utils.reverse

Selected utilities for doing things 'in reverse'.

In practice, the purpose of those is, in fact, to enable code that can be read in natural order.

Installation

[com.nedap.staffing-solutions/utils.reverse "1.1.0"]

Synopsis

rcomp

Like comp, but the functions that appear on the left will be first ones that will be executed.

Example:

(def ten-times (partial * 10))

(->> [1 2 3]
     ;; first `ten-times` will be executed, and then `str`
     ;; Similar to OOP dot notation: ten_times().str()
     (map (rcomp ten-times str))
     (remove (rcomp read-string #{20})))

Note how throughout the whole expression (both the top-level one and each of its members), all code can be read left-to-right, and will be executed in that same exact order.

Personally I've come to drop comp entirely, and always use rcomp.

r->, rcond->

Like their -> and cond-> counterparts, but clauses will be evaluated bottom-to-top, rather than top-to-bottom.

Using these should be rare. They are apt for dealing with middleware-like designs, where things are executed in the reverse order than they were expressed.

By 'reversing the reversal', we restore readability.

There's a middleware example in the included tests.

Documentation

Please browse the sole offered namespace, which is documented.

The tests attempt to be readable examples as well.

License

Copyright © Nedap

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0.

utils.reverse's People

Contributors

thumbnail avatar vemv avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  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.