Lena Code

A code analysis platform built on a deterministic pipeline. Understand, improve, and transform code across 30 languages. Built on Lena and Yana.

A sample analysis

sum_even.py

Understand

Adds up only the even numbers.

Python

def sum_even(xs):
    total = 0
    for x in xs:
        if x % 2 == 0:
            total += x
    return total

Improve

Writes the same calculation in fewer lines.

Python

def sum_even(xs):
    return sum(
        x for x in xs if x % 2 == 0
    )

Transform

Carries the same calculation into another language.

JavaScript

function sumEven(xs) {
  return xs
    .filter(x => x % 2 === 0)
    .reduce((a, x) => a + x, 0);
}