This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Introduction

Abstract

A cool tool for functional programming. Operating Functions as in math. Type testing is implemented in an awsome way.

Keywords

Functional Programming, Type Testing

New Feature:

  1. f.arity to get the arity of a function(Function type), arity(f) for normal function
  2. decorator extend or method f.extend(), maps op(a,b,…) to op(f, g, …) where f, g are functions.
  3. other new methods: array, iden

Feature:

  1. function with domain, the domain can be used to type testing
  2. operator on functions, for example, f + g: x -> f(x) + g(x) where f, g, f+g are functions
  3. to glue functions with glue function or method that can be used to define piecewise functions
  4. no 3rd part requirement

Content

Classes:

BaseFunction -> Type (or Domain), Function
BaseFunction: func: function (or number)
Function: func,
          domain: Type, the definition domain of func
          codomian: useless in current version

Functions:

Interval(a:num, b:num) -> Type
restrict(t:Type) -> decorator(f:function -> Function(f, t))

Constants:

TURE, FLASE(Type) represent universal set, empty set

Grammar

Basic grammar

import:

import fcool (or from fcool import *)

Define Function with domain:

F = Function(lambda x:x, Type(lambda x:x>2))
F(3)

Operators on Functions:

(F + F)(3)
(F * F)(4)
(2 * F)(3)

2D Functions and Types:

t = Type(lambda x:x<0 and isinstance(x, int)) * TRUE  # define type(domain) and functions on it
    <=> Type(lambda x, y:x<5) & Type(lambda x, y:isinstance(x, int))
G = Function(lambda x,y: 2/x, t)
tt = (Type(lambda x:x>=0) & Type(int)) * TRUE
F = Function(3, tt)

Advanced Grammar

Glue Functions:

print(G.glue(F)(3,4), glue(G, F)(-3,4))    # glue functions

ID = Function(lambda x:x) <=> Function.iden()  # identity function
print(ID.compose(F)(3,4))      # composition
print(ID.o(F)(1,1))            # more succinctly

Type testing with restrict decorator:

@restrict(Interval(1,2))       # restriction decorator
def f(x):
    return x

print(f(1))
try:
    print(f(3))
except Exception as ex:
    print(ex)

G=Function(lambda x:x)
print(G(3))
G = G | Interval(1,2)           # restriction method
print(G(3))

Extend Function:

f = extend(operator.add)
print(f(lambda x:x, lambda x:x)(2))
f = Function(operator.add)
f.extend()
print(f(lambda x:x, lambda x:x)(2))
Release History

Release History

0.0.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fcool-0.0.3.zip (6.1 kB) Copy SHA256 Checksum SHA256 Source Jul 2, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting