summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/post/2017-08-16-tapl.md16
-rw-r--r--content/post/2017-08-17-untyped-arithmetic-expressions.md9
-rw-r--r--content/post/2017-08-22-thinkpad-e470.md39
-rw-r--r--content/post/2017-08-24-untyped-lambda-calculus.md17
-rw-r--r--content/post/2018-09-11-shapeless.md15
5 files changed, 96 insertions, 0 deletions
diff --git a/content/post/2017-08-16-tapl.md b/content/post/2017-08-16-tapl.md
new file mode 100644
index 0000000..59b3fa7
--- /dev/null
+++ b/content/post/2017-08-16-tapl.md
@@ -0,0 +1,16 @@
+---
+date: '2017-08-16T00:00:00Z'
+tags:
+- tapl
+- rust
+title: Types and Programming Languages
+---
+February 2016, as a birthday present to myself I bought a copy of [Types and Programming Languages](https://www.cis.upenn.edu/~bcpierce/tapl/). At the time the only thing I did with it was to take a photo of it, sharing it on Twitter and congratulating myself. To be fair, I did try reading it, but it was so intimidating that I gave up very early in the book. One and a half years later I’m going to give it another go because a few things have changed.
+
+First of all, I should say that I've no academic background in computer science—I've studied Zoology. I easily get frightened by any text with more than a few lines of maths in it especially when it's heavy on symbols which I don't know, and Google doesn't help. I've had many attempts at learning maths—watching YouTube videos, reading books—but I always gave up mostly due to lack of discipline in doing the exercises. A year ago I decided to do something about it and enrolled into DIT's [B.Sc. in Information Systems and Information Technology](http://www.dt249.ie/). I thought if I'm paying a substantial amount of money for a class in a relatively well-established institute it might help. To my unwelcome surprise, the course isn't heavy on maths, but it was an immense help, discipline-wise, nonetheless.
+
+The second thing was that due to some unforeseen circumstances, all of a sudden I found myself with plenty of free time and I didn't want to waste this once in a lifetime opportunity.
+
+After deciding that I want to read the book and be rigorous in doing the exercises, I had to choose a programming language to do the exercises in, and I found it a good excuse to give Rust a try.
+
+I also decided to publish my progress both as in [code](https://github.com/amir/tapl.rs) as well as in a series of blog posts, as suggested by a wise man, [Iain](http://iainhull.github.io/). Hence this blog.
diff --git a/content/post/2017-08-17-untyped-arithmetic-expressions.md b/content/post/2017-08-17-untyped-arithmetic-expressions.md
new file mode 100644
index 0000000..9385ce0
--- /dev/null
+++ b/content/post/2017-08-17-untyped-arithmetic-expressions.md
@@ -0,0 +1,9 @@
+---
+date: '2017-08-17T00:00:00Z'
+draft: true
+tags:
+- tapl
+- rust
+title: Untyped Arithmetic Expressions
+---
+Chapters 3 and 4 of the book develop the required tools for a small and trivial language of numbers and booleans. You can find the [OCaml implementation](https://www.cis.upenn.edu/~bcpierce/tapl/checkers/arith.tar.gz) of this language on book's website. And you can find my Rust implementation at [arith.rs](https://github.com/amir/tapl.rs/blob/master/src/tapl/arith.rs).
diff --git a/content/post/2017-08-22-thinkpad-e470.md b/content/post/2017-08-22-thinkpad-e470.md
new file mode 100644
index 0000000..9e48d66
--- /dev/null
+++ b/content/post/2017-08-22-thinkpad-e470.md
@@ -0,0 +1,39 @@
+---
+date: '2017-08-22T00:00:00Z'
+tags:
+- thinkpad
+- e470
+title: ThinkPad E470
+---
+Recently I've been looking for a Linux-friendly, budget laptop. I like ThinkPads, and all of my laptops have been either T-series or X-series but this time I didn't want to spend that amount of money and was looking for cheaper alternatives.
+
+Browsing Lenovo website, I realised that a reasonably configured [E470](http://www3.lenovo.com/ie/en/laptops/thinkpad/edge-series/E470/p/22TP2TEE470) would cost about €1000 which was about how much I was willing to pay. I configured it, so it has:
+
+* Intel® Core™ i7-7500U
+* 16GB RAM
+* NVIDIA® GeForce® 940MX 2 GB
+* 14" FHD (1920x1080) anti-glare IPS
+* 256GB SSD
+
+Including VAT it set me back €1032 which I think is reasonable.
+
+Unlike my other laptops, this time I kept the Windows mainly because it has a discrete GPU—granted not a high-performance one but still much better than Intel HD ones—and I thought I might be able to use it for some light gaming.
+
+I installed Debian testing on it, and everything worked out of the box! The only issue I have with it is that middle-click isn't working, but this [patch](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/input/mouse/trackpoint.c?id=293b915fd9bebf33cdc906516fb28d54649a25ac) will fix it.
+
+Being a budget laptop, E470 lacks some features of X and T series. For example, it doesn't have ThinkLight or the keyboard isn't backlit. Its only video output is HDMI which caused me some headache. My monitor only has DisplayPort input; so I bought an HDMI to DisplayPort adapter not realizing that those cables aren't bi-directional. They're suitable for scenarios in which you need to connect your DisplayPort-capable device to an HDTV, not the other way around. However, there are [converters](https://www.amazon.co.uk/Adapter-Resolution-DisplayPort-Converter-monitors/dp/B00WM6MPGC/) capable of doing such transformation, at higher costs.
+
+**The Good**
+
+* Reasonably priced.
+* 45WH battery lasts 8 hours.
+
+**The Bad**
+
+* FHD is the most high-resolution option.
+* Keyboard is not backlit.
+* No ThinkLight.
+
+**The Ugly**
+
+* It's weighty, ugly, bulky, and the design is unimaginative.
diff --git a/content/post/2017-08-24-untyped-lambda-calculus.md b/content/post/2017-08-24-untyped-lambda-calculus.md
new file mode 100644
index 0000000..0304ca9
--- /dev/null
+++ b/content/post/2017-08-24-untyped-lambda-calculus.md
@@ -0,0 +1,17 @@
+---
+date: '2017-08-24T00:00:00Z'
+draft: true
+tags:
+- tapl
+- rust
+title: Untyped Lambda Calculus
+---
+As I mentioned in an [earlier post]({% post_url 2017-08-16-tapl %}), I've been working through [Types and Programming Languages](https://www.cis.upenn.edu/~bcpierce/tapl/) in Rust. Chapters 5 to 7 of TAPL discuss untyped lambda calculus through an implementation of a simple expression-based language. Chapter 5 lays the foundations; chapter 6 focuses more on one of the concepts introduced in chapter 5; [de Bruijn index](https://en.wikipedia.org/wiki/De_Bruijn_index) and chapter 7 explores an ML implementation of the said language, but only how to evaluate the terms, and not how to parse them. The accompanying OCaml [implementation](https://www.cis.upenn.edu/~bcpierce/tapl/checkers/)'s parser is generated automatically from a Yacc grammar.
+
+I've had good experiences writting parsers in Haskell using [parsec](https://hackage.haskell.org/package/parsec) and [attoparsec](https://hackage.haskell.org/package/attoparsec) before, so I started looking for parser-combinators in Rust. There seem to be three capable options:
+
+* [combine](https://github.com/Marwes/combine)
+* [chomp](https://github.com/m4rw3r/chomp)
+* [nom](https://github.com/Geal/nom)
+
+Combine even has the [combine-language](https://github.com/Marwes/combine-language) extension which is very similar to Parsec's [Text.Parsec.Token](http://hackage.haskell.org/package/parsec/docs/Text-Parsec-Token.html) which would've simplified the task of parsing lexical elements but I couldn't add it as a dependency to my project—due to compile errors which I'm sure has been because of my ignorance and lack of familiarity with Rust and Cargo. At the end I ended up choosing using layman's metrics, number of GitHub stars and nom won by a huge margin.
diff --git a/content/post/2018-09-11-shapeless.md b/content/post/2018-09-11-shapeless.md
new file mode 100644
index 0000000..f56210d
--- /dev/null
+++ b/content/post/2018-09-11-shapeless.md
@@ -0,0 +1,15 @@
+---
+date: '2018-09-11T00:00:00Z'
+draft: true
+tags:
+- shapeless
+- scala
+title: Shapeless
+---
+[Shapeless](https://github.com/milessabin/shapeless)
+
+```scala
+import shapeless._
+import shapeless.ops.hlist.{LiftAll, Mapper, Mapped}
+import shapeless.UnaryTCConstraint._
+```