Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
30
Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp
Normal file
30
Task/Odd-word-problem/EchoLisp/odd-word-problem-1.echolisp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
(lib 'sequences)
|
||||
(define input-stream null)
|
||||
(define output-stream "")
|
||||
|
||||
;;---------------------------
|
||||
;; character I/O simulation
|
||||
;; --------------------------
|
||||
(define (read-char) (next input-stream)) ;; #f if EOF
|
||||
(define (write-char c) (when c (set! output-stream (string-append output-stream c))))
|
||||
|
||||
(define (init-streams sentence)
|
||||
(set! input-stream (procrastinator sentence))
|
||||
(set! output-stream ""))
|
||||
|
||||
;;---------------------------------
|
||||
;; task , using read-char/write-char
|
||||
;;----------------------------------
|
||||
|
||||
(define (flop) ; reverses, and returns first non-alpha after word, or EOF
|
||||
(define c (read-char))
|
||||
(if (string-alphabetic? c) (begin0 (flop) (write-char c)) c))
|
||||
|
||||
(define (flip)
|
||||
(define c (read-char))
|
||||
(if (string-alphabetic? c) (begin (write-char c) (flip)) c))
|
||||
|
||||
(define (task sentence)
|
||||
(init-streams sentence)
|
||||
(while (and (write-char (flip)) (write-char (flop))))
|
||||
output-stream )
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
(task "what,is,the;meaning,of:life.")
|
||||
→ "what,si,the;gninaem,of:efil."
|
||||
; check diacritical
|
||||
(task "Longtemps,je me suis couché,héhé,hôhô,de bonne heure.")
|
||||
→ "Longtemps,ej me sius couché,éhéh,hôhô,ed bonne erueh."
|
||||
Loading…
Add table
Add a link
Reference in a new issue