For a small side project Iām working on, Iām using a Sudoku puzzle solver and puzzle generator that Iāve written in Rust. The experience was fun, so I thought Iād write up a little bit about the algorithm Iāve used and some interesting stats about how it performs.
The Solver Algorithm The first thing I built was an algorithm for solving Sudoku puzzles. After reading a bunch of Stack Overflow articles and a research paper or two, I came to the conclusion that the best way (and maybe only way) to write a solver is using a recursive solver that picks a value for a cell from the possible values left, and if it gets stuck it backtracks and starts over again with a different random value....
The other day, a friend of mine who is learning Rust asked if Rust is a pass-by-value or a pass-by-reference language. For the unfamiliar, pass-by-value means that when passing an argument to a function it gets copied into the new function so that the value in the calling function and the value in the called function are two separate values. Changes to one will not in turn result in the same change to the other....
In recent projects of mine, Iāve been using WebAssembly quite a bit. WebAssembly (Wasm) is āa new binary instruction format for a stack based virtual machineā that lets you use languages besides JavaScript to run code on a web page - usually either for performance reasons or to run code youād like to share across different platforms. In my opinion, the most promising of these languages, due to its lack of a need for a runtime and great tooling is Rust....
And the Lord said, Behold, the people is one, and they have all one language
Linguistic diversity is one of the true treasures of the human species. Learning a language imparts to us new insights, new ways of viewing the world.
Programming languages often times mirror their natural language counterparts when it comes to what can be gained from learning new ones. Learning new languages can be extremely informative, giving the programmer not only new paradigms to think in but also a new vocabulary which she can use to describe concepts present in languages already learned....
Despite Functional Programmingās (FP) growing popularity, for many ānormal programmersā the language family seems to be merely an academic exercise that they are neither capable of or willing to engage in. Despite there being many FP languages that are arguably much more accessible than some ānormalā programming languages like C++ (e.g. Elixir), FP does at times have some concepts that remain fuzzy even to those who have programmed before in the functional style....
Being productive is more popular than ever. Everyone wants to get more and more done in less and less time. And no wonder. Getting things done feels really good.
Yet, āgetting things doneā is not always the best way to spend our time. yak shaving, done in the right way, can also be a good way to spend time.
Here are some reasons why I find disciplined yak shaving to be a good thing and some things Iāve learned along the way about how to do it well....
Hereās an idea: Erlang is the only true object oriented language in use today.
You might be thinking āWATTTT, that doesnāt make any senseā. But bear with me. Letās examine this idea a bit and see where it takes us.
Functional Programming and Object Orientation Often when you ask programmers what the opposite of functional programming is, they simply reply āwell, object oriented programming, of course!ā.
Unfortunately, this isnāt true. Object orientation and functional programming are orthogonal to one another, meaning, in more laymanās terms, that you can have your cake and eat it too....
So, you feel pretty comfortable writing Ruby on Rails applications. Connecting to one (or more) databases and doing complex queries on complex relations doesnāt faze you one bit. But it bothers you that you donāt know more about how it works ābehind the scenesā.
Today Iāll be starting the first in a series of posts on the internals of ActiveRecord, the part of Rails that allows us to connect to relational databases....
Fear is something that we all experience. Generally when we think of fear, we conjure up stereotypical images of snakes or serial killers in our minds. And it makes sense that this would be our go-to definition of fear. We tend to remember things that are out of the ordinary, and the truth is that the fear the some homicidal manic invokes in us is much more unique than the fear that we experience on the daily basis....