Newest at the top
2025-09-04 17:37:26 +0200 | <EvanR> | the danger of more letters, maybe more computation, otherwise just seems like style |
2025-09-04 17:37:26 +0200 | <bwe> | yes |
2025-09-04 17:36:44 +0200 | <EvanR> | instead of null? |
2025-09-04 17:36:32 +0200 | <bwe> | EvanR: what's the danger of S.size mySet == 0 ? |
2025-09-04 17:34:23 +0200 | <EvanR> | since Set is abstract |
2025-09-04 17:34:00 +0200 | <EvanR> | I conflated pattern matching with "covering views" for giggles, and changed the subject |
2025-09-04 17:33:11 +0200 | <mari51613> | __monty__: we are discussing how to keep set structures after pattern-matching |
2025-09-04 17:32:50 +0200 | <EvanR> | rather than a benefit xD |
2025-09-04 17:32:38 +0200 | <EvanR> | __monty__, if your algorithm works on any foldable, then you can't rely on any Set details whatsoever, so null would basically be your only option |
2025-09-04 17:32:20 +0200 | <tomsmeding> | in Set.fromList [1,2], apparently '1' is the root and '2' its right child; in Set.fromList [2,1], apparently '2' is the root |
2025-09-04 17:32:09 +0200 | <mari51613> | hm almost suited for recursion. Thanks tomsmeding |
2025-09-04 17:31:43 +0200 | <tomsmeding> | which element in the set is the root depends on exactly how the Set came to be |
2025-09-04 17:31:18 +0200 | <tomsmeding> | mari51613: what splitRoot does internally is give you three sets: the elements less than what happens to be the root of the tree, a singleton set containing the root, and the elements greater than the root |
2025-09-04 17:31:11 +0200 | <__monty__> | Isn't a bonus of null that it works for any Foldable? |
2025-09-04 17:30:29 +0200 | pavonia | (~user@user/siracusa) (Quit: Bye!) |
2025-09-04 17:30:21 +0200 | <int-e> | Also, if all you do with the result of `minView` is to check whether it's `Tip`, that *could* be constant time... bu of course the function is super strict so it isn't ;-) |
2025-09-04 17:30:20 +0200 | <mari51613> | huh the example by int-e above |
2025-09-04 17:30:01 +0200 | <tomsmeding> | mari51613: what do you get from splitRoot? |
2025-09-04 17:29:11 +0200 | <mari51613> | i am surprised a binary search tree could have an empty root while being nonempty |
2025-09-04 17:28:25 +0200 | <tomsmeding> | constructing the remainder of the set is just _more_ log(n) work |
2025-09-04 17:27:45 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 252 seconds) |
2025-09-04 17:27:25 +0200 | <tomsmeding> | a Set is a binary search tree, so minView and maxView have to do log(n) work to descend to the left-most, resp. right-most, leaf in the tree |
2025-09-04 17:23:07 +0200 | <EvanR> | don't look at the remainder |
2025-09-04 17:23:03 +0200 | <EvanR> | but you could avoid it through laziness |
2025-09-04 17:22:52 +0200 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-09-04 17:22:36 +0200 | <EvanR> | yes it has to do some work to give you the remainder set |
2025-09-04 17:22:15 +0200 | <mari51613> | hm but you said they are log(n) |
2025-09-04 17:22:15 +0200 | <EvanR> | or not |
2025-09-04 17:22:10 +0200 | <EvanR> | minView and maxView prove that the set is non-empty, if it is, and might be avoiding redundant work on your followup |
2025-09-04 17:21:49 +0200 | <mari51613> | min and maxView are cool, allow to recur on the rest of the set |
2025-09-04 17:20:54 +0200 | <ski> | using `null' is more direct (possibly also more efficient ?) than using `size' |
2025-09-04 17:20:21 +0200 | <EvanR> | it reads fine but seems like a roundabout way to do it |
2025-09-04 17:20:18 +0200 | <ski> | (in Mercury, matching on data constructor of a type with user-defined equality (aka quotient type) is (committed-choice) nondeterministic (executing gives you one of the possible choices, possibly also affected by optimizations). you have to use the `promise_equivalent_solutions' pragma, at the point where the choice of representation no longer affects your answers) |
2025-09-04 17:19:51 +0200 | rekahsoft | (~rekahsoft@174.95.4.83) (Remote host closed the connection) |
2025-09-04 17:19:41 +0200 | <bwe> | EvanR: | S.size mySet > 0 = -- is what I actually use now |
2025-09-04 17:19:24 +0200 | <EvanR> | but like "pattern matching" makes me think you do |
2025-09-04 17:17:53 +0200 | <EvanR> | yeah if you really don't care about the structure if non-empty, then an if statement over null |
2025-09-04 17:16:55 +0200 | <EvanR> | comparing a number to zero? o_O |
2025-09-04 17:16:37 +0200 | <EvanR> | makes more sense than toList |
2025-09-04 17:16:33 +0200 | <bwe> | I stick with | S.size mySet == 0 = -- guard style |
2025-09-04 17:16:26 +0200 | <EvanR> | if you don't care how the set gets split up the splitRoot works |
2025-09-04 17:16:14 +0200 | int-e | shrugs |
2025-09-04 17:16:12 +0200 | <int-e> | I'd use `null`. |
2025-09-04 17:15:40 +0200 | <EvanR> | yeah if your algorithm would be affected use maxView or minView |
2025-09-04 17:15:31 +0200 | <int-e> | splitRoot exposes the tree structure of the set's representation |
2025-09-04 17:15:14 +0200 | <int-e> | mari51613: sure, that's odd, but that's not the issue I'm after |
2025-09-04 17:14:57 +0200 | <mari51613> | i mean as the first return value |
2025-09-04 17:14:17 +0200 | <EvanR> | what |
2025-09-04 17:14:02 +0200 | <mari51613> | hm i see it returns an empty list for a non empty set |
2025-09-04 17:13:58 +0200 | chele | (~chele@user/chele) (Remote host closed the connection) |