Virtual machine in C++
This is not a tutorial. This post is a flashback I had today. It might be a bit fiction as my memory about events tends to be fuzzy at times. But I promise it at least resembles the real story. I was in elementary school and just found out about programming and was learning about c++. After reading “C++ na kolenih” by Goran Bervar I was empowered by knowledge and tried to do all sorts of projects.
Setting up for better Scala development on Android
I did a tutorial how to set up everything using IntelliJ a while ago. I still think IntelliJ IDEA is awesome and you should use it(it has a free and open version) but I've found a better way. No more clicking around in wizards…it's config file time. Relax - it's quite simple. I recommend installing the Typesafe-stack. It gives you the two tools listed below in nice packaged form with updates.
This week I felt the impulse to express myself multiple times. I felt like writing. Being a bit sentimental I opened up a notepad I got from my girlfriend as a birthday present and began a brain dump. A stream of consciousness. But my handwriting is painfully slow. This means I had time to do reformatting and rewording in my mind. Sot this was definitely not a brain dump. I wasn't expressing my thoughts directly but rather doing some writing - I don't know how to put this subtle(but important) difference better.
Chaining implicit conversion in scala
Today I was hanging in the #scala IRC channel and somebody came along(forgot the nick, sorry) and asked about some compilation error. I deduced he was trying to chain implicit conversions. And this doesn't work. Else compilation would take forever and would also compile some wrong code by inserting long strings of implicits. But then somebody else responded(I think nick started with d) and gave a solution to implicit chaining. But I'm not giving it away yet, you'll have to read a bit more.
Generic singletons through dependent method types
Ever tried to write a generic singleton? It's an oxymoron of a sort. But sometimes my brain dreams up funny concepts to solve the problem at hand. Sadly I cannot remember what I wanted to use them for. Anyway I think I just made all the methods generic and solved it this way. But this doesn't really express the notion of one entity that's agnostic to type of the parameters. With generic methods you get a bunch of disconnected units - at least that's the picture in my head.
Monadic IO with ScalaZ
I just recently scratched the surface with scalaz. Think of it as an additional standard library for scala that's FP oriented. It provides a bunch of type classes, instances for pretty much everything, some fancy data types, pimps(Pimp My Library) for standard library collections, actor implementation and probably some stuff I'm not aware of. I could really use a “map of scalaz” - but I'll probably dive into source and scaladoc anyway.
Null-coalescing(??) in scala
I was doing my homework today(yes I am aware I should be enjoying myself on 30th December) and had some problems with concatenating possibly null strings in LINQ. Quick trip to StackOverflow and I find out C# has some funky operators that solve this in a (sort-of) clean way. var outputString = input1 ?? "" + input2 ?? ""; I like type inference so I use var's extensively - please don't judge me.
Union types in scala
I've done some research a while ago on union types and found a nice implementation by Miles Sabin but it only works for declaring types of function parameters. And you can also do this with with type classes. What do I mean with “only function parameters”? In “everything is a function” kind of view there are three places to put types function parameters value(val or let binding in haskell and the like) function return type Even though Miles’ encoding with Curry-Howard isomorphism is ingenious it only applies to point 1.
Cool Monday - Exploration of dynamic db acces from scala
I use scala on Android and I don't like the integrated database API. It's very verbose and very stateful. I had written my own ORM(DAO would be a more appropriate tag) a while back, before I used scala but it's not enough anymore. So now I'm on a quest for a better database API. My dream is something small that handles schema for me and is type-safe. A nice DSL that is converted to SQL at compile time and does code generation.
Homework - functional style (outer sorting)
I'm attending Algorithms and data structures class this semester. Material it self is quite interesting and one TA is pretty cool too. But I don't like professor(makes whole experience very much worse) and I believe homeworks could be much better. Oh, and we didn't even mention functional approach…you know Haskell, Scala and the like. All we do is imperative, C-style code in Java. Enough ranting. This is how it saw the bright side.