This entire article can be summed up as "type coercion is bad"
andrew_404
Comment 705
This entire article can be summed up as "type coercion is bad"
Hey Michael Doh! Thanks so much for letting me know. I've corrected the text :-)
This is both halarious and informative :') I'm vegan uni student and stumbled across this article, great job! Cracking up at 'vegan splodge' and 'fuck-off 2L' XD
Great article! You might want to fix your definition of associative. It doesn't mean that sum(a,b) = sum(b,a); that would be "commutative". Associative means that sum(a,sum(b,c)) = sum(sum(a,b),c).
Adam Definitely. Hoogle/Hayoo are pretty amazing!
Hey Adam,
Nice one, I didn't know about dupd.
And thanks for the tip about the docs. I am also looking forward to idris. Have watched a youtube vid about it but not sure that I reallyget dependent typing.
the name Factor does not make it any easier to search the web for answers
Hah! Must be it's biggest downfall. That and the lack of types, or I would have been able to search the documentation much like hoogle or hayoo.
Sorry, messed up the formatting.
If you had the numbers 1 2 on the stack, what code could you use to end up with 1 1 2 on the stack
dupd
or alternatively:
[ dup ] dip
you wouldn't need the '1' then.
I wasn’t completely happy with the repeated 10 here. I am sure I could have done some stack trickery to avoid repeating myself.
42 10 [ /i ] [ mod ] 2bi
Factor documentation (F1) is super useful. In particular, the articles in factor handbook section. More in particular, shuffle words and combinators. Thanks for the article, I had been curious about the contents of the book. Can't wait for you to start on Idris!
If you had the numbers 1 2 on the stack, what code could you use to end up with 1 1 2 on the stack dupd or alternatively: [ dup ] dip you wouldn't need the '1' then
Great article! I was unaware of the implementation details of max and min and really enjoyed learning about them.
There's also a minor tweak I'd consider making to the article. When discussing why max needs to have -Infinity as its identity you say, "If it were 0 then, if our list of numbers had a negative number in it, max would return 0."
This isn't quite right as it might return a number higher than 0 if it appears in the list. It should probably read something like "If it were 0 then, if our list of numbers had only negative numbers in it, max would return 0."
Thanks again for the great article!