Skip to content

Instantly share code, notes, and snippets.

View matux's full-sized avatar
💭
To call each thing by its right name.

Matias Pequeno matux

💭
To call each thing by its right name.
View GitHub Profile
@matux
matux / Arrow.swift
Created January 21, 2023 13:16
Arrow is the algebraic representation of function.
import Swift
public typealias Λ = Arrow // Capital lambda Λ, a computationally aware λ.
/// Λrrow ∎ A general interface to represent a computation.
///
/// Arrows are a new abstract view of computation, defined by John Hughes [Hug00].
/// They serve much the same purpose as monads -- providing a common structure
/// for libraries -- but are more general. In particular they allow notions of
/// computation that may be partially static (independent of the input) or may
@matux
matux / table_set.dart
Created July 26, 2022 14:05
Specialized Set over Persistable objects that leverages SQLite3 in Dart
import 'dart:collection';
import 'package:meta/meta.dart';
import 'package:sqlite3/sqlite3.dart';
import 'extension/object.dart';
import 'extension/collection.dart';
import 'extension/string.dart';
import 'extension/database.dart';
import 'identifiable.dart';
@matux
matux / endocompo.dart
Created July 21, 2022 15:28
Operators for composition of endomorphism in Dart
// Here be dragons //
extension _EndomorphicComposition<T> on T Function(T) {
/// Mathematical composition of endomorphisms.
///
/// In mathematics, function composition is an operation ∘ that takes two
/// functions ƒ and g, and produces a function h = g ∘ ƒ such that
/// h(x) = g(ƒ(x)).
///
/// An endomorphism is any morphism ƒ whose domain is equal to its codomain
/// such that ƒ: a -> a or T ƒ(T)
// Extensions to the Daon's API peripheral to the biometric verification
// process.
import class ObjectiveC.NSObject
import Swift
import Dispatch
import DaonFIDOSDK
import DaonAuthenticatorSDK
// MARK: - Configuration
@matux
matux / swifting.swift
Last active September 16, 2019 18:18
Env.net.request(.signup, result:
tap(AppId.init • ^\.[.registrationRequest] >>> assign(to: &Env.vars.id.app)) >>>
select(\.[.registrationId], \.[.registrationRequest], or: .badRequest) >>>
when(success: async(partial(presentBiometrics, __, __, succeed, fail)),
failure: when(.noSession, createAccount, otherwise: fail)))
or:
Env.net.request(.signup, result:
select(\.[.registrationId], \.[.registrationRequest], or: .badRequest) >>>
@matux
matux / hellomultiverse.lisp
Created May 5, 2019 07:32
A special kind of Hello World. In a typical kind of Lisp. For a quantum kind of reality.
;;;; 'sup, quantum physics.
;;; Interview challenge:
;;; Teleport the state of a single qubit existing in a 2-dimensional
;;; complex Hilbert space by way of classical communication without
;;; spawning any more than 4 parallel universes.
;;; "...hold my beer."
((HADAMARD 1) ; Open a Hadamard gate to map the probability basis with an orthogonal, symmetric, involutive, linear Hadamard-Rademacher-Walsh-class quantum Fourier transform over a single qubit, or something.
@matux
matux / complex.swift
Created February 26, 2019 14:05
Mandelbrot fractal
import func Darwin.sin
import func Darwin.cos
import Swift
public typealias ℤ = Int
public typealias ℝ = Double
public typealias ℂ = Complex
public func ρmap(_ ρ: ℤ) -> String {
switch ρ {
@matux
matux / quadratic-primes.apl
Created February 26, 2019 11:31
Quadratic Primes in APL
Dyalog APL/S-64 Version 17.0.35664
Unicode Edition
Tue Feb 26 00:37:36 2019
⍝ _Little did he know that the simple, seemingly innocuous act of starting
⍝ Dyalog's APL REPL would result in his imminent institutionalization._
⍝ Some array-driven, some fp, some quadratic, some primes.
gfx.∆.Init
// Swift compilation issue
// Shadowing across modules
// Module 1
public struct S {
public static var a = S(a: 0)
public var a: Int
public init(a: Int) { self.a = a }
}
4.4:matux@Weiland:new-hints:∴μ ∆15:~/code/v1/joybird-ios$ swift -Xfrontend -debug-constraints
Welcome to Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1). Type :help for assistance.
1> 1 + 1
---Constraint solving for the expression at [/var/folders/k_/1374v5ms6wz1lhtvrkrky2800000gq/T/repl1-b583bf..swift:1:1 - line:1:5]---
---Initial constraints for the given expression---
(binary_expr type='$T3' location=/var/folders/k_/1374v5ms6wz1lhtvrkrky2800000gq/T/repl1-b583bf..swift:1:3 range=[/var/folders/k_/1374v5ms6wz1lhtvrkrky2800000gq/T/repl1-b583bf..swift:1:1 - line:1:5]
(overloaded_decl_ref_expr type='$T0' location=/var/folders/k_/1374v5ms6wz1lhtvrkrky2800000gq/T/repl1-b583bf..swift:1:3 range=[/var/folders/k_/1374v5ms6wz1lhtvrkrky2800000gq/T/repl1-b583bf..swift:1:3 - line:1:3] name=+ number_of_decls=27 function_ref=unapplied decls=[
Swift.(file).Float.+,
Swift.(file).Double.+,
Swift.(file).Float80.+,