string=???

7 views
Skip to first unread message

Libby Miles

unread,
May 20, 2019, 9:43:53 PM5/20/19
to Bootstrap-Teachers
My teaching partner and I have stared at this for an hour. What are we missing? I'm so desperate for an answer for my student in second period tomorrow. Thank you if you can help!!

(EXAMPLE (update-player 320 "up") (+ 320 20))
(EXAMPLE (update-player 100 "up") (+ 100 20))
(EXAMPLE (update-player 200 "down") (- 200 20))
(EXAMPLE (update-player 120 "down") (- 120 20))
(define (update-player y key)
(cond
[(string=? key "up") (+ y 20)]
[(string=? key "down") (- y 20)]
[else y]))

yields the error message
string=?: expects a string as 1st argument, but given: 1; other arguments were: "up"

Screen Shot 2019-05-20 at 9.27.06 PM.png
Screen Shot 2019-05-20 at 9.27.23 PM.png

Emmanuel Schanzer

unread,
May 20, 2019, 10:04:49 PM5/20/19
to Libby Miles, Bootstrap-Teachers
Hi Libby - I just copied and pasted your code into a blank WeScheme window, and I get no error message. I think the error you’re seeing is coming from elsewhere. Can you click “share”, and paste the link to the entire program here?

Sent from my iPhone. May appear unintentionally terse.
--
You received this message because you are subscribed to the Google Groups "Bootstrap-Teachers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bootstrap-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bootstrap-discuss/0acb8120-f67b-4c57-a0f1-fbd146dabd88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<Screen Shot 2019-05-20 at 9.27.06 PM.png>
<Screen Shot 2019-05-20 at 9.27.23 PM.png>

Libby Miles

unread,
May 20, 2019, 10:10:02 PM5/20/19
to Emmanuel Schanzer, Bootstrap-Teachers

Mark Engelberg

unread,
May 20, 2019, 10:45:15 PM5/20/19
to bootstra...@googlegroups.com
 [(string=? "key" "up") (+ y 20)]

The "key" shouldn't be in quotes.

Emmanuel Schanzer

unread,
May 20, 2019, 10:48:21 PM5/20/19
to Libby Miles, Bootstrap-Teachers
I’m still not seeing that error. (I’m seeing other errors, but not the one you’re posting about.)

Your update-player is definitely looking a little strange...id say keep working on it, and be sure to check out the examples that are failing. But there is no problem with string=? in this code.

Emmanuel Schanzer

unread,
May 20, 2019, 10:51:52 PM5/20/19
to bootstra...@googlegroups.com
Oh!! Great catch, Mike!!!

Yes - something has gotten messed up on line 177. Libby, your student has been messing with some of the provided code. :)

Update-player has been written twice. Can you see what your student changed? And what it should be?

Libby Miles

unread,
May 21, 2019, 7:07:57 AM5/21/19
to Emmanuel Schanzer, Bootstrap-Teachers
Emmanuel, I just tried the link I sent you and realized that, in that link, there were still quotations around "key" in the definition, which I erased. Then you get my error message. I don't know what you mean by keep working on it - I even copied and pasted update-player from another student's working game and got the same error message. I have checked all the code above and can't find the mistake and so has my colleague. Why are you saying that the code looks a little strange - was it just those quote marks? 

I can just tell the students to start over on a new game template if you think that will help, but I'm out of other ideas. 

Thanks a bunch

Emmanuel Schanzer

unread,
May 21, 2019, 7:11:47 AM5/21/19
to Libby Miles, Bootstrap-Teachers
Have you seen like 177? Your student has been messing around with some of the provided code. Compare that to another student’s program and you’ll see what I mean. :) 


Sent from my iPhone. May appear unintentionally terse.
Reply all
Reply to author
Forward
0 new messages