Re: FizzBuzz



On 3 Mar, 17:17, "Bruce McFarling" <agil...@xxxxxxxxxxxx> wrote:
On Mar 3, 11:09 am, "J Thomas" <jethom...@xxxxxxxxx> wrote:

Writing to be easy for other people to read, it's better to avoid
subtle ideas. Anything that people find hard to understand before the
first cup of coffee is a problem.

That's why I liked John Passiniti's factoring ... it was easy enough
for me to read to directly add the pretty printing into the main loop
when I didn't like the way it printed ... it only took two iterations
to get it exactly right, which would be a record for me ... and then
that could come directly out as a word rather than being handled in
multiple locations.

The test of whether something is easy for other people to read
is other people trying to add a capability.

I'm not disagreeing with you but would just point out that it's
trivial to add pretty printing to other versions.

hex
1249 constant 3vec
0421 constant 5vec
4000 constant probe
3vec 5vec or constant 3or5vec
decimal

: bang
cr 0 101 1
do
?dup 0= if probe then
3or5vec over and 0= if i 2 .r then
3vec over and if ." fizz" then
5vec over and if ." buzz" then
dup 1 = if cr else space then
1 rshift
loop
drop
;

.



Relevant Pages

  • Re: Word 2004, printing issue
    ... Check your printing from TextEdit. ... character for character? ... dup 51 /o put ...
    (microsoft.public.mac.office.word)
  • A role for roll? Re: Interpreter mode loops
    ... I realised that the data stack could be used to hold 2 stacks, ... on which make use of DEPTH, ROLL and PICK. ... dup 0 ?do dup pick swap loop drop ...
    (comp.lang.forth)
  • Re: Word 2004, printing issue
    ... It still is not printing. ... dup 51 /o put ... character formatting in invisible colours or hidden characters. ... Print Layout,Preview and print screens, all look "normal". ...
    (microsoft.public.mac.office.word)
  • Re: FizzBuzz
    ... 4000 constant probe ... We could get rid of the if in the tests. ... It isn't clear what to optimise, ...
    (comp.lang.forth)
  • Re: class sort
    ... FLAGS 8190 + CONSTANT EFLAG ... IF DUP I + DUP EFLAG < ... IF EFLAG SWAP ... LOOP DROP; ...
    (comp.lang.forth)