Skip to content

Weird duplicate execution in case #103

@ngeiswei

Description

@ngeiswei

What is your problem?

Combining case with Empty evaluates twice the non empty branch.

How to reproduce your problem?

Run the following code with PeTTa:

!(case 42
   ((42 (trace! Here 42))
    (Empty (trace! There 0))))

What would normally expect?

Here
42

What do you get instead?

Here
Here
42

What else do you have say?

Taking the empty branch by running the following

!(case (empty)
   ((42 (trace! Here 42))
    (Empty (trace! There 0))))

works as expected.

Also, when replacing the Empty case by NotEmpty

!(case 42
   ((42 (trace! Here 42))
    (NotEmpty (trace! There 0))))

it also works as expected (i.e. (trace! Here 42) is only taken once).

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions