FAQ
Hi,

since quite some time I followed Go in read-only mode ;-)

Now I have started with a real (but toy) program, using an algorithm
described at a few places on the web.

The program runs fine on my Windows, but seems to loop when running in the
playground.

Please be kind, it's a first try ;-) All advice is welcome!

Here is the link: http://play.golang.org/p/rMeHAU32qa

Thanks and kind regards,
    Arie

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Nate Finch at Jul 22, 2014 at 6:18 pm
    It probably loops on the playground because you can't read from stdin on
    the playground, so the read just always returns an error, which causes your
    loop. You should exit if your fmt.Fscan errors out. You should also check
    the error from std.Readline in calc().

    You almost never need to use var.
    var abc string = "abcdefghijklmnopqrstuvwxyz"

    is the same as

    abc := "abcdefghijklmnopqrstuvwxyz"

    var text []byte = make([]byte, 256)

    is the same as

    text := make([]byte, 256)

    etc. The := version is much preferred.




    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in the
    playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Jones at Jul 22, 2014 at 8:06 pm
    Arle,

    Here is my take on your program:
    http://play.golang.org/p/_AKEPYf0yL

    It shows how to write beast() and also how to implement the inverse
    operation, beastify(), which finds combinations of base and step to make
    chosen strings have whatever goal value you seek. Here is a sample :

    $ go run main.go
                   hitler = 666 (100, 1)

                 computer = 666 ( 6, 6)
                 humanity = 666 ( 6, 6)
             nuclear hell = 666 ( 6, 6)
                kissinger = 666 ( 6, 6)

                      air = 666 ( 72, 18)
                 alphabet = 666 ( 12, 10)
                  America = 666 ( 3, 15)
                   amoeba = 666 ( 18, 18)
                   depone = 666 ( 5, 12)
                    Earth = 666 ( 11, 13)
                    fruit = 666 ( 9, 9)
                     love = 666 ( 4, 13)
               nudibranch = 666 ( 33, 4)
                   peanut = 666 ( 40, 6)
                    pizza = 666 ( 31, 7)
                    pluto = 666 ( 70, 4)
                    sushi = 666 ( 48, 6)
               transistor = 666 ( 38, 2)
         ultracrepidarian = 666 ( 32, 1)
                   Uranus = 666 ( 23, 6)
                    water = 666 ( 34, 8)
               xenophobia = 666 ( 27, 4)
                   Q.E.D. = 666 ( 84, 18)
    On Tue, Jul 22, 2014 at 11:18 AM, Nate Finch wrote:

    It probably loops on the playground because you can't read from stdin on
    the playground, so the read just always returns an error, which causes your
    loop. You should exit if your fmt.Fscan errors out. You should also check
    the error from std.Readline in calc().

    You almost never need to use var.
    var abc string = "abcdefghijklmnopqrstuvwxyz"

    is the same as

    abc := "abcdefghijklmnopqrstuvwxyz"

    var text []byte = make([]byte, 256)

    is the same as

    text := make([]byte, 256)

    etc. The := version is much preferred.




    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Jones at Jul 22, 2014 at 10:36 pm
    Arie,

    I've added a bit to the sample program. First, I expanded the search range
    so that all single letter words can be beastified, and also, I added code
    to read file names as command line arguments, extract all their words, and
    then beastify each unique word across the document set. The new version is
    here:

    http://play.golang.org/p/CzL2f3xvVA

    For example:

    *$ ./beast ozymandias.txt *
    *80.2326% beastly words*

      *17 non-beastly words:*
    *[ a colossal command from kings ozymandias passions read sculptor
    shattered traveller trunkless well whose wreck wrinkled]*

    *69 beastly words:*
      *[an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*
    *mtj@mtj-linux:~/gocode/src/beast$ go build *
    *mtj@mtj-linux:~/gocode/src/beast$ ./beast ozymandias.txt *
    *81.3953% beastly words*

      *16 non-beastly words:*
    *[ colossal command from kings ozymandias passions read sculptor shattered
    traveller trunkless well whose wreck wrinkled]*

    *70 beastly words:*
      *[a an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*

    ...and, perhaps more apropos, from the KJV...

    *$ ./beast bible.txt *
    *76.6383% beastly words*

    *2966 non-beastly words:*
    *[abda abdi abel abelbethmaachah abelmaim abelmeholah abelshittim abhorrest
    abhorreth abhorring abialbon abiathar abideth abiezrite abihail abishai
    able abner abominations*
    *: *
    *zephaniah zephath zepho zephonites zerahiah ziha zimri zion zior ziphites
    zizah zoan zoar zoba zorathites zorites]*

    *9730 beastly words:*
    *[a aaron aaronites aarons abaddon abagtha abana abarim abase abased
    abasing abated abba abdeel abdiel abdon abednego abelmizraim abez abhor
    abhorred abi abia abiah *
    *:*
    *ziphron zippor zipporah zithri ziz ziza zobah zobebah zohar zoheleth
    zoheth zophah zophai zophar zophim zorah zoreah zorobabel zuar zuph zur
    zuriel zurishaddai zuzims]*

    The general ratio seems to be in the range of 70%-85% beastly.

    On Tue, Jul 22, 2014 at 1:05 PM, Michael Jones wrote:

    Arle,

    Here is my take on your program:
    http://play.golang.org/p/_AKEPYf0yL

    It shows how to write beast() and also how to implement the inverse
    operation, beastify(), which finds combinations of base and step to make
    chosen strings have whatever goal value you seek. Here is a sample :

    $ go run main.go
    hitler = 666 (100, 1)

    computer = 666 ( 6, 6)
    humanity = 666 ( 6, 6)
    nuclear hell = 666 ( 6, 6)
    kissinger = 666 ( 6, 6)

    air = 666 ( 72, 18)
    alphabet = 666 ( 12, 10)
    America = 666 ( 3, 15)
    amoeba = 666 ( 18, 18)
    depone = 666 ( 5, 12)
    Earth = 666 ( 11, 13)
    fruit = 666 ( 9, 9)
    love = 666 ( 4, 13)
    nudibranch = 666 ( 33, 4)
    peanut = 666 ( 40, 6)
    pizza = 666 ( 31, 7)
    pluto = 666 ( 70, 4)
    sushi = 666 ( 48, 6)
    transistor = 666 ( 38, 2)
    ultracrepidarian = 666 ( 32, 1)
    Uranus = 666 ( 23, 6)
    water = 666 ( 34, 8)
    xenophobia = 666 ( 27, 4)
    Q.E.D. = 666 ( 84, 18)
    On Tue, Jul 22, 2014 at 11:18 AM, Nate Finch wrote:

    It probably loops on the playground because you can't read from stdin on
    the playground, so the read just always returns an error, which causes your
    loop. You should exit if your fmt.Fscan errors out. You should also check
    the error from std.Readline in calc().

    You almost never need to use var.
    var abc string = "abcdefghijklmnopqrstuvwxyz"

    is the same as

    abc := "abcdefghijklmnopqrstuvwxyz"

    var text []byte = make([]byte, 256)

    is the same as

    text := make([]byte, 256)

    etc. The := version is much preferred.




    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765*

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Michael Jones at Jul 23, 2014 at 4:17 am
    Arie, a few more examples provide support for the "~80% beastly" metric.

    Aesop's Fables

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/aesop
    79.2385% beastly words
    867 non-beastly words
    3309 beastly words

    Lewis Carroll's "Alice in Wonderland"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/alice
    80.4664% beastly words
    511 non-beastly words
    2105 beastly words

    Ayn Rand's "Anthem"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/anthem
    80.9281% beastly words
    374 non-beastly words
    1587 beastly words

    Martin Luther King, Jr.'s "I Have A Dream"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/king
    78.6245% beastly words
    115 non-beastly words
    423 beastly words

    Abraham Lincoln's "Gettysburg Address"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/lincoln
    80.4348% beastly words
    27 non-beastly words
    111 beastly words

    Herman Melville's "Moby Dick"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/mobydick
    74.0654% beastly words
    4405 non-beastly words
    12580 beastly words

    If you think a little bit about the arithmetic of your algebraic structure
    (and about the extended greatest common factor algorithm) then you'll see
    how to know if there are solutions that attain the goal number (666 in this
    case) and to produce those solutions without needing to iterate for trial
    and error. Iteration seemed simpler and the cases are few, which harken's
    to Ken Thompson's famous advice about brute force.

    On Tue, Jul 22, 2014 at 3:35 PM, Michael Jones wrote:

    Arie,

    I've added a bit to the sample program. First, I expanded the search range
    so that all single letter words can be beastified, and also, I added code
    to read file names as command line arguments, extract all their words, and
    then beastify each unique word across the document set. The new version is
    here:

    http://play.golang.org/p/CzL2f3xvVA

    For example:

    *$ ./beast ozymandias.txt *
    *80.2326% beastly words*

    *17 non-beastly words:*
    *[ a colossal command from kings ozymandias passions read sculptor
    shattered traveller trunkless well whose wreck wrinkled]*

    *69 beastly words:*
    *[an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*
    *mtj@mtj-linux:~/gocode/src/beast$ go build *
    *mtj@mtj-linux:~/gocode/src/beast$ ./beast ozymandias.txt *
    *81.3953% beastly words*

    *16 non-beastly words:*
    *[ colossal command from kings ozymandias passions read sculptor shattered
    traveller trunkless well whose wreck wrinkled]*

    *70 beastly words:*
    *[a an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*

    ...and, perhaps more apropos, from the KJV...

    *$ ./beast bible.txt *
    *76.6383% beastly words*

    *2966 non-beastly words:*
    *[abda abdi abel abelbethmaachah abelmaim abelmeholah abelshittim
    abhorrest abhorreth abhorring abialbon abiathar abideth abiezrite abihail
    abishai able abner abominations*
    *: *
    *zephaniah zephath zepho zephonites zerahiah ziha zimri zion zior ziphites
    zizah zoan zoar zoba zorathites zorites]*

    *9730 beastly words:*
    *[a aaron aaronites aarons abaddon abagtha abana abarim abase abased
    abasing abated abba abdeel abdiel abdon abednego abelmizraim abez abhor
    abhorred abi abia abiah *
    *:*
    *ziphron zippor zipporah zithri ziz ziza zobah zobebah zohar zoheleth
    zoheth zophah zophai zophar zophim zorah zoreah zorobabel zuar zuph zur
    zuriel zurishaddai zuzims]*

    The general ratio seems to be in the range of 70%-85% beastly.

    On Tue, Jul 22, 2014 at 1:05 PM, Michael Jones wrote:

    Arle,

    Here is my take on your program:
    http://play.golang.org/p/_AKEPYf0yL

    It shows how to write beast() and also how to implement the inverse
    operation, beastify(), which finds combinations of base and step to make
    chosen strings have whatever goal value you seek. Here is a sample :

    $ go run main.go
    hitler = 666 (100, 1)

    computer = 666 ( 6, 6)
    humanity = 666 ( 6, 6)
    nuclear hell = 666 ( 6, 6)
    kissinger = 666 ( 6, 6)

    air = 666 ( 72, 18)
    alphabet = 666 ( 12, 10)
    America = 666 ( 3, 15)
    amoeba = 666 ( 18, 18)
    depone = 666 ( 5, 12)
    Earth = 666 ( 11, 13)
    fruit = 666 ( 9, 9)
    love = 666 ( 4, 13)
    nudibranch = 666 ( 33, 4)
    peanut = 666 ( 40, 6)
    pizza = 666 ( 31, 7)
    pluto = 666 ( 70, 4)
    sushi = 666 ( 48, 6)
    transistor = 666 ( 38, 2)
    ultracrepidarian = 666 ( 32, 1)
    Uranus = 666 ( 23, 6)
    water = 666 ( 34, 8)
    xenophobia = 666 ( 27, 4)
    Q.E.D. = 666 ( 84, 18)

    On Tue, Jul 22, 2014 at 11:18 AM, Nate Finch <nate.finch@gmail.com>
    wrote:
    It probably loops on the playground because you can't read from stdin on
    the playground, so the read just always returns an error, which causes your
    loop. You should exit if your fmt.Fscan errors out. You should also check
    the error from std.Readline in calc().

    You almost never need to use var.
    var abc string = "abcdefghijklmnopqrstuvwxyz"

    is the same as

    abc := "abcdefghijklmnopqrstuvwxyz"

    var text []byte = make([]byte, 256)

    is the same as

    text := make([]byte, 256)

    etc. The := version is much preferred.




    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765*

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Arie van Wingerden at Jul 23, 2014 at 8:42 am
    @nate
      thx for the tips; I'll look into them. The error checking was on my
    wishlist already, but I ignored that part up till now for the sake of
    simplicity.

    @michael
    Wow! You dived right into this thing!
    I'll study your examples to learn quite a few things ;-)

    May I conclude that my code was not too bad after all?

    Thanks again and kind regards,
        Arie


    2014-07-23 6:16 GMT+02:00 'Michael Jones' via golang-nuts <
    golang-nuts@googlegroups.com>:
    Arie, a few more examples provide support for the "~80% beastly" metric.

    Aesop's Fables

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/aesop
    79.2385% beastly words
    867 non-beastly words
    3309 beastly words

    Lewis Carroll's "Alice in Wonderland"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/alice
    80.4664% beastly words
    511 non-beastly words
    2105 beastly words

    Ayn Rand's "Anthem"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/anthem
    80.9281% beastly words
    374 non-beastly words
    1587 beastly words

    Martin Luther King, Jr.'s "I Have A Dream"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/king
    78.6245% beastly words
    115 non-beastly words
    423 beastly words

    Abraham Lincoln's "Gettysburg Address"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/lincoln
    80.4348% beastly words
    27 non-beastly words
    111 beastly words

    Herman Melville's "Moby Dick"

    mtj-macbookpro:beast mtj$ ./beast ../ladder/words/text/mobydick
    74.0654% beastly words
    4405 non-beastly words
    12580 beastly words

    If you think a little bit about the arithmetic of your algebraic structure
    (and about the extended greatest common factor algorithm) then you'll see
    how to know if there are solutions that attain the goal number (666 in this
    case) and to produce those solutions without needing to iterate for trial
    and error. Iteration seemed simpler and the cases are few, which harken's
    to Ken Thompson's famous advice about brute force.

    On Tue, Jul 22, 2014 at 3:35 PM, Michael Jones wrote:

    Arie,

    I've added a bit to the sample program. First, I expanded the search
    range so that all single letter words can be beastified, and also, I added
    code to read file names as command line arguments, extract all their words,
    and then beastify each unique word across the document set. The new version
    is here:

    http://play.golang.org/p/CzL2f3xvVA

    For example:

    *$ ./beast ozymandias.txt *
    *80.2326% beastly words*

    *17 non-beastly words:*
    *[ a colossal command from kings ozymandias passions read sculptor
    shattered traveller trunkless well whose wreck wrinkled]*

    *69 beastly words:*
    *[an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*
    *mtj@mtj-linux:~/gocode/src/beast$ go build *
    *mtj@mtj-linux:~/gocode/src/beast$ ./beast ozymandias.txt *
    *81.3953% beastly words*

    *16 non-beastly words:*
    *[ colossal command from kings ozymandias passions read sculptor
    shattered traveller trunkless well whose wreck wrinkled]*

    *70 beastly words:*
    *[a an and antique appear away bare beside boundless cold decay desert
    despair far fed frown half hand heart i in is its king land legs level lies
    lifeless lip lone look met mighty mocked my name near nothing of on
    pedestal remains round said sand sands sneer stamped stand stone stretch
    sunk survive tell that the them these things those two vast visage which
    who words works ye yet]*

    ...and, perhaps more apropos, from the KJV...

    *$ ./beast bible.txt *
    *76.6383% beastly words*

    *2966 non-beastly words:*
    *[abda abdi abel abelbethmaachah abelmaim abelmeholah abelshittim
    abhorrest abhorreth abhorring abialbon abiathar abideth abiezrite abihail
    abishai able abner abominations*
    *: *
    *zephaniah zephath zepho zephonites zerahiah ziha zimri zion zior
    ziphites zizah zoan zoar zoba zorathites zorites]*

    *9730 beastly words:*
    *[a aaron aaronites aarons abaddon abagtha abana abarim abase abased
    abasing abated abba abdeel abdiel abdon abednego abelmizraim abez abhor
    abhorred abi abia abiah *
    *:*
    *ziphron zippor zipporah zithri ziz ziza zobah zobebah zohar zoheleth
    zoheth zophah zophai zophar zophim zorah zoreah zorobabel zuar zuph zur
    zuriel zurishaddai zuzims]*

    The general ratio seems to be in the range of 70%-85% beastly.

    On Tue, Jul 22, 2014 at 1:05 PM, Michael Jones wrote:

    Arle,

    Here is my take on your program:
    http://play.golang.org/p/_AKEPYf0yL

    It shows how to write beast() and also how to implement the inverse
    operation, beastify(), which finds combinations of base and step to make
    chosen strings have whatever goal value you seek. Here is a sample :

    $ go run main.go
    hitler = 666 (100, 1)

    computer = 666 ( 6, 6)
    humanity = 666 ( 6, 6)
    nuclear hell = 666 ( 6, 6)
    kissinger = 666 ( 6, 6)

    air = 666 ( 72, 18)
    alphabet = 666 ( 12, 10)
    America = 666 ( 3, 15)
    amoeba = 666 ( 18, 18)
    depone = 666 ( 5, 12)
    Earth = 666 ( 11, 13)
    fruit = 666 ( 9, 9)
    love = 666 ( 4, 13)
    nudibranch = 666 ( 33, 4)
    peanut = 666 ( 40, 6)
    pizza = 666 ( 31, 7)
    pluto = 666 ( 70, 4)
    sushi = 666 ( 48, 6)
    transistor = 666 ( 38, 2)
    ultracrepidarian = 666 ( 32, 1)
    Uranus = 666 ( 23, 6)
    water = 666 ( 34, 8)
    xenophobia = 666 ( 27, 4)
    Q.E.D. = 666 ( 84, 18)

    On Tue, Jul 22, 2014 at 11:18 AM, Nate Finch <nate.finch@gmail.com>
    wrote:
    It probably loops on the playground because you can't read from stdin
    on the playground, so the read just always returns an error, which causes
    your loop. You should exit if your fmt.Fscan errors out. You should also
    check the error from std.Readline in calc().

    You almost never need to use var.
    var abc string = "abcdefghijklmnopqrstuvwxyz"

    is the same as

    abc := "abcdefghijklmnopqrstuvwxyz"

    var text []byte = make([]byte, 256)

    is the same as

    text := make([]byte, 256)

    etc. The := version is much preferred.




    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*


    --
    *Michael T. Jones | Chief Technology Advocate | mtj@google.com
    <mtj@google.com> | +1 650-335-5765 <%2B1%20650-335-5765>*

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Lex Sheehan at Jul 24, 2014 at 12:53 am
    1) Package comments should not begin with a space
    /*

    ===========================================================================

         This program calculates the value for a given word, based on the
    following:
         1. only characters in the range a..z are considered


    2) should omit type int from declaration of var base; it will be inferred
    from the right-hand side
    var base int = readint("Enter base: ")

    3) should omit type int from declaration of var step; it will be inferred
    from the right-hand side
    var step int = readint("Enter step: ")

    4) should omit type []byte from declaration of var text; it will be
    inferred from the right-hand side
    var text []byte = make([]byte, 256)

    5) abc should be declared as a constant
    const abc string = "abcdefghijklmnopqrstuvwxyz"

    6) should drop = 0 from declaration of var number; it is the zero value
    var number int = 0

    7) should drop = 0 from declaration of var pos; it is the zero value
    var pos int = 0

    Hope that helps.

    ~ Lex


    On Tuesday, July 22, 2014 1:59:49 PM UTC-4, Arie van Wingerden wrote:

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in the
    playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Lubos Pintes at Jul 24, 2014 at 7:43 am
    Sorry, I maybe totally stupid, but ... what is this? :) Which "problem"
    this solves?
    Thanks
    Dňa 22. 7. 2014 19:59 Arie van Wingerden wrote / napísal(a):
    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie

    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to
    golang-nuts+unsubscribe@googlegroups.com
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Arie van Wingerden at Jul 24, 2014 at 2:00 pm
    @lex thanks!
    @lubos you are *not* stupid. As I said it is just an algorithm used by some
    people to interpret words against a numerological / religious background.
    My only purpose is to start learning Go with it ;-) Please don't be
    offended by the algorithm!



    2014-07-24 9:43 GMT+02:00 Lubos Pintes <lubos.pintes@gmail.com>:
    Sorry, I maybe totally stupid, but ... what is this? :) Which "problem"
    this solves?
    Thanks
    Dňa 22. 7. 2014 19:59 Arie van Wingerden wrote / napísal(a):
    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/rMeHAU32qa

    Thanks and kind regards,
    Arie

    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to
    golang-nuts+unsubscribe@googlegroups.com
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups
    "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Lubos Pintes at Jul 24, 2014 at 2:35 pm
    Oh yes. I just read more about it on the net...

    Dňa 24. 7. 2014 16:00 Arie van Wingerden wrote / napísal(a):
    @lex thanks!
    @lubos you are *not* stupid. As I said it is just an algorithm used by
    some people to interpret words against a numerological / religious
    background. My only purpose is to start learning Go with it ;-) Please
    don't be offended by the algorithm!



    2014-07-24 9:43 GMT+02:00 Lubos Pintes
    <lubos.pintes@gmail.com

    Sorry, I maybe totally stupid, but ... what is this? :) Which
    "problem" this solves?
    Thanks
    Dňa 22. 7. 2014 19:59 Arie van Wingerden wrote / napísal(a):

    Hi,

    since quite some time I followed Go in read-only mode ;-)

    Now I have started with a real (but toy) program, using an algorithm
    described at a few places on the web.

    The program runs fine on my Windows, but seems to loop when
    running in
    the playground.

    Please be kind, it's a first try ;-) All advice is welcome!

    Here is the link: http://play.golang.org/p/__rMeHAU32qa
    <http://play.golang.org/p/rMeHAU32qa>

    Thanks and kind regards,
    Arie

    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from
    it, send
    an email to
    golang-nuts+unsubscribe@__googlegroups.com

    For more options, visit https://groups.google.com/d/__optout
    <https://groups.google.com/d/optout>.



    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to golang-nuts+unsubscribe@__googlegroups.com
    For more options, visit https://groups.google.com/d/__optout
    <https://groups.google.com/d/optout>.


    --
    You received this message because you are subscribed to the Google
    Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send
    an email to
    golang-nuts+unsubscribe@googlegroups.com
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJul 22, '14 at 5:59p
activeJul 24, '14 at 2:35p
posts10
users5
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase