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
#! /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
#!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 | |
!# | |
(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
(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 . 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)))))) |
NewerOlder