Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Exercism

OCaml

via Exercism

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
OCaml is an industrial strength programming language supporting functional, imperative and object-oriented styles - but don't worry if you're not familiar with these, as it's used as a teaching language by a lot of institutions (including Cornell and Princeton). One of the best features of OCaml is the rich and powerful type system - this is useful to catch some mistakes early on saving developers a huge amount of frustration. Also, relieves developers from having to specify types in the code - the compiler will work these out for you!

Syllabus

  • Hello World
    • Exercism's classic introductory exercise. Just say "Hello, World!".
  • Leap
    • Determine whether a given year is a leap year.
  • Armstrong Numbers
    • Determine if a number is an Armstrong number.
  • Darts
    • Calculate the points scored in a single toss of a Darts game.
  • Difference of Squares
    • Find the difference between the square of the sum and the sum of the squares of the first N natural numbers.
  • Eliud's Eggs
    • Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.
  • Hamming
    • Calculate the Hamming distance between two DNA strands.
  • Nucleotide Count
    • Given a DNA string, compute how many times each nucleotide occurs in the string.
  • Raindrops
    • Convert a number into its corresponding raindrop sounds - Pling, Plang and Plong.
  • Reverse String
    • Reverse a given string.
  • RNA Transcription
    • Given a DNA strand, return its RNA complement.
  • Sieve
    • Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
  • Two-Fer
    • Create a sentence of the form "One for X, one for me.".
  • Acronym
    • Convert a long phrase to its acronym.
  • Allergies
    • Given a person's allergy score, determine whether or not they're allergic to a given item, and their full list of allergies.
  • Anagram
    • Given a word and a list of possible anagrams, select the correct sublist.
  • Binary Search Tree
    • Insert and search for numbers in a binary tree.
  • Bob
    • Bob is a lackadaisical teenager. In conversation, his responses are very limited.
  • Collatz Conjecture
    • Calculate the number of steps to reach 1 using the Collatz conjecture.
  • ETL
    • Change the data format for scoring a game to more easily add other languages.
  • Grade School
    • Given students' names along with the grade that they are in, create a roster for the school.
  • ISBN Verifier
    • Check if a given string is a valid ISBN-10 number.
  • Isogram
    • Determine if a word or phrase is an isogram.
  • Pangram
    • Determine if a sentence is a pangram.
  • Space Age
    • Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.
  • Square Root
    • Given a natural radicand, return its square root.
  • Scrabble Score
    • Given a word, compute the Scrabble score for that word.
  • Triangle
    • Determine if a triangle is equilateral, isosceles, or scalene.
  • All Your Base
    • Convert a number, represented as a sequence of digits in one base, to any other base.
  • Beer Song
    • Produce the lyrics to that beloved classic, that field-trip favorite: 99 Bottles of Beer on the Wall.
  • Binary Search
    • Implement a binary search algorithm.
  • Knapsack
    • Given a knapsack that can only carry a certain weight, determine which items to put in the knapsack in order to maximize their combined value.
  • Luhn
    • Given a number determine whether or not it is valid per the Luhn formula.
  • Matching Brackets
    • Make sure the brackets and braces all match.
  • Perfect Numbers
    • Determine if a number is perfect, abundant, or deficient based on Nicomachus' (60 - 120 CE) classification scheme for positive integers.
  • Phone Number
    • Clean up user-entered phone numbers so that they can be sent SMS messages.
  • Sum of Multiples
    • Given a number, find the sum of all the multiples of particular numbers up to but not including that number.
  • Word Count
    • Given a phrase, count the occurrences of each word in that phrase.
  • D&D Character
    • Randomly generate Dungeons & Dragons characters.
  • Nth Prime
    • Given a number n, determine what the nth prime is.
  • Prime Factors
    • Compute the prime factors of a given natural number.
  • Roman Numerals
    • Convert modern Arabic numbers into Roman numerals.
  • Run-Length Encoding
    • Implement run-length encoding and decoding.
  • Say
    • Given a number from 0 to 999,999,999,999, spell out that number in English.
  • Change
    • Correctly determine change to be given using the least number of coins.
  • List Ops
    • Implement basic list operations.
  • Palindrome Products
    • Detect palindrome products in a given range.
  • Rectangles
    • Count the rectangles in an ASCII diagram.
  • Robot Name
    • Manage robot factory settings.
  • Atbash Cipher
    • Create an implementation of the Atbash cipher, an ancient encryption system created in the Middle East.
  • Bowling
    • Score a bowling game.
  • Dominoes
    • Make a chain of dominoes.
  • Flower Field
    • Mark all the flowers in a garden.
  • Connect
    • Compute the result for a game of Hex / Polygon.
  • Custom Set
    • Create a custom set type.
  • Forth
    • Implement an evaluator for a very simple subset of Forth.
  • Meetup
    • Calculate the date of meetups.
  • Hangman
    • Implement the logic of the hangman game using functional reactive programming.
  • React
    • Implement a basic reactive system.
  • Zipper
    • Creating a zipper for a binary tree.

Reviews

Start your review of OCaml

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.