Comments (6)
That is what commit rakudo/rakudo@d0ec99a861 fixed: rakudo HEAD now says:
$ raku -e 'say --«<a b c d c d>.BagHash'
BagHash(c d)
as expected.
from problem-solving.
Related: rakudo/rakudo@d0ec99a861
from problem-solving.
OK, I understand that it's about the difference between post and pre-decrement.
Obviously (now :-) ) post-decrement returns the original value, then decrements the content of the variable. The pre-decrement does it in the opposite order.
So
$ raku -e 'say [1,2,3,4,5]»--'
[1 2 3 4 5]
while
raku -e 'say --«[1,2,3,4,5]'
[0 1 2 3 4]
Yet doing the same on a BagHash still returns strange results using the stock Rakudo v2022.07:
$ raku -e 'say --«<a b c d c d>.BagHash'
BagHash(d)
$ raku -e 'say --«<a b c d c d>.BagHash'
BagHash(c)
$ raku -e 'say --«<a b c d c d>.BagHash'
BagHash(c d)
(Those are really three successive tests on my computer :-o )
from problem-solving.
Quoting from https://docs.raku.org/language/operators#index-entry-hyper_%3C%3C-hyper_%3E%3E-hyper_%C2%AB-hyper_%C2%BB-Hyper_operators:
Hyper operators can work with hashes. The pointy direction indicates if missing keys are to be ignored in the resulting hash. The enclosed operator operates on all values that have keys in both hashes.
I think it makes sense that >>. behaves similarly, operating on the values of the Associative data types. I'm not sure if the issue was concerned with this approach but maybe it's good to point out that this seems to derived from related documented behavior.
There are still problems with the semantics/documentation of hyper operators, I wanted to open an issue for that, getting into it now.
EDIT: #346 is ready now.
from problem-solving.
Quoting from [doc]:
The pointy direction indicates if missing keys are to be ignored in the resulting hash. The enclosed operator operates on all values that have keys in both hashes.
Aiui that doc is about binary op hypers ("both hashes", i.e. "missing keys" is about one hash having a key and the other not and so the direction controls whether the mismatch means that element is dropped or not), not unary ops like this issue. I'm not seeing a connection.
from problem-solving.
I am making the connection by saying:
I think it makes sense that >>. behaves similarly, operating on the values of the Associative data types.
Since it seemed the "operating on the values" part may not be written down for the >>. call.
from problem-solving.
Related Issues (20)
- TAP refers to Perl 6 HOT 2
- LEAVE phaser with return HOT 46
- Metamodel concurrency problems HOT 17
- Named arguments don't respect canonical `key => value` convention (specific example of `mm-dd-yyyy` routine) HOT 15
- Add `.bufs`/`.blobs` methods to `IO::Path` / `IO::Handle` HOT 6
- `when` doesn't support smartmatching against a pointy block HOT 8
- Code highlighting / inspection / IDE tooling HOT 6
- Using multiple named arguments gives different result than just supplying value alone; specific example of `splice`. HOT 22
- Will we ever need more than 64K unique strings at compile time? HOT 4
- Add "short-index" version of often occurring ops HOT 1
- Behavior of type-constrained parameters is surprising given other behavior HOT 65
- Add `nomark` for striping accents, `samemark` is counterintuitive and slow for that purpose. HOT 3
- Root(s) - missing prefix operators HOT 1
- Enabling `no strict` for `raku` one-liners (and perhaps REPL) HOT 8
- Should `.flatmap` be really DEPRECATED or not? HOT 5
- Feature Request - method ```.hammer``` HOT 19
- Hash slices should have an option to return a hash HOT 17
- Feature Request: recognize "doubled" Unicode characters in Raku ternary operator (question mark and exclamation point). HOT 6
- DivideByZero exception has conflicting attributes HOT 5
- X::Numeric::CannotConvert vs. X::Numeric::Real
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from problem-solving.