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 subnth (x n xs) | |
(let ((len (length xs))) | |
(if (<= len n) xs | |
(nconc (butlast xs (- len n)) `(,x) (cdr (nthcdr n xs)))))) | |
(defun bf-rec (code pos tape ret jump) | |
(if (null code) | |
(values tape pos) | |
(flet ((_ (&key ((:tape e) tape) ((:code c) (cdr code)) ((:pos p) pos) ((:ret r) ret) ((:jump j) jump)) | |
(bf-rec c p e r j))) |
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 bf (src &optional (tape-length 100)) | |
(let* ((code (remove-if-not (lambda (c) (find c "<>+-.,[]")) src)) | |
(len (length code)) | |
(jump (make-hash-table))) | |
(do* ((i 0 (1+ i)) (stack)) | |
((= i len) (when stack (error (format nil "unmatch [ at ~A" (car stack))))) | |
(case (aref code i) | |
(#\[ (push i stack)) | |
(#\] (unless stack (error (format nil "unmatch ] at ~A" i))) |
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
/*@cc_on@*//*@if (@_jscript) var print=function(s){WScript.Echo(s)};@*//*@end@*/ | |
var prompt=function(x,y){return'a'}; | |
var alert = print; | |
(function(bf){j=s=[];o=p='';b=[m=0];bf=bf.split(''); | |
for(i in bf)(c=bf[i])=='['?s.push(i):c==']'?j[j[i]=s.pop()]=i:0; | |
for(i=0;c=bf[i],i<bf.length;++i) | |
c=='>'?b[++m]=b[m]||0: | |
c=='<'?--m:c=='+'?++b[m]: | |
c=='-'?--b[m]:c=='['?b[m]||(i=j[i]): |
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 read-bf (s &optional (d 0)) | |
(let (code) | |
(loop | |
for p = nil then c | |
for c = #1=(read-char s nil) then #1# | |
while (and c (char/= c #\^)) | |
do (case c | |
(#\[ (push `(loop while (< 0 #2=(aref tape pos)) | |
do ,@(read-bf s (1+ d))) code)) | |
(#\] (if (= d 0) (error "unmatch ]") |
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
// ==UserScript== | |
// @name Outputz bar chart | |
// @namespace http://d.hatena.ne.jp/youz/ | |
// @include http://outputz.com/* | |
// ==/UserScript== | |
(function(){ | |
var make_uri = function (param) { | |
var q = ''; | |
for (k in param) { q += '&' + k + '=' + param[k]; } |
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
using System; | |
using System.IO; | |
using System.Text; | |
using System.Collections.Generic; | |
namespace list2xf | |
{ | |
class list2xf | |
{ | |
private const string usageText = "Usage: list2xf [-i filelist.txt] [-o output.ini] [-t typenum]"; |
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
(defparameter image-width 256) | |
(defparameter image-height 256) | |
(defparameter nsubsamples 2) | |
(defparameter nao-samples 8) | |
;; vector | |
(defmacro vx (v) `(svref ,v 0)) | |
(defmacro vy (v) `(svref ,v 1)) | |
(defmacro vz (v) `(svref ,v 2)) | |
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
(declaim (optimize (speed 3) (debug 0) (safety 0))) | |
(defparameter image-width 256) | |
(defparameter image-height 256) | |
(defparameter nsubsamples 2) | |
(defparameter nao-samples 8) | |
;; macros | |
(eval-when (:compile-toplevel :load-toplevel :execute) |
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
(require :asdf) | |
(in-package :asdf) | |
(defvar *win-central-registry* | |
`((,(user-homedir-pathname) ".sbcl/site/") | |
(,(sb-ext:posix-getenv "SBCL_HOME") "site/"))) | |
(defun win-sysdef-search (system) | |
(dolist (dir *win-central-registry*) | |
(let ((files (directory |
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
;;; growl.l --- Growl command for xyzzy | |
;;; Growl for Windows http://www.growlforwindows.com/gfw/default.aspx | |
;;; GNTP specification http://www.growlforwindows.com/gfw/help/gntp.aspx | |
(eval-when (:compile-toplevel :load-toplevel :execute) | |
(unless (find-package "growl") | |
(defpackage "growl" | |
(:use "lisp" "editor")))) | |
OlderNewer