> <\body> \<#56FE\>> <\session|scheme|default> <\folded-io|Scheme] > (define (plot l) (stree-\tree l)) <|folded-io> plot <\folded-io|Scheme] > (plot `(frac 1 2)) <|folded-io> > <\folded-io|Scheme] > (plot `(point 0 0)) <|folded-io> > <\folded-io|Scheme] > (plot `(graphics (point "-5" "-5") (point "5" "5"))) ; quasiquote ` <|folded-io> |>> <\folded-io|Scheme] > (plot `(graphics (point ,(number-\string (+ 1 2)) ,(number-\string (+ 1 3))) (point 0 0))) <|folded-io> |gr-grid-old||1>|gr-edit-grid-aspect|||>|gr-edit-grid||gr-edit-grid-old||1>||>>> <\folded-io|Scheme] > (plot `(graphics (point "0" "0") (point "1" "1") (line (point "0" "0") (point "1" "1"))))) <|folded-io> |||>>> <\folded-io|Scheme] > (plot `(cline (point 0 0) (point 3 0) (point 0 4))) <|folded-io> ||>> <\folded-io|Scheme] > (kbd-map ("d i a n var" (insert (utf8-\cork "\<#70B9\>")))) <|folded-io> ("d i a n tab") <\folded-io|Scheme] > (kbd-map ("h t var" (insert (utf8-\cork "\<#7ED8\>\<#56FE\>")))) <|folded-io> ("h t tab") <\folded-io|Scheme] > (kbd-map ("t u var" (insert (utf8-\cork "\<#56FE\>")))) <|folded-io> ("t u tab") <\folded-io|Scheme] > (kbd-map ("s j x var" (insert (utf8-\cork "\<#4E09\>\<#89D2\>\<#5F62\>")))) <|folded-io> ("s j x tab") <\folded-io|Scheme] > (kbd-map ("z s j x var" (insert (utf8-\cork "\<#6B63\>\<#4E09\>\<#89D2\>\<#5F62\>")))) <|folded-io> ("z s j x tab") <\folded-io|Scheme] > (define (scm2stm x) \ \ (define (x-\string x) \ \ \ \ (cond ((number? x) (number-\string x)) \ \ \ \ \ \ \ \ \ \ ((list? x) (scm2stm x)) \ \ \ \ \ \ \ \ \ \ (else x))) \ \ (if (eq? () x) \ \ \ \ \ \ () \ \ \ \ \ \ (cons (x-\string (car x)) \ \ \ \ \ \ \ \ \ \ \ \ (scm2stm (cdr x)))))) <|folded-io> scm2stm <\unfolded-io|Scheme] > (define (\<#7ED8\>\<#56FE\> x) \ \ (stree-\tree (scm2stm x))) <|unfolded-io> \<#7ED8\>\<#56FE\> <\unfolded-io|Scheme] > (define (\<#70B9\> x y) `(point ,x ,y)) <|unfolded-io> \<#70B9\> <\unfolded-io|Scheme] > (define (\<#56FE\> . objects) \ \ (cond ((nlist? objects) '(graphics "" "")) \ \ \ \ \ \ \ \ ((== objects '()) '(graphics "" "")) \ \ \ \ \ \ \ \ (else `(graphics "" ,@objects)))) <|unfolded-io> \<#56FE\> <\folded-io|Scheme] > (\<#7ED8\>\<#56FE\> (\<#56FE\> (\<#70B9\> 1 1) (\<#70B9\> 2 2))) <|folded-io> |>> <\unfolded-io|Scheme] > (define (triangle x y z) \ \ `(cline ,x ,y ,z)) <|unfolded-io> triangle <\unfolded-io|Scheme] > (define (\<#4E09\>\<#89D2\>\<#5F62\> x y z) (triangle x y z)) <|unfolded-io> \<#4E09\>\<#89D2\>\<#5F62\> <\unfolded-io|Scheme] > (\<#7ED8\>\<#56FE\> (\<#4E09\>\<#89D2\>\<#5F62\> (\<#70B9\> 0 0 ) (\<#70B9\> 0 3) (\<#70B9\> 4 0))) <|unfolded-io> ||>> <\unfolded-io|Scheme] > (car (cdr (cdr (\<#70B9\> 1 2)))) ; third <|unfolded-io> 2 <\unfolded-io|Scheme] > (car (cdr (\<#70B9\> 1 2))) ; second <|unfolded-io> 1 <\unfolded-io|Scheme] > (list-ref (list 1 2 3 4 5) 1) <|unfolded-io> 2 <\unfolded-io|Scheme] > (define (\<#6B63\>\<#4E09\>\<#89D2\>\<#5F62\> A a) \ \ (\<#4E09\>\<#89D2\>\<#5F62\> \ \ \ \ \ \ \ A \ \ \ \ \ \ \ (\<#70B9\> (+ a (second A)) \ \ \ \ \ \ \ \ \ \ \ (third A)) \ \ \ \ \ \ \ (\<#70B9\> (+ (* 0.5 a) (second A)) \ \ \ \ \ \ \ \ \ \ \ (+ (third A) (* (sqrt 0.75) a)))))) <|unfolded-io> \<#6B63\>\<#4E09\>\<#89D2\>\<#5F62\> <\input|Scheme] > \; <\unfolded-io|Scheme] > (scm2stm (\<#6B63\>\<#4E09\>\<#89D2\>\<#5F62\> (\<#70B9\> 0 0) 3)) <|unfolded-io> (cline (point "0" "0") (point "3" "0") (point "1.5" "2.598076211353316")) <\unfolded-io|Scheme] > (\<#7ED8\>\<#56FE\> (\<#6B63\>\<#4E09\>\<#89D2\>\<#5F62\> (\<#70B9\> 0 0) 3)) <|unfolded-io> ||>> <\input|Scheme] > \; \<#627E\>\<#8D28\>\<#6570\>> <\session|scheme|default> <\unfolded-io|Scheme] > (define (square x) (* x x)) <|unfolded-io> square <\unfolded-io|Scheme] > (define (smallest-divisor n) \ \ (find-divisor n 2)) <|unfolded-io> smallest-divisor <\unfolded-io|Scheme] > (define (find-divisor n test-divisor) \ \ (cond ((\ (square test-divisor) n) n) \ \ \ \ \ \ \ \ ((divides? test-divisor n) test-divisor) \ \ \ \ \ \ \ \ (else (find-divisor n (+ test-divisor 1))))) <|unfolded-io> find-divisor <\unfolded-io|Scheme] > (define (divides? a b) \ \ (= (remainder b a) 0)) <|unfolded-io> divides? <\unfolded-io|Scheme] > (define (prime? n) \ \ (= n (smallest-divisor n))) <|unfolded-io> prime? <\unfolded-io|Scheme] > (prime? 7) <|unfolded-io> #t <\unfolded-io|Scheme] > (smallest-divisor 7) <|unfolded-io> 7 <\unfolded-io|Scheme] > (find-divisor 7 2) <|unfolded-io> 7 <\input|Scheme] > \; <\unfolded-io|Scheme] > (define (square x) (* x x)) <|unfolded-io> square <\unfolded-io|Scheme] > (define (expmod base exp m) \ \ (cond ((= exp 0) 1) \ \ \ \ \ \ \ \ ((even? exp) \ \ \ \ \ \ \ \ \ (remainder (square (expmod base (/ exp 2) m)) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ m)) \ \ \ \ \ \ \ \ (else \ \ \ \ \ \ \ \ \ (remainder (* base (expmod base (- exp 1) m)) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ m)))) <|unfolded-io> expmod <\unfolded-io|Scheme] > (define (fermat-test n) \ \ (define (try-it a) \ \ \ \ (= (expmod a n n) a)) \ \ (try-it (+ 1 (random (- n 1))))) <|unfolded-io> fermat-test <\unfolded-io|Scheme] > (define start 0) <|unfolded-io> 0 <\input|Scheme] > (debug-message "std" "\\nHello\\n") <\unfolded-io|Scheme] > (define (show-time msg ts) \ \ (debug-message "std" \ \ \ \ (string-append msg (number-\string (- (texmacs-time) ts)) "\\n"))) <|unfolded-io> show-time <\unfolded-io|Scheme] > (define (fast-prime? n times ts) \ \ (cond ((= times 0) \ \ \ \ \ \ \ \ \ (begin \ \ \ \ \ \ \ \ \ \ \ (show-time "true time: " ts) \ \ \ \ \ \ \ \ \ \ \ #t)) \ \ \ \ \ \ \ \ ((fermat-test n) (fast-prime? n (- times 1) ts)) \ \ \ \ \ \ \ \ (else (begin \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ (show-time "false time: " ts) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #f)))) <|unfolded-io> fast-prime? <\unfolded-io|Scheme] > (define (wrap-prime? n times) \ \ (fast-prime? n times (texmacs-time))) <|unfolded-io> wrap-prime? <\unfolded-io|Scheme] > (wrap-prime? 99999787 100000) <|unfolded-io> #t <\unfolded-io|Scheme] > (current-time) <|unfolded-io> 1711437953 <\unfolded-io|Scheme] > (define start (current-time)) <|unfolded-io> 1711438362 <\unfolded-io|Scheme] > (define end (current-time)) <|unfolded-io> 1711438370 <\unfolded-io|Scheme] > (- end start) <|unfolded-io> 8 <\unfolded-io|Scheme] > (texmacs-time) <|unfolded-io> 10853179 <\unfolded-io|Scheme] > (texmacs-time) <|unfolded-io> 10859400 <\input|Scheme] > \; \<#58A8\>\<#8005\>\<#767E\>\<#79D1\>\<#FF1A\>\<#5B66\>/\<#8D39\>\<#9A6C\>\<#5C0F\>\<#5B9A\>\<#7406\>.tm> <\initial> <\collection> <\references> <\collection> > > <\auxiliary> <\collection> <\associate|toc> |math-font-series||\<#7ED8\>\<#56FE\>> |.>>>>|> |math-font-series||\<#5BFB\>\<#627E\>\<#8D28\>\<#6570\>> |.>>>>|>