Skip to content

Instantly share code, notes, and snippets.

(defmacro letfn- [fn-bindings & body]
(let [fn-names (map first fn-bindings)
fn-gensyms (into {} (for [f fn-names]
[f (gensym f)]))
delayed-bindings (for [f fn-names
x [(fn-gensyms f)
`(delay (~f ~@fn-names))]]
x)
forced-bindings (for [[n v] fn-gensyms
x [n `(force ~v)]]
@jckarter
jckarter / factor-modules.md
Created August 23, 2012 19:57
Factor modules design

A package system for Factor

Factor's current module system and development model is heavily monolithic, reflecting Factor's history as a small-scale hobby project. The default settings encourage development within the Factor source tree and make it difficult to accommodate packaged read-only installations or projects developed outside of the source tree. Altering the module search path to accommodate these use cases is currently a manual and error-prone process. This proposal describes a new model for module lookup and installation with the following improvements:

  • a standardized search path for modules, allowing for global, user-local, project-local, and
(ns cara.type.core)
;(declare Nothing Just)
(defprotocol PDataType
(get-constructors [self]))
(defprotocol PConstructor
(get-datatype [self]))
@sjoerdvisscher
sjoerdvisscher / profunctorlens.hs
Last active October 1, 2017 21:42
Pure profunctor lenses
{-# LANGUAGE Rank2Types #-}
import Control.Applicative (Applicative(..), (<$>), Const(..))
import Control.Lens.Internal.Review (Reviewed(..))
import Control.Lens.Internal.Bazaar (Bazaar(..))
import Data.Monoid (Monoid(..), First(..))
import Data.Profunctor
import Data.Profunctor.Rep
import Data.Functor.Identity
@14427
14427 / hkt.rs
Last active August 31, 2024 00:57
Higher-kinded type trait
use std::rc::Rc;
trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
extern crate memmap;
#[cfg(target_pointer_width = "32")]
const MAGIC_VALUE: usize = 0xdedbeef0;
#[cfg(target_pointer_width = "32")]
const WORD_SIZE: usize = 4;
#[cfg(target_pointer_width = "64")]
const MAGIC_VALUE: usize = 0xd0e0a0d0b0e0e0f0;
#[cfg(target_pointer_width = "64")]
const WORD_SIZE: usize = 8;
@camthesaxman
camthesaxman / irixswextract.c
Created March 17, 2018 19:32
tool to extract IRIX software packages
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
struct Archive