Let's Explore Programming Languages

The Pure language, introduced in 2008, is a Functional language aimed mostly at academic mathematical and scientific uses. It’s the successor to an earlier effort, Q, by the same author, Albert Gräf. Given its math roots, it has the expected equation-like syntax of a language like ML or Haskell. Here is an example of Euler1 in Pure:

// Euler1 in Pureusing system;

mySum (x:xs) = x + mySum xs;

euler1 n = mySum [x | x =..n; x mod 3==|| x mod 5==];

printf"%d\n" (euler1 999);

Pure has full support for functional operations. Here’s an example using the canonical functions mapfilter, and fold. Map’s only purpose here obviously is for illustration, since it returns itself. It also demonstrates use of lambda – an anonymous inline function using the \…

View original post 1,717 more words


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s