deliay / analysisscript Goto Github PK
View Code? Open in Web Editor NEWA super mini script for data processing
License: MIT License
A super mini script for data processing
License: MIT License
Sometimes we want to use values from pipe context in pipe steps, like string interpolation, but hasn't any way to reference current pipe value. Hence, we support reference current value in pipe use '&' keyword and support do string interpolation in pipe operation.
Use keyword '&' to reference current value in pipe.
int Add(int left, int right); // register as 'add'
let a = 1
| add &
# a = 2
In default, pipe operation will pass the current value of pipe to next function, but in sometimes we don't want to pass current value to next function as first argument, in this case we could use pipe operator '|' again to stop pass first argument to function.
let a = 1
|| add 1 &
# a = 2
Just leave literal string to pipe operator
let animal = "fox"
let text = "A lazy"
| "${&} animal"
# text = "A lazy fox"
Add new method format
to BFL to support interpolation.
let a = 1
|| format "${&}"
string Format(string format);
string Format(string ignore, string format);
List<T> ListOf(T sequence)
List<T> ListOf(IEnumerable<T> sequence)
HashSet<T> SetOf(IEnumerable<T> sequence)
HashSet<T> SetOf(T sequence)
List<T> Add(List<T> sequence)
HashSet<T> Add(HashSet<T> sequence)
In practice, we usually define sequence by the []
grammar. But in AnalysisScript we could only generate sequence via a BFL function, like:
let arr = first_item
# C# signature: List<T> ListOf(T sequence)
| list_of
# C# signature: List<T> Add(List<T> sequence)
| add second_item
| add third_item
Add the []
grammar to make code more readable.
# typeof(first)[]
let arr = [first, second, third]
let set = arr
# C# signature: HashSet<T> SetOf(IEnumerable<T> sequence)
| set_of
# C# signature: List<T> ListOf(IEnumerable<T> sequence)
| list_of
And add more Collection function to BFL
List<T> ListOf(T sequence)
List<T> ListOf(IEnumerable<T> sequence)
HashSet<T> SetOf(IEnumerable<T> sequence)
HashSet<T> SetOf(T sequence)
List<T> Add(List<T> sequence)
HashSet<T> Add(HashSet<T> sequence)
Analysis Script doesn't support any 'foreach' syntax for batch operations. Now we consider add 'foreach' operator '*' follow pipe operator.
int Add(int left, int right) // register as 'add'
# IEnumerable<int> [1,2,3,4]
let result = [1,2,3,4]
|* add 1
| sum
# result = 2+3+4+5
return result
'*' operator will throw exception when last value in pipe does not inherit IEnumerable<T>
let result = [1,2,3,4]
| sum
|* add 1
# throw InvalidOperationException
Support IAsyncEnumerable
in pipe operation
Add these functions to support basic operation of async sequence:
IAsyncEnumerable<R> SelectAsync<T, R>(IAsyncEnumerable<T> sequence, String property)
IAsyncEnumerable<string> FilterContainsAsync(IAsyncEnumerable<string> sequence, string value)
IAsyncEnumerable<T> FilterContainsAsync<T>(IAsyncEnumerable<T> sequence, string proeprty, string value)
IAsyncEnumerable<T> DistinctAsync<T>(IAsyncEnumerable<T> sequence)
IAsyncEnumerable<T> TakeAsync<T>(IAsyncEnumerable<T> sequence, int count)
IAsyncEnumerable<T> SkipAsync<T>(IAsyncEnumerable<T> sequence, int count)
IAsyncEnumerable<T> LastAsync<T>(IAsyncEnumerable<T> sequence, int count)
IAsyncEnumerable<T> FlatAsync<T>(IAsyncEnumerable<IAsyncEnumerable<T>> sequence)
Task<string> JoinAsync(IAsyncEnumerable<T> sequence, string delimiter)
Keyword ui
was design to pass variable to UI element:
let logs =
| ....
ui
| hierarchy_tree_graph logs
| table logs
This is equivalent to method invoke and ui
keyword does not implement in latest release version. Thus, we add a new keyword `call to instead of it.
call
Use call
keyword to invoke a method which registered in execution context. Keyword call
will ignore return value of method.
let logs =
| ...
call hierarchy_tree_graph logs
call table logs
call write_to_json "logs.json" logs
call notify "https://xxx.com" logs
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.