cobbler
refactors programs to use library functions.
It currently supports refactoring:
- Elm programs to use functions like those found in
the Elm Standard Library (e.g.
map
andfilter
); specifically, the ones defined in this file - Python programs to use the NumPy high-performance computing library
How to run: First, install cobbler
's dependencies by following the
instructions in DEPENDENCIES.md
; then, you can run
cobbler
via the cobbler
script in the root of this repository.
For help: Run ./cobbler --help
.
For information about how cobbler
works: Please see our
PLDI 2024 paper!
Input:
main : (Int -> Int) -> Maybe Int -> Int
main f mx =
case mx of
Nothing -> 0
Just x -> f (f x)
Output:
main : (Int -> Int) -> Maybe Int -> Int
main f mx =
mx
|> Maybe.map (\x -> f (f x))
|> Maybe.withDefault 0
Input:
main : (String -> Bool) -> (String -> List Int) -> List String -> List Int
main p f list =
case list of
[] -> []
head :: tail -> if p head then f head ++ main p f tail else main p f tail
Output:
main : (String -> Bool) -> (String -> List Int) -> List String -> List Int
main p f list =
list
|> List.filter p
|> List.map f
|> List.concat
Input:
s = 0
for i in range(len(x)):
s += x[i] * y[i]
s
Output:
s = np.sum(np.multiply(x, y[:len(x)]))
s
Input:
y = np.zeros(len(x) - WINDOW_SIZE + 1)
for i in range(len(y)):
s = 0
for j in range(WINDOW_SIZE):
s += x[i + j]
y[i] = s
y
Output:
y = np.convolve(x, np.full(WINDOW_SIZE, 1), mode="valid")
y
- For information about how this project is structured, please see
ARCHITECTURE.md
. - For information about the artifact evaluation process for our PLDI 2024 paper,
please see
ARTIFACT_EVALUATION.md
.
- Thanks to Anna Christenson for the logo!
- Thanks to
Patrick Gillespie
for the
Text to ASCII Art Generator
and
myflix
for the "Sweet" ASCII art font.