This past week discussion around solving anagrams was brought up - I thought it would be interesting to devise a couple of methods for computational achieving such a task. Providing an anagram string and a dictionary file, I wished to be returned all possible matching words from the dictionary.
array_column function has been a welcome addition to the PHP language, allowing us to remove the need for common-place
array_map invocations that just pluck specific values from arrays.
However, I just found out that you can provide a third argument that allows you to define what the returning arrays keys will be.
This combined with
null for the value argument allows you to easily re-index an array based on a key value whilst maintaining the original arrays values and ordering.
In the 100th episode of Three Devs and a Maybe I decided to generate some stats relating to the previous 99 episodes and formed a small quiz out of these findings. All information relating to each podcast is stored in separate Markdown files within YAML front-matter, which makes it easy to pull out and process. I thought it would be interesting to go over the code I used to achieve this.
Yesterday I watched a conference talk about Formal Logic and De Morgan’s laws were discussed. Wikipedia does a very good job of explaining the laws in-depth, but essentially they are transformation rules that allow you to simplify certain propositions. Whilst programming, predicate logic of this form appears very frequently, and it is very useful to know how you can rewrite a predicate to better describe its intent.