[Haskell-cafe] representing spreadsheets
Eric Rasmussen
ericrasmussen at gmail.com
Sat May 28 00:11:29 CEST 2011
Stephen, thanks for the link! The paper was an interesting read and
definitely gave me some ideas.
Tillmann -- you are correct in that it's very similar to a database.
I frequently go through this process:
1) Receive a flat file (various formats) of tabular data
2) Create a model of the data and a parser for the file
3) Code utilities that allow business users to
filter/query/accumulate/compare the files
The models are always changing, so one option would be to inspect a
user-supplied definition, build a SQLite database to match, and use Haskell
to feed in the data and run queries. However, I'm usually dealing with files
that can easily be loaded into memory, and generally they aren't accessed
with enough frequency to justify persisting them in a separate format.
It's actually worked fine in the past to code a custom data type with record
syntax (or sometimes just tuples) and simply build a list of them, but the
challenge in taking this to a higher level is reading in a user-supplied
definition, perhaps translated as 'the first column should be indexed by the
string "Purchase amount" and contains a Double', and then performing
calculations on those doubles based on further user input. I'm trying to get
over bad object-oriented habits of assigning attributes at runtime and
inspecting types to determine which functions can be applied to which data,
and I'm not sure what concepts of functional programming better address
these requirements.
On Fri, May 27, 2011 at 12:33 PM, Tillmann Rendel <
rendel at informatik.uni-marburg.de> wrote:
> Hi,
>
>
> Eric Rasmussen wrote:
>
>> The spreadsheet analogy isn't too literal as I'll be using this for data
>> with a more regular structure. For instance, one grid might have 3 columns
>> where every item in column one is a CellStr, every item in column two a
>> CellStr, and every item in column 3 a CellDbl, but within a given grid
>> there
>> won't be surprise rows with extra columns or columns that contain some
>> cell
>> strings, some cell ints, etc.
>>
>
> Sounds more like a database than like a spreadsheet.
>
> Tillmann
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110527/d46c2586/attachment.htm>
More information about the Haskell-Cafe
mailing list