Comments (8)
It works like a charm, thank you.
the negative side of
op: fn(it)
is that you cannot name arguments likemap((x, y) => x+y)
Yes, I found that out when I first started using iterrr
but being able to pick one style or the other depending on what fits the situation is still great despite having to give up renaming args.
from iterrr.
hey, I thought it was not very useful to write iterrr
everywhere, so I removed it.
back then this style was possible:
(3..6).iterrr:
filter(it > 3)
map(n => n - 2)
each(n):
acc.add n
do think it worth to bring it back?
Another style that I can think of is:
|>(3..6):
filter(it > 3)
map(n => n - 2)
sum()
from iterrr.
here you go:
https://github.com/hamidb80/iterrr/#iterrr-macro
from iterrr.
Hi!
My reasons for preferring iterrr
to |>
are:
- I try to avoid operators that are not well known. Seeing
.iterrr
makes it (much?) easier for people not familiar with theiterrr
library to know that it must be something imported from theiterrr
module. If I saw|>
and didn't know aboutiterrr
it would slow down my parsing of the code I am reading. - I liked I could to break up the a "transform pipeline" into indented lines like
op: details
. I found it compact and more readable compared to the parenthesised version.op(details)
from iterrr.
here you go: https://github.com/hamidb80/iterrr/#iterrr-macro
Thank you! I will check it out ASAP
from iterrr.
2. I liked I could to break up the a "transform pipeline" into indented lines like
op: details
. I found it compact and more readable compared to the parenthesised version.op(details)
the negative side of op: fn(it)
is that you cannot name arguments like map((x, y) => x+y)
from iterrr.
It works like a charm, thank you.
the negative side of
op: fn(it)
is that you cannot name arguments likemap((x, y) => x+y)
Yes, I found that out when I first started using
iterrr
but being able to pick one style or the other depending on what fits the situation is still great despite having to give up renaming args.
hey, just checked out that you can ignore pars in iterrr
macro version, likeL
import iterrr
let points = @[(1, 2), (-3, 4), (12, 3), (-1, -6), (5, -9)]
points.items.iterrr:
map (x, y) => x
filter it > 0
each n:
echo n
that's pretty neat in my opinion.
from iterrr.
that's pretty neat in my opinion.
Indeed! Thank you for documenting this. FYI I have added support for nestable .iterrr:
calls on a my fork's dev branch and I am looking to see if it's possible to add support for naming args like this map: (x, y) => x+y
. See https://github.com/dxxb/iterrr/commits/dev and dxxb@0a6d444
from iterrr.
Related Issues (20)
- Add inplace reducer
- Optimize `replacedIdent`
- add support for more syntax flexibility HOT 2
- Add non operator version
- Add `ifor`
- replace `><` with `|>`
- add another syntax for custom idents
- custom adapter HOT 11
- Add doc for adapters
- problem with nested calls HOT 1
- nested call variable shadowing HOT 3
- `acc` name collision
- make it simple, make it usable
- remove unncessary `untyped` from template args in generated code
- Replace `with` by `inject`
- add `define` HOT 1
- nested problems HOT 3
- add custom reducer
- Add `isum`
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 iterrr.