yuu_nkjm blog
2015-12-15(Tue) [長年日記] 編集
[Kawa][Scheme] Kawaでの例外のキャッチ
(try-catch (display "test" "test") (ex((org.apache.logging.log4j.LogManager:getLogger):error ex ex)))
2015-12-15 11:54:05.165 ERROR [Thread-3] atInteractiveLevel$165.run(stdin:11) Argument #3 'test' to 'gnu.kawa.functions.DisplayFormat.format(java.lang.Object,gnu.lists.Consumer)' has wrong type (String) (java.lang.String cannot be cast to gnu.lists.Consumer) gnu.mapping.WrongType: Argument #3 'test' to 'gnu.kawa.functions.DisplayFormat.format(java.lang.Object,gnu.lists.Consumer)' has wrong type (String) (java.lang.String cannot be cast to gnu.lists.Consumer) at kawa.lib.ports.display(ports.scm:315) ~[kawa-2.0.jar:?] at atInteractiveLevel$165.run(stdin:9) [?:?] at gnu.expr.ModuleExp.evalModule2(ModuleExp.java:317) [kawa-2.0.jar:?] at gnu.expr.ModuleExp.evalModule(ModuleExp.java:219) [kawa-2.0.jar:?] at kawa.Shell.run(Shell.java:291) [kawa-2.0.jar:?] at kawa.Shell.run(Shell.java:203) [kawa-2.0.jar:?] at kawa.Shell.run(Shell.java:184) [kawa-2.0.jar:?] at kawa.ReplDocument$2.apply0(ReplDocument.java:98) [kawa-2.0.jar:?] at gnu.mapping.RunnableClosure.run(RunnableClosure.java:80) [kawa-2.0.jar:?] at gnu.mapping.Future.run(Future.java:46) [kawa-2.0.jar:?] Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to gnu.lists.Consumer at kawa.lib.ports.display(ports.scm:314) ~[kawa-2.0.jar:?] ... 9 more
2015-12-25(Fri) [長年日記] 編集
[Kawa][Scheme] defineで再定義
(define foo (lambda (bar) (string-append "foo" bar))) (define pyo foo) (pyo "2") ;;=> "foo2" (define foo (lambda (bar) (string-append "foooooooooo" bar))) (pyo "2") ;;=> "foo2" ;;;;;;;;;;;;;;;;;;;;; (define (foo bar) (string-append "foo" bar)) (define pyo foo) (pyo "2") ;;=> "foo2" (define foo (lambda (bar) (string-append "foooooooooo" bar))) (pyo "2") ;;=> "foo2" ;;;;;;;;;;;;;;;;;;;;; (define (foo bar) (string-append "foo" bar)) (define pyo foo) (pyo "2") ;;=> "foo2" (define (foo bar) (string-append "foooooooooo" bar)) (pyo "2") ;;=> "fooooooooooooooo2" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (foo bar) (string-append "foo" bar)) (define (pyo bar) (foo bar)) (pyo "2") ;;=> "foo2" (define (foo bar) (string-append "foooooooooo" bar)) (pyo "2") ;;=> "fooooooooooooooo2" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (foo bar) (string-append "foo" bar)) (define pyo (lambda (bar) (foo bar))) (pyo "2") ;;=> "foo2" (define (foo bar) (string-append "fooooooooooooooo" bar)) (pyo "2") ;;=> "fooooooooooooooo2" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (foo bar) (string-append "foo" bar)) (define (pyo bar) (foo bar)) (pyo "2") ;;=> "foo2" (define (foo bar) (string-append "fooooooooooooooo" bar)) (pyo "2") ;;=> "fooooooooooooooo2" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;