this post was submitted on 21 Oct 2023
1 points (100.0% liked)

Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Ok_Specific_7749@alien.top 1 points 1 year ago

Program :


(module-name MyTest)
(module-compile-options main: #t)

(define (main)
    (define ar ::java.util.ArrayList[symbol] (java.util.ArrayList))
    (ar:add 'a)
    (ar:size)
    (ar:add 1))
(main)

Error:


(compiling ./MyTest.scm to MyTest)
./MyTest.scm:9:13: warning - type integer is incompatible with required type symbol
./MyTest.scm:9:5: warning - cannot convert literal (of type gnu.math.IntNum) to ClassType gnu.mapping.Symbol
        0,32 real         0,53 user         0,07 sys
java.lang.ClassCastException: class gnu.math.IntNum cannot be cast to class gnu.mapping.Symbol (gnu.math.IntNum and gnu.mapping.Symbol are in unnamed module of loader 'app')
	at MyTest.main(MyTest.scm:9)
	at MyTest.run(MyTest.scm:5)

µ