importClass(Packages.icy.gui.main.MainInterface)
importClass(Packages.plugins.ylemontag.mathoperations.Functor)
importClass(Packages.plugins.ylemontag.mathoperationspp.Expression)

// get the sequence
seq = getSequence()
if (seq == null) throw "Please open a sequence first"

// create the expression
formula = "seq ^ 2"

// get the formula as a Function
fn = Expression.parse(formula).getFunctor()

// create an array of arguments
args = [ seq ]

// apply the Function to the arguments
seq = fn["apply(icy.sequence.Sequence[])"](args)

gui.addSequence(seq)
