Skip to content

Instantly share code, notes, and snippets.

View tripack45's full-sized avatar

Yue Yao tripack45

View GitHub Profile
@tripack45
tripack45 / dumpbits.md
Created December 15, 2022 09:38
Dumping SML bits for `real`

The following is the SML code to perform the dump

fun dumpBits x =
  let val vec = Unsafe.blastWrite x
      val lst = Word8Vector.toList vec
      val items = List.map (fn x => " " ^ Word8.fmt StringCvt.HEX x) lst
      val items = List.map (StringCvt.padLeft #"0" 2) items
   in
      print (String.concat items ^ "\n")
@tripack45
tripack45 / utlc.cpp
Created September 28, 2021 19:21
C++ templates are Church complete without value parameters or recursive definitions
#include <type_traits>
#include <iostream>
struct Unit {};
struct Id {
template <class X> using V = X;
};
struct True {
//
// Created by tripack on 2017/10/14.
//
#ifndef SRC_FORMATTER_H
#define SRC_FORMATTER_H
#include <string>
@tripack45
tripack45 / .cpp
Created June 17, 2018 09:36
Search Diff 8
#include <iostream>
#include <cstdio>
#include <bitset>
#include <x86intrin.h>
using namespace std;
// The majority gate
inline unsigned char
majority (unsigned char a,
@tripack45
tripack45 / keybase.md
Created June 18, 2017 10:01
keybase.md

Keybase proof

I hereby claim:

  • I am tripack45 on github.
  • I am tripack (https://keybase.io/tripack) on keybase.
  • I have a public key ASDXMpOxLInKbl_nwEIrksaDzBpf4-TuyBudhOU2qyEWdAo

To claim this, I am signing this object: