google / lisp-koans

Common Lisp Koans is a language learning exercise in the same vein as the ruby koans, python koans and others. It is a port of the prior koans with some modifications to highlight lisp-specific features. Structured as ordered groups of broken unit tests, the project guides the learner progressively through many Common Lisp language features.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TEST-GUESS-THAT-TYPE! (ERROR)

anquegi opened this issue · comments

Hi I get this error using

[anquegi@localhost lisp-koans]$ sbcl --script contemplate.lsp

Thinking about ASSERTS
ASSERT-TRUE has expanded your awareness.

         ...
     ...

Thinking about SCORING-PROJECT
TEST-SCORE-OF-AN-EMPTY-LIST-IS-ZERO has expanded your awareness.
TEST-SCORE-OF-A-SINGLE-ROLL-OF-5-IS-50 has expanded your awareness.
TEST-SCORE-OF-A-SINGLE-ROLL-OF-1-IS-100 has expanded your awareness.
TEST-SCORE-OF-MULTIPLE-1S-AND-5S-IS-THE-SUM-OF-INDIVIDUAL-SCORES has expanded your awareness.
TEST-SCORE-OF-SINGLE-2S-3S-4S-AND-6S-ARE-ZERO has expanded your awareness.
TEST-SCORE-OF-A-TRIPLE-1-IS-1000 has expanded your awareness.
TEST-SCORE-OF-OTHER-TRIPLES-IS-100X has expanded your awareness.
TEST-SCORE-OF-MIXED-IS-SUM has expanded your awareness.

; in: LAMBDA ()
; (TYPEP (MAKE-ARRAY '(5 3 33) :ELEMENT-TYPE 'VECTOR) TYPE-CHECKING::X)
;
; caught WARNING:
; Derived type of TYPE-CHECKING::X is
; (VALUES (SIMPLE-ARRAY T (5 3 33)) &OPTIONAL),
; conflicting with its asserted type
; (OR CONS SYMBOL SB-KERNEL:INSTANCE).
; See also:
; The SBCL Manual, Node "Handling of Types"

; (TYPEP (MAKE-ARRAY '(5 3 9) :ELEMENT-TYPE 'STRING) TYPE-CHECKING::X)
;
; caught WARNING:
; Derived type of TYPE-CHECKING::X is
; (VALUES (SIMPLE-ARRAY T (5 3 33)) &OPTIONAL),
; conflicting with its asserted type
; (OR CONS SYMBOL SB-KERNEL:INSTANCE).
; See also:
; The SBCL Manual, Node "Handling of Types"

; (SUBTYPEP TYPE-CHECKING::X '(SIMPLE-ARRAY ARRAY *))
;
; caught WARNING:
; Derived type of TYPE-CHECKING::X is
; (VALUES (SIMPLE-ARRAY T (5 3 33)) &OPTIONAL),
; conflicting with its asserted type
; (OR CONS SYMBOL SB-KERNEL:INSTANCE).
; See also:
; The SBCL Manual, Node "Handling of Types"

; (SUBTYPEP TYPE-CHECKING::X '(SIMPLE-ARRAY T (5 * *)))
;
; caught WARNING:
; Derived type of TYPE-CHECKING::X is
; (VALUES (SIMPLE-ARRAY T (5 3 33)) &OPTIONAL),
; conflicting with its asserted type
; (OR CONS SYMBOL SB-KERNEL:INSTANCE).
; See also:
; The SBCL Manual, Node "Handling of Types"

; (SUBTYPEP TYPE-CHECKING::X '(SIMPLE-ARRAY T (* 3 *)))
;
; caught WARNING:
; Derived type of TYPE-CHECKING::X is
; (VALUES (SIMPLE-ARRAY T (5 3 33)) &OPTIONAL),
; conflicting with its asserted type
; (OR CONS SYMBOL SB-KERNEL:INSTANCE).
; See also:
; The SBCL Manual, Node "Handling of Types"
;
; compilation unit finished
; caught 5 WARNING conditions

Thinking about TYPE-CHECKING
TEST-CHECK-SOME-COMMON-TYPES has expanded your awareness.
TEST-GET-TYPE-WITH-TYPE-OF has expanded your awareness.
TEST-TYPE-SETS-MAY-OVERLAP has expanded your awareness.
TEST-INTEGERS-CAN-GET-REALLY-BIG has expanded your awareness.
TEST-LISP-TYPE-SYSTEM-IS-HIERARCHY has expanded your awareness.
TEST-SOME-TYPES-ARE-LISTS has expanded your awareness.
TEST-TYPE-SPECIFIER-LISTS-ALSO-HAVE-HIERARCHY has expanded your awareness.
TEST-TYPE-COERSION has expanded your awareness.
TEST-ATOMS-ARE-ANYTHING-THATS-NOT-A-CONS has expanded your awareness.
TEST-FUNCTIONP has expanded your awareness.
TEST-THERE-ARE-SOME-OTHER-TYPE-PREDICATES has expanded your awareness.
TEST-GUESS-THAT-TYPE! requires more meditation.

You have not yet reached enlightenment ...
A koan threw an error.

Please meditate on the following code:
File "koans/type-checking.lsp"
Koan "TEST-GUESS-THAT-TYPE!"
Current koan assert status is "(ERROR)"

You are now 145/183 koans and 21/27 lessons closer to reaching enlightenment

I have to do this

(assert-true (subtypep (type-of x) '(SIMPLE-ARRAY T (* 3 *))))

instead of this

(assert-true (subtypep x '(SIMPLE-ARRAY T (* 3 *))))

For the test working I have to add the function type-of, I'm not sure if it a part of the exercise or is for new sbcl implementation http://www.sbcl.org/manual/#Handling-of-Types

Thanks for this great way of learning lisp

What kind of value did you give to x? If it's a type specifier (like '(simple-array t (5 3 *))) it should work.