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

Refactor if-chains, add to janet #338

Merged
merged 3 commits into from
Mar 1, 2024
Merged

Refactor if-chains, add to janet #338

merged 3 commits into from
Mar 1, 2024

Conversation

MichalMarsalek
Copy link
Collaborator

1 more point from #328

@MeWhenI
Copy link
Contributor

MeWhenI commented Dec 30, 2023

Janet could also use cond for implementing ConditionalOp, and I imagine some other langs might also be able to pull the IfChain logic over to conditionals.

@MichalMarsalek
Copy link
Collaborator Author

Ah, right. It might make sense to merge the two (If and ConditionalOp) completely, but for now, I just used the logic for ConditionalOp too.

@MeWhenI
Copy link
Contributor

MeWhenI commented Dec 31, 2023

Is there a plugin that currently exists to try inverting the condition and then swapping the alternate and consequent statements? Since if-chaining as I understand it only expands the alternate, this would be beneficial. Maybe thats for a separate issue though, PR otherwise looks good.

@MichalMarsalek
Copy link
Collaborator Author

Is there a plugin that currently exists to try inverting the condition and then swapping the alternate and consequent statements? Since if-chaining as I understand it only expands the alternate, this would be beneficial. Maybe thats for a separate issue though, PR otherwise looks good.

Such plugin should probably be added, but I wonder if there's ever a reason to nest the conditions in a "nonstandard" way in the Polygolf program?

@MeWhenI
Copy link
Contributor

MeWhenI commented Jan 4, 2024

What do you mean by "nonstandard" nesting?

@MichalMarsalek
Copy link
Collaborator Author

What do you mean by "nonstandard" nesting?

One that is not

if(cond){

}
else{
  if (cond){

  }
  else{
    if(cond){
    
    }
    else{
      
    }
  }
}

@MichalMarsalek MichalMarsalek merged commit 6218d2b into main Mar 1, 2024
1 check passed
@MichalMarsalek MichalMarsalek deleted the if-chains branch March 2, 2024 13:40
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