background preloader

Introduction to Systematic Programming – Part 3 Originally authored by Dara Monasch Week 3 of Introduction to Systematic Program Design was definitely a LOT more video content than I was used to from before, and I can safely say that having started watching the videos from Week 4 already, it’s only going to get crazier from here on out! That said, as always, here are the links to the starting posts from this series, in case you missed out on them: Intro to “Introduction to Systematic Programming” Course Introduction to Systematic Programming – Week 1 Introduction to Systematic Programming - Week 2 So Week 3 of class focused primarily on learning How to Design Data and I’ll walk you through each lesson we learned step by step as best I can. Interestingly, I’ve also found that writing up these summaries assists with my own learning as well, so I hope that reading them does something similar for those of you who are my classmates! Lesson 1: cond Expressions Standard cond expression template: To form a cond QA expression: Points to Remember:

Introduction Haskell is a computer programming language. In particular, it is a polymorphically statically typed, lazy, purely functional language, quite different from most other programming languages. The language is named for Haskell Brooks Curry, whose work in mathematical logic serves as a foundation for functional languages. Haskell is based on the lambda calculus, hence the lambda we use as a logo. 1 Why use Haskell? Writing large software systems that work is difficult and expensive. WOW! Even if you are not in a position to use Haskell in your programming projects, learning Haskell can make you a better programmer in any language. I learned Haskell a couple of years ago, having previously programmed in Python and (many) other languages. Haskell offers you: Substantially increased programmer productivity (Ericsson measured an improvement factor of between 9 and 25 using Erlang, a functional programming language similar to Haskell, in one set of experiments on telephony software). 3.4 Brevity

openvmtil - openVm : Tookit for Implementing (and exploring) Languages - a bottom-up vm that is an extensible scripting language Lastest downloads at An Exploration of Language Theory - and its Machine Implementation Imagine a low level, optimizing, virtual machine (like llvm) that is an extensible scripting language and that is small enough to be easily verified, where even the runtime is reconfigurable - minimize that. Current focus (to do) : minimal bootstrap, self-hosting, patterns/sets, logic, tail call, type checking, gui The Turing Machine, the Lambda Calculus and Type/Category Theory are the theoretical foundations. With an ideal that the best (cross platform) virtual machine or common language runtime is a minimal but maximally extensible, optimally and simply compiled (rpn) language, certainly "human readable", but also maintainable, learnable and extensible. Current Focus and Direction : Goals : Explore the power of simplicity as a software design principle - how simple can it be and still be totally effective. Acknowledgements : Special thanks for : Haskell B.

Did it with .NET - A Higher Calling After a long break, it's time to return to my informal series of articles on functional programming concepts using only C# 2.0. While C# 3.0 might be syntactically more suitable to functional-style programming, 2.0 has the advantage of being more familiar, and in some cases, clearer. In addition, using C# 2.0 makes compiling sample code under Visual Studio 2005 possible, so an installation of the Orcas beta (i.e. Visual Studio 2008) is unnecessary. Because this article builds on information that I have already been presented, a refresher might be in order. Let's get started... Higher-Order Functions The notion of higher-order functions is an amazingly simple (and extraordinarily powerful!) In order to support higher-order functions, a language must treat functions as first-class objects, but what does that mean? In general, programming languages impose restrictions on the ways in which computational elements can be manipulated. Why is this useful? return result.ToArray(); } The Big Three

Dynamic Programming Wow, it’s been a while since I’ve written anything here. Between changing jobs, working on my PhD and moving to a new country I guess you could say I’ve been pretty busy. But at the same time, together with all these changes in my life there’s a ton of new things that I’m learning almost every day. And, as many others, I feel that writing about them in a way that is easy for others to understand is one of the best ways to consolidate my own learning. So I’ll try to write here more often from now on. So with that covered lets move to the important stuff. On this post I wanted to talk about Dynamic Programming. So what exactly is Dynamic Programming? The classic example to explain dynamic programming is the fibonacci computation, so I’ll also go with that. F(n) = F(n-1) + F(n-2) and F(1) = F(2) = 1 This means that the sequence of the first 10 fibonacci numbers would go: You might also find it defined as: And so the sequence would be: You can even make that a one liner: Cheers!

Excellent Overview of Functional Programming 14 Feb 2008 I just ran into an article on DZone that totally threw me off my chair in terms of content. It’s titled (ambitiously enough) “Functional Programming For the Rest of Us“. Basically the article attempts to explain many of the common FP techniques in terms that imperative programmers can understand. More importantly, it motivates these explanations with a long and rambling set of real-world reasons. It’s worth noting that the author claims to be presenting his explanations in Java, but is in fact devising an extension of Java to represent FP constructs more concisely. The really interesting bit is how the author motivates FP through a combination of real-world examples and lengthy reasoning. So grab yourself a cup of coffee and a box of donuts (it’ll take you about that long to finish the article), and slog your way through.

Program Languages Research Eric White's Blog : Query Composition using Functional Prog Functional Programming (FP) has the potential to reduce program line count by 20% to 50%, reduce bugs and increase robustness, and move us in the direction of taking advantage of multiple core CPUs. But perhaps due to the learning curve, and unfamiliarity, many developers are not taking advantage of the potential that LINQ and FP offers. This blog is inactive.New blog: TOCThis is a tutorial on using Functional Programming (FP) techniques for constructing LINQ queries. It is certainly possible to write simple LINQ queries without using these techniques, but as soon as you start writing more complicated queries, you need to understand these techniques. Learning about functional programming made me a better and faster coder. The tutorial is written in a granular fashion so that if you already understand a topic, you can skip it. 1. Presents the case for why you want to learn functional programming. 2. Functional programming is most applicable when transforming data. 3.

Introduction to Systematic Programming – Week 1 - Marketing & PR - Infragis For those of you just tuning in, check out the “Intro” to the Introduction to Systematic Programming series here for some more background on what we’re about to get into. If you’ve been here since last week, I’m sure you’re waiting with bated breath to hear how the first week of classes went. Well, the wait is over! Week 1 consisted of 9 lessons centered around the topic of Primitives in Dr. Racket. Lesson 1: Introduction to Systematic Program Design The primary point covered in this first lesson is that, “Computation is what makes ‘things’ happen!” Next, we reviewed the question, “What’s the ‘Design Method’?” Lesson 2: Expressions Dr. In Dr. For example, to have Dr. Additional notes from this section: ; designates a line to be commented out #i designates an inexact number Lesson 3: Evaluation The Rules in Dr. An Expression is a “Primitive Call” when it begins as (*…… With * standing for any of the primitive Operators, including, but not limited to: +, -, /, * Additional notes from this session:

Can Your Programming Language Do This? by Joel Spolsky Tuesday, August 01, 2006 One day, you're browsing through your code, and you notice two big blocks that look almost exactly the same. // A trivial example: alert("I'd like some Spaghetti!") These examples happen to be in JavaScript, but even if you don't know JavaScript, you should be able to follow along. The repeated code looks wrong, of course, so you create a function: function SwedishChef( food ) { alert("I'd like some " + food + "!") OK, it's a trivial example, but you can imagine a more substantial example. Now you notice two other blocks of code which look almost the same, except that one of them keeps calling this function called BoomBoom and the other one keeps calling this function called PutInPot. alert("get the lobster"); PutInPot("lobster"); PutInPot("water"); alert("get the chicken"); BoomBoom("chicken"); BoomBoom("coconut"); Now you need a way to pass an argument to the function which itself is a function. Look! Can your language do this? Jeez, that is handy.

Fortran Literature Functional Programming in C# 3. As a developer who was raised on procedural and object oriented programming languages like C, C++ and Java it took me a while to figure out what people were raving about when it comes to the benefits of functional programming techniques. I always thought closures and higher order functions were words used by snobby kids from MIT and grad students to show how overeducated they were as opposed to programming tools I'd ever find useful. This thinking was additionally fueled by articles like Joel Spolsky's Can Your Programming Language Do This? which not only came off as snobby but also cemented the impression that higher order functions like map() and reduce() are for people solving "big" problems like the folks at Google who are trying to categorize the entire World Wide Web not people like me who write desktop feed readers in their free time. All of this changed when I started learning Python. There are more examples from the RSS Bandit code base but I'm sure you get the idea.