Warning: Declaration of action_plugin_subjectindex_indexer::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php on line 15

Warning: Declaration of action_plugin_mathjax_enable::register(Doku_Event_Handler &$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/mathjax/action/enable.php on line 62

Warning: Declaration of action_plugin_googleanalytics::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/googleanalytics/action.php on line 40

Warning: Declaration of action_plugin_folded::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/folded/action.php on line 40

Warning: Declaration of action_plugin_hidden::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/hidden/action.php on line 28

Warning: Declaration of action_plugin_include::register(&$controller) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/include/action.php on line 354

Warning: Declaration of action_plugin_tag::register(&$contr) should be compatible with DokuWiki_Action_Plugin::register(Doku_Event_Handler $controller) in /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/tag/action.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/auth.php on line 532

Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/auth.php on line 818

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/actions.php on line 656

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/actions.php on line 656

Warning: Cannot modify header information - headers already sent by (output started at /data/web/virtuals/28604/virtual/www/subdom/bo/lib/plugins/subjectindex/action/indexer.php:15) in /data/web/virtuals/28604/virtual/www/subdom/bo/inc/actions.php on line 656
======K4b.scm====== #!/usr/bin/env racket #lang racket/base ====== fac ====== (define ! (lambda (n) (if (= n 0) 1 (* n (! (- n 1)))))) ====== fac-iter ====== (define !iter (lambda (a i) (if (= i 0) a (!iter (* a i) (- i 1))))) (define !* (lambda(n) (!iter 1 n))) (define !iter (lambda (a i) (display "a: ") (display a) (newline) (display "i: ") (display i) (newline) (newline) (if (= i 0) a (!iter (* a i) (- i 1))))) ====== merge ====== (define merge (lambda (l1 l2 order) (cond ((null? l1) l2) ((null? l2) l1) ((order (car l1) (car l2)) (cons (car l1) (merge (cdr l1) l2 order))) (else (cons (car l2) (merge (cdr l2) l1 order)))))) ====== split ====== (define split (lambda (l) (split-pomocna l () ()))) ====== split-pomocna ====== (define split-pomocna (lambda (l l1 l2) (if (null? l) (cons l1 l2) (split-pomocna (cdr l) (cons (car l) l2) l1)))) ====== mergesort ====== (define mergesort (lambda (l order) (if (or (null? l) (null? (cdr l))) l (let* ((l1l2 (split l)) (l1 (car l1l2)) (l2 (cdr l1l2))) (merge (mergesort l1 order) (mergesort l2 order) order))))) ====== abc-string ====== (define abc-string "aábcčdďeéěfghiíjklmnňoópqrřsštťuůúvwxyýzž") ====== abc-assoc1 ====== (define abc-assoc1 (let* ((lst (string->list abc-string)) (len (length lst))) (map cons lst (build-list len +)))) ====== my-assoc2 ====== (define my-assoc2 (lambda (e l) (cond ((null? l) #f) ((equal? e (caar l)) (car l)) (else (my-assoc e (cdr l)))))) ====== my-assoc ====== (define my-assoc (lambda (e l) (if (null? l) #f (if (equal? e (caar l)) (car l) (my-assoc e (cdr l)))))) ====== index-of ====== (define index-of (lambda (c) (cdr (my-assoc c abc-assoc)))) ====== compare-strings-cz ====== (define compare-strings-cz (lambda (s1 s2) (compare-strings-cz-aux (string->list s1) (string->list s2) ))) ====== compare-strings-cz-aux ====== (define compare-strings-cz-aux (lambda (l1 l2) (cond ((null? l1) #t) ((null? l2) #f) ((< (index-of (car l1)) (index-of (car l2))) #t) ((> (index-of (car l1)) (index-of (car l2))) #f) (else (compare-strings-cz-aux (cdr l1) (cdr l2)))))) (compare-strings-cz "svete" "áhoj" ) ====== merge-sort ====== (mergesort '("ahoj" "člověče" "xxx" "ššš") compare-strings-cz) ; vim: syntax=racket