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

Add ability to have "canned" Formula sequences. #430

Closed
gwhitney opened this issue Aug 28, 2024 · 4 comments
Closed

Add ability to have "canned" Formula sequences. #430

gwhitney opened this issue Aug 28, 2024 · 4 comments
Assignees
Labels
question Further information is requested sequence Related to a sequence or the sequence subsystem ui Something having to do with the user interface

Comments

@gwhitney
Copy link
Collaborator

This will be much like the specific OEIS sequence cards in the switcher. We should have the ability to have cards in the sequence switcher that correspond to pre-filled Formulas, as well as a "New Formula" one for entering an arbitrary formula. When this is implemented, the Naturals sequence should be dropped altogether, and one of the canned formulas should be formula n producing the naturals.

Some questions that need to be nailed down:

  1. Should we automagically save the last couple of sequences used?
  2. Should the site visitor have the ability to add new canned formulas, maybe (re)name them, etc? Like the saved specimens, but just formulas?
  3. Are there other canned formulas we want there by default, other than the natural numbers?
@gwhitney gwhitney added ui Something having to do with the user interface sequence Related to a sequence or the sequence subsystem labels Aug 28, 2024
@gwhitney gwhitney changed the title Add ability to have "canned" sequences. Add ability to have "canned" Formula sequences. Aug 28, 2024
@gwhitney gwhitney added the question Further information is requested label Aug 28, 2024
@gwhitney gwhitney added the meeting To be discussed at weekly meeting label Oct 13, 2024
@gwhitney
Copy link
Collaborator Author

Resolved on October 29 meeting:

The frontscope will keep a list of all sequences visited (since the last browser cache clear). The most recent N will be displayed visually in the sequence switcher (along with the mandatory "stock" ones, which I think should include a couple of OEIS and a couple of Formula and a Random). At the bottom of the switcher will be "History" dropdown, which will show all of the rest in a text-only format, but with hyperlinks to go back to them. There will still be a trashcan on the user ones, which will eliminate it from the visual list and relegate it only to the text History section.

Note that this feature will be uniform for all classes of Sequences. A Sequence is considered visited when (a) a new URL with it as the sequence specification is loaded, (b) a Specimen is saved with that Sequence, or (c) when it is the current sequence and a new URL is loaded with a different sequence. This eliminates saving all the little intermediate versions as you play with the parameters of a sequence or the details of a formula.

Remaining questions @katestange @Vectornaut:

  1. Any suggestions for the other "always there" Formula besides n (to show an example of how you can do something more complicated)? The Beatty sequence in Formula form??
  2. Should the start index/ end index/ length be considered part of the identity of the Sequence, so that you might have a couple of entries that are exactly the same sequence, just with different extents? Or should the start/end/length be stripped to avoid that redundancy? The latter would mean when you re-select a previous sequence from the history, it would go back to the default of the entire sequence. So if you had focused on a particular region of the sequence, say indices 8192 to 16383, that information would be lost. Is that an OK price to pay for avoiding cluttering up the history list with different sections of the VF numbers? I guess there is a third option: save the indices/length, but do not save additional new sequences in the history if they differ from one there only in the index information. Or a fourth option, which upon reflection is my favorite: Only one saved instance of a sequence, and the extents are saved, but if you would be saving another copy of the same sequence but with different extents, the saved extents are updated to the one you are now saving. That way you get all of the individual sequences you have visited, and for each you get the most recent index range you used it with.

Thanks for letting me know your thoughts.

@gwhitney gwhitney removed the meeting To be discussed at weekly meeting label Oct 30, 2024
@katestange
Copy link
Member

I like the beatty sequence formula! in your bullet 1.

I like the fourth option in your bullet 2.

@gwhitney
Copy link
Collaborator Author

OK, I will be getting to this soon after the docsite overhaul lands, so @Vectornaut if you would like to weigh in befoer then please do, or if either of you think this should wait until after our next in-person meeting please add the "meeting" label back. Otherwise the beatty sequence formula will become the other canned sequence and I will go with the "fourth option" on sequence identity, which is that the extents of a sequence are not considered part of sequence's identity, but the most recent ones used are saved.

@gwhitney gwhitney self-assigned this Nov 17, 2024
gwhitney added a commit to gwhitney/frontscope that referenced this issue Nov 19, 2024
  This partially resolves numberscope#430; the only portion remaining is to have a
  limit on the number of sequences that will show as thumbnails (the
  rest will show as a table or something like that).

  Also, testing for this commit revealed that the p5.brush addon does not work
  properly with multiple different sketches all updating asynchronously.
  Therefore, this commit removes p5.brush and provides a simple hatchRect()
  method in P5Visualizer (since hatching is all that p5.brush was being used
  for anyway).

  The current sequence is saved/updated in the list of remembered sequences
  when (a) the Scope view is first loaded; (b) the Scope view is closed;
  (c) a sequence or visualizer is selected in the SwitcherModal; or (d) the
  current specimen is saved to the Gallery.

  This commit removes the former list of OEIS IDs that was being saved in
  browser localStorage, as it is superseded by this sequence-saving feature.
  That removal means that the frontscope no longer (pre-)fetches a collection
  of OEIS sequences immediately on startup; they are loaded only as used.
gwhitney added a commit to gwhitney/frontscope that referenced this issue Nov 20, 2024
  This partially resolves numberscope#430; the only portion remaining is to have a
  limit on the number of sequences that will show as thumbnails (the
  rest will show as a table or something like that).

  Also, testing for this commit revealed that the p5.brush addon does not work
  properly with multiple different sketches all updating asynchronously.
  Therefore, this commit removes p5.brush and provides a simple hatchRect()
  method in P5Visualizer (since hatching is all that p5.brush was being used
  for anyway).

  The current sequence is saved/updated in the list of remembered sequences
  when (a) the Scope view is first loaded; (b) the Scope view is closed;
  (c) a sequence or visualizer is selected in the SwitcherModal; or (d) the
  current specimen is saved to the Gallery.

  This commit removes the former list of OEIS IDs that was being saved in
  browser localStorage, as it is superseded by this sequence-saving feature.
  That removal means that the frontscope no longer (pre-)fetches a collection
  of OEIS sequences immediately on startup; they are loaded only as used.
katestange pushed a commit that referenced this issue Nov 24, 2024
* feat: Save a history of any kind of Sequences (not just OEIS)

  This partially resolves #430; the only portion remaining is to have a
  limit on the number of sequences that will show as thumbnails (the
  rest will show as a table or something like that).

  Also, testing for this commit revealed that the p5.brush addon does not work
  properly with multiple different sketches all updating asynchronously.
  Therefore, this commit removes p5.brush and provides a simple hatchRect()
  method in P5Visualizer (since hatching is all that p5.brush was being used
  for anyway).

  The current sequence is saved/updated in the list of remembered sequences
  when (a) the Scope view is first loaded; (b) the Scope view is closed;
  (c) a sequence or visualizer is selected in the SwitcherModal; or (d) the
  current specimen is saved to the Gallery.

  This commit removes the former list of OEIS IDs that was being saved in
  browser localStorage, as it is superseded by this sequence-saving feature.
  That removal means that the frontscope no longer (pre-)fetches a collection
  of OEIS sequences immediately on startup; they are loaded only as used.

* fix: Improve circumstances under which sequence is saved to history
   Also save a sequence when the switcher is opened (so there is no
   need to save it when a new sequence is selected, since the switcher
   must have been opened in order for something else to be selected),
   and save the destination sequence any time a specimen card is
   selected.

   Also puts the mod information in the description of an OEIS sequence
   so that we don't end up with a bunch of identical-looking sequence
   cards.

* feat: Add a list view to SpecimensGallery

  Also adds a simple toggle switch component for selecting how a given
  SpecimensGallery should be displayed. Makes the title and subtitle
  properties for a specimen card mandatory (as they are displayed in the
  table view). Adds the visualizer as well as the sequence to the subtitle
  for featured and saved specimens so that the table view would be more
  informative (and the extra information also shows up in the thumbnails
  view. This commit significantly reorganizes the HTML/CSS of a
  SpecimensGallery component to accomodate the toggling between the two
  views (not to mention the non-scrolling control to do that toggling).
  All of the same abilities (select a specimen, delete a specimen, link
  to OEIS) are present in the table view as in the thumbnails view.
  Canonicalizes the query string of a couple of the featured items, to
  prevent them from apparently creating duplicate saved sequences.

* ui: several sequence history tweaks per discussion in #500
  1) Renames table view to list view.

  3) Remembers the last-used view in browser-local storage
  4) Keeps undeleteable 'Formula: n' and 'Random from 0 to 9' at
     the head of the history list. Thereafter entries are in most-
     recently-used order. History defaults to the Beatty-sequence
     formula, OEIS primes, and OEIS VF numbers.
  5) In the display toggle, both options are in numberscope grey,
     with the active one in the slightly heavier weight we use.
     The inactive one turns black on hover, indicating it can be
     clicked on. (As always, you can also click directly on the
     toggle switch.)

* feat: MathML display for Formula sequences
  Adds an `htmlName` property (defaulting to `name`) to a Paramable objects. The idea
  is that the user interface is supposed to use the htmlName where possible to display
  the name of an element. Implements `htmlName` for Formula sequences, to contain
  the MathML rendering of their `formula` parameter. Adds a `v-safe-html` directive
  to Vue to facilitate using this generated MathML. Displays the `htmlName` using
  the new directive in the ParamEditor, SpecimenCard titles, and in the columns of
  the list view in a SpecimensGallery.

  Also adds the ability to tailor the heading of the first column in the list view, so
  that it reads "Visualizer" in the visualizer switcher, etc.

* chore: dummy commit to grab CI snapshots

* chore: New CI snapshots to reflect mathml formulas

* ui: Try to improve switcher height calculation

* ui: Always title the permanent Formula card 'Formula'

* ui: Enable formula wrapping on chromium-based browsers

* ui: Actually make any sequence with no query have special title

* feat: Store preference for each gallery display style separately

* fix: Attempt to head off non-rendering thumbnails

* chore: fix comment typos
katestange pushed a commit to katestange/frontscope that referenced this issue Nov 24, 2024
…scope#500)

* feat: Save a history of any kind of Sequences (not just OEIS)

  This partially resolves numberscope#430; the only portion remaining is to have a
  limit on the number of sequences that will show as thumbnails (the
  rest will show as a table or something like that).

  Also, testing for this commit revealed that the p5.brush addon does not work
  properly with multiple different sketches all updating asynchronously.
  Therefore, this commit removes p5.brush and provides a simple hatchRect()
  method in P5Visualizer (since hatching is all that p5.brush was being used
  for anyway).

  The current sequence is saved/updated in the list of remembered sequences
  when (a) the Scope view is first loaded; (b) the Scope view is closed;
  (c) a sequence or visualizer is selected in the SwitcherModal; or (d) the
  current specimen is saved to the Gallery.

  This commit removes the former list of OEIS IDs that was being saved in
  browser localStorage, as it is superseded by this sequence-saving feature.
  That removal means that the frontscope no longer (pre-)fetches a collection
  of OEIS sequences immediately on startup; they are loaded only as used.

* fix: Improve circumstances under which sequence is saved to history
   Also save a sequence when the switcher is opened (so there is no
   need to save it when a new sequence is selected, since the switcher
   must have been opened in order for something else to be selected),
   and save the destination sequence any time a specimen card is
   selected.

   Also puts the mod information in the description of an OEIS sequence
   so that we don't end up with a bunch of identical-looking sequence
   cards.

* feat: Add a list view to SpecimensGallery

  Also adds a simple toggle switch component for selecting how a given
  SpecimensGallery should be displayed. Makes the title and subtitle
  properties for a specimen card mandatory (as they are displayed in the
  table view). Adds the visualizer as well as the sequence to the subtitle
  for featured and saved specimens so that the table view would be more
  informative (and the extra information also shows up in the thumbnails
  view. This commit significantly reorganizes the HTML/CSS of a
  SpecimensGallery component to accomodate the toggling between the two
  views (not to mention the non-scrolling control to do that toggling).
  All of the same abilities (select a specimen, delete a specimen, link
  to OEIS) are present in the table view as in the thumbnails view.
  Canonicalizes the query string of a couple of the featured items, to
  prevent them from apparently creating duplicate saved sequences.

* ui: several sequence history tweaks per discussion in numberscope#500
  1) Renames table view to list view.

  3) Remembers the last-used view in browser-local storage
  4) Keeps undeleteable 'Formula: n' and 'Random from 0 to 9' at
     the head of the history list. Thereafter entries are in most-
     recently-used order. History defaults to the Beatty-sequence
     formula, OEIS primes, and OEIS VF numbers.
  5) In the display toggle, both options are in numberscope grey,
     with the active one in the slightly heavier weight we use.
     The inactive one turns black on hover, indicating it can be
     clicked on. (As always, you can also click directly on the
     toggle switch.)

* feat: MathML display for Formula sequences
  Adds an `htmlName` property (defaulting to `name`) to a Paramable objects. The idea
  is that the user interface is supposed to use the htmlName where possible to display
  the name of an element. Implements `htmlName` for Formula sequences, to contain
  the MathML rendering of their `formula` parameter. Adds a `v-safe-html` directive
  to Vue to facilitate using this generated MathML. Displays the `htmlName` using
  the new directive in the ParamEditor, SpecimenCard titles, and in the columns of
  the list view in a SpecimensGallery.

  Also adds the ability to tailor the heading of the first column in the list view, so
  that it reads "Visualizer" in the visualizer switcher, etc.

* chore: dummy commit to grab CI snapshots

* chore: New CI snapshots to reflect mathml formulas

* ui: Try to improve switcher height calculation

* ui: Always title the permanent Formula card 'Formula'

* ui: Enable formula wrapping on chromium-based browsers

* ui: Actually make any sequence with no query have special title

* feat: Store preference for each gallery display style separately

* fix: Attempt to head off non-rendering thumbnails

* chore: fix comment typos
@gwhitney
Copy link
Collaborator Author

OK, in ui2 we have an arbitrary history of Sequences shown in the Sequence Switcher, thanks to #500. Closing.

gwhitney added a commit that referenced this issue Jan 20, 2025
* feat: Save a history of any kind of Sequences (not just OEIS)

  This partially resolves #430; the only portion remaining is to have a
  limit on the number of sequences that will show as thumbnails (the
  rest will show as a table or something like that).

  Also, testing for this commit revealed that the p5.brush addon does not work
  properly with multiple different sketches all updating asynchronously.
  Therefore, this commit removes p5.brush and provides a simple hatchRect()
  method in P5Visualizer (since hatching is all that p5.brush was being used
  for anyway).

  The current sequence is saved/updated in the list of remembered sequences
  when (a) the Scope view is first loaded; (b) the Scope view is closed;
  (c) a sequence or visualizer is selected in the SwitcherModal; or (d) the
  current specimen is saved to the Gallery.

  This commit removes the former list of OEIS IDs that was being saved in
  browser localStorage, as it is superseded by this sequence-saving feature.
  That removal means that the frontscope no longer (pre-)fetches a collection
  of OEIS sequences immediately on startup; they are loaded only as used.

* fix: Improve circumstances under which sequence is saved to history
   Also save a sequence when the switcher is opened (so there is no
   need to save it when a new sequence is selected, since the switcher
   must have been opened in order for something else to be selected),
   and save the destination sequence any time a specimen card is
   selected.

   Also puts the mod information in the description of an OEIS sequence
   so that we don't end up with a bunch of identical-looking sequence
   cards.

* feat: Add a list view to SpecimensGallery

  Also adds a simple toggle switch component for selecting how a given
  SpecimensGallery should be displayed. Makes the title and subtitle
  properties for a specimen card mandatory (as they are displayed in the
  table view). Adds the visualizer as well as the sequence to the subtitle
  for featured and saved specimens so that the table view would be more
  informative (and the extra information also shows up in the thumbnails
  view. This commit significantly reorganizes the HTML/CSS of a
  SpecimensGallery component to accomodate the toggling between the two
  views (not to mention the non-scrolling control to do that toggling).
  All of the same abilities (select a specimen, delete a specimen, link
  to OEIS) are present in the table view as in the thumbnails view.
  Canonicalizes the query string of a couple of the featured items, to
  prevent them from apparently creating duplicate saved sequences.

* ui: several sequence history tweaks per discussion in #500
  1) Renames table view to list view.

  3) Remembers the last-used view in browser-local storage
  4) Keeps undeleteable 'Formula: n' and 'Random from 0 to 9' at
     the head of the history list. Thereafter entries are in most-
     recently-used order. History defaults to the Beatty-sequence
     formula, OEIS primes, and OEIS VF numbers.
  5) In the display toggle, both options are in numberscope grey,
     with the active one in the slightly heavier weight we use.
     The inactive one turns black on hover, indicating it can be
     clicked on. (As always, you can also click directly on the
     toggle switch.)

* feat: MathML display for Formula sequences
  Adds an `htmlName` property (defaulting to `name`) to a Paramable objects. The idea
  is that the user interface is supposed to use the htmlName where possible to display
  the name of an element. Implements `htmlName` for Formula sequences, to contain
  the MathML rendering of their `formula` parameter. Adds a `v-safe-html` directive
  to Vue to facilitate using this generated MathML. Displays the `htmlName` using
  the new directive in the ParamEditor, SpecimenCard titles, and in the columns of
  the list view in a SpecimensGallery.

  Also adds the ability to tailor the heading of the first column in the list view, so
  that it reads "Visualizer" in the visualizer switcher, etc.

* chore: dummy commit to grab CI snapshots

* chore: New CI snapshots to reflect mathml formulas

* ui: Try to improve switcher height calculation

* ui: Always title the permanent Formula card 'Formula'

* ui: Enable formula wrapping on chromium-based browsers

* ui: Actually make any sequence with no query have special title

* feat: Store preference for each gallery display style separately

* fix: Attempt to head off non-rendering thumbnails

* chore: fix comment typos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested sequence Related to a sequence or the sequence subsystem ui Something having to do with the user interface
Projects
None yet
Development

No branches or pull requests

2 participants