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
// Playground - noun: a place where people can play | |
public func id<A>(x : A) -> A { | |
return x | |
} | |
public func error<A>(x : String) -> A { | |
assert(false, x) | |
} |
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
public func unsafeCoerce<A, B>(_ x : A) -> B { | |
return unsafeBitCast(x, to: B.self) | |
} | |
func Y<A>(_ f : @escaping (A) -> A) -> A { | |
return { (x : @escaping (A) -> A) in | |
return f((x(unsafeCoerce(x)))) | |
}({ (x : A) -> A in | |
let fn : (A) -> A = unsafeCoerce(x) | |
return f(fn(x)) |
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
struct State0 {}; struct State1 {}; struct FinalState {} /*States*/ | |
struct Symbol {}; struct Blank {} /*Symbols*/ | |
struct Left {}; struct Right {} /*Directions*/ | |
struct EndOfTape {} /*End of Tape*/ | |
struct Transition<StartState, StartHead, EndState, EndHead, Direction> { | |
static func transitionOne() -> Transition<State0, Blank, State1, Symbol, Left> { fatalError() } | |
static func transitionTwo() -> Transition<State1, Blank, State0, Symbol, Right> { fatalError() } | |
static func transitionThree<State>() -> Transition<State, Symbol, FinalState, Symbol, Left> { fatalError() } | |
} |
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
// | |
// Yoneda.swift | |
// Basis | |
// | |
// Created by Robert Widmann on 12/11/14. | |
// Copyright (c) 2014 Robert Widmann. All rights reserved. | |
// | |
import Basis |
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
class AsyncOperation: Operation { | |
private(set) var taskHandle: Task.Handle<Void, Error>? | |
fileprivate enum State: Equatable { | |
case ready | |
case executing | |
case finished | |
} | |
fileprivate var state: State = .ready { |
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
// Playground - noun: a place where people can play | |
protocol ℕ { | |
static func construct() -> Self | |
static var value : UInt { get } | |
} | |
struct Zero : ℕ { | |
static func construct() -> Zero { | |
return Zero() |
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
@interface TUIScrollView : TUIView | |
{ | |
CGPoint _unroundedContentOffset; | |
CGSize _contentSize; | |
CGSize resizeKnobSize; | |
TUIEdgeInsets _contentInset; | |
__unsafe_unretained id _delegate; | |
TUIScrollKnob * _verticalScrollKnob; |
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
// | |
// NUIColor.h | |
// NUIKit | |
// | |
// Created by Robert Widmann on 9/21/13. | |
// Copyright (c) 2013 CodaFi. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <CoreGraphics/CoreGraphics.h> |
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
# NOTE: You need sccache first - but if you already have it, this'll void your cache. | |
env SCCACHE_RECACHE=1 caffeinate ./swift/utils/build-script -R --cmake-cxx-launcher (which sccache) --cmake-c-launcher (which sccache) --skip-build-benchmark |
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
% Introduce reflexive equality | |
refl(X, X). | |
% Introduce symmetrical equality | |
sym(X, Y) :- | |
refl(X, Y), | |
refl(Y, X). | |
% Identity of addition by zero | |
add_zero(N) :- |