Tag: university

Taking Notes

I always thought taking notes was a waste of time. Surely you could just look back at the slides if you forgot something?

But I realized I might have had it backwards all this time. What if you take notes not to have something to refer to, but because it forces you to listen with greater attention and strengthens your memory?

To really take notes you need to understand the subject well enough to pick out the key phrases and concepts in real time, all while the lecturer is speaking on and on. It's similar to how actually doing the …


Beemind your Papers

If you've seen my post on motivation hacking then you know that I'm using Beeminder to track a wide variety of things. I try everything I can to automate the tracking - import learning data directly from Duolingo, have a custom script poll WaniKani for my current level, track how long I practice piano by reading midi output over USB, integrating with Runkeeper to track how often I run, etc.

Now I've also found a good way to track the papers I read: Every paper I'm interested in I add to [cached]Mendeley. Then once I've actually read it I can …


Units of Measure - A Scala Macro System

I finally finished my Units of Measure system for Scala. The source is - of course - on [cached]GitHub, and I'm putting the finishing touches on my thesis about it, but for a quick view please refer to this presentation:


Units of Measurement - An Overview

Last time, I talked a bit about how you might implement parts of a Units of Measurement system in Scala (stay tuned for the rest of the implementation). Since this is going to be the topic of my Bachelor's thesis, I've made a presentation about Units of Measurement systems in other languages, specifically F#, C++ and Haskell. You can view it right here:

or download a pdf (without the snazzy transitions).


Scalisp - now with tail-call optimization

The last few days, I worked a bit more on Scalisp. Most importantly, I added tail-call optimization. If you don't know what this is all about, think what a normal function call does: It grows the stack, one frame for each call. Normally, that's what you want, but not when you try to implement loops with recursive functions. (as you usually do in functional languages)

Take this simple example, summing all numbers from 1 to n (nevermind that there's a simple formula to do that):

1
2
3
4
(defun sum_to (n)
  (if (<= n 1)
    1
    (+ n (sum_to (- n 1 …

Scalisp - now with Compilation

It's been a while since my last update - I've been quite busy with course work. Part of that was a complete write of Scalisp - now it's truely List-based and it also includes a Compiler. Since it grew quite a bit, I split it up in several modules, which should be self-explaining:

1
2
3
4
5
6
7
8
+--------+   +--------------+    +----------+
| Parser +-->| Preprocessor +--->| Compiler |
+--------+   +------+-------+    +----------+
                   |
                   v
            +--------------+
            | Interpreter  |
            +--------------+

The Parser is very simple and quite short now, since it doesn't care about special forms anymore, it just makes sure that each expression has correct syntax:

 1
 2
 3
 4
 5
 6
 7
 8
 9 …

Scalisp - a Lisp interpreter in Scala

Inspired by [cached]Peter Norvig's lispy, I wrote a little Lisp interpreter in Scala. So far, it only provides a small subset of Lisp, but I plan to extend it eventually.

It makes heavy use of Scala's parser-combinators to build the AST (abstract syntax tree), execution is little more than calling "eval" on this tree.

Here's what the main parser looks like:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
class LispParser extends JavaTokenParsers {
    def expression: Parser[Expression] = (
        "("~>expressionBody<~")" | number | string | variable )
    def expressionBody: Parser[Expression] = ( "quote"~>expression
        | "if"~expression~expression~expression …

Visualizing sorting Algorithms with D3

In my Algorithm class, we had to implement our own sorting algorithm as an exercise in pseudo-code. It was very simple: Alternatingly iterate over an array from beginning to end and from end to beginning, always swapping pairs over numbers which are not correctly sorted. Repeat until finished.

In Python (you can also [cached]download a runnable versionspan)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def sort(a):
  lower_limit = 0
  upper_limit = len(a) - 1

  while(lower_limit != upper_limit ):
    i …

Learning on your own Terms

Today, you don't even need to go to college to get access to all those fancy courses - thanks to MIT and Yale, you can now simply download and watch them at home:

If you are still in high school, or just want to know more about some subject, this is an ideal possibility to find out more - I listened to a bunch of lectures about Mathematics for my own paper.

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .