Skip to content

Substitution model visualizer #803

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

Merged
merged 45 commits into from
Aug 21, 2019
Merged

Substitution model visualizer #803

merged 45 commits into from
Aug 21, 2019

Conversation

LeowWB
Copy link
Contributor

@LeowWB LeowWB commented Aug 2, 2019

No description provided.

LeowWB added 6 commits August 2, 2019 12:22
Modify class definitions, instantiations to incorporate SUBST button

Remove SUBST button from controlbar

Create SubstTimeline and SubstVisualizer

Add a SUBST tab to the sidebar

Fix problem with range input not sliding in SUBST visualizer tab

22 march 2019

Remove compile error; confirm can generate code from tree and display

Add functionality to handle slider change

Add SUBST visualizer functionality to maximum extent permissable by current state of SUBST substitutor

Remove excess code and comments left over from testing

Add functionality for SUBST to return the actual correct output in the repl output display

Remove redundant code

Add code to make SUBST slider default to max value

Change SUBST display to automatically update to match slider default value

Add buttons to SUBST timeline to allow for fine-grained control over stepping through substitution

Add checks to disable SUBST timeline control buttons when appropriate

"When appropriate" -> for example, all buttons are disabled when the program has not yet been run, and hence there is nothing to step through; button to go to previous step is disabled when already at first step.

Add code such that SUBST interpreter is only used when the SUBST tab of the sidebar is open

Add keyboard controls to SUBST timeline buttons

Add code to transfer default focus to SUBST slider after program evaluation

Override default behavior of HTML input slider for SUBST

Rationale: default HTML input slider binds up and down to increase and decrease, respectively. This runs counter to the intuition provided by course textbook.

Make SUBST slider inline

Make SUBST slider inline (via sass)
@coveralls
Copy link

coveralls commented Aug 2, 2019

Pull Request Test Coverage Report for Build 3183

  • 42 of 92 (45.65%) changed or added relevant lines in 11 files are covered.
  • 2 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.07%) to 36.906%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/components/workspace/Repl.tsx 6 7 85.71%
src/containers/PlaygroundContainer.ts 0 1 0.0%
src/components/workspace/index.tsx 0 3 0.0%
src/sagas/workspaces.ts 5 9 55.56%
src/components/workspace/side-content/SubstVisualizer.tsx 9 24 37.5%
src/components/Playground.tsx 14 40 35.0%
Files with Coverage Reduction New Missed Lines %
src/components/Playground.tsx 1 50.0%
src/components/workspace/index.tsx 1 15.07%
Totals Coverage Status
Change from base Build 3176: -0.07%
Covered Lines: 2671
Relevant Lines: 6485

💛 - Coveralls

LeowWB and others added 8 commits August 2, 2019 20:06
* SubstVisualizer and SubstTimeline merged into one component

* Tooltip changed to 'Substituter'

* Use Blueprint Slider instead of HTML ones

* REPL now checks Redux state to evaluate results for Subst

* New actions set up to update Redux state

* Minor CSS style changes

* Changed use of 'bp3' literals to constants

* Updated tests
@geshuming
Copy link
Contributor

Please don't commit package-lock here. Delete the changes on package-lock, and run npm ci to ensure you only install the dependencies on the package lock.

alcen added 9 commits August 6, 2019 15:50
* CSS changes for code display style
* Implemented use of breakpoints to activate SUBST

* SUBST now only enabled for Chapter 1 and 2

* Hide REPL, disable resizing on SUBST tab

* Minor style changes for SUBST tab, slider

* Fix bug where SUBST would be active outside Playground

* Implemented blinking style for SUBST tab

* Updated snapshots
* Fix for code text being justified in SUBST

* SUBST tab now scrolls properly on Chrome

* Added vendor prefixes for SUBST CSS

* Change occurences of 'code' => 'your program'

* Updated snapshots
@geshuming
Copy link
Contributor

geshuming commented Aug 8, 2019

Please fix the tests. Make sure travis pass, do not push changes with --no-verify flag @alcen

@geshuming
Copy link
Contributor

If possible, rebase the PR so we only see required changes

@alcen
Copy link
Contributor

alcen commented Aug 8, 2019

Please fix the tests. Make sure travis pass, do not push changes with --no-verify flag @alcen

Don't worry, I am not using --no-verify to push. Travis fails because this branch does not work with the current js-slang.

This change here will need to be put in --> source-academy/js-slang#320

@geshuming
Copy link
Contributor

Then we'll wait until we get js-slang updated

@geshuming
Copy link
Contributor

Can I get some screenshots in the meantime?

@alcen
Copy link
Contributor

alcen commented Aug 11, 2019

Can I get some screenshots in the meantime?

No problem. Here they are:
 

Default text of the Substituter tab
 
Substituter can be run by being on the Substituter tab, using Source §2 and below, and hitting "Run"
 

It can also be activated by setting breakpoints on Source §2 and below. Ideally the program would run until the breakpoint is reached, however the position of the breakpoint currently has no consequence because the functionality is not yet implemented in js-slang.
 
 
EDIT: I have updated the screenshots. The previous ones were a little outdated

@martin-henz
Copy link
Member

martin-henz commented Aug 11, 2019

Can I get some screenshots in the meantime?

No problem. Here they are:
 
Default text of the Substituter tab
 
photo6222269970012809593Substituter can be run by being on the Substituter tab, using Source §2 and below, and hitting "Run"
 
It can also be activated by setting breakpoints on Source §2 and below. Ideally the program would run until the breakpoint is reached, however the position of the breakpoint currently has no consequence because the functionality is not yet implemented in js-slang.

expmod is quite a nasty example. These expression blocks will not appear if we only write functions whose body starts with "return".

Having said that: the substituter covers all of Source §2, and the handling of applications of functions whose body does not start with "return" is quite straightforward and I hope won't cause issues with the students.

@martin-henz martin-henz self-requested a review August 11, 2019 09:05
Copy link
Contributor

@alcen alcen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Member

@martin-henz martin-henz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@martin-henz martin-henz merged commit 156a2d3 into master Aug 21, 2019
@alcen alcen deleted the leow-subst branch August 21, 2019 00:19
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

Successfully merging this pull request may close these issues.

5 participants