“Why Functional Programming Matters” by John Hughes.
https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf.
https://blog.acolyer.org/2016/09/14/why-functional-programming-matters/
“The Design of a Pretty-printing Library” by John Hughes.
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type='text/javascript' src="http://fb.me/JSXTransformer-0.12.1.js"></script> | |
<script type='text/javascript' src="http://fb.me/react-with-addons-0.12.1.js"></script> | |
</head> | |
<style type="text/css"> | |
.CardsList-Card { | |
background-color: #ddeeaa; |
var BetterBankingPage = React.createClass({ | |
render: function() { | |
return ( | |
<div className="BetterBankingPage"> | |
<Header /> | |
<AccountsList /> | |
<Footer /> | |
</div> | |
); | |
} |
type instruction = | |
| Order of {id: int; price: float; size: int} | |
| Cancel of {id: int} | |
| Cancel_replace of {id: int; new_price: float; new_size: int} | |
let filter_by_oid instructions oid = | |
List.filter (function | |
o.id = oid | |
) instructions |
type json = Js.Json.t; | |
let x: json = [%bs.raw {|{"a": [1, "hello", 2, {"b": {"c": [100,200, "d", [10,20,30]]}}]}|}]; | |
let rec json_to_string json => { | |
let array_to_string a => a |> Array.to_list |> String.concat ","; | |
let emitObject o => | |
"{" ^ | |
{ | |
let emitKV (key, value) => key ^ ": " ^ json_to_string value; |
/* This example demonstrates how to use bs-express to receive a Json POST request and emit a Json response. */ | |
let myJsonHandler = incoming => | |
/* This is the application-level request handler. It is a pure function that takes a string and returns a Json. | |
In this example, Express doesn't parse the incoming string. We leave it to the application handler so that it has | |
more control (deal with parsing errors in its own way for example) | |
*/ | |
incoming |> Json.parseOrRaise |> MyApplication.doSomething; | |
open Express; |
“Why Functional Programming Matters” by John Hughes.
https://www.cs.kent.ac.uk/people/staff/dat/miranda/whyfp90.pdf.
https://blog.acolyer.org/2016/09/14/why-functional-programming-matters/
“The Design of a Pretty-printing Library” by John Hughes.
-- to be used in init.lua | |
-- based on https://github.com/fikovnik/ShiftIt/wiki/The-Hammerspoon-Alternative | |
-- replicates ShiftIt functionality | |
function setScreenPrimary() | |
local currentScreen = hs.screen.mainScreen() | |
currentScreen:setPrimary() | |
end | |
function moveToNextScreen() |
# Two alternative approaches for https://gist.github.com/peeyush14goyal/506689c0227ff7d7a6071c30f1166a27 | |
todos = [ | |
["Send invoice", "money"], | |
["Clean room", "organize"], | |
["Pay rent", "money"], | |
["Arrange books", "organize"], | |
["Pay taxes", "money"], | |
["Buy groceries", "food"] | |
] |
# To execute: | |
# ruby ar_sample_impl.rb | |
require 'pp' | |
class ActiveRecord | |
class Migration | |
# See original implementation of `create_table` in ActiveRecord: | |
# https://github.com/rails/rails/blob/main/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L296 | |
def self.create_table(table_name) |