Cody

Sasha Petrenko

14257
Rank
2
Badges
100
Score
1 – 11 of 11

Sasha Petrenko submitted a Comment to Solution 697657

Even though it doesn't solve the actual problem, I thought this solution was clever enough (without too many copy-pastes by others, or maybe MathWorks fixed this workaround since then) to merit explaining it. For those wondering, the line of code within the is_it_odd function does the following: 1. It does a system call to echo a single line to the standard i/o (a virtual place where programs can share/exchange their inputs and outputs). 2. The single line is in the form of a Matlab inline function, named assert(), that black-holes any inputs and always outputs the boolean 'true.' 3. The system call takes this single inline Matlab function and replaces the contents of assert.m (of whatever structure/setup for Matlab interpretation that Cody uses) with that single line. 4. Cody checks solutions with a series of assert(isequal(stuff,things)) calls, which now always evaluate to be true in this particular instance, as opposed to actually comparing if 'stuff' and 'things' are the same.

on 21 Jul 2016

Sasha Petrenko received Commenter badge for Solution 697657

on 21 Jul 2016

Sasha Petrenko received Solver badge for Solution 925856

on 21 Jul 2016

1 – 11 of 11