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


Groups > comp.lang.forth > #25794 > unrolled thread

well this code works and I had some guy say it doesn't

Started bygavino_himself <visploveslisp@gmail.com>
First post2013-09-18 22:55 -0700
Last post2013-09-24 07:46 -0700
Articles 15 on this page of 35 — 15 participants

Back to article view | Back to comp.lang.forth


Contents

  well this code works and I had some guy say it doesn't gavino_himself <visploveslisp@gmail.com> - 2013-09-18 22:55 -0700
    Re: well this code works and I had some guy say it doesn't gavino_himself <visploveslisp@gmail.com> - 2013-09-18 22:58 -0700
    Re: well this code works and I had some guy say it doesn't VoidVolker <voidvolker@gmail.com> - 2013-09-18 23:35 -0700
      Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-19 03:09 -0400
        Re: well this code works and I had some guy say it doesn't gavino_himself <visploveslisp@gmail.com> - 2013-09-19 01:11 -0700
          Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-19 04:32 -0400
            Re: well this code works and I had some guy say it doesn't Elizabeth D Rather <erather@forth.com> - 2013-09-19 14:15 -1000
              Re: well this code works and I had some guy say it doesn't "Ed" <invalid@invalid.com> - 2013-09-21 12:48 +1000
                Re: well this code works and I had some guy say it doesn't "Elizabeth D. Rather" <erather@forth.com> - 2013-09-20 17:52 -1000
                  Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-21 08:46 -0400
                    Re: well this code works and I had some guy say it doesn't Doug Hoffman <glidedog@gmail.com> - 2013-09-21 10:40 -0400
                      Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-21 10:48 -0400
                        Re: well this code works and I had some guy say it doesn't Doug Hoffman <glidedog@gmail.com> - 2013-09-21 18:12 -0400
                        Re: well this code works and I had some guy say it doesn't albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-09-23 16:59 +0000
                      Re: well this code works and I had some guy say it doesn't "WJ" <w_a_x_man@yahoo.com> - 2013-09-21 17:48 +0000
                        Re: well this code works and I had some guy say it doesn't Doug Hoffman <glidedog@gmail.com> - 2013-09-21 19:34 -0400
                      Re: well this code works and I had some guy say it doesn't "Ed" <invalid@invalid.com> - 2013-09-22 11:51 +1000
                        Re: well this code works and I had some guy say it doesn't hughaguilar96@yahoo.com - 2013-09-21 21:09 -0700
                    Re: well this code works and I had some guy say it doesn't "Rod Pemberton" <dont_use_email@nohavenotit.com> - 2013-09-21 13:09 -0400
                      Re: well this code works and I had some guy say it doesn't "Elizabeth D. Rather" <erather@forth.com> - 2013-09-21 08:37 -1000
                        Re: well this code works and I had some guy say it doesn't albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-09-23 17:26 +0000
            Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-21 02:19 -0700
        Re: well this code works and I had some guy say it doesn't "WJ" <w_a_x_man@yahoo.com> - 2013-09-19 09:16 +0000
          Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-20 23:08 -0700
            Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-21 08:47 -0400
    Re: well this code works and I had some guy say it doesn't Spam@ControlQ.com - 2013-09-19 11:16 -0400
      Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-20 23:07 -0700
    Re: well this code works and I had some guy say it doesn't "Rod Pemberton" <dont_use_email@nohavenotit.com> - 2013-09-20 04:37 -0400
      Re: well this code works and I had some guy say it doesn't "Elizabeth D. Rather" <erather@forth.com> - 2013-09-19 22:45 -1000
        Re: well this code works and I had some guy say it doesn't Howerd <howerdo@yahoo.co.uk> - 2013-09-20 01:49 -0700
          Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-20 23:10 -0700
      Re: well this code works and I had some guy say it doesn't rickman <gnuarm@gmail.com> - 2013-09-20 08:19 -0400
        Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-20 23:11 -0700
      Re: well this code works and I had some guy say it doesn't the_gavino_himself <visphatesjava@gmail.com> - 2013-09-20 23:09 -0700
      Re: well this code works and I had some guy say it doesn't Mark Wills <markrobertwills@yahoo.co.uk> - 2013-09-24 07:46 -0700

Page 2 of 2 — ← Prev page 1 [2]


#25969

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2013-09-23 17:26 +0000
Message-ID<524079e1$0$26887$e4fe514c@dreader37.news.xs4all.nl>
In reply to#25900
In article <KOOdnQTUasnHeqDPnZ2dnUVZ_rKdnZ2d@supernews.com>,
Elizabeth D. Rather <erather@forth.com> wrote:
<SNIP>
>
>But in fact, having a DROP or 2DROP at the end of a loop is quite
>common, and for very good reasons. The very next problem in this
>sequence is BOX:
>
>: BOX ( nr nc -- )  \ Make a star box of nr rows and nc columns
>       CR  SWAP 0 DO  DUP STARS CR LOOP  DROP ;
>

This is a good example to show the benefit of synatx high lighting in
Forth.
This is how it looks.  DUP<lg> means that the last letter of dup is
light green which means that it produces one. <lg>STARS means it
consumes one. <dg> is two, <y> is three, <o> is four, <r> is red (danger).

: BOX ( nr nc -- )  \ Make a star box of nr rows and nc columns
       CR  <dg>SWAP<dg> 0<g> <dg>DO  DUP<g> <g>STARS CR LOOP  ;

1.   DUP<g> <g>STARS   "pipes fit" no net stack effect within the loop.

2.  <dg>SWAP<dg> 0<g> <dg>DO  The net effect is clearly one item
    going in.   (You must see it and experienced it.
    One way to do it is mentally postpone  the 0<g> ,
    the pipes fit and the result is "consume two, produce one"

Bottom line: the total consumes one item, which violates
the stack contract: a DROP is missing.

It it somewhere on my side. Now we're waiting for some one to
add it to the eclipse Forth environment,

>It was that DROP that was stuck in my mind. This is actually a very
>common scenario. We can also discuss that SWAP: the arguments are the
>way they are because it is often more natural in the calling code to
>order arguments for this kind of scenario with the faster-changing
>element on top. Putting the SWAP in here *might* save a bunch of SWAPs
>in the calling code (if not, of course, you change the order). Context
>is important. The difficulty with sample problems is that you can't
>always see the context, but in a class we can discuss the options.
>
>Cheers,
>Elizabeth
>
>--
>==================================================
>Elizabeth D. Rather   (US & Canada)   800-55-FORTH
>FORTH Inc.                         +1 310.999.6784
>5959 West Century Blvd. Suite 700
>Los Angeles, CA 90045
>http://www.forth.com
>
>"Forth-based products and Services for real-time
>applications since 1973."
>==================================================
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

[toc] | [prev] | [next] | [standalone]


#25878

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-21 02:19 -0700
Message-ID<88ee6d61-3e88-47a0-9419-2da1df19ee60@googlegroups.com>
In reply to#25802
I find my way simpler.  Not sure about efficiency...

[toc] | [prev] | [next] | [standalone]


#25803

From"WJ" <w_a_x_man@yahoo.com>
Date2013-09-19 09:16 +0000
Message-ID<l1efdb$a6j$1@dont-email.me>
In reply to#25798
rickman wrote:

> On 9/19/2013 2:35 AM, VoidVolker wrote:
> > четверг, 19 сентября 2013 г., 9:55:55 UTC+4 пользователь gavino_himself написал:
> > > $ gforth
> > > Gforth 0.7.2, Copyright (C) 1995-2008 Free Software Foundation, Inc.
> > > Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> > > Type `bye' to exit
> > > 
> > > : stock-gain 100 * swap / 100 - cr . ." precent" cr ; redefined stock-gain   ok
> > > 34 55 stock-gain
> > > 61 precent
> >>  ok
> > > 
> > > 
> > > IN YOUR FUCKING FACE!!
> > 
> > Yes, the code is work, but it's calculate not percents =) Look here:
> > 
> > 30 100  stock-gain
> > 233 precent
> > 
> > 100 30 stock-gain .
> > -70 precent
> > 
> > Now, let's calculate real percents - the word */ exist for it:
> >     : p% 100 SWAP */ CR . ." %" CR ;  ok
> >     34 55 p%
> >     61 %
> >      ok
> > 
> > Or:
> > 
> >     : p%2 10000 SWAP */ CR S>D<# [CHAR] % HOLD # # [CHAR] . HOLD #S #>  TYPE CR ;
> >     34 55 p%2
> >     61.81%
> >      ok
> > 
> >     30 100 p%2
> >     30.00%
> >      ok
> > 
> >     100 30 p%2
> >     333.33%
> >      ok
> 
> I think you don't understand what Gavino's code is doing.  It
> is calculating the percent gain or loss, not the simple
> percent ratio.  To get gain you take the ratio, subtract one,
> then multiply by 100.

(I broke your lines for you.  Anyone who knows anything whatsoever
about usenet knows that he must limit the length of his lines.)

Of course he doesn't understand.  Forth is not used by men who
know much about computing; it is used by those who are too stupid
to learn another language.

Who would hire a workman who doesn't know how to use a screwdriver
and who uses a hammer for everything?

>
> / 1.0 - 100.0 *  (floating point numbers, not literal forth)
> 
> 

Ruby:

def stock_gain before,after
  (after * 100.0)/before - 100
end
    ==>nil
stock_gain 100,110
    ==>10.0
stock_gain 34,55
    ==>61.7647058823529
stock_gain 30,100
    ==>233.333333333333
stock_gain 100,30
    ==>-70.0

Forth is the perfect language for gavino.

[toc] | [prev] | [next] | [standalone]


#25870

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-20 23:08 -0700
Message-ID<3f06f47f-c250-4af8-9049-479c22c4f86b@googlegroups.com>
In reply to#25803
oh shut up wj

go well you know at a rolling donut

[toc] | [prev] | [next] | [standalone]


#25885

Fromrickman <gnuarm@gmail.com>
Date2013-09-21 08:47 -0400
Message-ID<l1k4h2$hqi$2@dont-email.me>
In reply to#25870
On 9/21/2013 2:08 AM, the_gavino_himself wrote:
> oh shut up wj
>
> go well you know at a rolling donut

Troll vs. troll

-- 

Rick

[toc] | [prev] | [next] | [standalone]


#25818

FromSpam@ControlQ.com
Date2013-09-19 11:16 -0400
Message-ID<alpine.BSF.2.00.1309191115070.775@yoko.controlq.com>
In reply to#25794
On Wed, 18 Sep 2013, gavino_himself wrote:

> Date: Wed, 18 Sep 2013 22:55:55 -0700 (PDT)
> From: gavino_himself <visploveslisp@gmail.com>
> Newsgroups: comp.lang.forth
> Subject: well this code works and I had some guy say it doesn't
> 
>
> $ gforth
> Gforth 0.7.2, Copyright (C) 1995-2008 Free Software Foundation, Inc.
> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> Type `bye' to exit
>
> : stock-gain 100 * swap / 100 - cr . ." precent" cr ; redefined stock-gain   ok
> 34 55 stock-gain
> 61 precent
> ok
>
>
> IN YOUR FUCKING FACE!!
>

bash-3.2$ mff
-- MiniForth-Hosted alpha Version: 00.01.23F
-- www.ControlQ.com
ok : stock-gain 100 * swap / 100 - cr . ." precent" cr ;
ok 34 55 stock-gain

61 precent
ok


Confirmed!  You cannot spell percent!

Are you planning to sell this remarkable software?

[toc] | [prev] | [next] | [standalone]


#25869

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-20 23:07 -0700
Message-ID<8912b0ab-8a3c-46e0-af13-afb01ed5506d@googlegroups.com>
In reply to#25818
oh get a life

I can spell fine, I just don't type well.

la la a rolling donut eh

[toc] | [prev] | [next] | [standalone]


#25835

From"Rod Pemberton" <dont_use_email@nohavenotit.com>
Date2013-09-20 04:37 -0400
Message-ID<op.w3pbkogh0e5s1z@localhost>
In reply to#25794
On Thu, 19 Sep 2013 01:55:55 -0400, gavino_himself  
<visploveslisp@gmail.com> wrote:

>
> $ gforth
> Gforth 0.7.2, Copyright (C) 1995-2008 Free Software Foundation, Inc.
> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> Type `bye' to exit
>
> : stock-gain 100 * swap / 100 - cr . ." precent" cr ; redefined  
> stock-gain   ok
> 34 55 stock-gain
> 61 precent
>  ok
>

Ok.

It's clear you aren't going to be using a Forth
environment for latency arbitrage (or HFT)...

So, for Forth to be of any real use to you, you'd need
to implement Black-Scholes, Sharpe ratio, Treynor ratio,
or perhaps Modigliani risk-adjusted performance metric
in Forth, i.e., something not on a standard calculator.

Is one of those next up?

How do you plan on implementing logarithms in Forth
for charting stock prices?  You definately don't want
to use linear price charting.

So, do you think SBUX is a good short since they angered
half of the U.S. population with their anti-gun rhetoric?
It's clear SBUX has a neglible dividend which means
there is no price floor should their stock price crash.

Of course, it's much easier to just use BigCharts or
Yahoo! Finance.  They've done all that programming for
you already.  Scottrade and E*trade probably provide
even more calculations on stock data for their members.
Of course, none of it will be as complete as ValueLine.


Rod Pemberton

[toc] | [prev] | [next] | [standalone]


#25836

From"Elizabeth D. Rather" <erather@forth.com>
Date2013-09-19 22:45 -1000
Message-ID<Z9idnXj1mNuzlqHPnZ2dnUVZ_qudnZ2d@supernews.com>
In reply to#25835
On 9/19/13 10:37 PM, Rod Pemberton wrote:
> On Thu, 19 Sep 2013 01:55:55 -0400, gavino_himself
> <visploveslisp@gmail.com> wrote:
>
>>
>> $ gforth
>> Gforth 0.7.2, Copyright (C) 1995-2008 Free Software Foundation, Inc.
>> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
>> Type `bye' to exit
>>
>> : stock-gain 100 * swap / 100 - cr . ." precent" cr ; redefined
>> stock-gain   ok
>> 34 55 stock-gain
>> 61 precent
>>  ok
>>
>
> Ok.
>
> It's clear you aren't going to be using a Forth
> environment for latency arbitrage (or HFT)...
>

Hey, don't knock the kid. All practice in a new skill has to start with 
simple exercises. I'm glad to see him actually writing some code.

Cheers,
Elizabeth

-- 
==================================================
Elizabeth D. Rather   (US & Canada)   800-55-FORTH
FORTH Inc.                         +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

[toc] | [prev] | [next] | [standalone]


#25837

FromHowerd <howerdo@yahoo.co.uk>
Date2013-09-20 01:49 -0700
Message-ID<ddf23199-56d2-4df6-9cd8-6defd5700395@googlegroups.com>
In reply to#25836
On Friday, September 20, 2013 9:45:34 AM UTC+1, Elizabeth D. Rather wrote:
> On 9/19/13 10:37 PM, Rod Pemberton wrote:
> 
> > On Thu, 19 Sep 2013 01:55:55 -0400, gavino_himself
> 
> > <visploves....@gmail.com> wrote:
> 
> >
> 
> >>
> 
> >> $ gforth
> 
> >> Gforth 0.7.2, Copyright (C) 1995-2008 Free Software Foundation, Inc.
> 
> >> Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
> 
> >> Type `bye' to exit
> 
> >>
> 
> >> : stock-gain 100 * swap / 100 - cr . ." precent" cr ; redefined
> 
> >> stock-gain   ok
> 
> >> 34 55 stock-gain
> 
> >> 61 precent
> 
> >>  ok
> 
> >>
> 
> >
> 
> > Ok.
> 
> >
> 
> > It's clear you aren't going to be using a Forth
> 
> > environment for latency arbitrage (or HFT)...
> 
> >
> 
> 
> 
> Hey, don't knock the kid. All practice in a new skill has to start with 
> 
> simple exercises. I'm glad to see him actually writing some code.
> 
> 
> 
> Cheers,
> 
> Elizabeth
> 
> 
> 
> -- 
> 
> ==================================================
> 
> Elizabeth D. Rather   (US & Canada)   800-55-FORTH
> 
> FORTH Inc.                         +1 310.999.6784
> 
> 5959 West Century Blvd. Suite 700
> 
> Los Angeles, CA 90045
> 
> http://www.forth.com
> 
> 
> 
> "Forth-based products and Services for real-time
> 
> applications since 1973."
> 
> ==================================================

Hi Elizabeth,

I agree - well done gavino.
BTW we have all posted snippets of Forth that don't work ;-)

Best regards,
Howerd

[toc] | [prev] | [next] | [standalone]


#25872

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-20 23:10 -0700
Message-ID<4c4de4ed-e826-45a6-bffa-1ac28f7abaa2@googlegroups.com>
In reply to#25837
:)

What's funny is that I didn't post a snippet of code that didn't work.

[toc] | [prev] | [next] | [standalone]


#25841

Fromrickman <gnuarm@gmail.com>
Date2013-09-20 08:19 -0400
Message-ID<l1hehc$u22$1@dont-email.me>
In reply to#25835
On 9/20/2013 4:37 AM, Rod Pemberton wrote:
>
> Of course, it's much easier to just use BigCharts or
> Yahoo! Finance. They've done all that programming for
> you already. Scottrade and E*trade probably provide
> even more calculations on stock data for their members.
> Of course, none of it will be as complete as ValueLine.

OMG!  You want the guy to have to write a browser in forth now?

Oh wait, that's what Gavino wants too...

-- 

Rick

[toc] | [prev] | [next] | [standalone]


#25873

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-20 23:11 -0700
Message-ID<0df5b7d6-09b8-4e60-93a4-abc67820e13e@googlegroups.com>
In reply to#25841
no I want to write something like www.prevayler.org and interface it to like mathopd webserver with scgi ish thingy.

[toc] | [prev] | [next] | [standalone]


#25871

Fromthe_gavino_himself <visphatesjava@gmail.com>
Date2013-09-20 23:09 -0700
Message-ID<b0f7f39f-8213-4f5a-8aed-1156a2ba8884@googlegroups.com>
In reply to#25835
you been drinking?

[toc] | [prev] | [next] | [standalone]


#25995

FromMark Wills <markrobertwills@yahoo.co.uk>
Date2013-09-24 07:46 -0700
Message-ID<b815a793-822e-48f1-8a72-7109a138ff6f@googlegroups.com>
In reply to#25835
On Friday, September 20, 2013 9:37:26 AM UTC+1, Rod Pemberton wrote:
> So, do you think SBUX is a good short since they angered
> half of the U.S. population with their anti-gun rhetoric?
> It's clear SBUX has a neglible dividend which means
> there is no price floor should their stock price crash.

If you're looking for a good short may I suggest MON :-)

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.forth


csiph-web