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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; Copyright (c) Rich Hickey. All rights reserved. | |
; The use and distribution terms for this software are covered by the | |
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php) | |
; which can be found in the file CPL.TXT 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. | |
;dimensions of square world |
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
(ns three.demo) | |
(def camera (THREE.Camera. 75 (/ window/innerWidth | |
window/innerHeight) 1 10000)) | |
(set! (.z (.position camera)) 1000) | |
(def scene (THREE.Scene.)) | |
(def geometry (THREE.CubeGeometry. 200 200 200)) | |
(def obj (js/Object.)) | |
(set! (.color obj) 0xff0000) | |
(set! (.wireframe obj) true) | |
(def material (THREE.MeshBasicMaterial. obj)) |
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
import java.util.List; | |
import java.util.ArrayList; | |
/* | |
* Lexical analyzer for Scheme-like minilanguage: | |
* (define (foo x) (bar (baz x))) | |
*/ | |
public class Lexer { | |
public static enum Type { | |
// This Scheme-like language has three token types: |
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
signature POSITIONAL_STREAM = | |
sig | |
type elem | |
type stream | |
val peek : stream -> (elem * stream) option | |
val getPos : stream -> pos | |
end | |
structure SubstringStream : STREAM = |
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
type 'a monoid = {zero : 'a; plus : 'a -> 'a -> 'a} | |
let sum (m : 'a monoid) (l : 'a list) : 'a = List.fold_left m.plus m.zero l | |
let string_summer = sum {zero = ""; plus = (^)} | |
let int_summer = sum {zero = 0; plus = (+)} |
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 eopl | |
;(module lang (lib "eopl.ss" "eopl") | |
(require "drscheme-init.scm") | |
(provide (all-defined)) | |
;;;;;;;;;;;;;;;; grammatical specification ;;;;;;;;;;;;;;;; | |
(define the-lexical-spec |
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
utahraptor:~ aki$ rlwrap ocaml | |
Objective Caml version 3.12.1 | |
# #use "topfind";; | |
- : unit = () | |
Findlib has been successfully loaded. Additional directives: | |
#require "package";; to load a package | |
#list;; to list the available packages | |
#camlp4o;; to load camlp4 (standard syntax) | |
#camlp4r;; to load camlp4 (revised 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
#!/usr/bin/emacs --script | |
(princ (format "batch mode: %s\n" noninteractive)) |
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
(defun ext (cmd args) | |
(with-temp-buffer | |
(let ((exit (funcall 'call-process cmd nil (current-buffer) nil args))) | |
(cons exit (buffer-substring (point-min) (point-max)))))) |
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
(defun deep-rev (list) | |
(if (or (null list) (not (listp list))) list | |
(reverse (mapcar 'deep-rev list)))) |
NewerOlder