This file contains hidden or 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
;----------------------------------------------------------- | |
; | |
; --> DRAWARC.TEXT | |
; | |
; Routine to draw solid or hollow Ovals, RoundRects or Arcs. | |
; | |
;------------------------------------------------------ | |
; |
This file contains hidden or 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
# Rough translation from Joy of Clojure refs example in Familiar | |
# https://github.com/daveray/familiar | |
# https://github.com/joyofclojure/book-source/blob/master/src/joy/refs.clj | |
$initial_board = [[:o, :k, :o], | |
[:o, :o, :o], | |
[:o, :K, :o]].to_clojure | |
# (defn board-map [f bd] | |
# (vec (map #(vec (for [s %] (f s))) bd))) |
This file contains hidden or 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 typed/racket | |
(: stx Syntax) | |
(define stx #'bar) | |
(syntax-case stx () | |
[foo (identifier? #'foo) (symbol=? 'bar (syntax-e #'foo))] | |
[_ (error 'whoops)]) |
This file contains hidden or 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
(use 'clojure.walk) | |
(defmacro ->_ | |
"Threads the forms, replacing underscores with the result of the last expression." | |
([x] x) | |
([x form] (if (seq? form) | |
(with-meta (postwalk-replace {'_ x} form) (meta form)) | |
(list form x))) | |
([x form & more] `(->_ (->_ ~x ~form) ~@more))) |
This file contains hidden or 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
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) | |
; which can be found in the file epl-v10.html at the root of this distribution. | |
; By using this software in any fashion, you are agreeing to be bound by | |
; the terms of this license. | |
; You must not remove this notice, or any other, from this software. | |
(set! *warn-on-reflection* true) |
This file contains hidden or 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
(ns srepl.core | |
(:use [clojure.main :only [repl]] | |
[clojure.pprint :only [pprint with-pprint-dispatch code-dispatch]]) | |
(:import (jline.console ConsoleReader) | |
(jline.console.completer Completer)) | |
(:gen-class)) | |
(defmulti super-dispatch class) | |
(defmethod super-dispatch :default [thing] |
This file contains hidden or 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
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-October/thread.html#17696 | |
const className = superClass <| function(/*constructor parameters */) { | |
//constructor body | |
super.constructor(/*arguments to super constructor */); | |
this.{ | |
//per instance property definitions | |
}; | |
}.prototype.{ | |
//instance properties defined on prototype |
This file contains hidden or 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
// Here is a proposal for minimalist JavaScript classes, humbly offered. | |
// There are (at least) two different directions in which classes can be steered. | |
// If we go for a wholly new semantics and implementation, then fancier classical | |
// inheritance can be supported with parallel prototype chains for true inheritance | |
// of properties at both the class and instance level. | |
// If however, we keep current JavaScript prototype semantics, and add a form that | |
// can desugar to ES3, things must necessarily stay simpler. This is the direction | |
// I'm assuming here. |
This file contains hidden or 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
:- object(database). | |
:- public(rule/2). | |
nat(zero) :- true. | |
nat(s(X)) :- nat(X). | |
add(zero, Y, Y) :- true. | |
add(s(X), Y, s(Z)) :- | |
add(X, Y, Z). |
This file contains hidden or 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
(ns pallet.cache.impl | |
"An implementation namespace for pallet.cache") | |
(defprotocol CacheProtocolImpl | |
"Cache implementation interface." | |
(lookup [cache e] [cache e default] | |
"Retrieve the value associated with `e` if it exists") | |
(has? [cache e] | |
"Checks if the cache contains a value associtaed with `e`")) |