In section 23.7, on implementing a database, it says that I should get an error message on running the first test in the attached pic — but in fact, with DrRacket 7.8, I have no trouble doing so and I get “Actual value … differs from …, the expected value.” How come?
@thomaswevans I suspect you are using a different language than intended for that section.
I have checked — I am on ISL+.
So which value do you get?
Okay. I see you have put in a temporary definition of project
. The value produces by your project
doesn’t return any functions, so check-expect
can compare the values without problems.
However when you replace project
with the one in the book, the returned value will contain functions, and then check-expect
can’t compare the values - and then you get the error.
Hm, I used the temporary definition of project given by the book at that point. And looking ahead, even the final definition returns the make-db constructor.
What happens if you use the template in figure 144 ?
Do you have a direct link to the exercise - I may have looked at the old version of the book.
Huh, I get the error message when I use the final definition of project, in figure 146.
So I get the error message when I use the version in figure 146 but not when I use the dummy version that returns (make-db ’() ’()).
In (define projected-schema
`(("Name" ,string?) ("Present" ,boolean?)))
the functions string?
and boolean?
are stored in the list. They are then used in projected-db
.
Okay, I get it: with the dummy version of project, it doesn’t get as far as comparing the content of projected-schema, because it comes up against the empty list, whereas with the final version, it tries to compare the string? in projected-db and the string? in school-db.
(Sorry, don’t know how to do per-word code formatting on Slack.)
Sounds right.
Use single quotes around a single word.
Use triple quotes if you want to insert a snippet.
project
Oh. I meant backticks. Sorry.
Thank you!
I suppose an older version of DrRacket used to signal the first argument of equality cannot be a function
error at that point, but the current version of check-expect
works differently?
What does it say now?
Actual value
etc (if I use the code given up to that point in the book).
I don’t know whether the change is intended or not.