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

anonymous patterns + muting #1059

Merged
merged 1 commit into from
Apr 18, 2024
Merged

anonymous patterns + muting #1059

merged 1 commit into from
Apr 18, 2024

Conversation

felixroos
Copy link
Collaborator

@felixroos felixroos commented Apr 17, 2024

  1. adds the ability to create an anonymous patterns with a $: label
$: s("bd")
$: s("hh*4")

this is handy because you won't have to name your patterns. I found myself just keyboard mashing random characters in a live situation because i just needed a unique name quickly.

  1. adds the ability to mute a labeled pattern by adding a _ before or after:
p1_: s("bd")
$_: s("hh*4")

I've started out with just a prefix, but I've noticed that the click area of the first column in each line is half as big as the click aread of the other columns. Maybe just a suffix is enough..

credits to @geikha for the idea

@yaxu
Copy link
Member

yaxu commented Apr 17, 2024

Looks handy!

Would it be possible to allow any label to be used more than once like this?

@felixroos
Copy link
Collaborator Author

Looks handy!

Would it be possible to allow any label to be used more than once like this?

rn, labels overwrite each other (last one wins), which would be useful for block based evaluation in tidal style. The evaluate function of the repl already has a shouldHush flag, which currently always returns true, but maybe the editor will have a setting someday to evaluate only the block where the cursor is at..

Another alternative to block based evaluation would be to add an editor feature that mutes all labels with the same name on eval:

p1: s("bd")

_p1: s("bd(3,8)")

if we'd eval the second pattern, it could become:

_p1: s("bd")

p1: s("bd(3,8)")

this would have the same benefit of being able to switch between patterns quickly, but without hidden state. So it would mean that the state of the code reflects the state of evaluation, which is desirable imo

@felixroos felixroos merged commit f427b56 into main Apr 18, 2024
2 checks passed
@felixroos felixroos deleted the dollar-colon branch April 18, 2024 22:05
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.

2 participants