Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

symbols to export for essentials2023 context #468

Open
12 tasks
schanzer opened this issue Apr 15, 2023 · 21 comments
Open
12 tasks

symbols to export for essentials2023 context #468

schanzer opened this issue Apr 15, 2023 · 21 comments

Comments

@schanzer
Copy link
Contributor

schanzer commented Apr 15, 2023

  • num-sqrt and sqrt
  • num-expt and expt
  • num-sqr and sqr
  • num-abs and abs
  • flip-vertical and reflect-x
  • flip-horizontal and reflect-y
  • scale and dilate
  • put-image and translate
  • num-cos and cos
  • num-sin and sin
  • num-tan and tan
  • num-random and random
@blerner
Copy link
Member

blerner commented Apr 15, 2023

Hmm, I really don't like the namespace inconsistency of removing the num- prefix, for things that go in the bog-standard-default namespace. That seems like a big regression to me, in terms of rationalizing the default imported names. I'd prefer if we had a bootstrap-essentials2023 context for things like this, plus the drop-down context chooser that we talked about elsewhere. @jpolitz or @shriram , what're your thoughts here?

@schanzer
Copy link
Contributor Author

to be clear - nobody is suggesting removing the old aliases.

I'm also happy to have a Bootstrap-specific context, but this opens up the "discover curated contexts UI" question

@blerner
Copy link
Member

blerner commented Apr 15, 2023

Right: adding new aliases while not removing old ones, and ad-hoc names without namespace-prefixes, just makes the global namespace issue worse.

Having short names for bootstrap is a worthwhile goal. Polluting the global namespace is an anti-goal...

@schanzer
Copy link
Contributor Author

@blerner OK, so you're ok with a curated dropdown of contexts in the "Choose Context" menu? Note that this is starting to replicate DrRacket's "Add teachpack" UI...

@blerner
Copy link
Member

blerner commented Apr 17, 2023

I'm more ok with that, yes. I'm also mulling the idea of allowing supplying the context as a URL parameter, so that teachers can create a short-URL that drops students right into the correct context.

@shriram
Copy link
Member

shriram commented Apr 18, 2023

Seems like I no longer need to weigh in? (-:

@jpolitz
Copy link
Member

jpolitz commented Apr 18, 2023

I'm fine with adding the listed names to the next essentials (and potentially to image) alongside the existing names.

I also really like the idea of the dropdown/URL infrastructure for contexts.

But the names suggested here (as motivated by Bootstrap) are a reasonable proxy for “stuff first-time programmers could probably use”. Putting it in essentials-202X only breaks e.g. tutorials that tell someone to type into an empty buffer.

There is one other interface suggestion worth making here. @schanzer points out that one reason to want them in essentials is that teachers will go to code.pyret.org and click the "Start Coding" button. Other tools, when you click the corresponding button, have a modal that shows up the first time for “what kind of project are you starting”. That could be the right place to make that selection.

@schanzer
Copy link
Contributor Author

I would love a "what kind of project are you starting?" UI. That puts this all front-and-center.

@retabak
Copy link

retabak commented Dec 20, 2023

how about num-expt and expt?

is there a place for negate (which we use in early math)?

@schanzer
Copy link
Contributor Author

@retabak good call on num-expt. added

negate does not already exist in Pyret. This issue is about providing alternative symbols for ones that already exist

jpolitz added a commit that referenced this issue Jan 9, 2024
essentials2024 is just an updated name for essentials2021

starter is the new name (we can bikeshed) for default for new programs.

Addresses #468 (#468)
@jpolitz
Copy link
Member

jpolitz commented Jan 9, 2024

@schanzer are pi/e part of this? Can easily add to starter2024. Didn't see them in the top list, didn't know if that was the canonical list.

@schanzer
Copy link
Contributor Author

schanzer commented Jan 9, 2024

@jpolitz yep! the corresponding issue in pyret-lang can probably be closed once you add these

@schanzer
Copy link
Contributor Author

@jpolitz just added the basic trig functions to the list. Hopefully these are easy to add.

@jpolitz
Copy link
Member

jpolitz commented Jan 18, 2024

@schanzer a request that may seem a little silly but would help me a lot – could you write a short check/examples block that uses all the identifiers you want included on trivial inputs? That will be the spec for what ought to work. Something like:

sqrt = ...
expt = ...
check:
  sqrt(1) is 1
  expt(2, 3) is 8
  ...
end

and so on. This would help me rule out typos and also be a useful agreement on what this is accomplishing. Share link to CPO or just paste it here.

@schanzer
Copy link
Contributor Author

@jpolitz here you go!

I was surprised to find that random already exists without the num- prefix!

@schanzer
Copy link
Contributor Author

@jpolitz not sure if this is related to the constants context, but it would be pretty great to have these symbols available by default as well

@jpolitz
Copy link
Member

jpolitz commented Jan 24, 2024

(Think I have this, just confirming) should PI and E be in this file, too? That is, I'm going to include this as part of the spec, too:

import constants as C

E = C.E
shadow PI = C.PI

check:
...
  cos(PI) is-roughly ~-1
  sin(PI / 2) is-roughly ~1
  num-exp(1) is-roughly E
end

@schanzer
Copy link
Contributor Author

Yes - and IIRC, Shriram wanted both the upper- and lower-case versions of both.

@blerner
Copy link
Member

blerner commented Jan 24, 2024

Is there any reason you needed to shadow PI? Pretty sure the definition comes from constants anyway, so you should be able to just include constants or import constants as C / provide from C: * end

@jpolitz
Copy link
Member

jpolitz commented Jan 24, 2024

Right, but PI is provided by essentials2021 and E is not, and to keep the spec runnable that's needed.

The other spec is that all the imports + definitions should go away and the check block should still succeed if the context is starter2024!

@jpolitz
Copy link
Member

jpolitz commented Jan 24, 2024

And for the default namespace we don't want e and pi because that will be really annoying w/shadowing of e.

Both of your comments help clarify that my goal is the starter2024 namespace spec, not necessarily just the constants change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants