Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanbieler/refactoring.jl
Refactoring tools for Julia language
https://github.com/jonathanbieler/refactoring.jl
julialang refactoring
Last synced: 28 days ago
JSON representation
Refactoring tools for Julia language
- Host: GitHub
- URL: https://github.com/jonathanbieler/refactoring.jl
- Owner: jonathanBieler
- License: mit
- Created: 2019-09-17T15:15:14.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-07T10:03:08.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T16:43:56.962Z (about 1 month ago)
- Topics: julialang, refactoring
- Language: Julia
- Homepage:
- Size: 15.6 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Refactoring.jl
[![Build Status](https://travis-ci.org/jonathanBieler/Refactoring.jl.svg?branch=master)](https://travis-ci.org/jonathanBieler/Refactoring.jl)
[![Coverage Status](https://coveralls.io/repos/github/jonathanBieler/Refactoring.jl/badge.svg?branch=master)](https://coveralls.io/github/jonathanBieler/Refactoring.jl?branch=master)### Extract method
```julia
using Refactoringm = 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]
end
```The arguments of the method are guessed by listing the variables that
are unassigned in the expression:```julia
ex = quote
using Gadfly
mu = K1
const alpha = 1
const beta = (alpha+1)*mu
for i=1:10
x = rand(100, f(K2))
end
plot(x = K3, y = pdf(InverseGamma(K4,beta),K5), Geom.line)
ind, K7 = K6.asd
x = [K8[K7] for i=1:K6]
endjulia> unassigned_variables(ex)
7-element Array{Any,1}:
:K1
:K2
:K3
:K4
:K5
:K6
:K8
```### Search and replace
Replace all sub-expressions matching a pattern with another :
```julia
julia> @search_and_replace sin(sin(x)) sin($x) cos($x +1)
:(cos(cos(x + 1) + 1))
```