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

Filter is never reduced #706

Closed
imaqtkatt opened this issue Sep 5, 2024 · 1 comment · Fixed by #707
Closed

Filter is never reduced #706

imaqtkatt opened this issue Sep 5, 2024 · 1 comment · Fixed by #707
Assignees
Labels
bug Something isn't working

Comments

@imaqtkatt
Copy link
Contributor

Reproducing the behavior

type Bool:
  T
  F

def filter(f, ls):
  match ls:
    case List/Nil:
      return List/Nil
    case List/Cons:
      match f(ls.head):
        case Bool/T:
          return List/Cons(ls.head, filter(f, ls.tail))
        case Bool/F:
          return filter(f, ls.tail)

def main:
  return filter(lambda x: x, [Bool/T])

Result:

Result: λa (a filter__C4 λb λc [Bool/T])
- ITRS: 7
- TIME: 0.00s
- MIPS: 0.00

System Settings

bend-lang 0.2.37-alpha.1

Additional context

No response

@imaqtkatt imaqtkatt added the bug Something isn't working label Sep 5, 2024
@imaqtkatt imaqtkatt self-assigned this Sep 5, 2024
@developedby
Copy link
Member

filter(lambda x: x, [Bool/T]) is being parsed as (filter @x (x, [T])) and not as (filter @x x [T]).

, for tuples has the wrong precedence here.

@imaqtkatt imaqtkatt linked a pull request Sep 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants