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
| #!/bin/bash | |
| # --------------------------------------------------------------------------- | |
| # OO support functions | |
| # Kludged by Pim van Riezen <pi@madscience.nl> | |
| # --------------------------------------------------------------------------- | |
| DEFCLASS="" | |
| CLASS="" | |
| THIS=0 |
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
| main(argc, argv) | |
| int argc; | |
| char *argv[]; | |
| { | |
| int i; | |
| argc--; | |
| for(i=1; i<=argc; i++) | |
| printf("%s%c", argv[i], i==argc? '\n': ' '); | |
| } |
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
| ;; The following is a tiny Prolog interpreter in MacLisp | |
| ;; written by Ken Kahn and modified for XLISP by David Betz. | |
| ;; It was inspired by other tiny Lisp-based Prologs of | |
| ;; Par Emanuelson and Martin Nilsson. | |
| ;; There are no side-effects anywhere in the implementation. | |
| ;; Though it is VERY slow of course. | |
| (defun prolog (database &aux goal) | |
| (do () ((not (progn (princ "Query?") (setq goal (read))))) | |
| (prove (list (rename-variables goal '(0))) |
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
| ; | |
| ; Ported to Chicken Scheme by Ivan Raikov. | |
| ; | |
| ; Scheme 9 from Empty Space, Function Library | |
| ; By Nils M Holm, 1998-2009 | |
| ; See the LICENSE file of the S9fES package for terms of use | |
| ; | |
| ; (prolog list1 list2) ==> list | |
| ; (new-database!) ==> unspecific | |
| ; (fact! list) ==> unspecific |
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
| ;;; PORTABLE PROLOG INTERPRETER by H. Nakashima | |
| ;;; ( Version 2 ) 1983.04.09 | |
| ;;; Common Lisp Version 1988.11.21 | |
| (defvar cue nil "Goals to be executed") | |
| (defvar clause nil "Body of a goal") | |
| (defvar epilog nil "Switch to exit") | |
| (defvar fetched-subst nil "The environment of the value of a variable") | |
| (defvar goal nil "top-level goal") | |
| (defvar new-subst nil "environment of the callee") |
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
| (defn mundane-pack | |
| "Mundane recursive way to pack a sequence" | |
| [[f & r :as S]] | |
| (if (seq S) | |
| (let [[packed tail] (split-with {f true} S)] | |
| (if (seq tail) | |
| (cons packed (mundane-pack tail)) | |
| [packed])) | |
| [nil])) |
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
| ; http://groups.google.com/group/clojure/browse_thread/thread/974e2c7f89e27231/5f4bff3e58dfa36f | |
| ; output images http://i.imgur.com/gSASS.png (square maze) | |
| ; http://i.imgur.com/uEqaq.png (hex maze) | |
| ;; generic Wilson's algorithm implementation | |
| (defn maze | |
| "Returns a random maze carved out of walls; walls is a set of | |
| 2-item sets #{a b} where a and b are locations. | |
| The returned maze is a set of the remaining walls." | |
| [walls] |
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. | |
| ; modified by Chris Houser | |
| (require '[clojure.contrib.reflect :as hack]) |
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
| #include "stdio.h" | |
| #include "stdlib.h" | |
| #include "string.h" | |
| typedef char C;typedef long I; | |
| typedef struct a{I t,r,d[3],p[2];}*A; | |
| #define P printf | |
| #define R return | |
| #define V1(f) A f(w)A w; | |
| #define V2(f) A f(a,w)A a,w; |
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
| ;; stolen from http://cemerick.com/2010/08/02/defrecord-slot-defaults/ | |
| (defmacro defrecord+defaults | |
| "Defines a new record, along with a new-RecordName factory function that | |
| returns an instance of the record initialized with the default values | |
| provided as part of the record's slot declarations. e.g. | |
| (defrecord+ Foo [a 5 b \"hi\"]) | |
| (new-Foo) | |
| => #user.Foo{:a 5, :b \"hi\"}" | |
| [name slots & etc] |