The "problem"
Define a function log
(or other 3 letter name) which when called will log/print/write (whatever is the default for the language in question) both the instruction (as source) and the first argument. In other words:
i=777
j=333
log(i) //outputs: "log(i) 777"
log(i+j+1) //outputs: "log(i+j+1) 1111"
For all practical purposes the output i: 777
would be enough, but in some languages there are very specific reflection libraries for that, and that would be no challenge, so the entire instruction should be outputted.
Inspiration
The inspiration for this was me and another programmer discussing how irritating it is that often (with bad debuggers), you write things like console.log("i:", i)
, next we made a (pretty crazy) javascript (node only) solution (it outputs i: 777
rather than the entire line of source) which was suprisingly long and reminded me of codegolfing and made me wonder how much better other (especially code golfing) languages would fare.
Bonuses
-10%: No file reading (beyond the compiler)
PS. This is my first 'question' here, so feel free to point out any mistakes I made.
help/on-topic
(it's mentioned, but I didn't consider it worth checking the way it was described there). \$\endgroup\$