奇数
30分プログラム、その775。anarchy golf - odd linesをやってみます。
いつものごとく、ゴルフにはこだわりません。
使い方
$ jot 10 | gosh odd-line.scm 2 4 6 8 10
ソースコード
#! /opt/local/bin/gosh ;; -*- mode:scheme; coding:utf-8 -*- (use util.stream) (define (filter-odd xs) (stream-map cdr (stream-filter (lambda (x) (odd? (car x))) (stream-map cons (stream-iota -1) (list->stream xs))))) (for-each print (stream->list (filter-odd (port->string-list (standard-input-port)))))