Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
26
Task/Odd-word-problem/Racket/odd-word-problem.rkt
Normal file
26
Task/Odd-word-problem/Racket/odd-word-problem.rkt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
#|
|
||||
exec racket -tm- "$0" "$@"
|
||||
|#
|
||||
|
||||
#lang racket
|
||||
|
||||
(define (even k)
|
||||
(define c (read-char))
|
||||
(cond [(eq? c eof) (k)]
|
||||
[(not (char-alphabetic? c)) (k) (write-char c) (odd)]
|
||||
[else (even (λ() (write-char c) (k)))]))
|
||||
|
||||
(define (odd)
|
||||
(define c (read-char))
|
||||
(unless (eq? c eof)
|
||||
(write-char c)
|
||||
(if (char-alphabetic? c) (odd) (even void))))
|
||||
|
||||
(provide main)
|
||||
(define (main) (odd) (newline))
|
||||
|
||||
;; (with-input-from-string "what,is,the;meaning,of:life." main)
|
||||
;; ;; -> what,si,the;gninaem,of:efil.
|
||||
;; (with-input-from-string "we,are;not,in,kansas;any,more." main)
|
||||
;; ;; -> we,era;not,ni,kansas;yna,more.
|
||||
Loading…
Add table
Add a link
Reference in a new issue