Skip to content

Instantly share code, notes, and snippets.

View greghendershott's full-sized avatar

Greg Hendershott greghendershott

View GitHub Profile
@gigamonkey
gigamonkey / criteria.txt
Last active January 5, 2020 06:21
Hiring criteria: looking for the ability to …
Write a program that does what it’s supposed to do
Write idiomatic code
Debug a program that you wrote
Debug a program someone else wrote
Debug the interaction between a system you wrote and one you didn’t
File a good bug report
Modify a program you didn’t write
Test a program you wrote
Test a program you didn’t write
Learn a new programming language
;;; -*- lexical-binding: t -*-
(require 'dash)
(defun var (c) (vector c))
(defun var? (x) (vectorp x))
(defun var=? (x1 x2) (= (elt x1 0) (elt x2 0)))
(defun assp (pred l)
(-first (lambda (i) (funcall pred (car i))) l))
@lwhjp
lwhjp / factorial.rkt
Created October 19, 2014 08:18
Factorials in Racket
#lang racket
;;
;; These are some examples of different ways to compute factorials
;; using various paradigms and features provided by Racket. There
;; are more options available in packages which are not imported
;; by default, but that rabbit hole goes very deep indeed.
;;
;; Comments and suggestions welcome!
;; leo@lwh.jp
@khernyo
khernyo / racket-android-build.sh
Last active March 20, 2016 09:20
Make it build the android version properly
#!/bin/bash
set -e
SCRIPT_DIR=$( cd "$( dirname "$0" )" && pwd )
# the location of a clean racket repo which will be copied to avoid "git clone"-ing
REPO=$SCRIPT_DIR/../tools/racket
PLATFORM=linux-x86_64
@soegaard
soegaard / colors.rkt
Created August 8, 2013 18:09
Match expanders and color% objects
#lang racket
(require racket/draw (for-syntax syntax/parse) pict unstable/gui/pict)
(define-syntax defv (make-rename-transformer #'define-values))
(define-syntax defm (make-rename-transformer #'match-define))
(define-syntax def (make-rename-transformer #'define))
(define-match-expander color:
(λ (stx)
(syntax-parse stx
@dyoo
dyoo / annotation-example.rkt
Last active December 15, 2015 19:49
An example of using namespaces and modules to communicate between annotated, expanded syntax, and some external evaluator. We do it without 3d syntax, which avoids the sort of silly problems that can happen otherwise. (e.g. we can actually compile the code.)
#lang racket
;; Experiment: interaction between compiled code and a tool.
;;
;; Typically, 3d syntax is often used here. But let's say we don't
;; want 3d syntax. Is there another way?
;;
;; Idea: when evaluating code, attach a module to the evaluating
;; namespace that the code and the tool share.
;;
@dyoo
dyoo / gist:4659253
Created January 28, 2013 21:33
external test with submodule
#lang racket
(define (f x)
(* x x))
(provide f)
(module* foo racket/base
;; External test of the function
(require rackunit
@tonyg
tonyg / README.md
Created January 16, 2013 17:09
Racket custodians and namespaces for rebootable racket programs

Demonstrates the use of Racket's custodians and namespaces to create enough isolation to "reboot" programs without restarting the whole of Racket, including possibly recompiling and reloading code.

To experiment with this:

$ racket ~/src/racket-experiments$ racket
Welcome to Racket v5.3.1.4.
-> (require "reloader.rkt")
-> (load-and-foo)
Starting worker...

test-mod: "foo"

@greghendershott
greghendershott / git-workflow.md
Last active September 30, 2016 14:56
Draft of guide for new and/or casual contributors to Racket. Again, this is a DRAFT. Please be careful using. If you spot any mistakes, please let me know.

A guide for new and/or casual contributors to Racket

Maybe you're comfortable with Git, but haven't made a pull request before.

Maybe you've made one-off pull requests, but haven't tried to contribute to the same project over time and stay in sync with the upstream project.

This guide may help. DRAFT