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


Groups > comp.lang.forth > #15945

Re: Olympic Spririt for Forth

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Olympic Spririt for Forth
Date 2012-10-05 11:08 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2012Oct5.130829@mips.complang.tuwien.ac.at> (permalink)
References (7 earlier) <7xmx03bclp.fsf@ruckus.brouhaha.com> <1797229.DCWuoRaQ3N@sunwukong.fritz.box> <7x4nmauisn.fsf@ruckus.brouhaha.com> <2028826.7QaYsnLk6j@sunwukong.fritz.box> <7xd30x4t9c.fsf@ruckus.brouhaha.com>

Show all headers | View raw


Paul Rubin <no.email@nospam.invalid> writes:
>Bernd Paysan <bernd.paysan@gmx.de> writes:
>> 4 red arms
>> green cylinder body
>> 4 black wheels
>>
>> Is this a data structure or a program?  I don't know, I don't care.  To 
>> draw the robot, you have to interpret the data structure or to execute 
>> the program.
>
>I'd rather that it be data since then I can write code to interpret the
>data in multiple ways, and it helps to be able to write data before
>starting to write code.  E.g. in Python:
>
>programmers = [
>  {'name':'Bernd' 'languages':['Forth','C']},
>  {'name':'Elizabeth','languages':['Forth','Fortran']},
>  {'name':'Paul','languages':['Python','Forth']}
>]
>
>I can type that directly into Python and have it create a nested data
>structure, without having to write and debug any specialized code.

This reminds me of what I do with data in charts written in Postscript.

In simple cases, the data is interpreted directly and drawn right away:

%trad
1
   3040561373
   3042635978
   3043166570
3 copy median3 /scalefactor swap def
median3point mt
%doprims
   3106897257
   3103339195
   3106836628
median3point lt

In more complex cases I put the data in arrays and drawn them later:

/compress
[ 0.0
  0.0
 29.3
 41.5
 29.3
  0.0
  0.0
] def
...
[ /compress /jess /db /javac /mpegaudio /mtrt /jack ]
{ << /bench rot >> begin bars end } forall

Finally, I put the data in procedures that can be used to draw things
or build arrays from the data several times in different ways, if
needed:

/core2 { %smaug
[
100383730 event0x0041008D@0
5370 event0x0041008E@1
5638338384 event0x00410000@0x40000000
3251152763 event0x00410000@0x40000001
100381820 event0x0041008D@0
5180 event0x0041008E@1
1638276480 event0x00410000@0x40000000
840453768 event0x00410000@0x40000001
(primitive) oneword
2400384720 event0x0041008D@0
300006874 event0x0041008E@1
7938302989 event0x00410000@0x40000000
9241083370 event0x00410000@0x40000001
400381976 event0x0041008D@0
5822 event0x0041008E@1
1938271683 event0x00410000@0x40000000
940217000 event0x00410000@0x40000001
(code-def) oneword
...
] /default oneforth
....
} def

/scalefactor 2000000000 def

/oneforth {load exec} def
/oneword {drop sub scalefactor div} def
%select none by default, later change one event and one forth from default
/event0x0041008D@0          {drop} def
/event0x0041008E@1	    {drop} def
/event0x00410000@0x40000000 {drop} def
/event0x00410000@0x40000001 {drop} def
/tsc			    {drop} def
/event0x004100C0            {drop} def
/event0x004100C4            {drop} def
/event0x004100C5            {drop} def
...
<< /results {core2} /event0x00410000@0x40000000 {} >> bars

This selects the event0x00410000@0x40000000 records from the data and
draws a set of bars (for a bar chart).  I guess I had to write _and
debug_ all these event* procedures before running the program
successfully.  So what.  The actual work was elsewhere.

These three steps are actually the evolution of how I write these
charts.  The main driver here was to minimize the manual work for
integrating the data coming out of my measurement scripts into the
charts.

>If I'm supposed to implement such stuff myself, why do I want your
>toolkit in the first place?  Obviously as a FOSS user I want to be able
>to extend the toolkit as a last resort, and obviously in the first
>releases of a toolkit, the important use cases haven't necessarily been
>identified.  But after a few iterations I'd expect the toolkit to do
>pretty much everything needed, and modularity makes me not want to
>maintain my own fork if I can help it.

Yes, Knuth expected users to do their own forks of TeX for specialized
purposes, but this has not really happened, even though there is no
evolution of TeX to speak of (so merging changes back into the fork
would not have been an issue).  People just don't want to much with
the internals of an existing program.

OTOH, the success of applications that support scripting and add-ons
shows that, no, you cannot expect a program to do everything that's
needed out of the box, even after a few iterations.  So people are
willing to program extensions given a defined interface (e.g., various
packages on top of TeX, such as LaTeX, instead of a fork of TeX).

>OK, so you make a small modification and create a bug, which makes your
>test fail.  What now?  You have to figure out the cause of the bug.
>And, I think, this is much easier in a (runtime) type-checked and
>bounds-checked language, than something like Forth.

For a small modification, the bug is usually obvious.  How can
something else be easier.

Debugging Forth code is usually easy in my experience, certainly for
things that would be caught by a type or bounds checker.  But maybe it
takes experience to write programs such that such bugs are easy to
find.

>> If you haven't found Forth strings, arrays, hash tables, etc., by now, 
>> it's because you were looking at an embedded Forth, where all these 
>> features just don't fit.
>
>I'm using gforth and I didn't notice any of that in the manual.

Strings: http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Memory-Blocks.html

(no docs for Bernds strings package, though).

Arrays:
http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Address-arithmetic.html

Hash tables:
http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Word-Lists.html

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2012: http://www.euroforth.org/ef12/

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


Thread

Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-09-15 22:28 +0100
  Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-09-18 02:08 -0700
    Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-18 11:58 +0000
      Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-09-18 05:55 -0700
        Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-19 12:50 +0000
        Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-06 01:40 -0700
          Re: Olympic Spririt for Forth "A. K." <akk@nospam.org> - 2012-10-06 11:18 +0200
    Re: Olympic Spririt for Forth Spam@ControlQ.com - 2012-09-18 11:13 -0400
    Re: Olympic Spririt for Forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-09-19 15:56 -0700
    Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-09-29 00:56 -0700
      Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-09-30 12:31 -0400
        Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-09-30 11:53 -0700
          Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-09-30 17:38 -0400
          Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-02 04:16 -0700
            Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-02 10:52 -0700
              Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-02 20:20 +0200
                Re: Olympic Spririt for Forth Spam@ControlQ.com - 2012-10-02 15:58 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-02 13:31 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-03 02:59 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-02 19:08 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-03 15:50 +0200
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-03 14:04 +0000
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-03 10:29 -0700
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-04 16:07 +0000
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-03 20:27 +0200
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-04 16:11 +0000
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-04 20:12 +0200
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-05 13:08 +0000
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-05 17:48 +0200
                Re: Olympic Spririt for Forth Pablo Hugo Reda <pabloreda@gmail.com> - 2012-10-03 07:39 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-03 20:24 +0200
                Re: Olympic Spririt for Forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-10-03 18:13 -0700
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-03 12:05 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-03 22:20 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-04 12:41 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-04 22:40 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-04 18:11 -0700
                Re: Olympic Spririt for Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-04 15:26 -1000
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-04 18:54 -0700
                Re: Olympic Spririt for Forth "A. K." <akk@nospam.org> - 2012-10-05 08:19 +0200
                Re: Olympic Spririt for Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-04 22:18 -1000
                Re: Olympic Spririt for Forth Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-10-05 08:20 +0100
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-05 11:08 +0000
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-07 08:32 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-07 21:39 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-07 21:03 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-08 19:09 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-08 21:57 -0700
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-09 01:10 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-09 14:12 -0400
                Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-10 09:29 +0100
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-10 21:13 -0400
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-10 02:02 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-10 21:23 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-10 18:24 -0700
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-11 17:21 +0000
                Re: Olympic Spririt for Forth Mark Wills <markrobertwills@yahoo.co.uk> - 2012-10-11 12:33 -0700
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-11 13:42 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-11 18:59 -0400
                Re: Olympic Spririt for Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-11 13:49 -1000
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-12 03:27 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-12 19:18 -0700
                Re: Olympic Spririt for Forth Elizabeth D Rather <erather@forth.com> - 2012-10-12 18:53 -1000
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-12 22:55 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-13 22:07 +0200
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-13 00:56 -0400
                Re: Olympic Spririt for Forth Doug Hoffman <glidedog@gmail.com> - 2012-10-13 18:41 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-13 16:05 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-14 02:57 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-14 00:26 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-14 19:28 +0200
                Re: Olympic Spririt for Forth kenney@cix.compulink.co.uk - 2012-10-15 04:21 -0500
                Re: Olympic Spririt for Forth Mark Wills <markrobertwills@yahoo.co.uk> - 2012-10-14 03:17 -0700
                Re: Olympic Spririt for Forth Alex McDonald <blog@rivadpm.com> - 2012-10-14 15:43 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-14 21:18 -0400
                Re: Olympic Spririt for Forth kenney@cix.compulink.co.uk - 2012-10-15 04:21 -0500
                Re: Olympic Spririt for Forth anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-10-15 10:03 +0000
                Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-15 04:04 -0700
                Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-15 21:34 +0100
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-15 17:51 -0400
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-16 01:09 -0700
                Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-16 02:15 -0700
                Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-16 02:30 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-16 15:18 -0400
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-14 21:05 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-14 18:19 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-15 17:58 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-15 15:21 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-15 18:51 -0400
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-15 17:20 -0700
                Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-12 22:41 +0100
                Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-12 22:24 +0100
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-09 01:20 -0700
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-09 08:56 -0700
                Re: Olympic Spririt for Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-09 11:14 -0500
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-09 22:47 +0200
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-09 18:31 -0700
                Re: Olympic Spririt for Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-09 22:55 -0500
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-09 01:04 -0700
                Re: Olympic Spririt for Forth Bernd Paysan <bernd.paysan@gmx.de> - 2012-10-09 17:30 +0200
                Re: Olympic Spririt for Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-04 11:31 -1000
                Re: Olympic Spririt for Forth kenney@cix.compulink.co.uk - 2012-10-03 16:53 -0500
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-03 16:50 -0700
                Re: Olympic Spririt for Forth Hugh Aguilar <hughaguilar96@yahoo.com> - 2012-10-03 18:06 -0700
                Re: Olympic Spririt for Forth kenney@cix.compulink.co.uk - 2012-10-03 16:53 -0500
              Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-03 00:38 -0700
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-03 02:06 -0700
                Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-03 03:38 -0700
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-03 13:40 -0700
                Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-04 01:00 -0700
                Re: Olympic Spririt for Forth "Elizabeth D. Rather" <erather@forth.com> - 2012-10-03 22:32 -1000
                Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-04 04:49 -0700
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-04 01:35 -0700
                Re: Olympic Spririt for Forth Howerd <howerdo@yahoo.co.uk> - 2012-10-06 06:17 -0700
                Re: Olympic Spririt for Forth arc <arc.deletethis@vorsicht-bissig.de> - 2012-10-07 23:45 +1300
                Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-10 09:34 -0700
                Re: Olympic Spririt for Forth Mark Wills <forthfreak@gmail.com> - 2012-10-10 12:16 -0700
                Re: Olympic Spririt for Forth Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-10-10 20:04 -0500
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-04 11:41 -0700
                Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-05 12:29 -0700
                Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-06 19:26 -0700
                Re: Olympic Spririt for Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-10-05 19:09 +0000
            Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-02 22:03 +0100
            Re: Olympic Spririt for Forth Ilya Tarasov <ilya74.tarasov@gmail.com> - 2012-10-06 08:30 -0700
  Re: Olympic Spririt for Forth ilya74.tarasov@gmail.com - 2012-09-29 07:09 -0700
  Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-09 14:30 -0700
    Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-09 18:27 -0400
      Re: Olympic Spririt for Forth "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-10-10 09:46 +0100
      Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-10 03:52 -0700
        Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-10 06:01 -0700
          Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-10 07:42 -0700
            Re: Olympic Spririt for Forth theoriginalsnial@gmail.com - 2012-10-10 09:10 -0700
            Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-10 10:34 -0700
              Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-11 17:17 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-13 01:03 -0400
        Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-10 21:59 -0400
          Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-10 20:57 -0700
            Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-11 02:05 -0700
            Re: Olympic Spririt for Forth Matthias Koch <koch@pci.uni-hannover.de> - 2012-10-15 11:20 +0200
          Re: Olympic Spririt for Forth albert@spenarnc.xs4all.nl (Albert van der Horst) - 2012-10-15 11:53 +0000
            Re: Olympic Spririt for Forth Paul Rubin <no.email@nospam.invalid> - 2012-10-15 08:52 -0700
              Re: Olympic Spririt for Forth visualforth@rocketmail.com - 2012-10-15 11:53 -0700
                Re: Olympic Spririt for Forth rickman <gnuarm@gmail.com> - 2012-10-15 18:00 -0400

csiph-web