UCBLogo is a general purpose programming language used primarily as a learning tool. Brian Harvey’s three volumes book Computer Science Logo Style is the first and foremost guide to learn the language.
As an exercise in my Logo learning journey, I have implemented two programming tasks taken from Rosetta Code, a web site that presents solutions to the same programming problems in as many different languages as possible.
The first task is about reading a simple CSV file, adding a column of the sums of the rows and saving the changes back to a new CSV file. Here is the proposed logo solution.
The second task requires merging and aggregating two CSV files into a new resulting dataset. Specifically, merge and group per patient id and last name, get the maximum visit date and get the sum and average of the scores per patient. This task is more complex, here is a logo script that seems to work.
Developments
Both tasks are aimed in particular at programming languages that are used in data science and data processing, such as Julia, Python, R , SQL and indeed the two logo solutions are very limited.
In the remaining sections we’ll illustrate more general Logo functions for reading and transforming CSV files, organized in groups of functions (“modules”) sharing a common prefix:
- functions to read and write CSV file (csv.)
- functions operating on “dataframes” (df.)
- statistical functions (st.)
- string functions (str.)
- regular sequences (rs.)
Please note, this is an hobby project, there is no guarantee that the Logo functions are written in the most natural Logo style or that they are in fact correct. Observations are welcome, please write to guidogaybenvenuto@gmail.com.