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

December 17, 2013

Functional data structures in JavaScript with Mori

Filed under: Functional Programming,Javascript — Patrick Durusau @ 1:47 pm

Functional data structures in JavaScript with Mori by Jesse Hallett.

From the post:

I have a long-standing desire for a JavaScript library that provides good implementations of functional data structures. Recently I found Mori, and I think that it may be just the library that I have been looking for. Mori packages data structures from the Clojure standard library for use in JavaScript code.

Functional Data Structures

A functional data structure (also called a persistent data structure) has two important qualities: it is immutable and it can be updated by creating a copy with modifications (copy-on-write). Creating copies should be nearly as cheap as modifying a comparable mutable data structure in place. This is achieved with structural sharing: pointers to unchanged portions of a structure are shared between copies so that memory need only be allocated for changed portions of the data structure.

A simple example is a linked list. A linked list is an object, specifically a list node, with a value and a pointer to the next list node, which points to the next list node. (Eventually you get to the end of the list where there is a node that points to the empty list.) Prepending an element to the front of such a list is a constant-time operation: you just create a new list element with a pointer to the start of the existing list. When lists are immutable there is no need to actually copy the original list. Removing an element from the front of a list is also a constant-time operation: you just return a pointer to the second element of the list….

Just in case you want to start practicing your functional programming in JavaScript.

I first saw this in Christophe Lalanne’s Bag of Tweets for November 2013.

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.

December 3, 2013

Of Algebirds, Monoids, Monads, …

Filed under: BigData,Data Analysis,Functional Programming,Hadoop,Scala,Storm — Patrick Durusau @ 2:50 pm

Of Algebirds, Monoids, Monads, and Other Bestiary for Large-Scale Data Analytics by Michael G. Noll.

From the post:

Have you ever asked yourself what monoids and monads are, and particularly why they seem to be so attractive in the field of large-scale data processing? Twitter recently open-sourced Algebird, which provides you with a JVM library to work with such algebraic data structures. Algebird is already being used in Big Data tools such as Scalding and SummingBird, which means you can use Algebird as a mechanism to plug your own data structures – e.g. Bloom filters, HyperLogLog – directly into large-scale data processing platforms such as Hadoop and Storm. In this post I will show you how to get started with Algebird, introduce you to monoids and monads, and address the question why you get interested in those in the first place.

Goal of this article

The main goal of this is article is to spark your curiosity and motivation for Algebird and the concepts of monoid, monads, and category theory in general. In other words, I want to address the questions “What’s the big deal? Why should I care? And how can these theoretical concepts help me in my daily work?”

You can call this a “blog post” but I rarely see blog posts with a table of contents! 😉

The post should come with a warning: May require substantial time to read, digest, understand.

Just so you know, I was hooked by this paragraph early on:

So let me use a different example because adding Int values is indeed trivial. Imagine that you are working on large-scale data analytics that make heavy use of Bloom filters. Your applications are based on highly-parallel tools such as Hadoop or Storm, and they create and work with many such Bloom filters in parallel. Now the money question is: How do you combine or add two Bloom filters in an easy way?

Are you motivated?

I first saw this in a tweet by CompSciFact.

November 30, 2013

RELEASE

Filed under: Erlang,Functional Programming — Patrick Durusau @ 7:31 pm

RELEASE A High-Level Paradigm for Reliable Large-Scale Server Software.

From the webpage:

RELEASE is an EU FP7 STREP (287510) project that aims to scale the radical concurrency-oriented programming paradigm to build reliable general-purpose software, such as server-based systems, on massively parallel machines. The trend-setting language we will use is Erlang/OTP which has concurrency and robustness designed in. Currently Erlang/OTP has inherently scalable computation and reliability models, but in practice scalability is constrained by aspects of the language and virtual machine. Moreover existing profiling and debugging tools don’t scale.

I found the project after following a lead to:

The Design of Scalable Distributed Erlang N. Chechina, P. Trinder, A. Ghaffari, R. Green, K. Lundin, and R. Virding. Symposium on Implementation and Application of Functional Languages 2012 (IFL’12), Oxford, UK, 2012 (Submitted).

Abstract:

The multicore revolution means that the number of cores in commodity machines is growing exponentially. Many expect 100,000 core clouds (or platforms) to become commonplace, and the best predictions are that core failures on such an architecture will become relatively common, perhaps one hour mean time between core failures. The RELEASE project aims to scale Erlang to build reliable general-purpose software, such as server-based systems, on massively parallel machines. In this paper we present a design of Scalable Distributed (SD) Erlang — an extension of the Distributed Erlang functional programming language for reliable scalability. The design focuses on three aspects of Erlang scalability: scaling the number of Erlang nodes by eliminating transitive connections and introducing scalable groups (s groups); managing process placement in the scaled networks by introducing semi-explicit process placement; and preserving Erlang reliability model.

You might also want to read Simon St. Laurent’s Distributed resilience with functional programming, an interview with Steve Vinoski.

November 29, 2013

Overtone 0.9.0

Filed under: Clojure,Functional Programming,Mathematics,Music,Music Retrieval — Patrick Durusau @ 9:24 pm

Overtone 0.9.0

From the webpage:

Overtone is an Open Source toolkit for designing synthesizers and collaborating with music. It provides:

  • A Clojure API to the SuperCollider synthesis engine
  • A growing library of musical functions (scales, chords, rhythms, arpeggiators, etc.)
  • Metronome and timing system to support live-programming and sequencing
  • Plug and play MIDI device I/O
  • A full Open Sound Control (OSC) client and server implementation.
  • Pre-cache – a system for locally caching external assets such as .wav files
  • An API for querying and fetching sounds from http://freesound.org
  • A global concurrent event stream

When I saw the announcement for Overtone 0.9.0 I was reminded it was almost a year ago that I posted: Functional Composition [Overtone/Clojure].

Hard to say if Overtone will be of more interest to musicians who want to learn functional programming or functional programmers who want a deeper understanding of music or people for who the usual baseball, book publishing, web pages, etc., examples just don’t cut it. 😉

While looking for holiday music for Overtone, I did stumble across:

Music: a Mathematical Offering by Dave Benson.

At over 500 pages, this living text is also for sale in hard copy by Cambridge University Press. Do us all a favor and if the electronic version proves useful to you, ask your library to order a hard copy. And/or recommend it to others. That will encourage presses to continue to allow electronic versions of hard copy materials to circulate freely.

If you are interested in the mathematics that underlie music or need to know more for use in music retrieval, this is a good place to start.

I struck out on finding Christmas music written with Overtone.

I did find this video:

I would deeply appreciate a pointer to Christmas music with or for Overtone.

Thanks!


Update: @Overtone tweeted this link for Christmas music: …/overtone/examples/compositions/bells.clj.

Others?

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!

November 2, 2013

RICON West 2013! (video streams)

Filed under: Functional Programming,Riak — Patrick Durusau @ 5:59 pm

RICON West 2013! (video streams)

Presentation by presentation editing is underway but you can duplicate the conference experience at your own terminal!

Day 1 and 2, both tracks are ready for your viewing!

True, it’s not interactive but here you can pause the speaker while you take a call or answer email. 😉

Enjoy!

Principles of Reactive Programming [4th of November]

Filed under: Akka,Functional Programming,Scala — Patrick Durusau @ 4:08 pm

Principles of Reactive Programming [4th of November]

Just in case U.S. government intercepts either prevented you from getting the news or erased data from your calendar, just a reminder that Principles of Reactive Programming starts next Monday and runs for seven (7) weeks.

Even though I am signed up for another course, I am tempted to add this one. Unlikely as two courses is a bit much at one time.

But will be watching the lectures later to prepare for the next time.

October 28, 2013

Series: The Neophyte’s Guide to Scala

Filed under: Functional Programming,Scala — Patrick Durusau @ 7:22 pm

Series: The Neophyte’s Guide to Scala

From the post:

Daniel Westheide (@kaffeecoder on twitter) has written a wonderful series of blog posts about Scala, including Akka towards the end. The individual articles are:

This series was published between Nov 21, 2012 and Apr 3, 2013 and Daniel has aggregated all content including an EPUB download here. Big kudos, way to go!

Excellent!

October 27, 2013

Erlang – Concurrent Language for Concurrent World

Filed under: Concurrent Programming,Erlang,Functional Programming — Patrick Durusau @ 6:23 pm

Erlang – Concurrent Language for Concurrent World by Zvi Avraham.

If you need to forward a “why Erlang” to a programmer, this set of slides should be near the top of your list.

It includes this quote from Joe Armstrong:

The world is concurrent… I could not drive the car, if I did not understand concurrency…”

Which makes me wonder: Do all the drivers I have seen in Atlanta understand concurrency?

That would really surprise me. 😉

The point should be that systems should be concurrent by their very nature, like the world around us.

Users should object when systems exhibit sequential behavior.

Modeling data with functional programming in R

Filed under: Data Models,Functional Programming,R — Patrick Durusau @ 4:20 pm

Modeling data with functional programming in R by Brain Lee Rowe.

From the post:

As some of you know, I’ve been writing a book (to be published by CRC Press/Chapman & Hall and released in late 2014) for the past year and a half. It’s one of those books that spans multiple disciplines so is both unique and also niche. In essence it’s a manifesto of sorts on using functional programming for mathematical modeling and analysis, which is based on my R package lambda.r. It spans the lambda calculus, traditional mathematical analysis, and set theory to 1) develop a mathematical model for the R language, and 2) show how to use this formalism to prove the equivalence of programs to their underlying model. I try to keep the book focused on applications, so I discuss financial trading systems, some NLP/document classification, and also web analytics.

The book started off as a more practical affair, but one thing that I’ve learned through this process is how to push ideas to the limit. So now it delves into quite a bit of theory, which makes it a more compelling read. In some ways it reminds me of ice climbing, where you’re scaling a waterfall and really pushing yourself in ways you didn’t think possible. Three chapters into the process, and it’s been that same combination of exhilarating challenge that results in conflicting thoughts racing through your head: “Holy crap — what am I doing?!” versus “This is so fun — wheeeee!” versus “I can’t believe I did it!”

Brain says some of the images, proofs and examples need work but that should not diminish your reading of the draft.

Do take the time to return comments while you are reading the draft.

Rowe – Modeling data with functional programming.

I first saw this in a tweet from StatFact.

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.

September 16, 2013

Principles of Reactive Programming [Nov. 2013]

Filed under: Functional Programming,Scala — Patrick Durusau @ 4:18 pm

Principles of Reactive Programming by Martin Odersky, Erik Meijer and Roland Kuhn.

From the webpage:

This is a follow-on for the Coursera class “Principles of Functional Programming in Scala”, which so far had more than 100’000 inscriptions over two iterations of the course, with some of the highest completion rates of any massive open online course worldwide.

The aim of the second course is to teach the principles of reactive programming. Reactive programming is an emerging discipline which combines concurrency and event-based and asynchronous systems. It is essential for writing any kind of web-service or distributed system and is also at the core of many high-performance concurrent systems. Reactive programming can be seen as a natural extension of higher-order functional programming to concurrent systems that deal with distributed state by coordinating and orchestrating asynchronous data streams exchanged by actors.

In this course you will discover key elements for writing reactive programs in a composable way. You will find out how to apply these building blocks in the construction of event-driven systems that are scalable and resilient.

The course is hands on; most units introduce short programs that serve as illustrations of important concepts and invite you to play with them, modifying and improving them. The course is complemented by a series of assignments, which are also programming projects.

Starts November 4, 2013 and last for seven weeks.

See the webpage for the syllabus, requirements, etc.

August 28, 2013

Functional Composition [Coding and Music]

Filed under: Clojure,Functional Programming,Music — Patrick Durusau @ 4:12 pm

Functional Composition by Chris Ford.

From the summary:

Chris Ford shows how to make music starting with the basic building block of sound, the sine wave, and gradually accumulating abstractions culminating in a canon by Johann Sebastian Bach.

You can grab the source on Github.

Truly a performance presentation!

Literally.

Chris not only plays music with an instrument, he also writes code to alter music as it is being played on a loop.

Steady hands if nothing else in front of a live audience!

Perhaps a great way to interest people in functional programming.

Certainly a great way to encode historical music that is hard to find performed.

August 11, 2013

Purely Functional Photoshop [Functional Topic Maps?]

Filed under: Erlang,Functional Programming,Topic Maps — Patrick Durusau @ 10:33 am

Purely Functional Photoshop by James Hague.

From the post:

One of the first things you learn about Photoshop—or any similarly styled image editor—is to use layers for everything. Don’t modify existing images if you can help it. If you have a photo of a house and want to do some virtual landscaping, put each tree in its own layer. Want to add some text labels? More layers.

The reason is straightforward: you’re keeping your options open. You can change the image without overwriting pixels in a destructive way. If you need to save out a version of the image without labels, just hide that layer first. Maybe it’s better if the labels are slightly translucent? Don’t change the text; set the opacity of the layer.

This stuff about non-destructive operations sounds like something from a functional programming tutorial. It’s easy to imagine how all this layer manipulation could look behind the scenes. Here’s a list of layers using Erlang notation:

A great illustration of one aspect of functional programming using something quite familiar, Photoshop.

Imagine a set of topics and associations prior to any merging rules being applied. In one of the standard topic map syntaxes.

Wouldn’t applying merging rules as layers provide greater flexibility to explore what merging rules work best for a data set?

And wouldn’t opacity of topics and associations, to particular users, be a useful security measure?

Am I wrong in thinking the equivalent of layers would be a good next step for topic maps?

August 6, 2013

PLOP – Place Oriented Programming

Filed under: Clojure,Functional Programming — Patrick Durusau @ 5:57 pm

The Value of Values by Rich Hickey.

Description:

Rich Hickey compares value-oriented programming with place-oriented programming concluding that the time of imperative languages has passed and it is the time of functional programming.

A deeply entertaining keynote by Rich Hickey on value based programming.

I do have a couple of quibbles, probably mostly terminology, with his presentation.

My first quibble is that Rich says that values are “semantically transparent.”

There are circumstances where that’s true but I would hesitate to make that claim for all values.

Remember that Egyptian hieroglyphs were “translated” centuries before the Rosetta Stone was found.

We don’t credit those earlier translations now but I don’t sense that a value can be “semantically transparent” (when written) and then become “semantically opaque” at some point and then return to “semantic transparency” at some future point.

How would we judge the “semantic transparency” of any value, simply upon receipt of the value?

If the Egyptian example seems a bit far fetched, what about the number 42?

In one context it meant: Year of the Consulship of Caesar and Piso.

In another context, it was the answer to the Ultimate Question of Life, the Universe, and Everything.

In another context, it was Jackie Robinson‘s number.

In yet another context, it is the natural number immediately following 41 and directly preceding 43 (Now there’s a useful definition.).

So I would say that values are not semantically transparent.

You?

My second quibble is with Rich’s definition of a fact to be: “an event or thing known to have happened or existed”

That is a very impoverished notion of what qualifies as a fact.

Like the topic map definition of a subject, I think a fact is anything a user chooses to record.

If on no other basis than some particular user claimed the existence of such a “fact.”

Rich closes with a quote from Aldous Huxley: “Facts do not cease to exist because they are ignored.”

I would paraphrase that to read: Facts do not cease to exist because of narrow definitions of “fact.”

Yes?

July 22, 2013

Clojure Documentation

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

Clojure Documentation

From the webpage:

Welcome to the community-driven documentation site for the Clojure programming language.

Read, use, contribute. What more could you want?

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 13, 2013

Transforming Log Events into Information

Filed under: ElasticSearch,Functional Programming,Log Analysis — Patrick Durusau @ 4:08 pm

Transforming Log Events into Information by Matthias Nehlsen.

From the post:

Last week I was dealing with an odd behavior of the chat application demo I was running for this article. The issue was timing-related and there were no actual exceptions that would have helped in identifying the problem. How are you going to even notice spikes and pauses in potentially thousands of lines in a logfile? I was upset, mostly with myself for not finding the issue earlier, and I promised myself to find a better tool. I needed a way to transform the raw logging data into useful information so I could first understand and then tackle the problem. In this article I will show what I have put together over the weekend. Part I describes the general approach and applies to any application out there, no matter what language or framework you are using. Part II describes one possible implementation of this approach using Play Framework.

Starting point for transforming selected log events into subjects represented by topics?

Not sure I would want to generate IRIs to identify the events as subjects, particularly since they already have identifiers in the log.

A broader processing model for the TAO should allow for the use of user defined identifiers.

What is the Latin for: User Beware? 😉

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 22, 2013

The Quipper Language [Quantum Computing]

Filed under: Computation,Computer Science,Functional Programming,Programming,Quantum — Patrick Durusau @ 5:26 pm

The Quipper Language

From the webpage:

Quipper is an embedded, scalable functional programming language for quantum computing. It provides, among other things:

  • A high-level circuit description language. This includes gate-by-gate descriptions of circuit fragments, as well as powerful operators for assembling and manipulating circuits.
  • A monadic semantics, allowing for a mixture of procedural and declarative programming styles.
  • Built-in facilities for automatic synthesis of reversible quantum circuits, including from classical code.
  • Support for hierarchical circuits.
  • Extensible quantum data types.
  • Programmable circuit transformers.
  • Support for three execution phases: compile time, circuit generation time, and circuit execution time. A dynamic lifting operation to allow circuit generation to be parametric on values generated at circuit execution time.
  • Extensive libraries of quantum functions, including: libraries for quantum integer and fixed-point arithmetic; the Quantum Fourier transform; an efficient Qram implementation; libraries for simulation of pseudo-classical circuits, Stabilizer circuits, and arbitrary circuits; libraries for exact and approximate decomposition of circuits into specific gate sets.

The website has a Quipper tutorial, online documentation and a detailed look at the language itself.

No link for a quantum computer but that isn’t very far off.

Learn Quipper now and perhaps you can lead the first Apache project to develop open source software for a quantum computer.

I first saw this in a tweet by Jose A. Alonso.

June 18, 2013

Functional Javascript

Filed under: Functional Programming,Javascript,Programming — Patrick Durusau @ 1:08 pm

Functional Javascript by Michael Fogus.

From the post:

After a seemingly endless journey, the publication of Functional JavaScript is complete and books have found their way into peoples’ homes. Below is a list of useful links related to the book:

Enjoy.

More summer reading material!

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.

May 31, 2013

Scala 2013 Overview

Filed under: Functional Programming,Programming,Scala — Patrick Durusau @ 10:09 am

Scala 2013 Overview by Sagie Davidovich.

An impressive set of slides on Scala.

Work through all of them and you won’t be a Scala expert but well on your way.

I first saw this at Nice Scala Tutorial by Danny Bickson.

May 19, 2013

Scala Resources & Community links for the newcomer

Filed under: Functional Programming,Scala — Patrick Durusau @ 3:14 pm

Scala Resources & Community links for the newcomer by Raúl Raja.

From the post:

During the last couple of months I have been asked a few times among colleagues and friends hot to get started with Scala. People come to Scala from diverse backgrounds such as… – Java folks looking for a better Java or just tired of waiting for Java features other modern languages such as C# already offer. – Ruby, PHP, and programmers that come from a scripting background looking for type safety. – People trying to bridge the best of both OOP and Functional paradigms. Scala is a vast language full of features with a very technical community. Don’t let your first step discourage you as you don’t need to know everything about Scala to become productive quickly. People in the mailing list will often talk about some crazy shit you don’t need to know just yet. Monads, Monoids, Combinators, Macros and things you may not even know how to pronounce,… Seriously guys as you start to learn about it it’s gonna blow your mind. It’s gonna take some time to digest all the info but it sure it’s worth it. Here is a few resources / steps may help you get started focused on its community and not so much on the technical details of downloading and running your first scala “hello world”

More than a collection to bookmark for “someday,” this is a collection of resources to start following today.

I haven’t looked at all the references but from the ones I checked, I don’t think you will be disappointed.

May 8, 2013

Bacon.js Tutorial Part I : Hacking With jQuery

Filed under: Functional Programming,Interface Research/Design — Patrick Durusau @ 1:58 pm

Bacon.js Tutorial Part I : Hacking With jQuery

From the post:

This is the first part of a hopefully upcoming series of postings intended as a Bacon.js tutorial. I’ll be building a fully functional, however simplified, AJAX registration form for an imaginary web site.

This material is based on my presentation/hands-on session at Reaktor Dev Day 2012 where I had to squeeze a Bacon.js intro and a coding session into less than an hour. I didn’t have much time to discuss the problem and jumped into the solution a bit too fast. This time I’ll first try to explain the problem I’m trying to solve with Bacon. So bear with me. Or have a look at the Full Solution first if you like.

A functional programming example that doesn’t start with theory.

How very odd. 😉

Other posts in this series:

Bacon.js Tutorial Part II: Get Started

Bacon.js Tutorial Part III : AJAX and Stuff

« Newer PostsOlder Posts »

Powered by WordPress