Skip to content

Instantly share code, notes, and snippets.

View webyrd's full-sized avatar

William E. Byrd webyrd

View GitHub Profile
#lang racket/base
(require racket/place racket/list racket/match)
(define (run-in-place)
(place ch
(define base-ns
(let ()
(define ns (make-base-empty-namespace))
(parameterize ([current-namespace ns])
Hey everyone!
After yesterday's hangout someone pointed out that a participant's
background contained something not-safe for work, and which might make
others feel uncomfortable or unwelcome. I didn't notice this during
the hangout, or I would have said something.
I have make the video private, and will ask folks to please make sure
that their backgrounds, along with the rest of their conduct, is
welcoming to everyone. I have spoken with the person, who was very
;; run 1 terminates, run 2 diverges
(run 1 (q)
(evalo
`((lambda (append)
((append (quote ,q)) (quote (d e))))
(lambda (l)
(lambda (s)
(fold (lambda (w) (lambda (v) (cons w v))) s l))))
'(a b c d e)))
@webyrd
webyrd / gist:b984f45a59f0e6fab814
Created March 6, 2015 07:22
type-conflicto triple duplicate answers
(test "type-conflicto-1"
(run* (t1 t2 b)
(== t1 t2)
(type-conflicto t1 t2 b))
'((_.0 _.0 #f)
(_.0 _.0 #f)
(_.0 _.0 #f)))
;; relational scheme interpreter
(define lookupo
(lambda (x env out)
(fresh (y val env^)
(== `((,y . ,val) . ,env^) env)
(symbolo x)
(symbolo y)
(conde
((== x y) (== val out))
;; relational scheme interpreter
;; (currently without absento)
(define lookupo
(lambda (x env out)
(fresh (y val env^)
(== `((,y . ,val) . ,env^) env)
(symbolo x)
(symbolo y)
(conde
;; relational scheme interpreter
;; (currently without absento)
(define lookupo
(lambda (x env out)
(fresh (y val env^)
(== `((,y . ,val) . ,env^) env)
(symbolo x)
(symbolo y)
(conde
function quote_desugar(exp) {
if (pairp(exp)) {
return list(intern("cons"), quote_desugar(exp.car), quote_desugar(exp.cdr));
} else if (exp == null) {
return list(intern("quote"), null);
}else if(constantp(exp)) {
return exp;
} else {
return list(intern("quote"), exp);
}
(ns monstero.core)
;; Basically this is a change calculator that returns all possible combinations of change for a given
;; total. Instead of being about money its about monsters for tabletop RPGs.
(require '[clojure.core.logic :as l]
'[clojure.core.logic.fd :as fd])
;; Andrew's definition
@webyrd
webyrd / gist:9217893
Created February 25, 2014 21:13
Annotated code from Steve
#lang racket
(require "miniKanren/mk.rkt")
; changed name of goal to be more descriptive
(define (key-not-boundo key env)
(conde
[(== '() env)] ; swapped conde clauses to make the non-recursive
; clause come first; not necessary, but could
; improve efficiency
[(fresh (k v rest)