11
GolfScript automatically coerces values, according to the following ‘priority’ sequence:
integer → array → string → block
(listed from lowest to highest.)
This means that "1"7+
leaves the string "17"
on the stack (and not 8
), because strings have a higher priority than integers.
[To those GolfScript veterans – apologies for insulting your respective intelligences.]
How would it be possible to do this the other way? That is, to coerce a string into an integer?
name:~ args:1 functions:bitwise not, dump, eval
– Leaky Nun – 2016-07-16T18:59:47.117This gives
8
. – Leaky Nun – 2016-07-16T19:00:47.403@LeakyNun; Nice! Do you want to want to put this in an answer? I'd certainly accept it. – digitalis_ – 2016-07-16T19:02:15.620
6
@closevoter Questions asking tips about golfing code are on-topic.
– user8397947 – 2016-07-16T19:10:05.767@downvoter; could you please leave a comment explaining why you have downvoted? – digitalis_ – 2016-07-18T16:45:47.533