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"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

トップ «前月 最新 翌月» 追記 設定
2006|01|06|12|
2007|06|09|
2008|01|03|04|06|07|08|09|10|12|
2009|01|02|05|06|07|08|10|11|12|
2010|03|04|05|06|07|08|09|10|11|
2011|01|02|03|04|05|06|07|08|09|11|12|
2012|01|02|04|06|07|08|10|11|12|
2013|01|02|03|07|08|10|11|12|
2014|01|02|04|05|06|07|08|09|10|11|
2015|01|02|07|11|12|
2016|01|03|05|07|08|09|