Profile

Cover photo
Jyri-Matti Lähteenmäki
Works at Solita Oy
Attended Tampere University of Technology
Lives in Kangasala, Finland
117 followers|49,785 views
AboutPostsPhotosVideos+1's

Stream

 
Some real-life Haskell:

fromCsvFake :: Either String (Vector (Double,Double))
fromCsvFake = CSV.decode CSV.NoHeader $ BS.pack "1.0,2.0"

fromCsv :: IO (Either String (Vector (Double,Double)))
fromCsv = CSV.decode CSV.NoHeader <$> BS.readFile "data.csv"

The first one is a simple line to parse a CSV. Anyone could write that. Feels easy. But it's not "real", it's parsing a fake value.

But I can see from my own programming that when some context is brought in, whether it's IO or anything else, I totally freeze. For some reason I find it incredibly difficult to implement the second function straight away. I'll turn to do-notation and argh, It takes ages to turn that into a one-liner like above.

One of the beauties of Haskell is that it abstracts away contexts. After all, why should it matter if a value has some context around it, since all the same information is there? Shouldn't the same code work for both plain values and contextual ones? Ofcourse it should.

As can be seen from the example, changing the fake value to an IO ByteString, is only a matter of letting the compiler know that we need a slightly different function application, namely <$> instead of $. Alternatively one could lift the function to a contextual scope like this:

fromCsv :: IO (Either String (Vector (Double,Double)))
fromCsv = liftA (CSV.decode CSV.NoHeader) $ BS.readFile "data.csv"

Sometimes I like to think it as lifting, sometimes I like the applicative syntax. I'm not sure yet which one's preferable, maybe it depends.

But one thing really bothers me: Since there are different ways to apply values to functions - the regular way, the applicative way and a monadic way (a.k.a "bind") - and the compiler should know which one is needed, why do I have to be explicit about it? Why couldn't the compiler "automatically lift" the functions for me when needed?
1
Add a comment...
 
Sounds like a reeeeally great family to belong to. Worth reading as a whole, but here's a few clips anyway:

"We have no managers, not even a CEO. Instead we rely on self-organization and transparency. Almost everything is bottom-up, and anyone can drive any decision."

"Crisp doesn’t want to earn money from it’s consultants. It is in practice a non-profit company (although not formally so). Consultants keep most of what they earn."

"No gold on the table – we don’t try to build financial value in the company."

"We don’t have a growth target. Growth is not a goal in itself. We grow only when we find awesome people and aren’t suffering from growth pain."

"Our model is simple: anyone who has been at Crisp for 2+ years can become an owner."

"As opposed to most traditional consulting companies, her job is not to maximize profit or sell as many consulting hours as possible. Instead, she optimizes for the happiness index, which means learning and adapting to each person’s individual needs"

"We used to have a more traditional budget process and debate about things like how much Crisp should spend on what. Lots of spreadsheets, discussions, compromises, and not very effective. After a while we got fed up with the whole idea of a centralized budgeting process and abandoned it in favor of something more like beyond budgeting"
What is this? This site is an open-source site describing how Crisp works and why. Crisp is a consulting company based in Stockholm, Sweden. But we aren't a very typical consulting company. For example: None of the 30+ consultants are actually employed by Crisp (although we do have a few ...
1
Add a comment...
 
If you're a statistician and think that R is somehow cool, please read this!
The categorical distribution is the main distribution for handling discrete data. I like to think of it as a histogram. For example, let's say Simon has a bag full of marbles. There are four “categories” of marbles—red, green, blue, and white. Now, if Simon reaches into the bag and randomly ...
1
Add a comment...
 
Interesting. Had to buy http://haskelldata.com to see what's the state of data analysis with Haskell. After all, R is an abomination.

Gosh, my reading list just grew to 58 books...
1
Add a comment...
 
Brilliant ;!)
I just wish and pray it would happen much sooner...

Anyway, he's absolutely right in that JavaScript is eventually going to "die" in the sense that it will deteriorate to be just an assembly language.
The Birth & Death of JavaScript. A talk by Gary Bernhardt from PyCon 2014. This science fiction / comedy / absurdist / completely serious talk traces the history of JavaScript, and programming in general, from 1995 until 2035. It's not pro- or anti-JavaScript; the language's flaws are discussed ...
1
Add a comment...
 
Cool, but I'm a little bit worried about "the level of transactionality". They say that purity is essential, and they use a cache to "guarantee" it.  In their open-sourcing announcement they state:

"One minor caveat is that requests could be overlapping without necessarily being identical—say, the last 10 and the last 100 posts made by a person. In such a case, it would be possible to observe a changing world. We do not feel this is a significant problem in practice, however it may be addressed in a future version of the library."

I'd say that it may not be a problem for Facebook, but it surely is a problem in general. Talking in SQL Transaction Isolation Levels, their solution corresponds to Repeatable-read, which leaves a lot to the responsibility of the programmer but which Simon said was something they wanted to avoid? For years in SQL databases we've had almost Serializability via MVCC databases, and even full Serializability with often acceptable performance, which greatly release burden from the programmers.

So, maybe great for Facebook and other "doesn't really need to work correctly most of the time" software, but probably not in general.
1
Add a comment...
 
I have no familiarity with Erlang, but I'm going to criticize this anyway:

"Actually the Elixir version is easier to read. The |> operator in the above means pipe the output of io_lib:format into lists:flatten and then list_to_binary. Just like the good ol' Unix pipe operator."

The pipe operator seems like plain-old-function-composition. Does this mean that there's no function composition in Erlang? I thought Erlang was supposed to be a functional language?

"Putting the language version in all source files is essential."
This would be rather silly. Every source file does not need a version since source files come in "groups". Also there's a difference to XML, which is data. Code is not data (at least in this sense).

"and a module is data."

No, it is not.

"The send operator should be !"

This still being an operator instead of just a library feature smells IMHO like bad language design.

"x |> y means call x then take the output of x and add it as an extra argument to y in the first argument position."

This seems really complicated, when compared to function composition with partial application.

"It’s kind-of what a monad does in Haskell, but keep this a secret."

I can't see how function composition could be "kind-of what a monad does"...

"In Erlang I haven’t a clue if a comment belongs to the next function or the previous one or the module. If a comment refers to a function it should be INSIDE the function not outside."

...he can't be serious, can he?

"fn’s have the nice property of capturing the present value of any variables that are in their scope"

I believe this is not correct. Closures capture the environment, which is the names, not the values they are bound to. The "reassignment" in Elixir example is in another environment, thus not applicable to the previously created closure. In the JavaScript example a global mutable variable is created, whose value is later changed, so I believe it is working as it should.
I hope I'm wrong, though, since I believe the designer of a widely used programming language (Erlang) should have a little bit more understanding in programming language concepts.
About a week ago I started looking at Elixir. Elixir had been one of those things that I was vaguely aware of but had not yet time to look at in any detail. This all changed when I discovered the announcement that Dave Thomas was publishing Programming Elixir. Dave Thomas edited my Erlang book ...
1
Petri Sirkkala's profile photo
 
Only a quick note about commenting functions. I think functions should be inside comments, not the other way around. Reasoning for this is that comments have higher abstraction level. 
Add a comment...
Have him in circles
117 people
Teppo Lindell's profile photo
Anniina Salo's profile photo
Juha Räsänen's profile photo
Joel Havermans's profile photo
Timo Kakko's profile photo
Samu Hovi's profile photo
Olli Nevalainen's profile photo
Marko Kattelus's profile photo
Tero Pyylampi's profile photo
 
"After each project, we felt we were getting better superlinearly. Our experiences carried forward elsewhere too. Our Python code became more functional, concise and easier to maintain."
1
Add a comment...
 
As Google abandons its past, Internet archivists step in to save our collective memory.
1
Add a comment...
 
Didn't like his style talking to youngsters as a grown up...

...but the point was excellent, and the references to data were interesting.

If you can't find the time to watch this, just remember to get rid of as many lines of code as possible ;)
1
Add a comment...
 
Enlightening video of the remarkable capabilities of Lenses!
I'm sooooo going to spend many nights striving to comprehend all this stuff...
1
Add a comment...
 
GHC truly seems like a brilliant piece of work. Not because of what it is, but what it can be extended to be!
1
Add a comment...
People
Have him in circles
117 people
Teppo Lindell's profile photo
Anniina Salo's profile photo
Juha Räsänen's profile photo
Joel Havermans's profile photo
Timo Kakko's profile photo
Samu Hovi's profile photo
Olli Nevalainen's profile photo
Marko Kattelus's profile photo
Tero Pyylampi's profile photo
Work
Occupation
Software Designer
Skills
Scala, Haskell, Java, ...
Employment
  • Solita Oy
    Software designer, 2007 - present
  • Metso Automation
    Summer trainee, 2006 - 2006
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Kangasala, Finland
Previously
Tampere, Finland - Kangasala, Finland
Links
Contributor to
Story
Tagline
A wanna-be Software Architect
Bragging rights
3 kids, wife, passion for elegant software solutions
Education
  • Tampere University of Technology
    Computer Science, 2003 - 2010
  • Tampereen Ammattikoulu
    Telecommunications engineer + Matriculation, 1998 - 2002
Basic Information
Gender
Male
Birthday
January 22, 1982
Relationship
Married
Jyri-Matti Lähteenmäki's +1's are the things they like, agree with, or want to recommend.
Language Power
aphyr.com

First, let me clarify that there are all sorts of wonderful patterns in software–things like “functions”, “iteration”, “monads”, “concurrent

Windows 8 — Disappointing Usability for Both Novice &amp; Power Users (J...
www.useit.com

Hidden features, reduced discoverability, cognitive overhead from dual environments, and reduced power from a single-window UI and low infor

Valkosuklaaleivokset
www.hs.fi

(noin 20 kpl) 200 g tuorejuustoa 50 g voita 3 1/2 dl tomusokeria 150 g valkosuklaata 3 rkl vahvaa kahvia 2 munaa (1 rkl konjakkia) 1 sitru

Propositional Logic in Coq - Paul Snively's Blog
psnively.github.com

As promised, I’m going to talk a little about simple propositional logic in the Coq proof assistant. Remember the first puzzle from Smullyan

in which we cater to those with an allergic reaction to parentheses - Te...
technomancy.us

A lot of people have been talking about how parentheses are such a big barrier to adoption of Clojure these days. Apparently they're pretty

Sorting and searching at the library
jorendorff.github.com

If you ever want to screw over a library, just walk up to any shelf, pick up any book, and put it on another shelf where it doesn't belong.

PHP: a fractal of bad design - fuzzy notepad
me.veekun.com

Preface I’m cranky. I complain about a lot of things. There’s a lot in the world of technology I don’t like, and that’s …

Why Structure and Interpretation of Computer Programs matters
www.eecs.berkeley.edu

Why Structure and Interpretation of Computer Programs matters. Brian Harvey University of California, Berkeley. In 2011, to celebrate the 15

How Google Builds Its Maps—and What It Means for the Future of Everything
www.theatlantic.com

An exclusive look inside Ground Truth, the secretive program to build the world's best accurate maps.

On Scala, Functional Programming and Type-Classes
bionicspirit.com

I've been following the excellent Coursera course on Functional Programming Principles in Scala led by Martin Odersky. This was not my first

What is it like to have an understanding of very advanced mathematics?
www.quora.com

Answer (1 of 11): * You can answer many seemingly difficult questions quickly. But you are not very impressed by what can look like magic,

IT Security in a Nutshell - The Fishbowl
fishbowl.pastiche.org

Charles Miller's weblog, covering Apple, Java, and whatever assorted nerdery happens to cross my path.

Fukushima - Rakkaani: Miksi mannerlaatat liikkuvat?
ritvapuolakka.puheenvuoro.uusisuomi.fi

Ritva, mon amour secret et tout le monde: Mannerlaattojen liikkeen aiheuttavat konvektiovirtaukset. Elikkä kiinteähkön laatan alla on hitaas

Software Effort Estimation Considered Harmful - Rogish Reading Writing
mattrogish.github.com

Delta Air Lines tells me it will take two hours and twenty-five minutes to fly from New York City to Atlanta, GA. American says two thirty.

Byte Buffers and Non-Heap Memory
www.kdgregory.com

Most Java programs spend their time working with objects on the JVM heap, using getter and setter methods to retrieve or change the data in

git concepts simplified
sitaramc.github.com

master TOC | chapter TOC | license. git concepts simplified. The title of this page used to be "git for computer scientists -- my version",

Java Streams Preview vs .Net High-Order Programming with LINQ
blog.informatech.cr

In today's post I want to share with you a comparison that I did this weekend between the high-order programming features from LINQ and thos

The Downfall of Imperative Programming | FP Complete
fpcomplete.com

Imperative programming is in my bloodstream. I've been a C++ programmer for most of my life. I wrote a book about C++. I helped Andrei and W

Effective Scala
twitter.github.com

Fork me on GitHub. Effective Scala. Marius Eriksen, Twitter Inc. marius@twitter.com (@marius). Table of Contents. Introduction; Formatting: