This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
I rename all classes in my package to have a prefix of ""DM"". | |
" | |
Class { | |
#name : #PrefixRenamer, | |
#superclass : #Object, | |
#category : #Lambcalc | |
} | |
{ #category : #'menu - change set' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(ql:quickload :cl-async) | |
(ql:quickload :iterate) | |
(ql:quickload :bordeaux-threads) | |
(ql:quickload :cl-speedy-queue) | |
(ql:quickload :access) | |
(use-package :iterate)) | |
(access:enable-dot-syntax) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ConduitTest where | |
import Data.Conduit.Internal (sourceToPipe, unconsM) | |
import Data.Foldable (for_) | |
import Control.Monad (forever, void) | |
import Control.Monad.Trans.Maybe (MaybeT (MaybeT, runMaybeT)) | |
import Conduit | |
lotsOfInts :: Monad m => ConduitT () Int m () | |
lotsOfInts = for_ [0..5] $ \i -> yield i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveFoldable #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module Main where | |
import Data.Foldable (fold) | |
import Data.Functor.Foldable (cata, embed, hylo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Concurrent.Async (async, wait) | |
import Control.Exception (Exception, catch, throwIO) | |
import Control.Monad.IO.Class (liftIO) | |
import Control.Monad.Trans.Class (lift) | |
import Control.Monad.Trans.Except (ExceptT (ExceptT), runExceptT) | |
import Control.Monad.Trans.Resource (ResourceT, allocate, release, runResourceT) | |
newtype MyException = MyException String deriving Show |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require racket/async-channel racket/future ffi/unsafe/os-thread) | |
(define (mandelbrot iterations x y n) | |
(let ([ci (- (/ (* 2.0 y) n) 1.0)] | |
[cr (- (/ (* 2.0 x) n) 1.5)]) | |
(let loop ([i 0] [zr 0.0] [zi 0.0]) | |
(if (> i iterations) | |
i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require syntax/parse/define | |
(for-syntax racket/base racket/syntax)) | |
(define-syntax-parser v! | |
#:datum-literals (:=) | |
[(_ vec:id [e:expr ...]) #'(~> vec (vector-ref e) ...)] | |
[(_ vec:id [e:expr ...] := exp:expr) | |
(define es (syntax-e #'(e ...))) | |
#`(~> vec | |
#,@(for/list ([i (in-range 0 (length es))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro make-table (sym &rest kvs) | |
(let* ((hash-sym (gensym)) | |
(setters (iter (for (k v) in kvs) | |
(collect `(setf (gethash ,k ,hash-sym) ,v))))) | |
`(defmacro ,sym () | |
(let ((,hash-sym (make-hash-table))) | |
,@setters | |
,hash-sym)))) | |
(defmacro get-table (sym k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax (: stx) | |
(syntax-parse stx | |
; #:literals needs to have bindings in order to work | |
; #:datum-literals only needs symbols so it works with '^'. | |
#:datum-literals (+ - * / ^) | |
[(_ l ... + r ...) #'(+ (: l ...) (: r ...))] | |
[(_ l ... - r ...) #'(- (: l ...) (: r ...))] | |
[(_ l ... * r ...) #'(* (: l ...) (: r ...))] | |
[(_ l ... / r ...) #'(/ (: l ...) (: r ...))] | |
[(_ l ... ^ r ...) #'(expt (: l ...) (: r ...))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- cabal: | |
build-depends: base >= 4.11 && < 5,shelly,text | |
ghc-options: -Wall -O0 | |
default-language: Haskell2010 | |
-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Shelly |