[ create a new paste ] login | about

Link: http://codepad.org/JKXQRIS5    [ raw code | fork ]

programmingpraxis - Scheme, pasted on Dec 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
; left-handed words

(define (all? pred? xs)
  (cond ((null? xs) #t)
        ((pred? (car xs))
          (all? pred? (cdr xs)))
        (else #f)))

(define left (string->list "qwertasdfgzxcvb"))

(define (left? word)
  (all? (lambda (c) (member c left))
        (string->list word)))

(with-input-from-file "words"
  (lambda ()
    (do ((word (read) (read))) ((eof-object? word))
      (when (left? (symbol->string word))
        (display word) (newline)))))


Create a new paste based on this one


Comments: