Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE RankNTypes #-}
data Z
data S n
type L a = forall b. (a -> b -> b) -> b -> b
consL a fold = \cons nil -> cons a (fold cons nil)
(@:) = consL
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
data Z
data S n
type family Pred n
type instance Pred (S n) = n
newtype Vec n a = Vec {
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; SECTION ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Macros
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unicode is the future
(define-macro (λ . args)
`(lambda ,@args))
(define-macro (cons-lazy a b)
`(cons ,a (delay ,b)))
@out-str = private unnamed_addr constant [4 x i8] c"%u\0A\00", align 1
declare i32 @printf(i8*, ...)
declare i32 @atoi(i8*)
define i32 @main(i32 %argc, i8** %argv) {
%cur = alloca i128, align 8
store i128 1, i128* %cur, align 8
%last = alloca i128, align 8
@print.uint = private unnamed_addr constant [4 x i8] c"%u\0A\00"
@multiples = private constant [2 x i32] [i32 3, i32 5]
declare i32 @printf(i8*, ...)
declare i32 @atoi(i8*)
define i1 @is-multiple-of-any(i32 %i, i32 %num-mults, i32* %mults) {
%n = alloca i32
store i32 0, i32* %n
@print.uint = private unnamed_addr constant [4 x i8] c"%u\0A\00"
declare i32 @printf(i8*, ...)
declare i64 @atol(i8*)
define i64 @sum-fibs-not-greater-than(i64 %not-greater-than) #0 {
%cur = alloca i64
store i64 1, i64* %cur
%last = alloca i64

Rust Optimization Tips (or, Why Rust Is Faster Than Python)

If you're looking to write fast code in Rust, good news! Rust makes it really easy to write really fast code. The focus on zero-cost abstractions, the lack of implicit boxing and the lifetime system that means memory is managed statically means that even naïve code is often faster than the equivalent in most other languages out there, and certainly faster than naïve code in any equivalently-safe language. Maybe, though, like most programmers you've spent your whole programming career safely insulated from having to think about any of this, and now you want to dig a little deeper and find out the real reason that

@jFransham
jFransham / CV.md
Last active December 11, 2023 14:09

Jack Fransham / +447979 144 575 / jackefransham@gmail.com / GitHub

Skills & Abilities

Professional experience

  • Desktop application/tools development (C# with WPF, Rust, Ruby, Python);
  • Back-end web development (Python with Django, Ruby with Ruby on Rails, PHP with CodeIgniter, NodeJS with Express, C# with ASP.NET, Rust with Iron);
  • Linux devops and administration (Bash, C, Make, CMake, Python);
  • Embedded development based on OpenWRT, including build and device automation;
  • Integration and unit tests with Python and Ruby;