Skip to content

Instantly share code, notes, and snippets.

View copumpkin's full-sized avatar
💭
Mostly unresponsive these days

Daniel Peebles copumpkin

💭
Mostly unresponsive these days
View GitHub Profile
#include <iostream>
void f(int &imachangeu) {
imachangeu = 7;
}
int main() {
int x = 5;
std::cout << x << std::endl;
// Something like this, anyway ;)
// by pumpkin
struct class_info_t {
struct class_info_t *metaclass; // maybe not exactly a class_info_t, maybe an info_table_t
struct class_info_t *superclass; // as above
void *cache;
void *vtable;
struct info_table_t *info;
}
/*
kernelcache.idc, by pumpkin with contributions from roxfan
Copyright (C) 2008 pumpkin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@copumpkin
copumpkin / gist:149443
Created July 18, 2009 06:32
Lots of iPhone protocols. Consider this BSD-licensed. I'd also appreciate if you made changes through the gist interface so I can see what you've done, but no pressure :)
# Very alpha still, but getting there...
# Yeah, I like it this way
require 'pp'
require 'set'
require 'zlib'
require 'base64'
require 'socket'
require 'openssl'
require 'stringio'
{-# LANGUAGE ExistentialQuantification, TypeOperators #-}
module Fold where
import Control.Applicative
import Control.Functor.Contra
import Data.Array.Vector
import qualified Data.Foldable as Foldable
data Fold b c = forall a. Fold (a -> b -> a) a (a -> c)
{-# LANGUAGE EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies, TypeFamilies, MultiParamTypeClasses, ScopedTypeVariables, TypeOperators, ImplicitParams, RankNTypes, GADTs, GeneralizedNewtypeDeriving, NoImplicitPrelude, TypeSynonymInstances, TypeOperators #-}
module Main where
-- ZOMG failgebra by copumpkin (not intended to be useful, but just as a straggly experiment to see what's possible)
-- TODO: using2 could take a function mapping from common types to wrapper types and maybe reduce ugliness
import Prelude hiding (id, (+), (-), (*), (/), Integral, fromInteger, Real)
import qualified Prelude as P
import Data.Number.CReal
{-# LANGUAGE ScopedTypeVariables #-}
module Data.Enumerable where
import Data.Int
import Data.Word
import Data.Ratio
import Unsafe.Coerce
import Data.List
@copumpkin
copumpkin / Prime.agda
Last active December 25, 2023 19:01
There are infinite primes
module Prime where
open import Coinduction
open import Data.Empty
open import Data.Nat
open import Data.Nat.Properties
open import Data.Nat.Divisibility
open import Data.Fin hiding (pred; _+_; _<_; _≤_; compare)
open import Data.Fin.Props hiding (_≟_)
@copumpkin
copumpkin / Search.agda
Last active September 29, 2015 06:57
Simple seemingly impossible Agda
module Search where
open import Coinduction
open import Function
open import Data.Empty
open import Data.Nat
open import Data.Product
open import Relation.Nullary
-- Thanks to Ed Kmett for helping me clarify what I was getting at here,
@copumpkin
copumpkin / Split.agda
Last active September 30, 2015 02:48
Split
module Split where
open import Data.Bool
open import Data.Nat
open import Data.Nat.Properties
open import Data.List hiding ([_])
open import Data.Product
open import Relation.Binary
open import Relation.Binary.PropositionalEquality