Giter VIP home page Giter VIP logo

ocaml's Introduction

OCaml

Exercism Exercises in OCaml

Contributing Guide

Contributions to the OCaml track (or any other part of Exercism) are very welcome!

Please see the contributing guide for overall guidance. The below notes contain a few details specific to Ocaml.

Getting started

Local setup

Prerequesites

  • OCaml 4.07
  • opam
  • make
git clone https://github.com/exercism/ocaml.git
cd ocaml
git submodule update --init --recursive

# see https://github.com/exercism/ocaml/blob/master/.travis/Dockerfile#L12
# might take a while
make install_deps

# Run generator tests
make test_generator

# Execute generator
make generate_exercises

# Run exercise tests
make test
Container setup

Prerequesites

  • VSCode
  • VSCode Remote Containers extension
  • Docker
git clone https://github.com/exercism/ocaml.git
cd ocaml
git submodule update --init --recursive

vscode .

# Inside container

# Run generator tests
make test_generator

# Execute generator
make generate_exercises

# Run exercise tests
make test

Adding an Exercise

The contributing guide provides guidance on how to add a new exercise, or port an existing exercise from another language track.

This is a brief guide, with specifics for the OCaml track.

Firstly, register the exercise in config json. The name of the exercise should go in the "slug" entry.

Then, write the exercise tests and proof of concept implementation. A folder layout for an exercise called "ocaml-exercise" is below.

└── templates
    └── ocaml-exercise
        ├── example.ml.tpl           (a proof of concept implementation)
        ├── ocaml_exercise.mli.tpl   (the interface definition for the exercise)
        ├── HINTS.md.tpl             (additional hints to anyone trying the exercise - optional)
        ├── Makefile                 (standard - copy this from any of the other Ocaml exercises)
        └── test.ml.tpl              (unit tests)

You can build your exercises from templates/ocaml-exercise to exercises/ocaml-exercise via the test generator:

make generate_exercises

This creates a folder exercises/ocaml-exercises that mirrors templates/ocaml-exercises and strips the .tpl extension:

└── templates
    └── ocaml-exercise
        ├── example.ml
        ├── ocaml_exercise.mli
        ├── HINTS.md
        ├── Makefile
        └── test.ml

Canonical test data

If you are implementing an existing test, there may be "canonical data" for it in the problem-specifications repository. An example: https://github.com/exercism/problem-specifications/blob/4531f54300f2a9f485a91a5dc0228be448b46b97/exercises/hello-world/canonical-data.json#L1-L12

You should base your tests off this data, in order to provide consistency across different language tracks.

Feedback

If you find this documentation is inaccurate or incomplete, or can be improved in any way, please don't hesitate to raise an issue or submit a pull request.

OCaml icon

The OCaml logo is released under the Attribution-ShareAlike 4.0 International license.

ocaml's People

Contributors

austinlyons avatar bcc32 avatar catb0t avatar citizen428 avatar cmccandless avatar daveyarwood avatar dcorking avatar dkinzer avatar dop avatar dvberkel avatar erikschierboom avatar exercism-bot avatar ihid avatar ismaelga avatar jackhughesweb avatar kevgathuku avatar kytrinyx avatar marionebl avatar mboeh avatar michaelavila avatar mziener avatar peaupote avatar petertseng avatar pminten avatar rootulp avatar sbl avatar sshine avatar stevejb71 avatar tejasbubane avatar tmcgilchrist 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.