type tree: {payload: int, void | {l, r: tree*}}
fun treePrint: (root: tree*) -> void {
}
- Declare using named case labels inside struct
- Fields declared before a case are common to all cases
| #include <dirent.h> | |
| #define for_dir(entry, dirname, continuation) \ | |
| do { \ | |
| DIR* for_dir_dir__ = opendir(dirname); \ | |
| for (struct dirent* (entry); \ | |
| ((entry) = readdir(for_dir_dir__));) { \ | |
| continuation \ | |
| } \ | |
| closedir(for_dir_dir__); \ |
| #include "runner.h" | |
| #include <gc.h> | |
| #include "dirctx.h" | |
| #include "sym.h" | |
| #include "ast.h" | |
| #include "type.h" | |
| #include "value.h" |
| #include "value.h" | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <gc.h> | |
| #include <common.h> | |
| #include "sym.h" | |
| #include "runner.h" | |
| #include "invoke.h" |
| def merge_into_release(self, dest_release, src_release): | |
| """Transfers all data from a release to another and removes the source. | |
| Overwrites the destination where the release info differs. | |
| There is never loss of user information.""" | |
| #merge = replace in dest + remove in src | |
| #move = insert in dest + remove in src | |
| def move_actions(model, dest_id, src_id): | |
| model.execute("update actions set object_id=? where object_id=?", src_id, dest_id) |
| import sys | |
| from model import Model, NotFound | |
| import musicbrainzngs as mb | |
| def mb_get_author_ids(release_mbid): | |
| mb.set_useragent("Skiller", "0.0.0", "mb@satyarth.me") | |
| response = mb.get_release_by_id(release_mbid, includes=["artists"])["release"] | |
| return [artist["artist"]["id"] for artist in response["artist-credit"] if isinstance(artist, dict)] |
| import sys | |
| from model import Model, NotFound | |
| from tools import get_wikipedia_image | |
| def safe_print(*args): | |
| try: | |
| print(*args) | |
| except: | |
| pass |
| import arrow | |
| from model import Model | |
| def convert_actions(): | |
| with Model() as model: | |
| model.db.executescript( | |
| """drop table if exists actions_2; | |
| create table actions_2 ( | |
| id integer primary key, | |
| user_id integer not null, |
| import requests | |
| from multiprocessing import Pool | |
| from model import Model, NotFound | |
| from mb_api_import import get_album_art_urls | |
| def safe_print(*args): | |
| try: | |
| print(*args) | |
| except: | |
| pass |
| import sys | |
| from model import Model, NotFound | |
| from tools import get_wikipedia_summary | |
| def safe_print(*args): | |
| try: | |
| print(*args) | |
| except: | |
| pass |