Skip to content

Instantly share code, notes, and snippets.

(define (pick-toothless ls)
(let rec ((ls ls)(acc '()))
(if (or (null? ls)
(null? (cdr ls)))
(reverse acc)
(let1 next (+ (car ls) 1)
(if (= next (cadr ls))
(rec (cdr ls) acc)
(rec (cons next (cdr ls))
(cons next acc)))))))
(use util.match)
(define-syntax %def
(syntax-rules (->)
((_ (a ...) (b ...) -> x r ...)
(%def (a ... ((b ...) x)) () r ...))
((_ (a ...) (b ...) x r ...)
(%def (a ...) (b ... x) r ...))
((_ (a ...) ())
(match-lambda* a ...))
function Primes() {
this.index=3;
this.nums=[2];
}
Primes.prototype.next=function() {
var i;
for(i=this.index; !(this.primep(i)); i++);
this.index=i+1;
this.nums.push(i);
@SaitoAtsushi
SaitoAtsushi / gist:781655
Created January 16, 2011 08:41
answer M-99 written in Scheme
;; http://common-lisp-users.jp/index.cgi?M-99
(define-syntax inc1
(syntax-rules ()
((_ v)
(set! v (+ v 1)))))
(define-syntax when
(syntax-rules ()
((_ p b0 b1 ...)
#!/usr/bin/env gosh
;; -*- coding: utf-8-unix ; mode: gauche; -*-
(use rfc.http)
(use rfc.json)
(use srfi-43)
(use gauche.collection)
(use text.tree)
(use sxml.tools)
(use sxml.serializer)
(define-syntax let-optionals
(syntax-rules ()
((_ args ((var default) rest ... . restarg) body ...)
(let* ((tmp args)
(var (if (null? tmp) default (car tmp))))
(let-optionals (if (null? tmp) '() (cdr tmp))
(rest ... . restarg)
body ...)))
((_ args () body ...)
(begin body ...))
(define-syntax let-optionals*
(syntax-rules ()
((_ a ((v d) . r) . b)
(let* ((t a)
(v (if (null? t) d (car t))))
(let-optionals* (if (null? t) '() (cdr t)) r . b)))
((_ a () . b)
(begin . b))
((_ a (v . r) . b)
(let-optionals* a ((v #f) . r) . b))
Index: src/sysdep.h
===================================================================
--- src/sysdep.h (リビジョン 506)
+++ src/sysdep.h (作業コピー)
@@ -114,6 +114,7 @@
#define VALUE_NAN std::numeric_limits<double>::quiet_NaN()
#define VALUE_INF std::numeric_limits<double>::infinity()
+ #ifndef __MINGW32__
#define INT8_MIN _I8_MIN
--- binary/pack.scm.org Sun Apr 01 17:09:10 2012
+++ binary/pack.scm Wed Jan 23 16:18:05 2013
@@ -1,6 +1,8 @@
+#!r6rs
;;;; binary.pack -- packing and unpacking binary data
;;; Author: Alex Shinn <[email protected]>
+;;; Modified by SAITO Atsushi for Sagittarius scheme
;; It is really insupportable that every hen lays an egg of a different
#!r6rs
(library (bound helper)
(export make-definition)
(import (rnrs))
(define-syntax make-definition
(lambda(stx2)
(syntax-case stx2 ()
((_ if-bound bound?)