new-Series with tuple record def

This commit is contained in:
Michael Schimmel
2026-01-06 13:38:06 +01:00
parent fb2fc8f6f9
commit 3b3966b2f7
13 changed files with 729 additions and 1131 deletions
+9 -7
View File
@@ -89,7 +89,8 @@ var
resultVal: TDataValue;
begin
// Chained Access: (get (.data (if false ...)) 0)
script := '(do ' + ' (def root (if false {:data (new-series "ordinal")}))' + ' (get (.data root) 0)' + ')';
// Updated: Use :Ordinal instead of "ordinal"
script := '(do ' + ' (def root (if false {:data (new-series :Ordinal)}))' + ' (get (.data root) 0)' + ')';
resultVal := FEnv.Run(TAstScript.Parse(script));
@@ -103,7 +104,8 @@ var
begin
// 1. Define 's' as Optional<Series>
// 2. Access via Indexer
script := '(do ' + ' (def s (if false (new-series "ordinal")))' + ' (get s 42)' + ')';
// Updated: Use :Ordinal instead of "ordinal"
script := '(do ' + ' (def s (if false (new-series :Ordinal)))' + ' (get s 42)' + ')';
// FIX: Parse String to AST Node
resultVal := FEnv.Run(TAstScript.Parse(script));
@@ -120,11 +122,11 @@ begin
FEnv.Run(
TAstScript.Parse(
'''
(do
(def a (if true 10)) ; a is Optional<Ordinal>
(+ a 5) ; Error: Operator + not defined for Optional
)
'''
(do
(def a (if true 10)) ; a is Optional<Ordinal>
(+ a 5) ; Error: Operator + not defined for Optional
)
'''
)
);
end,
+4 -3
View File
@@ -33,7 +33,7 @@ type
destructor Destroy; override;
// Manual trigger
procedure Emit(CycleID: Integer);
procedure Emit(CycleID: Int64);
// IStream implementation
function Subscribe(const Observer: IStreamObserver): TSubscriptionTag;
@@ -122,7 +122,7 @@ begin
end;
end;
procedure TTestStream.Emit(CycleID: Integer);
procedure TTestStream.Emit(CycleID: Int64);
var
obs: IStreamObserver;
observersCopy: TArray<IStreamObserver>;
@@ -227,7 +227,8 @@ begin
FEnv.RootScope.Define('src', mockStream, TTypes.CreateRecordSeries(source.Def));
script := '(pipe [src [:non_existent]] (fn [x] {:res x}))';
// Notice double bracket [[ ... ]] to correctly form the input vector
script := '(pipe [[src [:non_existent]]] (fn [x] {:res x}))';
Assert.WillRaise(procedure begin FEnv.Run(TAstScript.Parse(script)); end, ECompilationFailed);
end;