Back to Summer Programs

Wolfram Summer SchoolFounded in 2003

16th Annual Wolfram Summer School, held at Bentley University June 24–July 13, 2018


Giulio Meleleo

Technology & Innovation

Class of 2015


Since he was a child, Giulio has been fascinated by numbers, so after high school he moved from his little town in Southern Italy to Rome, in order to study mathematics at the University of Tor Vergata.

In May 2015 he completed his PhD in pure mathematics at the Roma Tre University, with a thesis in analytic number theory and arithmetic statistics. During his PhD, Giulio used Mathematica to understand the properties of some polynomials related to the problems he was trying to solve. Now, he is getting more and more interested in the applications of this powerful language to the real world.

A New Mathematica Function: InferredReplace

The project I am working on is about the implementation of a new function in the Wolfram Language. The purpose of this function is to go in the opposite direction of the function StringReplace. While that function takes a string and replaces part of the string with other characters (or strings), the function I want to create deduces a rule of replacement given a string and a list that contains selections of the string itself.

For example, given the string "{a,b,c,d}" and the list {"b","c","d","a"}, I need a function that can be seen as an intermediate function before the one we finally want and that deduces a rule that says, in a good way, how to automatically replace "{a,b,c,d}" with {"b","c","d","a"} (or even with "{b,c,d,a}").

So the final function is able to take a string like "{e,f,g,h}" and replace it with {"f","g","h","e"} (or with "{f,g,h,e}").

This function can be called InferredReplace, since the rule that says how to replace is inferred (deduced) by a previous analysis of a rule that is given implicitly.

A convenient syntax for the function could be the following:

InferredReplace[{string1, string2, string3_ , ...}, list_]

where the implicit rule is given by string1_ -> list_ in the sense described above and {string1, string2, string3_ , ...} are the ones that have to be transformed via the rule the intermediate function inferred.

This can be very useful if one has a huge amount of data, edited in rows and in the form of strings, and wants to rearrange all the data just giving the rearrangement in the first row.

Moreover, thanks to the Interpreter function, at the end of the inferred replacement, one can extract a structure from a string, for example interpreting dates, numbers, emails, and other meaningful data from the initial string.