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
Robot : type { | |
name :: Text | |
} | |
[context] | |
robot :: Robot | |
robot : crash "`robot` not initialized" | |
with-robot : syntax { | |
with-robot 'name 'body -> with (robot : Robot { name : 'name }) 'body |
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 std::collections::{HashMap, HashSet}; | |
#[derive(Debug, Clone, PartialEq, Eq)] | |
pub enum Expression { | |
Name(&'static str), | |
Number(i32), | |
Variable(&'static str), | |
List(Vec<Expression>), | |
Block(Vec<Vec<Expression>>), | |
} |
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 SwiftUI | |
import ViewExtractor // https://github.com/GeorgeElsham/ViewExtractor | |
let wallpaperURL = URL(string: "https://9to5mac.com/wp-content/uploads/sites/6/2022/09/iPhone-14-Pro-wallpaper-3.jpeg?quality=100&strip=all")! | |
struct ContentView: View { | |
@ScaledMetric(relativeTo: .largeTitle) var clockFontSize = 96 | |
@State private var timeIsVisible = true | |
@State private var notificationsAreVisible = false |
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 std::collections::{HashMap, HashSet}; | |
#[derive(Debug)] | |
pub struct Context<Id> { | |
substitutions: HashMap<TypeVariable, Type<Id>>, | |
exists: Vec<Type<Id>>, | |
next_var: u32, | |
} | |
#[derive(Debug)] |
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
show : external "internal" "show" :: Text -> () |
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
-- A work-in-progress recreation of Typing the Technical Interview | |
-- (https://aphyr.com/posts/342-typing-the-technical-interview) in what will | |
-- eventually be Wipple's type system! | |
-- | |
-- 'type' creates marker types. For example, you can define 'Phantom' as either: | |
-- given (some A) in Phantom : type A | |
-- Phantom : type (some _) | |
-- | |
-- 'some' creates invariant type parameters | |
-- |
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
set -ex | |
# Add arm64 packages to apt database | |
# WARNING: This overwrites the sources.list entirely! If you have custom sources, | |
# add [arch=amd64] to them instead and just add the [arch=arm64] lines yourself | |
sudo bash -c 'cat <<EOF > /etc/apt/sources.list | |
deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse | |
deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse | |
deb [arch=amd64] http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse |
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
LeftParen = '(' | |
RightParen = ')' | |
LeftBracket = '[' | |
RightBracket = ']' | |
LeftBrace = '{' | |
RightBrace = '}' | |
class Group(object): | |
def __init__(self): | |
self.exprs = [] |
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 Foundation | |
public struct IntermediateStrideThrough<Number: Strideable, Amount: Comparable & SignedNumeric> { | |
let from: Number | |
let by: Amount | |
public init(from: Number, by: Amount) { | |
self.from = from | |
self.by = by | |
} |
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 math import log, ceil, floor | |
digit_refs = list('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-/:;()$&@".,?!\'[]{}#%^*+=_\\|~<>€£¥•') | |
# Inverts the index relative to the length (of an array) provided. | |
# Example: (3, 0) => 2 | |
def rev(len, index): | |
return len - 1 - index | |
class Number: |
NewerOlder