Search This Blog

Showing posts with label FP. Show all posts
Showing posts with label FP. Show all posts

Sunday, March 13, 2022

Pugofer → Pug → ?

It was a rainy July day of 1993. My just-graduated student, Anuradha strode into the — at that time — ramshackle PU building with a mischievous twinkle in her eyes.

A: Sir!!!
Me: Yeah??
A: I've got a functional language for you!!!And she waved one (or was it 2?) 360 K floppies in front of my face
Me: Awww... We're a poor department we don't have fancy machines like Sun workstations to run these. In short FPLs are beautiful but only for the rich
A: It runs on PCs – Come see!!

Pug

Sunday, March 6, 2022

A Fairy Tale And a Bridge

Momma: Dr. Einstein, What should my lil boy read so that he becomes like you?

Einstein: Read him fairy tales

Momma : ! 😯!!😯!!!

In this post I shall channel 'the late Dr. Einstein' to make a case for Pugofer as a fairy tale.

Monday, July 4, 2016

A Little 25 year old Functional Parser Gem

1 Intro

When I was playing around inside Mark Jones' gofer sources in the early 90s I saw this piece of commented C code. The code was impenetrable… at first. But the comment was elegant and beautiful and cleared up the code nicely.. on careful reading.

Why is it needed?

Saturday, January 16, 2016

The Law of Primacy

I consider the absolute worst programming construct to be subroutine or the function.          Cleo Saulnier 
Hello?!?! Why pay attention to some random crank on the Internet?
Because I think he is onto something important...

Friday, January 1, 2016

How Long?

It takes 100 years for an idea to go from inception to general acceptance.
Dijkstra[1]
When I first read this I thought it alarming.

Then I started collecting some historical tit-bits[2]…

Tuesday, June 9, 2015

Functional Programming: A Moving Target

In my last post, I gave a functional programming time line in the last 50 years. Now I'll look at two things: The place of functional in ACM Curriculum 2013 and how C has messed up the notion of functional.

ACM Curriculum 2013


Wednesday, April 29, 2015

Functional Programming: A Timeline

Rob Hagan at Monash had shown that you could teach students more Cobol with one semester of Scheme and one semester of Cobol than you could with three semesters of Cobol.
Richard O'Keefe on Erlang list
Well that was before Functional Programming hit the headlines.
These days FP is quite a buzzword. Is this for good or bad?
If real worldgood well then Scala and Clojure and Erlang and Haskell becoming more and more 'real world' is a wonderful thing.
If what is good is understanding, then I am not so sure. Many things about programming, pedagogy and programming-pedagogy that were widely understood in the 1970s and 80s have mysteriously become un-understood today.
However in this darkening of the age there are some glimmers… eg ACM's 2013 curriculum.
In this post I would like to delineate a timeline of the semantics and significance of Functional in the last 50 years. In subsequent posts I'll try to deconstruct how the semantics has shifted around in this time.

Timeline

1957
The first programming language – Fortran
1957
The first functional programming language – For(mula)Tran(slator)

Why? Whoa! How?

Read on…

Friday, September 26, 2014

Pugofer

In the early 90s  I used gofer to teach FP in the introductory programming class at the university of Pune.  At first I used Miranda/Scheme, then gofer. I was also impressed with Dijkstra's philosophy of making function application explicit with a dot ('.') and decided to incorporate this into gofer.  This changed gofer was called pugofer.

The philosophy of these changes is here. Summary of changes is:

Tuesday, August 12, 2014

Universities starting with functional programming

Here's a list of some universities that are using functional languages to teach programming. As I find more data, it will be added. So please let me know (with links!!) what Ive missed – lists are particularly welcome, but individual universities is also welcome.  Also other languages that have some claim to being functional.
Haskell
Haskell – official list (list)
At quora (also scheme and ML dialects) 
ML
Carnegie Mellon 

Wednesday, July 9, 2014

ACM FDP – Invited Talk

I was an invited speaker at the ACM faculty development program (FDP) organized jointly by ACM and VIT Pune on 9th July 2014.
The stuff of my talk — and good deal of other stuff that I did not manage to cover for lack of time :D — is put up at github.

To view, you will need

Monday, September 9, 2013

The Poorest Computer Users are Programmers

In the old days programmers programmed computers. Period.

Nowadays when everything is a computer, and the traditional computer is about a decade and half behind the curve, describing a programmer as someone who programs computers is narrow and inaccurate. Instead we should think of programmers as working at effecting and improving the human-X interface, where X may be 'computer'. But it could also be IT, or technology or the network and through that last, interaction with other humans.

Now the classic 'nerdy' programmer was (by stereotype) always poor at 'soft' questions like that:  Interaction? Synergy?! What's all that manager-PR talk to do with programming?

And so today…

Programmers are inept as users of computers

Some examples:

Tuesday, August 27, 2013

Apply-ing SI on SICP

Abelson and Sussman wrote a legendary book: SICP. The book has a famous wizard cover:

Unfortunately the cover misses some key content of the book.  What is it?
If we remove the other wizardly stuff, three main artifacts stand out on that cover:  eval and apply on the crystal ball and a magical λ.  Lets put these into a table

apply eval
lambda

The fourth empty square seems to stand out, doesn't it?  Lets dig a little into this square.

Sunday, June 23, 2013

Functional Programming invades the Mainstream

Kewl-kids in love with their favorite language will often bring up how wonderful is some non-trivial app written in their language.

Kewl, Kewt, Ardent… And the producer of yawns…

So sometimes it is good to invert the perspective and ask about cross-fertilization:  What ideas/features of these fashionable languages are becoming compelling enough to enter the mainstream?

This post is about how the boring mainstream is giving in – feature-by-feature – to Functional Programming
  • Almost every modern language supports garbage collection. Origin Lisp
  • From that followed the fact that any value not just scalars can be first-class.
  • As widely disparate systems as Python, R, Groovy, VBA, Mathematica share a common idea – using the interpreter interactively as an exploratory tool. Started with Lisp's REPL.

Wednesday, May 1, 2013

Dance of Functional Programming

Languaging with Haskell and Python


Friday, April 26, 2013

Functional Programming Scratchbook

Concepts of FP – Mindmap

Please note this is a scratchbook, ie Work-in-progress
Lambda MindMap
A mind map of how to approach the concepts of FP

Thursday, November 1, 2012

Imperative Programming: Lessons not learnt

We like to believe that Computer Science (or Information Technology) has advanced and keeps on advancing.

But has it?
What was called programming 60 years ago would today be called Imperative programming.  And it remains the mainstream (but see 7. below).

In short our field has a definite resistance to learning from our past.

A few examples will illustrate:

Thursday, October 18, 2012

Layout Imperative in Functional Programming

How long should program lines be?

But wait! Is this question even meaningful without specifying which programming language?

Monday, October 8, 2012

Functional Programming – the lost booty

Lisp was conceived in 1958 and already implemented by the early 60s.  One of its strange features was something called 'garbage-collection' … which took 35 years to enter the mainstream in Java.

Which is to say that for 35 years:
  • CS researchers did whatever they were doing for their tenure, (sorry) publications
  • Programming teachers righteously beat their students on their knuckles for getting pointer-errors/core-dumps/segfaults etc… 

Saturday, August 4, 2012

Functional Programming – Philosophical Difficulties

All the currently competing programming paradigms have serious philosophical problems.
FP probably less than the others but it too has its little share, which I deal with here.

Equality

Haskell programs look beautiful. You just write equations and everything magically just works. What could be a prettier dance between declaration (equations) and imperation (works)?

However the equations of Haskell hide a fundamental problem – equality is undecidable in general. Lets look at this from different angles.

Tuesday, May 1, 2012

Recursion pervasive in CS

I am often surprised that people think of recursion solely confined to the narrow context of recursive functions, missing the widespread and ubiquitous status of recursion in computer science.  If I may be permitted some jargon, we need to move on from recursion in recursive functions to

The Recursion Design Pattern

which has a large number of instances such as