Giter Site home page Giter Site logo

exemplar's Introduction

Exemplar

See LOG.md for status.

The goal of this project is synthesis of working (unpolished) Python functions from example input/output and assertions.

Currently, if/elif, for loop, and break controls are synthesized until all given examples pass.

Exemplar's mechanisms for finding conforming code are deduction, generate-and-test, and asking multiple choice questions.

Examples that result in the function at bottom:

"""
leapYear(int year):
returns true iff
* the year is divisible by 4 and not divisible by 100 (eg, 2012, 2016, 2020, 2024)
or
* the year is divisible by 400 (eg, 2000, 2400, 2800)
"""
<399
True
>False

<400
i1 % 400 == 0
>True

<2012
i1 % 4 == 0 and i1 % 100 != 0
>True

<2000
i1 % 400 == 0
>True

<2013
True
>False

<2014
True
>False

<2015
True
>False

<2016
i1 % 4 == 0 and i1 % 100 != 0
>True

<2020
i1 % 4 == 0 and i1 % 100 != 0
>True

<2400
i1 % 400 == 0
>True

is interpreted to mean

def leap_year():
    i1 = int(input("i1:"))  # Eg, 399
    if i1%400==0:
        print(True)
        return True
    elif i1 % 4 == 0 and i1 % 100 != 0:
        print(True)
        return True
    elif True:
        print(False)
        return False

Per-example unit tests are also generated.

This project is licensed under the terms of the GPL v3 license.

exemplar's People

Contributors

gherson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.