Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #16229

Re: Fizz Buzz Zoom

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: Fizz Buzz Zoom
References (3 earlier) <2012Oct8.180835@mips.complang.tuwien.ac.at> <7x4nm5dja8.fsf@ruckus.brouhaha.com> <2012Oct8.191146@mips.complang.tuwien.ac.at> <7x626k90t2.fsf@ruckus.brouhaha.com> <2012Oct10.143249@mips.complang.tuwien.ac.at>
Date 2012-10-12 21:18 -0700
Message-ID <7xehl357iz.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> That supposed ambiguity is already there in the original
> specification.  It still seems that everybody interpreted it in the
> same way, following the following rule: Apply the most specific rule
> of those given.

I'd say the codinghorror post isn't an actual specification, but just an
informal description.

>>That is also a messy spec...
> It's also longer (10 lines instead of 8), more complicated and harder
> to understand.  

Well, harder to understand is in the eye of the beholder.  I do think
it's more precise.

> Let's see what program follows naturally from it: ...

That program looks ok; my version basically lifted the divisor checks
to do each one once instead of twice.

> Not in this case, because the interviewer was interested in
> correctness.  I also don't think that ambiguity lets you see a
> candidates approach any better than non-ambiguity.

Part of interviewing is describing a general problem and seeing
what kind of questions the person asks.

> If the point of the example is correctness (as in the original
> example), staying close to the spec is a good idea, as it reduces the
> opportunities for mistakes.  If the goal is to have the solution fast,
> staying close to the spec is also a good idea.  If the point of the
> example is to produce small or efficient code, then one should also
> consider other approaches.

In this particular case I was taking the approach of trying to identify
a "pure" version of the problem, like that blog post I linked
("FizzBuzz, A Deep Navel to Gaze Into"), not particularly as
optimization or future-proofing.  I think your extension:

> ... "Now change the program such that it prints 'boing' if the number
> is divisible by three and by five".

still fits into that monoidal picture (the tests just become a little
more complicated), but yeah, the factored Forth implementation suffers.

It's interesting, I keep seeing Chuck's stuff saying to factor
relentlessly so I tried to do that, but per yours and other posts in the
thread, it was probably overdone.

As for following specs in general, some specs (like ITU specs) for
policy reasons (I think this means "protecting incumbents") are written
to avoid giving any implementation guidance at all.  So such a spec
might say how to recognize the correct Fizzbuzz output in a purely
syntactic, descriptive way, in this case perhaps something like EBNF
notation.  I've haven't had to deal with this type of thing directly so
far though.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-07 09:19 -0700
  Re: Fizz Buzz Zoom mhx@iae.nl (Marcel Hendrix) - 2012-10-07 20:33 +0200
    Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-07 11:43 -0700
      Re: Fizz Buzz Zoom mhx@iae.nl (Marcel Hendrix) - 2012-10-07 21:09 +0200
        Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-07 12:18 -0700
          Re: Fizz Buzz Zoom ouatubi@gmail.com - 2012-10-08 01:15 -0700
            Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 09:37 -0700
              Re: Fizz Buzz Zoom ouatubi@gmail.com - 2012-10-09 01:16 -0700
  Re: Fizz Buzz Zoom Doug Hoffman <glidedog@gmail.com> - 2012-10-07 14:45 -0400
    Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-07 12:28 -0700
      Re: Fizz Buzz Zoom Doug Hoffman <glidedog@gmail.com> - 2012-10-07 21:06 -0400
        Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-07 21:32 -0700
          Re: Fizz Buzz Zoom Doug Hoffman <glidedog@gmail.com> - 2012-10-08 06:06 -0400
            Re: Fizz Buzz Zoom Mark Wills <forthfreak@gmail.com> - 2012-10-08 05:24 -0700
  Re: Fizz Buzz Zoom anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-08 14:02 +0000
    Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 08:38 -0700
      Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 08:43 -0700
      Re: Fizz Buzz Zoom "A. K." <akk@nospam.org> - 2012-10-08 18:03 +0200
      Re: Fizz Buzz Zoom anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-08 16:08 +0000
        Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 09:23 -0700
          Re: Fizz Buzz Zoom anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-08 17:11 +0000
            Re: Fizz Buzz Zoom Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-08 22:12 +0200
            Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 13:16 -0700
              Re: Fizz Buzz Zoom Hannu Vuolasaho <hannu.vuolasaho@nospam.tut.fi.invalid> - 2012-10-08 21:06 +0000
                Re: Fizz Buzz Zoom "Elizabeth D. Rather" <erather@forth.com> - 2012-10-08 11:57 -1000
                Re: Fizz Buzz Zoom Mark Wills <forthfreak@gmail.com> - 2012-10-09 01:26 -0700
                Re: Fizz Buzz Zoom George Hubert <georgeahubert@yahoo.co.uk> - 2012-10-09 08:38 -0700
                Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-09 09:03 -0700
                Re: Fizz Buzz Zoom "Elizabeth D. Rather" <erather@forth.com> - 2012-10-09 08:44 -1000
              Re: Fizz Buzz Zoom anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-10 12:32 +0000
                Re: Fizz Buzz Zoom Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-10 16:59 +0200
                Re: Fizz Buzz Zoom anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-10 16:42 +0000
                Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-12 21:18 -0700
                Re: Fizz Buzz Zoom "Elizabeth D. Rather" <erather@forth.com> - 2012-10-12 21:06 -1000
      Re: Fizz Buzz Zoom Doug Hoffman <glidedog@gmail.com> - 2012-10-10 09:02 -0400
  Re: Fizz Buzz Zoom Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-10-08 17:50 +0100
    Re: Fizz Buzz Zoom Paul Rubin <no.email@nospam.invalid> - 2012-10-08 10:15 -0700

csiph-web