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


Groups > comp.lang.forth > #34700

Re: Epic failure (was Epic Fail)

From Bernd Paysan <bernd.paysan@gmx.de>
Newsgroups comp.lang.forth
Subject Re: Epic failure (was Epic Fail)
Date 2014-11-30 00:31 +0100
Organization A noiseless patient Spider
Message-ID <m5dkvt$uo$1@dont-email.me> (permalink)
References <f357fc56-c996-4d72-a53d-194a13e276ec@googlegroups.com> <m5d9cn$o3s$1@dont-email.me>

Show all headers | View raw


WJ wrote:
> Forth is an extremely low-level and crude language, suitable only
> for programming embedded controllers.

Well, only idiots struggle with Forth.

> Gauche Scheme:
> 
> (use srfi-42)
> (let1 table (make-hash-table)
>   (dolist (ch (filter #[a-z]  (string->list
>                   "The Wikipedia article on Java states that in 2014
>                   Java is the most popular programming language with
>                   9 million developers.  How many developers do you
>                   think actually make money programming in Forth?
>                   Probably about 9!")))
>     (hash-table-update! table ch (pa$ + 1) 0))
>   (do-ec (: ch #\a #\z)
>     (print ch " " (make-string (hash-table-get table ch 0) #\*))))
[...]
> Now struggle to program the equivalent in Forth.

$100 cells buffer: chist
: stars ( n -- )  0 ?DO  '*' emit  LOOP ;
: .hist-az ( -- )  'z' 1+ 'a' DO
  cr i emit space chist i cells + @ stars  LOOP ;
: hist ( addr u -- )
  bounds ?DO  1 i c@ cells chist + +!  LOOP ;
s" The Wikipedia article on Java states that in 2014 Java is the most 
popular programming language with 9 million developers.  How many developers 
do you think actually make money programming in Forth? Probably about 9!" 
hist .hist-az

Written, did run first try without debugging, and produced the same result 
as your program.  And it's all Forth 200x without any library.

a *******************
b ***
c **
d ****
e **************
f 
g ******
h ******
i *************
j 
k ***
l **********
m *********
n **********
o ***************
p *******
q 
r **********
s ******
t ************
u *****
v ****
w **
x 
y *****
z

One question: Why didn't you write the code in Java, but in Scheme instead?  
You did even use a library, while I only used very basic Forth stuff, core 
words only, stuff you may find on any controller.  Scheme is certainly just 
about as obscure as Forth.  If you want to make money, use Java instead.

And even though you did use a library, you have the same line count in your 
Scheme program.  One of the lines just loading the library...  Well, I'd say 
that is really pathetic.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

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


Thread

Re: Epic failure (was Epic Fail) "WJ" <w_a_x_man@yahoo.com> - 2014-11-29 20:13 +0000
  Re: Epic failure (was Epic Fail) C G Montgomery <cgm@physics.utoledo.edu> - 2014-11-29 17:15 -0500
  Re: Epic failure (was Epic Fail) Pablo Hugo Reda <pabloreda@gmail.com> - 2014-11-29 14:20 -0800
  Re: Epic failure awegel@arcor.de (Alexander Wegel) - 2014-11-29 23:35 +0100
  Re: Epic failure (was Epic Fail) Bernd Paysan <bernd.paysan@gmx.de> - 2014-11-30 00:31 +0100
  Re: Epic failure (was Epic Fail) Julian Fondren <julian.fondren@gmail.com> - 2014-11-29 17:41 -0800
    Re: Epic failure (was Epic Fail) mhx@iae.nl - 2014-11-30 00:04 -0800
      Re: Epic failure (was Epic Fail) mhx@iae.nl - 2014-11-30 00:09 -0800
        Re: Epic failure (was Epic Fail) Bernd Paysan <bernd.paysan@gmx.de> - 2014-11-30 17:22 +0100
  Re: Epic failure (was Epic Fail) "WJ" <w_a_x_man@yahoo.com> - 2014-11-30 02:13 +0000
    Re: Epic failure (was Epic Fail) Julian Fondren <julian.fondren@gmail.com> - 2014-11-29 18:55 -0800
    Re: Epic failure (was Epic Fail) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-11-30 16:50 +0000
      Re: Epic failure (was Epic Fail) Bernd Paysan <bernd.paysan@gmx.de> - 2014-12-01 01:22 +0100
        Re: Epic failure (was Epic Fail) Melzzzzz <mel@zzzzz.com> - 2014-12-02 06:00 +0100
          Re: Epic failure (was Epic Fail) Melzzzzz <mel@zzzzz.com> - 2014-12-02 06:37 +0100
            Re: Epic failure (was Epic Fail) albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-12-02 12:28 +0000
            Re: Epic failure Paul Rubin <no.email@nospam.invalid> - 2014-12-02 18:03 -0800
        Re: Epic failure (was Epic Fail) the_gavino_himself <visphatesjava@gmail.com> - 2014-12-05 10:10 -0800
          Re: Epic failure (was Epic Fail) rickman <gnuarm@gmail.com> - 2014-12-05 16:23 -0500
            Re: Epic failure (was Epic Fail) Jason Damisch <jasondamisch@yahoo.com> - 2014-12-05 13:46 -0800
    Re: Epic failure (was Epic Fail) "WJ" <w_a_x_man@yahoo.com> - 2014-12-01 07:54 +0000
      Re: Epic failure awegel@arcor.de (Alexander Wegel) - 2014-12-01 14:02 +0100
        Re: Epic failure hughaguilar96@gmail.com - 2014-12-01 15:04 -0800
          Re: Epic failure awegel@arcor.de (Alexander Wegel) - 2014-12-02 04:54 +0100

csiph-web