Comments (3)
I'm not sure what problem this is meant to solve, could you come up with a better example?
from mond.
As I mentioned above, it's more niche than problem-solver. Closer to syntax sugar than anything else, mainly allowing an anonymous function or lambda to be separated from the argument list of a function call, which would be most useful for array prototype functions like map
, filter
, and reduce
, which take a callback as their only argument and apply it to each element of the sequence.
Another example could be a slightly more complex filtering algorithm to collect a list of file names.
// List all .cs files in the current directory
// that don't contain pre-processor directives
var files = Directory.getFiles( "./*.cs" ).filter() <|
fun( name ) {
var lines = File.readAllText( name ) // Read file contents into memory
.split( "\n" ) // Split on LF
.map( line -> line.trim() ); // Map each line through a lambda
// that trims all whitespace off both ends
foreach( var line in lines ) { // Iterate the sanitized lines
if( line.startsWith( "#" ) )
return false; // Reject the file if any of the lines start with '#'
}
return true; // Otherwise accept the file.
};
from mond.
I'm still not sure about it. The only advantage I see from this is the function call's closing parenthesis can stay with the call. I don't think it's very useful to chain <|
either.
If there was a better example for this I'd be up for it, but right now it looks like it only lets you type a bit more to keep the closing parenthesis with the call.
from mond.
Related Issues (20)
- Custom lib does not work HOT 4
- Override console output to simple string variable HOT 2
- Switch to using uniform function call syntax
- Defer clearing the stack until returning from a function HOT 1
- Redesign the VM bytecode format HOT 1
- How can I get all global variables? HOT 1
- How to add list / array to mondState? HOT 2
- Friendly MondValue builder methods
- How debugger work? HOT 3
- Visual Studio Code extension
- Language support for Interpolated Strings HOT 2
- Implement binding via source generators and remove the current method HOT 1
- Step over does not work correctly for metamethods
- Stack trace does not show metamethods properly
- Help with MondModuleBinder? HOT 1
- Comment on the last line of a script causes an Expression error HOT 1
- No clear documentation or feature on calling a function, binding a class, or overriding a function without global HOT 3
- Remove prototypes?
- General questions regarding sandboxing and performance HOT 1
- Debugger stop points behave weirdly before/after decorators
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 mond.