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

Seed UI #3006

Merged
merged 27 commits into from
Feb 7, 2024
Merged

Seed UI #3006

merged 27 commits into from
Feb 7, 2024

Conversation

OAGr
Copy link
Contributor

@OAGr OAGr commented Jan 27, 2024

No description provided.

Copy link

changeset-bot bot commented Jan 27, 2024

⚠️ No Changeset found

Latest commit: 7ae1e43

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Feb 7, 2024 1:15pm
squiggle-components ✅ Ready (Inspect) Visit Preview Feb 7, 2024 1:15pm
squiggle-website ✅ Ready (Inspect) Visit Preview Feb 7, 2024 1:15pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Feb 7, 2024 1:15pm

@@ -38,6 +38,7 @@ export abstract class SymbolicDist extends BaseDist {
// In this process we want the xyPointLength to be a bit longer than the eventual toSparkline downsampling. 3 is fairly arbitrarily.
xyPointLength: bucketCount * 3,
sampleCount: env.sampleCount,
seed: env.seed,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is awkward, because dist/* should never do anything with env.seed. Whenever dist/* functions need randomness, they take a separate explicit rng: PRNG.

So the only reason you have to pass the seed here is because Env type in dist/* and env in SqProject are the same type.

So it makes me want to... I'm not really sure, separate Env and DistEnv types, probably?

Fixing this now is not critical, and it's a bigger refactoring, but maybe it deserves a comment somewhere.

packages/squiggle-lang/__tests__/helpers/helpers.ts Outdated Show resolved Hide resolved
@@ -75,6 +81,7 @@ export const defaultPlaygroundSettings: PlaygroundSettings = {
environment: {
sampleCount: 1000,
xyPointLength: 1000,
seed: "default_seed",
Copy link
Collaborator

Choose a reason for hiding this comment

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

One reason why I think the playground (and also CLI) should start with a random seed: sometimes I want to use it as the source of randomness.

mx(List.upTo(1, 6)) -> sample now always produces the same output. I know I can re-roll, but that's an extra click.

This also gets in the way of building a calculator for generating random values; it's initial output would always be the same.

(by the lucky coincidence, it's always 4, as in xkcd/221)
(could be a nice way to cheat in board games or casual bets, btw, "ok, let's open squiggle playground and check...")

@@ -15,6 +15,8 @@ export type SquiggleEditorProps = {
defaultCode?: string;
onCodeChange?(code: string): void;
editorFontSize?: number;
seed?: string;
setSeed?(seed: string): void;
Copy link
Collaborator

Choose a reason for hiding this comment

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

These props are unused. Also, it's a problem that editors don't have re-rolls, e.g. in documentation we could have an example with randomness that would be hard to experiment with without random seeds.

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

Successfully merging this pull request may close these issues.

None yet

2 participants