Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)AP
Posts
1
Comments
2
Joined
2 mo. ago
  • I appreciate the effort! Further to this, I seems like if I change my function and the expected result to compare lists instead of 'make-ta' they pass!

     undefined
        
    (check-expect (sub-slot 1 SOBA) (make-ta "Soba" 1 (list 3))) ; subtract one shift <--- FAIL
    (check-expect (sub-slot 3 SOBA) (make-ta "Soba" 1 (list 1))) ; subtract a different shift <--- FAIL
    
    (define (sub-slot slot ta)
      (cond [(and (> (ta-max ta) 0) (> (length (ta-avail ta)) 1))
                  (make-ta (ta-name ta) 
                           (sub1 (ta-max ta))
                           (remq slot (ta-avail ta)))]
                  [else empty]))
    
      
     undefined
        
    (check-expect (sub-slot 1 SOBA) (make-ta "Soba" 1 (list 3))) ; subtract one shift <--- FAIL
    (check-expect (sub-slot 3 SOBA) (list "Soba" 1 (list 1))) ; subtract a different shift <--- PASS
    
    (define (sub-slot slot ta)
      (cond [(and (> (ta-max ta) 0) (> (length (ta-avail ta)) 1))
                  (list (ta-name ta) 
                           (sub1 (ta-max ta))
                           (remq slot (ta-avail ta)))]
                  [else empty]))
    
      

    This is the final problem of the course 😅. I'm going to try and get to the bottom of this rather than work around with lists (which is what I did last time). I must have some misunderstanding with make- functions...

  • Learn Programming @programming.dev
    appleberry @aussie.zone

    Why are "make-" expressions truncated in DrRacket test results and failing?

    How can I compare truncated test results in DrRacket?

    Actual value (make-ta ...) differs from (make-ta ...), the expected value.