-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
In prelude/set.ptls both difference and intersection use a for comprehension on a set. Sadly, when I tried to use them, they crash :(
It can easily be "fixed" by calling toList on the set:
intersection(a, b) = toSet(interElems)
where interElems =
- for elem in a
+ for elem in toList(a)
when elem in b
yield elemI could make a PR with that change, but it looks less nice, and I'm assuming this is a regression (i.e. for on a Set worked at some point). A proper fix would be making for comprehensions on sets work.
If you point me to the right file(s) I could check if can fix this myself.
This is the error message I get:
-------------------------------------------------------------------------------
Type Error:
No built-in field '!getHead' for type 'PtlsSet'
-------------------------------------------------------------------------------
At (line 216 column 19) in '/Users/till/code/ptls/pointless/bin/../prelude/list.ptls'
else [func(head(list))] ++ map(func, tail(list))
^
At (line 5 column 14) in '/Users/till/code/ptls/pointless/bin/../prelude/list.ptls'
head(list) = list.!getHead
^
At (line 38 column 13) in '/Users/till/code/ptls/pointless/bin/../prelude/list.ptls'
else head(lists) ++ concat(tail(lists))
^
At (line 37 column 17) in '/Users/till/code/ptls/pointless/bin/../prelude/set.ptls'
for elem in a
^
At (line 43 column 26) in '/Users/till/code/ptls/pointless/bin/../prelude/list.ptls'
concatMap(func, lists) = lists |> map(func) |> concat
^
At (line 1 column 19) in '<repl>'
difference(digits,digits)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels