Giter Site home page Giter Site logo

functools's Introduction

Functools

Functional programming tools for Matlab. It includes the following subpackages.

  • list: list related functions (foldl, foldr, zipWith2, etc)
  • curry: higher order functions to change the calling structure of a function. This includes partial, rpartial, and curry.
  • util: Some useful utility functions that don't fit elsewhere.

Install

Global installation can be done through the user's MATLAB directory. Place this entire directory in a directory under the userpath location (such as '/home/user/Documents/MATLAB/functools/'). The result will look like so.

Documents\
    MATLAB\
        functools\
            README.md
            +functools\
                +curry\
                    ...
                +list\
                    ...
                +util\
                    ...
                ...

Now, create or edit the function Documents/MATLAB/startup.m (or wherever your startup.m is) to include the following.

disp('Adding functools') % not needed but I like the reminder.
addpath('functools')

Start a new instance of Matlab and the functools package should be ready to use.

Using functools

Functools is defined as a Matlab package, which means the functions inside this package are called a bit differently that normal functions. In order to call the functions, their full namespace must be specified

functools.list.head([1 2 3 4])

or a function can be imported specifically

import functools.list.head
head([1 2 3 4])

or an entire subpackage of functions can be imported.

import functools.list.*
head([1 2 3 4])

If you would like to use the functools functions inside your own function, the same import rules will apply.

function out = add(a, b)
    import functools.list.zipWith2

    out = zipWith2(@plus, a, b);
end

functools's People

Contributors

rdodesigns avatar

Watchers

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