Craig Stuntz

F# • Compilers • Programming Languages • Functional Programming • Web

Posted by on in Blogs
In this post, I will show an example of where using unit testing as a design methodology does not work, and how to produce a design for correct code anyway. There is no single design methodology which works for all problems, so it's useful to have a variety of tools at your disposal. This post is my contribution to the 2015 F# Advent Calendar. I'm implementing a compiler for a tiny language without use of external libraries for things like parsing and code generation. The idea is to produce a minimal example of a purely functional compiler. This is an ongoing project, and some parts are further along than others, but you can see the source code as I work, and it does produce working EX...

Posted by on in Blogs
I've been scouring the CodeMash accepted session list for talks featuring F#, and there are quite a few! A Developer’s Journey from Object Oriented to Functional Programming, by Reid Evans Async Everywhere!, by Stephen Cleary Deep Dive into Deep Learning, by Gary Short Functional Browser Automation Testing for Newbs, by Bryan Arendt Programs that Write Programs: How Compilers Work, by Craig Stuntz Recognizing patterns in noisy data using trainable ‘Functional’ State Machines, by Faisal Waris The Beating Heart of CQRS, or Actor-Based Message Routing on the CLR, by Paulmichael Blasucci Bonus! Other talks of possible interest to functional programmers: Erlang, or How I ...
I'll be speaking about compilers, testing, and machine learning at a conference near you! Abstracts for all of these sessions are on my Presentations page. Programs that Write Programs: How Compilers Work Dog Food Conference and CodeMash What Testing Can Never Do and How to Do It Anyway Dog Food Conference Machine Learning with Azure ML CloudDevelop...
In Code First Entity Framework models, you can define the length of a string field with StringLengthAttribute, but you have to write code in OnModelCreating to indicate a CHAR/NCHAR fixed length field: public class MyEntity { [Key] public int Id { get; set; } [StringLength(2)] public string FixedLengthColumn { get; set; } } public partial class MyContext : DbContext { public virtual DbSet MyEntities { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { if (modelBuilder == null) throw new ArgumentNullException("modelBuilder"); modelBuilder.Entity() .Property(e => e.FixedLengthColumn) .IsFixedLength(); } } I f...
I'll be speaking at Lambda Jam next week. Here's the synopsis: When you leave Lambda Jam and return to work, do you expect to apply what you’ve learned here to hard problems, or is there just never time or permission to venture outside of fixing “undefined is not a function" in JavaScript? Many of us do use functional languages, machine learning, proof assistants, parsing, and formal methods in our day jobs, and employment by a CS research department is not a prerequisite. As a consultant who wants to choose the most effective tool for the job and keep my customers happy in the process, I’ve developed a structured approach to finding ways to use the tools of the future (plus a few from the ...

Posted by on in Blogs
Incredibly Strange Programming Languages Stir Trek · 6 May 2016 If you've ever suspected that “all programming languages are pretty much the same; they just have different syntax,” well, you will never suspect that again! Covering languages from the unusually powerful (Idris) to the illuminated (قلب) to the profoundly limited (BlooP), and all points in between, these languages will help you think differently about approaches to software problems you face in your day job. Of course we’ll have a lot of fun, but these languages are no joke. The practical benefit of an impractical language is the power to find new approaches to common problems. Programs that Write Programs: How Compilers...

Posted by on in Blogs
A few months ago, some coworkers sent around a Ruby challenge. It appears simple, but we can sometimes learn a lot from simple problems. Write a Ruby program that determines the smallest three digit number such that when said number is divided by the sum of its digits the answer is 20. In case that's not clear, let's pick a number, say, 123. The sum of the digits of 123 is 6, and 123/6 = 20.5, so 123 is not a solution. What is? Here's some Ruby code I wrote to solve it: def digitSum(num, base = 10) num.to_s(base).split(//).inject {|z, x| z + x.to_i(base)} end def solution (100..999).step(20).reject {|n| n / digitSum(n) != 20 }.first end puts solution Problem solv...

Posted by on in Blogs
There is a function I need. I know how to write it, but I don't know if it has a standard name (like map, fold, etc.). It takes one argument -- a list of something -- and returns a list of 2-tuples of equal length. Each tuple contains one item from the list and the list without that item. It's probably easiest if I show you an example: > f [1; 2; 3];; val it : (int * int list) list = [ (1, [2; 3]) (2, [1; 3]) (3, [1; 2]) ] Here's the implementation I'm using: let f (items : 'T list) = let rec implementation (start : 'T list) = function | [] -> [] | item :: tail -> (item, start @ tail) :: implementation (start @ [ item ]) tail imp...
That's the title of my presentation at Dog Food Conference 2014, 29-30 September, in Columbus, Ohio. If you found my post on "Test-Only Development" with the Z3 Theorem Prover was interesting, then you'll love this. What if simply writing "unit tests" was enough to produce a program which makes them pass? What if your compiler could guarantee that your OpenSSL replacement follows the TLS specification to the letter? What if you could write a test which showed that your code had no unintentional behavior? Microsoft Research is well known for its contributions to Kinect, F#, the Entity Framework, WorldWide Telescope, and more, but it's also the home of a number of programming tools which...
That's the title of the presentation I'll be giving at CloudDevelop 2014, on October 17th, in Columbus, Ohio. If you read my blog at all then you're probably interested in where software development will be headed five years in the future. Two things I recommend that you study are proving systems and homomorphic encryption. I've written about proving systems in the past, and will have more to say in the future, but today we'll talk about homomorphic encryption. Homomorphic encryption will change the web in the same way that SSL/TLS did. I say this with quite a bit more confidence than I have in the past! If you remember the web in 1993, that's interesting to you. If not, imagine the we...