Refactoring tools for Julia language
Author jonathanBieler
5 Stars
Updated Last
1 Year Ago
Started In
September 2019


Build Status Coverage Status

Extract method

using Refactoring

m = extract_method("
    y = [sin(2xi + exp(-c)) for xi in x]

julia> print(m)
function (c, x)
    y = [sin(2xi + exp(-c)) for xi in x]

The arguments of the method are guessed by listing the variables that are unassigned in the expression:

ex = quote
    using Gadfly
    mu = K1
    const alpha = 1
    const beta = (alpha+1)*mu
    for i=1:10
        x = rand(100, f(K2)) 
    plot(x = K3, y = pdf(InverseGamma(K4,beta),K5), Geom.line)
    ind, K7 = K6.asd
    x = [K8[K7] for i=1:K6]

julia> unassigned_variables(ex)
7-element Array{Any,1}:

Search and replace

Replace all sub-expressions matching a pattern with another :

julia> @search_and_replace sin(sin(x)) sin($x) cos($x +1)
:(cos(cos(x + 1) + 1))

Used By Packages

No packages found.