dawikur / lel Goto Github PK
View Code? Open in Web Editor NEW๐ค Lambda Expression Library
License: MIT License
๐ค Lambda Expression Library
License: MIT License
It looks like bug in VS. Apparently when deducing template parameters, when two packs resolves to the same one it crashes.
What with it?
auto foo = _x, _y;
This is failing
auto update = ++_x < ++_y;
int x = 2;
int y = 8;
update(x, y);
ASSERT_EQ(3, x);
ASSERT_EQ(9, y);
It looks like somewhere one additional copy is made
Allow curring, eg:
auto func3 = _1 + _2 + _3 + _4;
func3(1)(2)(3, 4);
This is an answer to how make IDT (ID type) parametric!
How to pass undefined number of arguments?
Add it?
Somethig like this:
auto call = (_x->*_y)._(_1);
call(&obj, &Obj::Method, arg);
One missing overload for placeholders is function call.
Currently operator()
invokes the lambda
_x(5); // returns 5
(_x+1)(5); // return 5
But, it might be useful to make lambda which will use operator()
inside, e.g.
auto call_with = _x(_y);
call_with(printf, "str");
But how to distinguish between placeholder and lambda?
For now there is no difference
_x <- lambda
_x + 1 <= lambda
It can be that
_x <- placeholder; operator() creates lambda
_x + 1 <- lambda, operator() invokes it
But what with
auto foo1 = _x;
auto foo2 = *_x;
It is lambda or placeholder?
void bar();
foo1(bar);
foo2(&bar);
Or maybe it can be distinguished on the base of class? bool
template parameter.
Use EBO to reduce size of lambdas.
E.g.:
sizeof(_x) == 1;
sizeof(_x + 1) == sizeof (1);
sizeof(_x + 1 < 5) == sizeof (1) + sizeof(5);
sizeof(_y < _x) == 1;
It breaks calls because how we do currying:
(_x ->* _y)._(_z);
translates to
(_x ->* _y)(_z);
and currying looks gives us
(&object -> *_y)(_z);
which is not working. We have to detect if currying is
happening and 'un-rebind' it to
(&object -> *_y)._(_z);
If something will not compile - it is just soo hard to see what is happening.
This has to be improved.
auto sign = match(_x)
, _x < 1 = -1
, _x == 0 = 0
, _x > 1 = 1
;
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.