Catto extends Python with concepts from category theory, such as functors, applicatives and monads

Overview

Catto

Catto extends Python with concepts from category theory, such as functors, applicatives and monads

Example

from catto.core import List

from catto.data.Maybe import Maybe, Just, Nothing
from catto.polyfills import polyfill
from catto.control.Applicative import Applicative
from catto.control.MonadIdentity import Identity

polyfill()

xs = list.fold([[1,2,3], [4,5,6]])
print(list.tail(xs) + [list.head(xs)])

ys = Maybe.ap(lambda x: Maybe.fmap(lambda y: x.value + y, Just(1)), Just(2))
#print(ys.value.value)

id_ = Identity.bind(Identity.pure(1), 
    lambda x: Identity.bind(Identity.pure(x + 1), lambda y: print(y)))

Maybe.bind(Just(5), lambda x: print(f'We got a Just({x})'))

Whats implemented so far?

  • Data.Semigroup
  • Data.Monoid
  • Data.Functor
  • Data.Foldable
  • Data.Maybe
  • Data.Either
  • Control.Applicative (Maybe, Either)
  • Control.Monad (MonadIdentity, Maybe)
You might also like...

This is a python program that reproduce the Butterfly effect of the chaos theory, discovered by Robert May on 1975, and started by Poincaré

The-Theory-Of-Chaos This is a python program that reproduce the Butterfly effect of the chaos theory, discovered by Robert May on 1975, and started by

Aug 1, 2022

This tools is used to create automatically discord threads by scraping ctfd plateform and collecting name , category , description and points of challenges.

This tools is used to create automatically discord threads by scraping ctfd plateform and collecting name , category , description and points of challenges.

Discord bot CTFD-Thread-Parser Description: This tools is used to create automatically discord threads by scraping ctfd plateform and collecting name

Jun 7, 2022

Algorithms from our course "Coding Theory & Applications", plus some I wrote to solve exercises from the book "Codes, Cryptology and Curves with Computer Algebra" (yes, that was a tad overkill).

Algorithms from our course

CodingTheory A few of the following are algorithms from our MSc course "Coding Theory & Applications": they are not many. Most of these are algorithms

Apr 30, 2022

This is a repository of the supplementary implementation for the 2022 summer course 'Mathematical Theory and Applications of Deep Learning', taught by Professor Haizhao Yang at Tianyuan Mathematical Center in Central China

2022-Summer-Course This is a repository of the supplementary implementation for the 2022 summer course 'Mathematical Theory and Applications of Deep L

Nov 13, 2022

Playing around with chaos theory simulations. Creating equilibrium graphs and visualizing the logistic maps.

Playing around with chaos theory simulations. Creating equilibrium graphs and visualizing the logistic maps.

chaos-theory Playing around with chaos theory simulations. Creating equilibrium graphs and visualizing the logistic maps. Chaos Theory The Logistic Ma

Nov 6, 2022

Code for "Category-Level 6D Object Pose and Size Estimation using Self-Supervised Deep Prior Deformation Networks"

Code for

Self-Supervised Deep Prior Deformation Network Code for "Category-Level 6D Object Pose and Size Estimation using Self-Supervised Deep Prior Deformatio

Jan 6, 2023

Interface for managing a Shop Database with 'category' and 'products' as collections in the MongoDB

Interface for managing a Shop Database with 'category' and 'products' as interlinked collections in the MongoDB. Made using Mongoengine concept in Python.

Aug 11, 2022

Official code for "Improving Few-Shot Learning through Multi-task Representation Learning Theory" ECCV 2022.

Official code for

MetaMTReg Official code for "Improving Few-Shot Learning through Multi-task Representation Learning Theory" ECCV 2022. How to run Install required pac

Nov 8, 2022

A solution to the problem of finding five English words with 25 distinct characters, using graph theory.

A solution to the problem of finding five English words with 25 distinct characters, using graph theory.

Nov 6, 2022
Owner
rem
nerd
rem
This short script will grab the current list of sd-concepts-library/stable-diffusion-conceptualizer concepts and drop them into a directory you specify

sd-concepts-library-stable-diffusion-conceptualizer-getter This short script will grab the current list of sd-concepts-library/stable-diffusion-concep

null 5 Nov 29, 2022
Upload an articles and it will return a category that closest matches each article. It also show an indication of how confident the AI is about its category choice will also be returned back.

Artificial Intelligence - Python Upload an articles and it will return a category that closest matches each article. It also show an indication of how

Henrique Cole Fernandes 9 Dec 19, 2022
Common simple python monads for more readable and maintainable pipeline-based code.

?? pymon pymon is a set of simple common monads for writing safe, maintainable and pipeline-based code in Python3.10+. Monads API Pipe and Future Pipe

Ilya Katun 4 Nov 29, 2022
This repo introduces users to python and its basic concepts and familiarises Beginers with Python Syntax.

?? Python-TUTORIALS This repo introduces users to python and its basic concepts and familiarises Beginers with Python Syntax. ?? Applications of Pytho

Palpatine 1 Apr 1, 2022
📚️ Concepts of data structures using Python

Data Structures Ways to store data in memory Manage data efficiently What type of organization? Sequential or not? How to search, insert, remove? Whic

Rodrigo Victor 4 May 22, 2022
Solution for Pose Estimation Challenge 2021 organized by the Advanced Concepts Team of the European Space Agency and the Space Rendezvous Laboratory (SLAB) of Stanford University.

Pose-Estimation-Challenge Solution for Pose Estimation Challenge 2021 organized by the Advanced Concepts Team of the European Space Agency and the Spa

Pedro Rodriguez 1 Apr 14, 2022
Crypto Tricks - a collection of proof-of-concepts, examples, essays and experiments in cryptography

Crypto Tricks - a collection of proof-of-concepts, examples, essays and experiments in cryptography, cryptanalysis, steganography and covert channels that I originally wrote in 2015.

James Fell 6 Nov 1, 2022
Hemangani 1 Mar 5, 2022
[NeurIPS 2022] code for "Visual Concepts Tokenization"

Visual Concepts Tokenization This is the official PyTorch implementation of NeurIPS 2022 paper: Visual Concepts Tokenization Arxiv | OpenReview. Visua

Tao Yang 11 Dec 8, 2022
network theory of jazz scales version 2. Modularized and 100% python.

Brightness Scores for 28 Jazz Modes and 18 Rules for Modulation This computational music theory project assigns a brightness score for all 28 modes de

R Tyler McLaughlin 13 Dec 19, 2022