Skip to content

Instantly share code, notes, and snippets.

Avatar

Bijoy Thomas bijoythomas

View GitHub Profile
View Capacitated-Vehicle-Routing-Problem.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bijoythomas
bijoythomas / trampoline.js
Last active Mar 18, 2020
Trampolining TCO functions in JS examples
View trampoline.js
/*
* aperture function modelled after https://ramdajs.com/docs/#aperture
*/
const head = xs => xs[0]
const last = xs => xs[xs.length - 1]
const tail = xs => xs.slice(1)
const isEmpty = xs => xs.length == 0
/* A recursive aperture implementation
@bijoythomas
bijoythomas / funpy.py
Last active Mar 17, 2020
Ramda like functions for Python
View funpy.py
import re
from fn import F, recur
from datetime import datetime
from funcy import mapcat, walk_values, merge as funcymerge, group_by
# basic combinators
I = F(lambda x: x) # identity
K = F(lambda x: F(lambda y: x)) # constant
T = F(lambda x: F(lambda f: f(x))) # thrush
A = F(lambda f: F(lambda x: f(x))) # apply
@bijoythomas
bijoythomas / add-sanctuaryfns-to-sublime-autocomplete-hints.js
Created Mar 21, 2019
Sanctuary functions in Sublime autocomplete
View add-sanctuaryfns-to-sublime-autocomplete-hints.js
let S = require('sanctuary')
let R = require('ramda')
let filecontent = R.compose(
JSON.stringify,
R.assoc('scope', 'source.js'),
R.flip(R.assoc('completions'))({}),
R.map(R.converge(R.merge, [R.flip(R.assoc('trigger'))({}), R.flip(R.assoc('content'))({})])),
R.keys
)(S)
View add-ramdafns-to-sublime-autocomplete-hints.js
let R = require('ramda')
let filecontent = R.compose(
JSON.stringify,
R.assoc('scope', 'source.js'),
R.flip(R.assoc('completions'))({}),
R.map(R.converge(R.merge, [R.flip(R.assoc('trigger'))({}), R.flip(R.assoc('content'))({})])),
R.keys
)(R)