Mailund on the Internet

On Writing, Science, Programming and more

  • Overscoping and eval

    In my previous post I used the lm function for an example of scope rules, but I left a few details out. I didn’t want to muddy the example with too many details, so I choice to lie a little. The drawing I used to explain the example was this: I explained how scope is implemented using environments that are chained through parent pointers, and how a function has an environment associated with it. This environment is the environment where you define the function. When you call a function, it gets its own instance environment (for historical reasons more than anything else we call this the call frame, but it is really just a new environment).

    Read more…
  • Slides for Computational Thinking (Chapter 5)

    I just finished make slides for chapter 5 of Introduction to Computational Thinking that covers search and sorting algorithms. The slides cover linear and binary search, insertion, selection and bubble sort, as well as bucket and radix sort. The chapter covers a little bit more, including how numbers are represented on a computer, and the consequences of this for bucket and radix sort. You can get the slides here. If you liked what you read, and want more like it, consider supporting me at Patreon.

  • Scoping Rules and NSE

    Earlier this week, I wrote some tweets about how you have to be careful about scopes when you do non-standard evaluation. I cover this in both Metaprogramming in R and Domain-Specific Languages in R, but this tweet Comprehensive overview of NSE. Should be of interest to @ThomasMailund @MilesMcBain @_ColinFay and @edwin_thoen https://t.co/2uI1HSnfEN — Deemah 🇺🇦 🇳🇴 (@dmi3k) September 17, 2018 made me write about it again—only this time in a twitter thread. Well, I say thread—I don’t actually know how to do that, it seams; I just replied to the tweet a bunch of times and apparently that doesn’t make a thread, it therefore my reply was hard to read.

    Read more…
  • Slides (CT chapters 3 and 4)

    I played around a little with my slides for chapter three of Introduction to Computational Thinking and made slides for chapter four. It takes surprisingly long to make these; I had expected to be done with the five chapters I use in my class this year a few weeks ago but I still have three chapters to go. I won’t run out of time—I have plenty of time to make slides between the first and last lecture—but it is eating into time I really should be using on The Joys of Hashing where a deadline is coming up. Anyway, here are the slides—let me know if you spot any obvious errors so I can fix them before my lectures.

    Read more…
  • Exercises (CT chapter 3)

    I have cleaned up the exercises for chapter three of Introduction to Computational Thinking. I’m still not exactly sure how best to provide them to my students, or if I can figure out some way to automatically test answers so they can be more interactive, but I have listed them below. I have listed my answers below the exercises, so if you want to do the exercises, then stop in time. As always, if you have comments or criticisms, or just suggestions for more exercises, I’m dying to hear. Below or above Here’s a game you can play with a friend: one of you think of a number between 1 and 20, both 1 and 20 included.

    Read more…
  • Complexity Exercises

    In the second lesson that I teach in our Computational Thinking in Bioinformatics I cover algorithmic complexity. It is chapter four in my (draft) book on the topic: Introduction to Computational Thinking. I have put exercises and my answers to them on GitHub. I still haven’t figured out the best way to give them to the students yet, but the can always read them on GitHub and download the source files where needed. Anyway, I know I always make mistakes both in phrasing the exercises and in answering them—not always substantial errors, but still. So if you have some time left and if you are interested in the topic, I would love to hear if there any obvious mistakes.

    Read more…
  • Slides for Computational Thinking (Chapter 3)

    I’m teaching four weeks of a class called Computational Thinking in Bioinformatics this year (the other weeks are taught by colleagues). It is this class that got me started on my book on the topic: Introduction to Computational Thinking. I have finished the chapters I need for the class—chapters three, four, five, seven and nine—but there is still a looong way to go before the book is done. Anyway, I am not writing on the book these days, but make slides for the lectures. That takes surprisingly long time. I have grown used to having slides to pick and choose from for any lecture, but I am starting from scratch here.

    Read more…
  • The Coming Storm

    If you are a member of Audible—and if you like audiobooks I think you should be—then they now give you two of six selected books for free every month. They call this Audible Originals, and while you only get six books to choose from, I am not complaining about getting something for free. I got two books, The Coming Storm by Michael Lewis—read by the author—and Emma by Jane Austen (I guess)—which I guess is an audio drama. I haven’t listened to it yet. I just finished The Coming Storm. It is pretty short, just a tad over two hours, so I finished it on my walk to and from work yesterday and today.

    Read more…
  • Premarkdown Plugins

    I’m working on a preprocessor for Markdown documents. I write all my books in Markdown, so this is something I have wanted to do for a while, to scratch a few itches I have. I write my books in Markdown and then I process them using Pandoc. If you are not familiar with that setup, then I have written a short book on the topic: The Beginner’s Guide to Markdown and Pandoc. For that book, because it is very short, I just have a single Markdown document containing the entire book, but usually, I have one file per chapter. Pandoc doesn’t handle that, but you can cat the files before you convert the Markdown source to PDF or ePUB documents.

    Read more…
  • Fluent Python

    I just finished reading Fluent Python. This is a really nice book on Python programming. It is not an introduction to Python programming, and it is not about specific packages, such as SciPy or Scikit-learn. Rather, it covers Python topics you might use in day-to-day programming and explains how you would write code in the most Pythonic way. Well, it covers mostly stuff you would use in everyday programming. It also covers co-routines and meta-programming; topics I do not expect you would use every day. From time to time, yes, but not every day. If you find that you need it, though, the coverage in Fluent Python is excellent.

    Read more…