thomaswevans
2020-8-15 19:23:35

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?


soegaard2
2020-8-15 19:26:12

@thomaswevans I suspect you are using a different language than intended for that section.


thomaswevans
2020-8-15 19:27:37

I have checked — I am on ISL+.


soegaard2
2020-8-15 19:28:47

So which value do you get?


thomaswevans
2020-8-15 19:30:34

soegaard2
2020-8-15 19:33:14

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.


soegaard2
2020-8-15 19:34:01

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.


thomaswevans
2020-8-15 19:35:45

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.


soegaard2
2020-8-15 19:37:36

What happens if you use the template in figure 144 ?


soegaard2
2020-8-15 19:38:26

Do you have a direct link to the exercise - I may have looked at the old version of the book.


thomaswevans
2020-8-15 19:38:54

Huh, I get the error message when I use the final definition of project, in figure 146.



thomaswevans
2020-8-15 19:40:51

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 ’() ’()).


soegaard2
2020-8-15 19:40:51

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 .


thomaswevans
2020-8-15 19:44:04

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.


thomaswevans
2020-8-15 19:44:41

(Sorry, don’t know how to do per-word code formatting on Slack.)


soegaard2
2020-8-15 19:44:50

Sounds right.


soegaard2
2020-8-15 19:45:03

Use single quotes around a single word.


soegaard2
2020-8-15 19:45:20

Use triple quotes if you want to insert a snippet.


thomaswevans
2020-8-15 19:45:28

project


soegaard2
2020-8-15 19:45:42

Oh. I meant backticks. Sorry.


thomaswevans
2020-8-15 19:46:01

Thank you!


thomaswevans
2020-8-15 19:47:20

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?


soegaard2
2020-8-15 19:47:42

What does it say now?


thomaswevans
2020-8-15 19:48:13

Actual value etc (if I use the code given up to that point in the book).


soegaard2
2020-8-15 19:48:47

I don’t know whether the change is intended or not.