brownplt / pyret-lang

The Pyret language.
Other
1.07k stars 109 forks source link

PAPL Chapter 8 #1219

Closed Kaykwanu closed 6 years ago

Kaykwanu commented 6 years ago

I am having issues getting past this chapter. Pyret keeps saying that "The identifier set-size is unbound:"

check: song-set3 = [set: lver, so, wnkkhs, so, so, lver, so] song-set is song-set3 set-size(song-set3) is 3 end

More so, I can't seem to run this:

fun an-elt(s :: Set): cases (Pick) set-pick(s): | pick-none => error("empty set") | pick-some(e, r) => e end end

Pyret also says "Pick" is not defined as a type and that both "set-pick" and "error" are unbound.

Is this a case of the intentional mistakes included in the book, as part of teaching style? I can't seem to figure it out. Please help.

Kaykwanu commented 6 years ago

chapter 8 papl

shriram commented 6 years ago

Thanks for the feedback. I'll think about how to improve this section, but for now, to help you make progress:

Hope this helps you make progress for now.

Kaykwanu commented 6 years ago

That was really quick. Thanks. But on correction,

include pick fun an-elt(s :: Set): cases (Pick) set-pick(s): | pick-none => raise("empty set") | pick-some(e, r) => e end end

Pyret says "set-pick" is undefined? I tried this though:

include pick fun an-elt(s :: Set): cases (Pick) s: | pick-none => raise("empty set") | pick-some(e, r) => e end end

Is that fine? Find attached.

On Tue, Oct 10, 2017 at 3:07 PM Shriram Krishnamurthi < notifications@github.com> wrote:

Thanks for the feedback. I'll think about how to improve this section, but for now, to help you make progress:

Hope this helps you make progress for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brownplt/pyret-lang/issues/1219#issuecomment-335484213, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDxe2WI75RVDuZc5TX_8dXaiD09XVszks5sq3oygaJpZM4Pz-XW .

sorawee commented 6 years ago

Use s.pick() instead of set-pick(s) :)

Kaykwanu commented 6 years ago

Really appreciate the prompt response. Thanks alot. On Tue, Oct 10, 2017 at 4:39 PM sorawee notifications@github.com wrote:

Use s.pick() instead of set-pick(s) :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brownplt/pyret-lang/issues/1219#issuecomment-335515175, or mute the thread https://github.com/notifications/unsubscribe-auth/AWDxe4bFwgYSBOBT6S1fp-RRzxxps5_Aks5sq4-7gaJpZM4Pz-XW .

blerner commented 6 years ago

Closing as resolved?