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
#! /usr/local/bin/guile \ | |
-e main -s | |
!# | |
(define (main . args) | |
(let* ((ll ((@ (srfi srfi-1) iota) (read) 1)) (len (length ll)) (m (1- (/ len 2)))) | |
(display len)(newline) | |
(let lp((a (list-head ll (1+ m))) (b (list-tail ll (1+ m))) (n 1)) | |
(and (< n len) (for-each (lambda (x y) (display x)(display " ")(display y)(display " ")) a b)(newline) | |
(lp (append (list 1 (car b)) (cdr a)) (append (cdr b) (list (list-ref a m))) (1+ 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
(define (main . args) | |
(let* ((ll ((@ (srfi srfi-1) iota) (read) 1)) (len (length ll)) (m (1- (/ len 2)))) | |
(display len)(newline) | |
(let lp((a (list-head ll (1+ m))) (b (list-tail ll (1+ m))) (n 1)) | |
(and (< n len) (for-each (lambda (x y) (display x)(display " ")(display y)(display " ")) a b)(newline) | |
(lp `(1 ,(car b) ,@(cdr a)) `(,@(cdr b) ,(list-ref a m)) (1+ 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
#! /usr/local/bin/guile \ | |
-e main -s | |
!# | |
(define main | |
(lambda args | |
(let ((wrl (primitive-eval (read)))) | |
(for-each (lambda (x) | |
(format #t "[~a]:~%" (car x)) |
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
#!r6rs | |
;; a toy for turning srfi 28 format strings into a procedure, that | |
;; performs the format, and outputs to stdout | |
(library (toys srfi-28-compiler) | |
(export format-string->procedure) | |
(import (rnrs) | |
(only (srfi :1 lists) fold) | |
(srfi :8 receive)) | |
(define (escape-char? char) |
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
#! /usr/local/bin/guile \ | |
-e main -s | |
!# | |
(use-modules (ice-9 regex) (ice-9 ftw)) | |
(define (sub from to str) (regexp-substitute #f (string-match from str) 'pre to 'post)) | |
(define (usage args) (format #t "~a from to path~%" (car args))) | |
(define main |
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-modules (rnrs)) | |
(define* (string->binary str #:key (base 16) (endiannes 'little)) | |
(let ((n (string->number str base)) | |
(f (case endiannes | |
((big) identity) | |
((little) reverse) | |
(else (error "wrong endiannes" endiannes))))) | |
(let lp ((n n) (result '())) | |
(if (zero? 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
(use-modules (rnrs)) | |
(define* (binary->string bin #:key (base 16) (endiannes 'little)) | |
(let ((bl (bytevector->uint-list bin endiannes 1)) | |
(n (car (assoc-ref '((2 "~b") (8 "~o") (16 "~x")) base)))) | |
(call-with-output-string | |
(lambda (port) | |
(for-each (lambda (i) (format port n i)) bl))))) |
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
#! /usr/bin/env guile | |
!# | |
(use-modules (ice-9 getopt-long)) | |
(setlocale LC_ALL "") | |
(define cur-out (current-output-port)) | |
(define cur-in (current-input-port)) | |
(define option-spec |
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
#! /usr/bin/env python | |
# Be sure you have installed: | |
# easy_install PIL | |
# easy_install PySerial | |
# easy_install gameduino | |
import Image | |
import gameduino.prep as gdprep | |
from sys import argv |
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-modules (srfi srfi-1) (ice-9 receiver)) | |
(define (gen-xfix-list str generator) | |
(let lp((ret '()) (n (1- (string-length str)))) | |
(if (zero? n) ret (lp (cons (generator str n) ret) (1- n))))) | |
(define (gen-prefix-list str) | |
(gen-xfix-list str (lambda (str n) (substring str 0 n)))) | |
(define (gen-suffix-list str) |
OlderNewer