CyberSpy

Rantings from a guy with way too much free time

Pathocaml - Getting Wacky with Functions And Polymorphism

2018-03-19 Programming Rob Baruch

OCaml on the Fringes - You can do that??

So, I got bored this afternoon and was contemplating why I was enjoying diving into OCaml more than say Elixir/Erlang for functional programming. The quality of the language that’s most captured my attention is the type system.

When you start playing around with the type system in OCaml you can go from some basic definitions of user-defined types to some pretty cool looking constructs. Let’s start of with something pretty transparent and move into something that might actually melt your brain.

Continue reading

Let's Get Funky with the Camel

2018-02-09 Programming Rob Baruch

How many ways can we get Fun(ky)

In any programming paradigm, it’s critical to understand how we write functions - be they traditional imperative , anonymous , recursive, or functional. In this post, I will break down the different types of functions that you can write in OCaml.

Let’s start by examining the imperative function. Here’s a simple function that prints out the phrase Hello World! $n$ times, once on each line, and returns the value $n$ as its result.

Continue reading