This file contains 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 sys import argv, stderr, stdout, exit | |
def main(args): | |
fname = args[1] | |
stdout.write('UID\tName\tAPI\tLatitude\tLongitude\tMonth\tOil\tGas\tWater\tWells\n') | |
with open(fname) as f: | |
for w in well_production(f): | |
n_records = len(w['Month']) | |
for i in range(n_records): | |
stdout.write('\t'.join((w['UID'], w['Name'], w['API'], |
This file contains 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
use "collections" | |
interface Sendable | |
fun tag send(word: I64) | |
primitive Running | |
primitive Blocked | |
primitive Halted | |
primitive IllegalInstruction |
This file contains 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
abstract type meat | |
Beef | |
pub Lamb(age: int) |
This file contains 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
fun iota_vec(n: int): vector<int> | |
vector-init(n, id) | |
fun oddity(n: int): exn vector<int> | |
var v := iota_vec(n) | |
for(0, n) fn(i) | |
v[i] := v[i] + 3 | |
v | |
fun space-oddity(n: int): exn vector<int> |
This file contains 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
open type openvar | |
A | |
B | |
extend type openvar | |
C | |
fun do_it_try_it(v: openvar): console () | |
match v | |
A -> println("got an A") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
(* yeah, so, Eff doesn't actually support polymorphic effects *) | |
effect Save: string -> int | |
effect Load: string * int -> empty | |
let save name = perform (Save name) | |
let load name v = absurd (perform (Load (name, v))) | |
let savegames = handler | |
| effect (Save name) k -> |
This file contains 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
effect QuickSave: int option | |
effect QuickLoad: int -> empty | |
let quicksave () = perform QuickSave | |
let quickload n = absurd (perform (QuickLoad n)) | |
let quicksaving = handler | |
| effect QuickSave k -> | |
let rec quickloading () = handler | |
| effect (QuickLoad n) _ -> |
This file contains 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
tree(nil). | |
tree([_, Left, Right]) :- tree(Left), tree(Right). | |
revtree(nil, nil). | |
revtree([Data, RLeft, RRight], [Data, Left, Right]) :- | |
revtree(RLeft, Right), | |
revtree(RRight, Left). |
This file contains 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
import sys | |
from zipfile import ZipFile | |
LINES = 10 | |
def main(argv: list[str]) -> int: | |
with ZipFile(argv[1]) as z: | |
for fn in z.namelist(): | |
if not fn.endswith('.csv'): | |
continue |