nfdi4plants / ARCtrl

Library for management of Annotated Research Contexts (ARCs) using an in-memory representation and runtime-agnostic contract systems.
MIT License
16 stars 8 forks source link

Base spreadsheet parsers on string columns #394

Closed HLWeil closed 4 months ago

HLWeil commented 4 months ago

closes #389

HLWeil commented 4 months ago
open ARCtrl.Spreadsheet

let headerStrings : string seq = ...
let rowStringSeqs : string seq seq = ...

let columns = 
    Seq.append [headerStrings] rowStringSeqs 
    |> Seq.transpose

let columnsList = 
    columns 
    |> Seq.toList
    |> List.map (Seq.toList)

let arcTable = ArcTable.composeColumns columnsList 
Freymaurer commented 4 months ago
open ARCtrl.Spreadsheet

let headerStrings : string seq = ...
let rowStringSeqs : string seq seq = ...

let columns = 
    Seq.append [headerStrings] rowStringSeqs 
    |> Seq.transpose

let columnsList = 
    columns 
    |> Seq.toList
    |> List.map (Seq.toList)

let arcTable = ArcTable.composeColumns columnsList 

love it!

HLWeil commented 4 months ago

But thinking about switching from list to array. Because I have quite a few .Item calls, which are painfully slow for lists.

Freymaurer commented 4 months ago

Would be fine with it 👍

HLWeil commented 4 months ago
open ARCtrl.Spreadsheet

let headerStrings : string seq = ...
let rowStringSeqs : string seq seq = ...

let columns = 
    Seq.append [headerStrings] rowStringSeqs 
    |> Seq.transpose

let columnsList = 
    columns 
    |> Seq.toList
    |> List.map (Seq.toList)

let arcTable = ArcTable.composeColumns columnsList 

Now it's

open ARCtrl.Spreadsheet

let headerStrings : string seq = ...
let rowStringSeqs : string seq seq = ...

let columns = 
    Seq.append [headerStrings] rowStringSeqs 
    |> Seq.transpose

let columnsArray = 
    columns 
    |> Seq.toArray
    |> Array.map (Seq.toArray)

let arcTable = ArcTable.composeColumns columnsArray