Another Word For It Patrick Durusau on Topic Maps and Semantic Diversity

February 19, 2014

Diagrams 1.0

Filed under: Graphics,Haskell — Patrick Durusau @ 9:16 pm

Diagrams 1.0 by Brent Yorgey.

From the post:

The diagrams team is very pleased to announce the 1.0 release of diagrams, a framework and embedded domain-specific language for declarative drawing in Haskell. Check out the gallery for some examples of what it can do. Diagrams can be used for a wide range of purposes, from data visualization to illustration to art, and diagrams code can be seamlessly embedded in blog posts, LaTeX documents, and Haddock documentation, making it easy to incorporate diagrams into your documents with minimal extra work.

….

Since we were talking about graphics, this seems to fit in well.

OK, one image and then you have to see Brent’s post for the rest:

knight's tour

Brent lists videos, slides, tutorials and guides.

December 14, 2013

Advanced Functional Programming

Filed under: Functional Programming,Haskell — Patrick Durusau @ 4:16 pm

Advanced Functional Programming

Not a MOOC but a course being taught in the Spring of 2014 by Patrik Jansson at Chalmers.

However, there is a wealth of materials, slides, code, reading assignments, Haskell specific search engines and other goodies at the course site.

Requires more than the usual amount of self-discipline but the materials you need are present. Success only requires you.

I first saw this in a tweet by Patrik Jansson.

November 29, 2013

Haskell Fast & Hard

Filed under: Functional Programming,Haskell — Patrick Durusau @ 8:24 pm

Haskell Fast & Hard by Yann Esposito.

The first part of this series opens with:

Don’t be afraid

Many book/articles about Haskell start by introducing some esoteric formula (quick sort, Fibonacci, etc…). I will do the exact opposite. At first I won’t show you any Haskell super power. I will start with similarities between Haskell and other programming languages. Let’s jump to the mandatory “Hello World”.

The lessons are:

After the extended holiday in the United States, physical and mental exercise is indicated!

Enjoy!

October 11, 2013

School of Haskell

Filed under: Functional Programming,Haskell — Patrick Durusau @ 5:52 pm

School of Haskell

I didn’t see a history of the site but judging from the dates on the published articles, the School of Haskell came online in late December 2012.

Since then it has accumulated approximately two hundred and eighty four (284) published articles.

Not to mention these resources listed on the homepage:

  • How to Use the School of Haskell School of Haskell Learning, playing, and keeping up with the latest. ## Welcome to the SoH We have created the School of Haskell to…
  • Pick of the Week A weekly selection of interesting tutorials created by our users….
  • IDE Tutorials Tutorials on how to make the best use of the FP Haskell Center including hidden gems, and code examples.
  • Project Templates Project templates for use with FP Haskell Center. The world's first commercial Haskell IDE and deployment platform.
  • Basics of Haskell A gentle introduction to Haskell for beginners….
  • Introduction to Haskell A basic introduction to Haskell based on a half-credit course (CIS 194) taught at the University of Pennsylvania.
  • Text manipulation A collection of tutorials on processing text – parsing structured forms, etc.
  • Random numbers in Haskell A look at how to use System.Random
  • Database access A tutorial covering database usage from Haskell with persistent-db.
  • Beautiful Concurrency ## Beautiful concurrency appeared in [Beautiful code](http://shop.oreilly.com/product/9780596510046.do)…
  • Basics of Yesod A gentle introduction to a Haskell web framework for beginners (no Haskell required)
  • Advanced Haskell Articles and tutorials for advanced Haskell programmers
  • Haskell Fast & Hard The SoH Version of Haskell Fast & Hard tutorial. From very beginner up to Monads in a very short and dense tutorial….

Interested in Haskell or functional programming? This is a site to re-visit on a regular basis.

July 16, 2013

Haskell Tutorial

Filed under: Functional Programming,Haskell — Patrick Durusau @ 4:52 pm

Haskell Tutorial by Conrad Barski, M.D.

From the post:

There’s other tutorials out there, but you’ll like this one the best for sure: You can just cut and paste the code from this tutorial bit by bit, and in the process, your new program will create magically create more and more cool graphics along the way… The final program will have less than 100 lines of Haskell[1] and will organize a mass picnic in an arbitrarily-shaped public park map and will print pretty pictures showing where everyone should sit! (Here’s what the final product will look like, if you’re curious…)

The code in this tutorial is a simplified version of the code I’m using to organize flash mob picnics for my art project, picnicmob… Be sure to check out the site and sign up if you live in one of the cities we’re starting off with 🙂

Could be a model for a topic maps tutorial. On the technical parts.

Sam Hunting mentioned quite recently that topic maps lacks the equivalent of nsgmls.

A command line app that takes input and gives you back output.

Doesn’t have to be a command line app but certainly should support cut-n-paste with predictable results.

Which is how most people learn HTML.

Something to keep in mind.

July 15, 2013

Purely Functional Data Structures in Clojure: Red-Black Trees

Filed under: Clojure,Functional Programming,Haskell — Patrick Durusau @ 3:34 pm

Purely Functional Data Structures in Clojure: Red-Black Trees by Leonardo Borges.

From the post:

Recently I had some free time to come back to Purely Functional Data Structures and implement a new data structure: Red-black trees.

Leonard continues his work on Chris Okasaki’s Purely Functional Data Structures.

Is a functional approach required for topic maps to move beyond being static digital artifacts?

July 7, 2013

wxHaskell

Filed under: Functional Programming,Graphics,Haskell — Patrick Durusau @ 3:21 pm

wxHaskell: A Portable and Concise GUI Library for Haskell by Daan Leijen.

Abstract:

wxHaskell is a graphical user interface (GUI) library for Haskell that is built on wxWidgets: a free industrial strength GUI library for C++ that has been ported to all major platforms, including Windows, Gtk, and MacOS X. In contrast with many other libraries, wxWidgets retains the native look-and-feel of each particular platform. We show how distinctive features of Haskell, like parametric polymorphism, higher-order functions, and first-class computations, can be used to present a concise and elegant monadic interface for portable GUI programs.

Complete your Haskell topic map app with a Haskell based GUI!

June 27, 2013

GHCJS introduction – Concurrent Haskell in the browser

Filed under: Concurrent Programming,Functional Programming,Haskell — Patrick Durusau @ 6:17 pm

GHCJS introduction – Concurrent Haskell in the browser by Luite Stegeman.

From the post:

After many months of hard work, we are finally ready to show you the new version of GHCJS. Our goal is to provide a full-featured Haskell runtime in the browser, with features like threading, exceptions, weak references and STM, allowing you to run existing libraries with minimal modification. In addition we have some JavaScript-specific features to make communication with the JS world more convenient. GHCJS uses its own package database and comes with Cabal and Template Haskell support.

The new version (gen2) is almost a ground-up rewrite of the older (trampoline/plain) versions. We built on our experience with the trampoline code generator, by Victor Nazarov and Hamish Mackenzie. The most important changes are that we now use regular JavaScript objects to store Haskell heap objects (instead of JS closures), and that we have switched to explicit stacks in a JavaScript array. This helps reduce the amount of memory allocation considerably, making the resulting code run much faster. GHCJS now uses Gershom Bazerman’s JMacro library for generating JavaScript and for the Foreign Function Interface.

This post is a practical introduction to get started with GHCJS. Even though the compiler mostly works now, it’s far from finished. We’d love to hear some feedback from users and get some help preparing libraries for GHCJS before we make our first official release (planned to coincide with the GHC 7.8 release). I have listed some fun projects that you can help us with at the end of this post. Join #ghcjs on freenode for discussion with the developers and other users.

Functional programming in your browser.

June 12, 2013

Anatomy of Programming Languages

Filed under: Functional Programming,Haskell,Programming — Patrick Durusau @ 11:14 am

Anatomy of Programming Languages by William R. Cook.

From the Introduction:

In order to understand programming languages, it is useful to spend some time thinking about languages in general. Usually we treat language like the air we breathe: it is everywhere but it is invisible. I say that language is invisible because we are usually more focused on the message, or the content, that is being conveyed than on the structure and mechanisms of the language itself. Even when we focus on our use of language, for example in writing a paper or a poem, we are still mostly focused on the message we want to convey, while working with (or struggling with) the rules and vocabulary of the language as a given set of constraints. The goal is to work around and avoid problems. A good language is invisible, allowing us to speak and write our intent clearly and creatively.

The same is true for programming. Usually we have some important goal in mind when writing a program, and the programming language is a vehicle to achieve the goal. In some cases the language may fail us, by acting as an impediment or obstacle rather than an enabler. The normal reaction in such situations is to work around the problem and move on.

The study of language, including the study of programming languages, requires a different focus. We must examine the language itself, as an artifact. What are its rules? What is the vocabulary? How do different parts of the language work together to convey meaning? A user of a language has an implicit understanding of answers to these questions. But to really study language we must create an explicit description of the answers to these questions.

The concepts of structure and meaning have technical names. The structure of a language is called its syntax. The rules that defined the meaning of a language are called semantics. Syntax is a particular way to structure information, while semantics can be viewed as a mapping from syntax to its meaning, or interpretation. The meaning of a program is usually some form of behavior, because programs do things. Fortunately, as programmers we are adept at describing the structure of information, and at creating mappings between different kinds of information and behaviors. This is what data structures and functions/procedures are for.

Thus the primary technique in these notes is to use programming to study programming languages. In other words, we will write programs to represent and manipulate programs. One general term for this activity is metaprogramming. A metaprogram is any program whose input or output is a program. Familiar examples of metaprograms include compilers, interpreters, virtual machines. In this course we will read, write and discuss many metaprograms.

I have only started to read this book but to say:

A good language is invisible, allowing us to speak and write our intent clearly and creatively.

May describe a good quality for a language but it is also the source of much difficulty.

Our use of a word may be perfectly clear to us but that does not mean it is clear to others.

For example:

Verbal Confusion

Wood you believe that I didn’t no
About homophones until too daze ago?
That day in hour class in groups of for,
We had to come up with won or more.

Mary new six; enough to pass,
But my ate homophones lead the class.
Then a thought ran threw my head,
”Urn a living from homophones,” it said.

I guess I just sat and staired into space.
My hole life seamed to fall into place.
Our school’s principle happened to come buy,
And asked about the look in my I.

“Sir,” said I as bowled as could bee,
My future roll I clearly see.”
“Sun,” said he, “move write ahead,
Set sail on your coarse, Don’t be mislead.”

I herd that gnus with grate delight.
I will study homophones both day and knight,
For weaks and months, through thick oar thin,
I’ll pursue my goal. Eye no aisle win.

—George E. Coon
The Reading Teacher, April, 1976

I first saw this at Verbal Confusion.

June 11, 2013

The Pragmatic Haskeller, Episode 5 – Let’s Write a DSL!

Filed under: DSL,Functional Programming,Haskell — Patrick Durusau @ 1:26 pm

The Pragmatic Haskeller, Episode 5 – Let’s Write a DSL! by Alfredo Di Napoli.

From the post:

Good morning everyone,

after a small break let’s resume our journey into the pragmatic world of the “Pragmatic Haskeller” series, this time exploring Parsec, a combinators library which will allow us to write a domain specific language to describe recipes.

We’ll see how Haskell type safety makes the process a breeze, and as a nice side effect (pun intended), our parser will be less than 100 SLOC! What are you waiting for? The code and the full disclosure is hosted once again on “The School of Haskell”, so that I can provide the reader with interactive examples:

https://www.fpcomplete.com/user/adinapoli/the-pragmatic-haskeller/episode-5-a-simple-dsl

Very cool!

Alfredo challenges you to find a bug in the data structure.

My challenge would be how do we reconcile DSLs with the same subjects but different tokens to represent them?

June 6, 2013

Speeding Through Haskell

Filed under: Functional Programming,Haskell — Patrick Durusau @ 7:54 am

Speeding Through Haskell: With Example Code by Mihai-Radu Popescu.

A work in progress (at 87 pages) with a breezy writing style and lots of examples.

Only available in PDF format.

Unfortunate because adding your own notes as you work through the examples would make it more valuable to you. There would be the issue of migrating your notes to a later version, a problem that remains after 20+ years of markup.

The download page is in Spanish but the text is in English.

Either download link returns the same content, one as a .zip file containing the PDF file and the other as a PDF file.

How would you solve the note migration issue?

I first saw this in a tweet by CompSciFact.

April 29, 2013

The Pragmatic Haskeller, Episode 4 – Recipe Puppy

Filed under: DSL,Haskell — Patrick Durusau @ 4:59 am

The Pragmatic Haskeller, Episode 4 – Recipe Puppy by Alfredo Di Napoli.

From the post:

Now we have our webapp that can read json from the outside world and store them inside MongoDB. But during my daily job what I usually need to do is to talk to some REST service and get, manipulate and store some arbitrary JSON. Fortunately for us, Haskell and its rich, high-quality libraries ecosystem makes the process a breeze.

Alfredo continues his series on building a basis web app in Haskell.

Promises a small DSL for describing recipes in the next espisode.

Which reminds me to ask, is anyone using a DSL to enable users to compose domain specific topic maps?

That is we say topic, scope, association, occurrence, etc. only because that is our vocabulary for topic maps.

No particular reason why everyone has to use those names in composing a topic map.

For a recipe topic map the user might see: recipe (topic), ingredient (topics), ordered instructions (occurrences), measurements, with associations being implied between the recipe and ingredients and between ingredients and measurements, along with role types, etc.

To a topic map processor, all of those terms are treated as topic map information items but renamed for presentation to end users.

If you select an ingredient, say fresh tomatoes in the salads category, it displays other recipes that also use fresh tomatoes.

How it does that need not trouble the author or the end user.

Yes?

April 21, 2013

The Pragmatic Haskeller – Episode 2 & 3

Filed under: Haskell — Patrick Durusau @ 3:30 pm

The Pragmatic Haskeller – Episode 2 – Snap by Alfredo Di Napoli.

Using Snap, this episode gets a minimal web app up and running.

The Pragmatic Haskeller – Episode 3 – Configurator by Alfredo Di Napoli.

Eliminates the hard coding of configuration information.

Here’s a semantic question for you:

If hard coding configuration information is bad practice, why is it acceptable to hard code semantics?

April 7, 2013

The Pragmatic Haskeller – Episode 1

Filed under: Functional Programming,Haskell,JSON — Patrick Durusau @ 2:40 pm

The Pragmatic Haskeller – Episode 1 by Alfredo Di Napoli.

The first episode of “The Pragmatic Haskeller” starts with:

In the beginning was XML, and then JSON.

When I read that sort of thing, it is hard to know whether to weep or pitch a fit.

Neither one is terribly productive but if you are interested in the rich heritage that XML relies upon drop me a line.

The first lesson is a flying start on Haskell data and moving it between JSON and XML fomats.

April 6, 2013

The Pragmatic Haskeller

Filed under: Haskell,Programming — Patrick Durusau @ 6:30 pm

Announcing The Pragmatic Haskeller by Alfredo Di Napoli.

From the post:

We are working programmers. Even though we are carried away by the beauty and formalism of functional languages, at the end of the day we still need to get the job done. The Haskell community has been accused during the years of navel gazing, and usually the misconception is that “Haskell is an academic language, but you can’t tackle real world problem with it”.

Despite internet is full of fantastic resources for learning Haskell (including the awesome and recently-released School of Haskell) I wanted to use a peculiar approach: I tried to create a web application in a similar fashion of what I would have done during my everyday job in Scala, to see if I was able to replicate a large subset of the features normally present in my Scala apps. Not only was the experiment a success, but I finally had the chance of experimenting with a lot of cool libraries which were in my “to-play-with-list” for a while. So without further ado I’m happy to announce The Pragmatic Haskeller, a collection of small building blocks for creating a full-fledged webapp:

https://github.com/cakesolutions/the-pragmatic-haskeller

As you might notice, we have a lot of small subfolders. Each folder is a self-contained, working, incremental example experimenting with a new library or technique. Even though you could rush and play with each app all at once, I aim to write a dedicated blog post to each sub-project, introducing the used library, in a similar way of what Oliver Charles did with 24 days of Hackage, with the difference we’ll use the same example episode after episode, until transforming our naive bunch of modules into a complete app.

If the future of big data is with functional programming, where’s yours?

March 30, 2013

Parallel and Concurrent Programming in Haskell

Filed under: Concurrent Programming,Haskell,Parallel Programming — Patrick Durusau @ 6:48 pm

Parallel and Concurrent Programming in Haskell by Simon Marlow.

From the introduction:

While most programming languages nowadays provide some form of concurrent or parallel programming facilities, very few provide as wide a range as Haskell. Haskell prides itself on having the right tool for the job, for as many jobs as possible. If a job is discovered for which there isn’t already a good tool, Haskell’s typical response is to invent a new tool. Haskell’s abstraction facilities provide a fertile ground on which to experiment with different programming idioms, and that is exactly what has happened in the space of concurrent and parallel programming.

Is this a good or a bad thing? You certainly can get away with just one way of writing concurrent programs: threads and locks are in principle all you need. But as the programming community has begun to realise over the last few years, threads and locks are not the right tool for most jobs. Programming with them requires a high degree of expertise even for simple tasks, and leads to programs that have hard-to-diagnose faults.

So in Haskell we embrace the idea that different problems require different tools, and we provide the programmer with a rich selection to choose from. The inevitable downside is that there is a lot to learn, and that is what this book is all about.

In this book I will discuss how to write parallel and concurrent programs in Haskell, ranging from the simple uses of parallelism to speed up computation-heavy programs, to the use of lightweight threads for writing high-speed concurrent network servers. Along the way we’ll see how to use Haskell to write programs that run on the powerful processor in a modern graphics card (GPU), and to write programs that can run on multiple machines in a network (distributed programming).

In O’Reilly’s Open Feedback Publishing System.

If you really want to learn something, write a book about it, edit a book about it or teach a class about it.

Here’s your chance for #2.

Read carefully!

I first saw this in Christophe Lalanne’s A bag of tweets / March 2013.

February 24, 2013

Purely Functional Data Structures in Clojure: Leftist Heaps

Filed under: Clojure,Functional Programming,Haskell — Patrick Durusau @ 6:01 pm

Purely Functional Data Structures in Clojure: Leftist Heaps by Leonardo Borges.

From the post:

Last year I started reading a book called Purely Functional Data Structures. It’s a fascinating book and if you’ve ever wondered how Clojure’s persistent data structures work, it’s mandatory reading.

However, all code samples in the book are written in ML – with Haskell versions in the end of the book. This means I got stuck in Chapter 3, where the ML snippets start.

I had no clue about Haskell’s – much less ML’s! – syntax and I was finding it very difficult to follow along. What I did notice is that their syntaxes are not so different from each other.

So I put the book down and read Learn You a Haskell For Great Good! with the hopes that learning more about haskell’s syntax – in particular, learning how to read its type signatures – would help me get going with Puretly Functional Data Structures.

Luckily, I was right – and I recommend you do the same if you’re not familiar with either of those languages. Learn You a Haskell For Great Good! is a great book and I got a lot out of it. My series on Monads is a product of reading it.

Enough background though.

The purpose of this post is two-fold: One is to share the github repository I created and that will contain the Clojure versions of the data structures in the book as well as most solutions to the exercises – or at least as many as my time-poor life allows me to implement.

The other is to walk you through some of the code and get a discussion going. Hopefully we will all learn something – as I certainly have when implementing these. Today, we’ll start with Leftist Heaps.

This sounds like a wonderful resource in the making!

I first saw this at Christophe Lalanne’s A bag of tweets / February 2013.

January 28, 2013

Hoopl (Dataflow and Haskell)

Filed under: Functional Programming,Haskell — Patrick Durusau @ 1:20 pm

Hoopl: Dataflow Optimization Made Simple by Norman Ramsey, JoĂŁo Dias, and Simon Peyton Jones.

Abstract:

We present Hoopl, a Haskell library that makes it easy for compiler writers to implement program transformations based on dataflow analyses. The compiler writer must identify (a) logical assertions on which the transformation will be based; (b) a representation of such assertions, which should form a lattice of finite height; (c) transfer functions that approximate weakest preconditions or strongest postconditions over the assertions; and (d) rewrite functions whose soundness is justified by the assertions. Hoopl uses the algorithm of Lerner, Grove, and Chambers (2002), which can compose very simple analyses and transformations in a way that achieves the same precision as complex, handwritten “super-analyses.” Hoopl will be the workhorse of a new back end for the Glasgow Haskell Compiler (version 6.12, forthcoming).

Superceded by later work but recommended by the authors as a fuller introduction to Hoopl.

The superceding work, Hoopl: A Modular, Reusable Library for Dataflow Analysis and Transformation, has the following abstract:

Dataflow analysis and transformation of control-flow graphs is pervasive in optimizing compilers, but it is typically tightly interwoven with the details of a particular compiler. We describe Hoopl, a reusable Haskell library that makes it unusually easy to define new analyses and transformations for any compiler. Hoopl’s interface is modular and polymorphic, and it offers unusually strong static guarantees. The implementation encapsulates state-of-the-art algorithms (interleaved analysis and rewriting, dynamic error isolation), and it cleanly separates their tricky elements so that they can be understood independently.

I started with the later work. Better read in the order presented here.

December 5, 2012

PragPub #42, December 2012

Filed under: Haskell,Programming — Patrick Durusau @ 3:48 pm


PragPub #42, December 2012 as HTML PDF epub mobi

Where you will find:

Web Programming in Haskell, Part One by Paul Callaghan.

The next few articles in this series on the Haskell language will look at web programming via Haskell. Web programming is supported in various ways, from low-level libraries for the basic operations like communicating over http and creation of html documents, up to sophisticated frameworks for building apps and performant web servers for running the apps. January’s article will look at the frameworks, primarily Yesod [U1]. This article will look at Fay [U2], which is a Haskell alternative to CoffeeScript.

Replicating the libraries and frameworks of other languages is not too difficult. The interesting question—following a key theme of this series of articles—is how we can use Haskell’s facilities to improve the experience of web programming. For example, less coding and better maintainability via more powerful abstractions, more safety through using the language style and type system to avoid certain problems, or even improved performance by supporting certain kinds of optimization behind the scenes. Even more interesting is to understand the cases and phenomena where Haskell isn’t enough and where more powerful techniques, like dependent types, might provide additional leverage.

The closer web browsers approach being the default app interface, the more important they become for delivery of topic maps.

This issue of PragPub, as always, has several items you will find interesting.

An upcoming issue will have a Raspberry Pi project.

Enjoy!

September 8, 2012

Bioinformatics Tools in Haskell

Filed under: Bioinformatics,Haskell — Patrick Durusau @ 3:46 pm

Bioinformatics Tools in Haskell by Udo Stenzel.

From the post:

This is a collection of miscellaneous stuff that deals mostly with high-throughput sequencing data. I took some of my throw-away scripts that had developed a life of their own, separated out a library, and cleaned up the rest. Everything is licensed under the GPL and naturally comes without any warranty.

Most of the stuff here is written in Haskell. The natural way to run these programs is to install the Haskell Platform, which may be as easy as running ‘apt-get install haskell-platform‘, e.g. on Debian Testing aka “Squeeze”. Instead, you can install\ the Glasgow Haskell Compiler and Cabal individually. After that, download, unpack and ‘cabal install‘ Biohazard first, then install whatever else you need.

If you don’t want to become a Haskell programmer (you really should), you can still download the binary packages (for Linux on ix86_64) and hope that they work. You’ll probably need to install Gnu MP (‘apt-get install libgmp-dev‘ might do it). If the binaries don’t work for you, I don’t care; use the source instead.

Good for bioinformatics and I suspect for learning Haskell in high-throughput situations.

Speculation: How will processing change when there is only “high-throughput data streams?”

That is there isn’t any “going back” to find legacy data, you just wait for it to reappear in the stream?

Or if there were streams of “basic” data that doesn’t change much along with other data streams that are “new” or rapidly changing data.

If that sounds wasteful of bandwidth, imagine if bandwidth were to increase at the same rate as local storage? So that your incoming data connection is 1 TB or higher at your home computer.

Would you really need local storage at all?

September 7, 2012

Thinking Functionally with Haskell: Types? Tests? We Need a New Word

Filed under: Functional Programming,Haskell — Patrick Durusau @ 1:42 pm

Thinking Functionally with Haskell: Types? Tests? We Need a New Word by Paul Callaghan.

From the post:

In which we explore what modern type systems bring to the table.

Imagine an approach to programming where you write down some description of what your code should do, then before running your code you run some automatic tool to see if the code matches the description. That’s Test-driven development, you say!

Actually, this is what you are doing when you use static types in most languages too. Types are a description of the code’s inputs and outputs, and the check ensures that inputs and outputs match up and are used consistently. Modern type systems—such as in Haskell or above—are very flexible, and allow these descriptions to be quite detailed; plus they are not too obtrusive in use and often very helpful.

One point I’ll investigate here is how advances in types are converging with new ideas on testing, to the point where (I claim) the old distinctions are starting to blur and starting to open up exciting new possibilities—hence my suggestion that we need a new word to describe what we’re doing that is free from preconceptions and out-dated thinking.

So put aside your bad experiences from Java, and prepare to be amazed!

I suppose we should all wish Paul luck on finding words that are “…free from preconceptions and out-dated thinking.”;-)

It has been my experience that “new” words replace “[existing] preconceptions and out-dated thinking,” with “[different] preconceptions and out-dated thinking.”

Not a bad thing but let’s be honest that we are contending for different preconceptions and assumptions as opposed to having none at all.

Has the potential to make us less resistant when some (then) younger programming generation wants to overturn “…preconceptions and out-dated thinking.”

If you haven’t kept up with type theory, you should spend some time with Paul’s post. Maybe suggest a new word or two.

August 5, 2012

Thinking Functionally with Haskell [Privileging Users or System Designers]

Filed under: Functional Programming,Haskell — Patrick Durusau @ 4:36 pm

Thinking Functionally with Haskell by Paul Callaghan.

From the post:

In which we begin an exploration into the Haskell language and dive deeply into functional programming.

Ever wondered how functional programmers think? I aim to give you a glimpse into the programming style and mindset of experienced functional programmers, so you can see why we are so passionate about what we do. We’ll also discuss some wider ideas about programming, such as making our languages fit the problem and not the other way round, and how this affects language design.

Few of these ideas get the exposure they deserve in textbooks or tutorials, and in my view they are essential for coming to grips with a functional language and using it productively in real apps.

Syntax and semantics, the meat and veg of most books and university courses, are ok for basic language use, but to really master a language that embodies a paradigm that is new to you, you need to know about the deeper pragmatic ideas. Let’s see if we can do something about that.

I used Lisp for a few years before university, then switched to Haskell and have been using it for around 20 years. However, inspired by learning about Rails and Ruby when revamping a tired web technology course, I changed career to do full-time Rails work, and have spent the last four years having fun on a variety of apps, including Spree (#2 committer at one point) and recently a big bespoke lab management system.

Ruby feels like naughty fun for a Haskell programmer. Many of the ideas are very similar, like the very natural use of blocks and lambdas and having lots of scope for bending the rules. I really enjoy programming in Ruby, though some times I do get homesick and pine for a bit more oomph.

Most of this article will refer to Haskell, though many of the ideas do apply to other, similar languages as well. Haskell has a few advantages and a good balance of features. Haskell has its weaknesses too, and I hope to explore these in due course.

I rather like the “…making our languages fit the problem and not the other way round…” phrase.

Or to phrase it for topic maps: “….taking subject identity as defined by users, not defining it for them….”

Perhaps I should ask: Do you want to privilege users or system designers?

August 4, 2012

Graph-rewriting Package

Filed under: Graphs,Haskell,Rewriting — Patrick Durusau @ 3:32 pm

Graph-rewriting Package

A Haskell based graph rewriting package I encountered recently.

You can find more information at Jon Rachel’s webpage. And the Wikipedia page on graph rewriting. (The Wikipedia page also has pointers to a number of graph rewriting software packages.)

For the definition of port graph grammars, see Charles Stewart, Reducibility Between Classes of Port Graph Grammar (2001).

February 20, 2012

Solving the Queens Problem with Haskell

Filed under: Algorithms,Haskell — Patrick Durusau @ 8:35 pm

Solving the Queens Problem with Haskell

From the post:

The eight queens puzzle is a classic problem in algorithm design because it showcases the power of backtracking and recursion. The premise is simple: find a way to place 8 queens on an 8Ă—8 board such that none of them are attacking each other, which means that no two queens can share the same row, column, or diagonal.

Sounds simple enough, but how to implement it? The most basic solution would be to brute force it: try every possible configuration, stopping when a valid one is found. Not very efficient, but hey, at least it’s easy to understand.

A good illustration of recursion and backtracking but also suggests that brute force isn’t the best option for authoring or manipulating topic maps.

A deep understanding of your data, relevant subjects, methods for identifying those subjects, etc., will be more useful than brute force.

December 26, 2011

Haskell – New Release

Filed under: Haskell — Patrick Durusau @ 8:23 pm

Haskell – New Release

Current stable release: 2011.4.0.0 (December 2011) – Download today!

December 4, 2011

Translating math into code with examples in Java, Racket, Haskell and Python

Filed under: Haskell,Java,Mathematics,Python — Patrick Durusau @ 8:17 pm

Translating math into code with examples in Java, Racket, Haskell and Python by Matthew Might.

Any page that claims Okasaki’s Purely Functional Data Structures as an “essential reference” has to be interesting.

And…, it turns out to be very interesting!

If I have a complaint, it is that it ended too soon! See what you think.

October 17, 2011

“Value polymorphism”, simple explanation with examples

Filed under: Haskell — Patrick Durusau @ 6:42 pm

“Value polymorphism”, simple explanation with examples

At first I thought this would be a post that would interest only one topic map person that I know. But upon reading the entire post, I decided it might interest two.

What pushed me over the edge was:

Thus by merely specifying the return type we have effectively generated a parser. An invalid string will produce an error:

That is a very powerful mechanism to use with processing values returned in processing a topic map (or data about to be included in a topic map).

October 11, 2011

Hoogle

Filed under: Haskell,Programming — Patrick Durusau @ 5:54 pm

Hoogle

From the webpage:

Hoogle is a Haskell API search engine, which allows you to search many standard Haskell libraries by either function name, or by approximate type signature.

[example searches omitted]

The Hoogle manual contains more details, including further details on search queries, how to install Hoogle as a command line application and how to integrate Hoogle with Firefox/Emacs/Vim etc.

Just in case you missed the reference in our post on Scalex (a similar interface for Scala).

Oh, Hoogle enables searching by “…function name, or by approximate type signature.”

What other searches you would like to perform?

How would you implement those searches? (by what kind of indexing including software to be used) Care to do that as a project to contribute back to the community?

Do you think topic maps could improve this resource? In what way?

October 7, 2011

Deterministic Parallel Programming in Haskell

Filed under: Haskell,Parallelism — Patrick Durusau @ 6:18 pm

Deterministic Parallel Programming in Haskell by Andres Löaut;h (pdf)

The bundle for the tutorial with slides, source code and exercises: http://www.well-typed.com/Hal6/Hal6.zip.

Very interesting slide deck on parallel programming in Haskell but you will also learn about parallelism in general.

Whether needed or not, you have to admit it is a current marketing phrase.

October 3, 2011

Write Yourself a Scheme in 48 Hours

Filed under: Functional Programming,Haskell,Scheme — Patrick Durusau @ 7:08 pm

Write Yourself a Scheme in 48 Hours

From the webpage:

Most Haskell tutorials on the web seem to take a language-reference-manual approach to teaching. They show you the syntax of the language, a few language constructs, and then have you construct a few simple functions at the interactive prompt. The “hard stuff” of how to write a functioning, useful program is left to the end, or sometimes omitted entirely.

This tutorial takes a different tack. You’ll start off with command-line arguments and parsing, and progress to writing a fully-functional Scheme interpreter that implements a good-sized subset of R5RS Scheme. Along the way, you’ll learn Haskell’s I/O, mutable state, dynamic typing, error handling, and parsing features. By the time you finish, you should be fairly fluent in both Haskell and Scheme.

Functional programming is gaining ground. Are you?

« Newer PostsOlder Posts »

Powered by WordPress