5 ms·
Where are they, "exposed". The post just says the values are always true and that you don't really need to care about them.
by justinator 10y ago
Where are they, "exposed". The post just says the values are always true and that you don't really need to care about them.
- throwanem 10y agoFrom the post: > Set types always have True as values, and since we don’t care about iterating over Pair objects in our loop, we use the keys [function] to get just the keys of the set: the email addresses. The impression I took away from that was that you needed to make sure to pass keys(@set) rather than just @set in the operator, or else you'd get weirdness in the result. Having just installed Rakudo and fired up a REPL to find out for myself what'd happen, I find: - that my understanding from the post was erroneous - that there's some kind of weird set/string coercion going on that isn't replicable in the terms the REPL uses to describe it - that the given examples do not reliably generalize - that nothing which seems to make sense actually works - that nothing which seems to work actually makes sense - that I'm now bleeding slightly from both caruncles. Having not closely followed the Perl 6 development process, I am very glad to see it has taken on board the frequently uttered and extremely well justified criticism of Perl 5 that it's not consistent enough, and that there are so many syntactic and semantic special cases that no one who doesn't heavily specialize in the language can use it very reliably.
- ab5tract 10y agoWhat are your expectations for reliable generalization? What were you expecting to work, in what way, that didn't work as you expected?
- throwanem 10y agoThe Rakudo REPL apparently doesn't save history outside a session by default, so I don't have the exact details of what I was trying to do. In attempting to recreate it, though, I did manage to discover that Perl 6 "sets" appear simply to be syntactic sugar around strings split on whitespace, except when they're not, sometimes. That's not necessarily a bad thing, but why call it a type? What is it actually giving me that I can't get without having to bind and learn to use a whole new keymap full of exciting Unicode characters that I'm not a mathematician and therefore will also need to learn to identify on sight?
- ab5tract 10y agoI've never used a Unicode operators myself and there are no requirements to use Unicode characters. Every Unicode operator has a "Texas" counterpart in 100% ASCII. This was mentioned in the OP. I think you are mistaking `<a b c d>` with a `Set`. `< >` is a shorthand for "give me a `List` of these words" (or in this case, characters). `<a b c d>.Set` would coerce you a `Set` from that list. The set operators coerce by default, so you can pass it a list of words without requiring you to coerce it yourself beforehand.
- throwanem 10y agoYeah, I cottoned to that eventually - it's short(er)-hand for Perl 5's qw() construct. I guess Set is a method (coercer!) of...lists? List-shaped things? Sets seem list-shaped, although indexing doesn't work by any syntax I could find, and certainly not by any that an @ sigil should suggest. Can I call Set on a set? Does it do something weird if I do? And if I'm going to deal with this kind of high weirdness, why not just bite the bullet and go with Haskell or even Urbit? This just feels like it's trying to out-Ruby Ruby, and Ruby is Ruby enough already. The OP had some snark to offer on the subject of "Texas" operators, and the documentation lists them by their Unicode glyphs. That they work I get. But I think it's reasonable to gather a sense of second-class citizenship from their presentation.
- kbp 10y agoWhat "high weirdness"? Sets in most languages that have them do not support indexing, because they're usually understood to be unordered. Aside from that, there is a method to convert a list to a set. What are you confused about?
- hsitz 10y agoYes, in mathematics sets are by definition unordered, so it would be strange to have a language that supported indexing of a set.
- deleted 10y ago[deleted]
- hsitz 10y agoI'm curious, did you read any documentation on sets and bags before experimenting, e.g., https://docs.perl6.org/language/setbagmix https://docs.perl6.org/language/setbagmix Are things not working as described by that documentation?
- throwanem 10y agoI didn't know that the Advent calendar post I read had a prerequisite! That would've been a useful thing for someone to have mentioned. Having read that documentation, I don't believe I saw anything inconsistent with it. I also really don't see what I'm getting here that I can't have in any language with basic collection types, and this is the only language I've ever run across that really wants me to buy new keycaps, which seems like a rather bold UI design choice.
- FreezerburnV 10y agoWhile it might feel like the fancy unicode operators are encouraged in documentation or posts about Perl6, every fancy unicode has a corresponding operator in simple ASCII. The operator in question earlier in this thread '∈' is the same as using '(elem)' (including the parens). So '42 (elem) (12 42 56)' is the same as '42 ∈ (12 42 56)'. No need for new keycaps :)
- labster 10y agoWell yeah, but who doesn't want to be rocking a space-cadet MacBook?
- throwanem 10y agoIt's not that I can't extend Emacs to support typing those glyphs, or that I can't learn to type them without seeing the actual symbols on my keys. It's that I do not understand what justifies all this mental effort, when any language gives me the same capabilities in a fashion that, while slightly more verbose, is much easier actually to use. The ability to perform native operations on collections is really nice, I agree. But Perl 6 isn't the only language that has it, either. From what I've seen today, it looks like Haskell without the rigor. Maybe that makes it easier to approach, but Perl 5 has long since taught me to mistrust such appealing shortcuts for the long-term cost they impose.