AnalysisScript 1.0.3-beta.3

This is a prerelease version of AnalysisScript.
There is a newer version of this package available.
See the version list below for details.
dotnet add package AnalysisScript --version 1.0.3-beta.3
                    
NuGet\Install-Package AnalysisScript -Version 1.0.3-beta.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AnalysisScript" Version="1.0.3-beta.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AnalysisScript" Version="1.0.3-beta.3" />
                    
Directory.Packages.props
<PackageReference Include="AnalysisScript" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AnalysisScript --version 1.0.3-beta.3
                    
#r "nuget: AnalysisScript, 1.0.3-beta.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AnalysisScript@1.0.3-beta.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AnalysisScript&version=1.0.3-beta.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AnalysisScript&version=1.0.3-beta.3&prerelease
                    
Install as a Cake Tool

Analysis Script

A super mini script for data processing

Examples

Basic usage

using AnalysisScript.Library;

// initialize variables
var variables = new VariableContext()
    .AddInitializeVariable("a", 1)
    .AddInitialzieVariable("b", new List<int>() { 2, 3, 4 });

// register custom methods
var incrSingle = (AsExecutionContext ctx, int x)
    => ValueTask.FromResult(p + 1);

var incrSequence = (AsExecutionContext ctx, IEnumerable<int> xs)
    => ValueTask.CompleteTask(xs.Select(x => x + 1));

var sumSequence = (AsExecutionContext ctx, IEnumerable<int> xs)
    => xs.Sum();

variables.Methods.RegisterInstanceFunction("inc", incrSingle);
variables.Methods.RegisterInstanceFunction("inc", incrSequence);
variables.Methods.RegisterInstanceFunction("sum", sumSequence);

// run code and get return value
var interpreter = AsInterpreter.Of(variables,
"""
param a
param b

let first = c
| inc

let firstArray = [0, first]
| join ","

let sum = b
| inc
| sum
# use '||' to allow '&' and make '&' reference to previous 'sum' result 
|| sum [1, &]

let res = "${firstArray}|${sum}"

return res
""");
var result = await interpreter.RunAndReturn<string>();
****
// Output: 0,2|13
Console.WriteLine(result);

All syntaxs example

# define variable 'a'
param a

let b = arg1
| fn arg2 arg3
| fn2 arg2
| fn3

# Use '||' to block the current value passed to the first arg of the next pipe function
# symbol '&' reference to return value of 'fn3'
|| fn4 & arg2 arg3
|| fn5 [&, arg2, arg3]

# symbol '*' can execute pipes that use 'for each' element from privious
# will throw exception if privious can't cast to 'IEnumerabe<T>'
||* fn6 arg1 & arg3

call fn6 arg1 arg2 arg3

let d = "string interpolation ${c}"
let e = "string ${c} interpolation"

return d

Grammars

param -> identity

arr -> param

arrs -> '[' arrs arr ',' | empty ']'

argument -> number | string | identity | arrs

arguments -> arguments argument

pipe -> pipe identity argument newline

pipes -> pipes pipe | empty

variable -> identity

let -> let variable = argument [pipes]

call -> call identity argument

cmd -> let | call | comment | param

return -> return identity

cmds -> cmds cmd | empty

analysis -> cmds return
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4-beta.1 95 5/29/2024
1.0.3 154 3/1/2024
1.0.3-beta.26 73 2/29/2024
1.0.3-beta.25 81 2/28/2024
1.0.3-beta.24 76 2/27/2024
1.0.3-beta.23 86 2/27/2024
1.0.3-beta.22 72 2/27/2024
1.0.3-beta.21 74 2/27/2024
1.0.3-beta.20 73 2/26/2024
1.0.3-beta.19 77 2/26/2024
1.0.3-beta.18 77 2/26/2024
1.0.3-beta.17 76 2/26/2024
1.0.3-beta.16 82 2/23/2024
1.0.3-beta.15 81 2/23/2024
1.0.3-beta.13 79 2/23/2024
1.0.3-beta.12 74 2/23/2024
1.0.3-beta.11 79 2/23/2024
1.0.3-beta.10 77 2/23/2024
1.0.3-beta.9 78 2/23/2024
1.0.3-beta.8 81 2/23/2024
1.0.3-beta.7 80 2/23/2024
1.0.3-beta.6 81 2/23/2024
1.0.3-beta.5 84 2/23/2024
1.0.3-beta.4 82 2/23/2024
1.0.3-beta.3 85 2/21/2024
1.0.3-beta.2 83 2/21/2024
1.0.3-beta.1 94 2/7/2024
1.0.2 124 2/7/2024
1.0.2-beta.10 105 1/19/2024
1.0.2-beta.9 74 1/19/2024
1.0.2-beta.8 73 1/18/2024
1.0.2-beta.7 73 1/18/2024
1.0.2-beta.6 80 1/18/2024
1.0.2-beta.5 73 1/18/2024
1.0.2-beta.4 79 1/16/2024
1.0.2-beta.3 84 1/13/2024
1.0.2-beta.2 80 1/12/2024
1.0.2-beta.1 82 1/12/2024
1.0.2-alpha.2 79 1/12/2024
1.0.2-alpha.1 75 1/12/2024
1.0.1 199 12/18/2023
1.0.0 101 12/18/2023