I ran this exactly same code several times (preceded by ./run racket):
#lang racket
(struct item (weight value) #:transparent)
(define (maximum-value maximum-weight items)
(for/fold ([maxval 0] #:result maxval) ([combo (in-combinations items)])
(values (if (<= (apply + (map item-weight combo)) maximum-weight)
(let ([curval (apply + (map item-value combo))])
(if (> curval maxval) curval maxval)) maxval))))
(display (format "max value: ~s" (maximum-value 10 (list (item 5 10) (item 4 40) (item 6 30) (item 4 50)))))
At first it produced the correct output (max value: 90) but afterwards it repeatedly said "Your racket(8.3.0) code ran without output".
Again, it was the EXACT same code.
Now, even even the following trivial code:
#lang racket
(display "hello")
...produces no output, only the messge "Your racket(8.3.0) code ran without output".
I ran this exactly same code several times (preceded by
./run racket):At first it produced the correct output (
max value: 90) but afterwards it repeatedly said"Your racket(8.3.0) code ran without output".Again, it was the EXACT same code.
Now, even even the following trivial code:
...produces no output, only the messge
"Your racket(8.3.0) code ran without output".