Skip to content

Filter with any function returning invalid #429

@aripiprazole

Description

@aripiprazole

Reproducing the behavior

(any f xs) = match (filter f xs) {
  List/Nil: 0
  List/Cons: 1
}
(filter f List/Nil) = List/Nil
(filter f (List/Cons x xs)) = switch (f x) {
  0: (filter f xs)
  _: (List/Cons x (filter f xs))
}
s = @xs (any @x 0 xs)
main = (filter s [[1, 2]])

the code that generates

@List/Cons = (a (b ((@List/Cons/tag (a (b c))) c)))

@List/Cons/tag = 1

@List/Nil = ((@List/Nil/tag a) a)

@List/Nil/tag = 0

@any = (a (b c))
  & @filter ~ (a (b (@any__C0 c)))

@any__C0 = (?((0 (* (* (* 1)))) a) a)

@filter = (a ((@filter__C3 (a b)) b))

@filter__C0 = (a (* (b c)))
  & @filter ~ (a (b c))

@filter__C1 = (* (b (a (c e))))
  & @List/Cons ~ (a (d e))
  & @filter ~ (b (c d))

@filter__C2 = (* ({a c} (d ({(a ?((@filter__C0 @filter__C1) (b (c (d e))))) b} e))))

@filter__C3 = (?(((* @List/Nil) @filter__C2) a) a)

@main = d
  & @filter ~ (@s (c d))
  & @List/Cons ~ (b (@List/Nil c))
  & @List/Cons ~ (1 (a b))
  & @List/Cons ~ (2 (@List/Nil a))

@s = (a b)
  & @any ~ ((* 0) (a b))

is returning just:

image

System Settings

Example:

  • OS: Mac OS
  • CPU: M3 Pro
  • GPU: n/a
  • Cuda Version: n/a

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions