-
While we initially recoiled at the adverts for the Junior Bake Off, after reading that it is “the Bake Off we deserve” after this year’s disappointing series, we gave it a go and are now fully converted. Watching the contestants recover from baking disasters and help each other without hesitation is truly joyful in a way the regular series totally failed to be.
-
After my computer noodling last week, I decided to write up in detail how to use a Raspberry Pi for Time Machine and how to script Photos for macOS with JavaScript. It was good to write something in-depth again, especially for the first post as I wanted to ensure every step was both necessary and justified which was especially tricky given the rather opaque configuration necessary for Avahi.
-
Long-time host of the London Ruby User Group Skills Matter recently went into administration and their recordings of previous talks have sadly been disappearing from the internet. Among them, the video of my March 2015 talk “Exploring
#to_proc
” seems to have been been removed. Another day, another reason to think about the 21-year old “Cool URIs don’t change”. -
Having said that, I changed the format of permalinks on this site to drop the
.html
extension from the URLs. Thankfully, there’s a redirection plugin for Jekyll to keep old links working. -
Tom Stuart shared the following logic puzzle on the London Computation Club Slack:
Which answer in this list is the correct answer to this question?
- All of the below.
- None of the below.
- All of the above.
- One of the above.
- None of the above.
- None of the above.
I thought this would be an excellent opportunity to use Chris Patuzzo’s Sentient programming language to solve it:
bool answer1, answer2, answer3, answer4, answer5, answer6; # 1. All of the below. invariant answer1 == [answer2, answer3, answer4, answer5, answer6].all?(*self); # 2. None of the below. invariant answer2 == [answer3, answer4, answer5, answer6].none?(*self); # 3. All of the above. invariant answer3 == [answer1, answer2].all?(*self); # 4. One of the above. invariant answer4 == [answer1, answer2, answer3].one?(*self); # 5. None of the above. invariant answer5 == [answer1, answer2, answer3, answer4].none?(*self); # 6. None of the above. invariant answer6 == [answer1, answer2, answer3, answer4, answer5].none?(*self); expose answer1, answer2, answer3, answer4, answer5, answer6;
Which returned a single answer: number 5!
$ sentient --number 0 answers.snt {"answer1":false,"answer2":false,"answer3":false,"answer4":false,"answer5":true,"answer6":false} {}
The story of Sentient is a great one and is told excellently by Chris and Tom in episode 4 of “Why Are Computers”.
-
A blog post circulated this week about solving puzzles with Amb so I thought I’d try using an ambiguous function/operator implementation in Ruby to solve the logic puzzle as well:
require 'amb' A = Class.new { include Amb }.new answer1 = A.choose(true, false) answer2 = A.choose(true, false) answer3 = A.choose(true, false) answer4 = A.choose(true, false) answer5 = A.choose(true, false) answer6 = A.choose(true, false) # 1. All of the below. A.assert answer1 == [answer2, answer3, answer4, answer5, answer6].all? # 2. None of the below. A.assert answer2 == [answer3, answer4, answer5, answer6].none? # 3. All of the above. A.assert answer3 == [answer1, answer2].all? # 4. One of the above. A.assert answer4 == [answer1, answer2, answer3].one? # 5. None of the above. A.assert answer5 == [answer1, answer2, answer3, answer4].none? # 6. None of the above. A.assert answer6 == [answer1, answer2, answer3, answer4, answer5].none? puts "Answer 1: #{answer1}" puts "Answer 2: #{answer2}" puts "Answer 3: #{answer3}" puts "Answer 4: #{answer4}" puts "Answer 5: #{answer5}" puts "Answer 6: #{answer6}"
And it returned the same answer!
$ ruby answers.rb Answer 1: false Answer 2: false Answer 3: false Answer 4: false Answer 5: true Answer 6: false
-
A friend bought C a lovely toy firefly which constantly reminds me of the butterfly from Don’t Hug Me I’m Scared 3 (we’d even taken to calling it “Bertie the Butterfly”). Pesky bee.
Weeknotes 3
By Paul Mucur,
on