Calling External Programs from OCaml with Core

I have a program I’d like to run with node. The program is typically run like so:

node $PROGRAM input_filename.js

and it prints its output to stdout. Now, this program is not written to handle streaming input:

node $PROGRAM < input_filename.js

So we can see that one of the main challenges is that the node program expects a file name. We could alter the Javascript program to take a stream as input, so that the second version works. However, I’m going to focus on implementing a function that will deal with $PROGRAM as is. So, for starters, I’d like to be able to programmatically call this from Ocaml using a function having the signature:

val exec_program : (prog : string) -> string

[Read More]

Thoughts on Church Encodings

I was recently reviewing Church encodings, for no particular reason other than to refresh my memory. It’s been a while since I first learned about them and I was pleased that they seemed so much easier to understand this time around! The exercise I was reviewing got me thinking about an idiom I’d learned and used often in Lisp dialects.

[Read More]

Background Assumptions

What are the priniciples that make an experimentation system sound? We’ll discuss in a future blog post how to make the experimentation-analysis pipeline correct by construction, and what correctness means in this context. First, however, we need to to look at the set of basic assumptions that allow us to reason about the interactions between concurrently running experiments, variables or parameters not represented in a particular experimental procedure, and those parameters of interest. The underlying experimentation system must reflect these assumptions; if it does not, then all of our analyses may be invalid.

[Read More]

Using Z3

Like many (all?) static analysis tools, our PlanOut analyzer does not have to be complete, but it should always be sound. Therefore, we must ensure that we never return estimators that are incorrect.

Conditional random assignment presents a complication on this front – in order to reason about conditionally assigned variants, we need to determine what values of variables in a particular guard lead us down a particular path. To solve this problem in the general case, we need an SMT solver.

[Read More]

Config File Input Schema

We would like to add assertions, annotations, and maybe even types to the PlanOut language. However, since it’s infeasible to rewrite our corpus of scripts in this updated language, we have a temporary solution: we are parsing in YAML config files to provide supplementary type information for inference.

[Read More]