This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure(2) do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Remember the bind operator's signiture: | |
Ma -> (a -> Mb) -> Mb | |
This means that | |
given a List(type a) and a function that takes each item a in the list and turns EACH ITEM into a List(type b) | |
and returns a List(type b)... not a List of List(type b)'s.. hence why you need a concat. | |
''' | |
''' | |
data List a = Nil | Cons a (List a) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(progn | |
(switch-to-buffer-other-window "*output*") | |
(erase-buffer) | |
(switch-to-buffer-other-window "*input*") | |
(erase-buffer ) | |
;;(insert-file-contents "~/workspace/exampledata/ingramfull.sh") | |
(insert "get \"/ebook/front/archive/0071386556.jpg\" \"./images/downloads/9780071386555-003-unprocessed.jpg\"\n") | |
(insert "get \"/ebook/front/archive/0071483438.jpg\" \"./images/downloads/9780071483438-029-unprocessed.jpg\"\n") | |
(goto-char (point-min)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (cons nil nil) | |
# (car '(nil)) | |
# nil | |
# (cdr '(nil)) | |
# nil | |
# (car '()) | |
# nil | |
# (cdr '()) | |
# nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (m) --> (m . NIL) | |
# (m1, m2.. mn) --> (m1 . ( m2 . ( ... ( .. ( mn . NIL) )))) | |
# (m1 , m2..mn . x) ---> (m1 . ( m2 . ( ... ( .. ( mn . x) )))) | |
Nil = None | |
def atom(value): | |
''' | |
1. atom. atom[x] has the value of T or F according to whether x is an | |
atomic symbol. Thus | |
atom [X] = T |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From https://www.fpcomplete.com/school/starting-with-haskell/basics-of-haskell/13-the-list-monad | |
from functools import partial | |
''' | |
okay let's try working from first principles first! | |
''' | |
def ACons(head, tail): | |
return lambda fn: fn(head, tail) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# class Monoid m where | |
# mempty :: m | |
# mappend :: m -> m -> m | |
# mconcat :: [m] -> m | |
# mconcat = foldr mappend mempty | |
class MonList(object): | |
@classmethod | |
def mappend(cls, a, b): | |
return a + b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# def bind(value, fn): | |
# return fn(value) | |
# print bind ( 12, lambda x : | |
# bind ( 13, lambda y : | |
# lambda x,y :x+y))() | |
# def maybe_bind(value, fn) : | |
# return fn(value) if value else None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Functor : | |
* fmap : (a -> b) -> fa -> fb | |
* | |
*/ | |
function array_fmap1(fn, typeA) { | |
var typeB = [] | |
typeA.forEach(function(aVal) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongodb = require("mongodb"); | |
var MongoClient = mongodb.MongoClient; | |
var fs = require("fs"); | |
var Transform = require("stream").Transform; | |
var name_surname_email_filter = new Transform({readableObjectMode:true, writableObjectMode:true} ); | |
name_surname_email_filter._transform = function(data, enc, cb) { | |
//console.log(data); | |
var newdata = { first_name: data.first_name, |