Is LISP or Latin dying? 
Author Message
 Is LISP or Latin dying?

Quote:

>> As an anti-spam measure I have scrambled my email address here.
>> Remove "nospam-" and ROT13 to obtain my email address in clear text.

>Please clue me in about ROT13.

( ROT13 is a simple substitution cypher, often used in the Internet back )
( when it first became really popular.  The residents of the Internet    )
( back then were all upright netizens, and there was no need for further )
( privacy measures.  Of course, today things are a bit different, but I  )
( digress.  Below is well factored Forth code to en/decrypt ROT13.  The  )
( same word is used for both.                                            )
(                                                                        )
( Usage:  S" Enter desired string here." 2DUP ROT13-String TYPE          )

: NOT ( f -- !f )               0= ;    ( Some Forths already have this. )
: EndOfString? ( u -- u f )     DUP 0= ;
: LowercaseLetter? ( ch -- f )  [CHAR] a [CHAR] z WITHIN ;
: ToUppercase ( ch -- ch' )     DUP LowercaseLetter? IF 32 XOR THEN ;
: A..M? ( ch -- f )             ToUppercase [CHAR] A [CHAR] M WITHIN ;
: A..Z? ( ch -- f )             ToUppercase [CHAR] A [CHAR] Z WITHIN ;
: Apply-ROT13 ( ch -- ch' )     DUP A..M? IF 13 + ELSE 13 - THEN ;
: ROT13-Char ( ch -- ch' )      DUP A..Z? IF Apply-ROT13 THEN ;

: ROT13-String ( c-addr u -- )
        BEGIN EndOfString? NOT

        REPEAT
        2DROP ;

==========================================================================
      KC5TJA/6     |                  -| TEAM DOLPHIN |-
        DM13       |                  Samuel A. Falvo II
    QRP-L #1447    |           http://www.*-*-*.com/
   Oceanside, CA   |......................................................



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Whoops.  In my prior post, I had forgotten about the utterly brain-dead (as
far as I'm concerned, outright BUG) behavior of the WITHIN ANSI Forth word.
Therefore, to make a CORRECT version of WITHIN, please prepend the following
definition, like so:

( This definition inherits from the existing ANSI definition of WITHIN )
: WITHIN (a b c -- f )          1+ WITHIN ;

Alternatively, you could make the following adjustments to retain ANSI
compatibility:

Quote:
>: LowercaseLetter? ( ch -- f )  [CHAR] a [CHAR] z WITHIN ;

: LowercaseLetter? ( ch -- f)   [CHAR] a [CHAR] z 1+ WITHIN ;

Quote:
>: A..M? ( ch -- f )             ToUppercase [CHAR] A [CHAR] M WITHIN ;
>: A..Z? ( ch -- f )             ToUppercase [CHAR] A [CHAR] Z WITHIN ;

: A..M? ( ch -- f )             ToUppercase [CHAR] A [CHAR] M 1+ WITHIN ;
: A..Z? ( ch -- f )             ToUppercase [CHAR] A [CHAR] Z 1+ WITHIN ;

All other program code remains the same.  I apologize for any confusion this
may have caused.

==========================================================================
      KC5TJA/6     |                  -| TEAM DOLPHIN |-
        DM13       |                  Samuel A. Falvo II
    QRP-L #1447    |          http://www.dolphin.openprojects.net
   Oceanside, CA   |......................................................



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?
Hi Jerry,

The problem is that you are thinking like an engineer, but the
people who use "Business Data Processing" think like accountants.
As far as an accountant is concerned 32-bits doesn't hold 6 and
fraction digits, but 6 digits.  So a 32-bit value will hold a
maximum of 999,999.  But, then when dealing with money that
32-bit value only holds 9,999.99.  If you go to 64 bits you can
represent a value with 12 integer digits and 2 fraction digits.
This is why COBOL (Sorry, I don't remember wether it was the
COBOL standard or IBM's COBOL implementation)  calls for 14
digits for operands and results in all arithmetic operations with
31 digit intermediate results in multiplication.

There is one advantage of BCD arithmetic that wasn't mentioned
and that is its ability to handle the addition and subtraction of
values with differing fraction digits without having to do the
multiplication and division by 10 operations you are forced into
when working with binary values.  (Multiplication is easy you
shift, save a copy of the shifted result, shift twice and then
add back the saved result of the first shift, but division
requires a series of subtract and shift operations that take a
relatively long time to execute.

regards
Jerry Gitomer

|>
|> > > is this 'more lines of COBOL than all...' bit
|> > > actually still true?
|> > > ok, when the only competition was fortran,
|> > > LISP, ALGOL, PL/1, whatever, i'm sure it was but in  1999?
|>
|> COBOL is *still* being used for new implementations of billing
software
|> these days. Also, COBOL data structures and databases are
being used
|> (CODASYL).
|>
|> Take your phone bill or utilities bill as example. The chance
is, that it
|> has been created by COBOL code. One strong incentive to use
COBOL for
|> billing is the built in support of BCD (binary coded
decimals), which
|> ensures there is no inaccurracy intruduced when converting
numbers between
|> decimal and binary.
|>
|[Interestinh text snipped.]
|
|I'm confused about the need for BCD. Surely, there can be no
ambiguity
|when converting (scaled) integer values to and from decimal
notation for
|I/O. Making the scaling factor 1000 to keep track of mils still
leaves
|room for representing plenty of dollars in a 32-bit signed int.
(Few
|transactions exceed 2 million.) By using a double, Forth can
represent
|in a single number more money that the treasuries, budgets, or
debts of
|most countries. What's the problem?
|>
|> benjamin
|>
|> --
|> As an anti-spam measure I have scrambled my email address
here.
|> Remove "nospam-" and ROT13 to obtain my email address in clear
text.
|
|Please clue me in about ROT13.
|
|Jerry
|--
|Engineering is the art       |      Let's talk about what
|of making what you want      |      you need; you may see
|from things you can get.     |      how to do without it.
|---------------------------------------------------------
|--
|Engineering is the art       |      Let's talk about what
|of making what you want      |      you need; you may see
|from things you can get.     |      how to do without it.
|---------------------------------------------------------



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:

>I want to defend WITHIN as it stands. If it has a flaw, it is the name,
>but I can't think of a better one. It works with signed and unsigned

I think "BETWEEN" would be a much better name for it, given the current
semantics.  WITHIN, based on my learned use of the word, is all inclusive of
its arguments.  But then, there's nothing I can do -- except complain.  :-)

Quote:
>in the stack comment. Since it is frequently used with constant
>arguments, they can often be adjusted at compile time, and extra code so
>isn't worth while.

This is true.

==========================================================================
      KC5TJA/6     |                  -| TEAM DOLPHIN |-
        DM13       |                  Samuel A. Falvo II
    QRP-L #1447    |          http://www.dolphin.openprojects.net
   Oceanside, CA   |......................................................



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:

> Hi Jerry,

> The problem is that you are thinking like an engineer, but the
> people who use "Business Data Processing" think like accountants.
> As far as an accountant is concerned 32-bits doesn't hold 6 and
> fraction digits, but 6 digits.  So a 32-bit value will hold a

This has me confused. What kind of encoding are you talking about? 2^31
(with 1 digit for sign) ~ 2*10^9. The only other approach I know of (I'm
not sure if this is in fact BCD representation, for some reason EBCDIC
keeps coming to mind and confusing me further) is to encode each digit as
four bits, which gives 7 digits plus four left over for handling sign etc.

Neither of these are sufficient by any means to accurately handle large
sums of money, so I see your point despite the above confusion.

Thanks,

Sunil



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:
Jerry writes:
> I want to defend WITHIN as it stands. If it has a flaw, it is the name, but I
> can't think of a better one.

How about BETWEEN . F-PC (and others) have both.

-marcel



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:

> I'm confused about the need for BCD. Surely, there can be no ambiguity
> when converting (scaled) integer values to and from decimal notation for
> I/O. Making the scaling factor 1000 to keep track of mils still leaves
> room for representing plenty of dollars in a 32-bit signed int. (Few
> transactions exceed 2 million.) By using a double, Forth can represent
> in a single number more money that the treasuries, budgets, or debts of
> most countries. What's the problem?

The problem is that a very samll error can mount up to a large sum and
that messes up the balance sheet. If there is only one penny missing on
the balance sheet the accounts cannot be closed for end of month or end of
year processing.

Example:

Divide 10 by 3 -> 3.33333333
multiply by 3 again -> 9.99999999

thus 10 equals 9.99999999

If you stay within the decimal system (BCDs) you can accommodate for this
by rounding up, but if you convert between decimal and binary, then you
get rounding errors with numbers that are rational numbers in decimal but
irrational numbers in binary representation. In a serious of financial
transactions these errors can then accumulate to substantial errors.

Benjamin

--
As an anti-spam measure I have scrambled my email address here.
Remove "nospam-" and ROT13 to obtain my email address in clear text.



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:


> >I want to defend WITHIN as it stands. If it has a flaw, it is the name,
> >but I can't think of a better one. It works with signed and unsigned

> I think "BETWEEN" would be a much better name for it, given the current
> semantics.  WITHIN, based on my learned use of the word, is all inclusive of
> its arguments.  But then, there's nothing I can do -- except complain.  :-)

> >in the stack comment. Since it is frequently used with constant
> >arguments, they can often be adjusted at compile time, and extra code so
> >isn't worth while.

> This is true.

> ==========================================================================
>       KC5TJA/6     |                  -| TEAM DOLPHIN |-
>         DM13       |                  Samuel A. Falvo II
>     QRP-L #1447    |          http://www.dolphin.openprojects.net
>    Oceanside, CA   |......................................................

"BETWEEN" fixes one end, but breaks the other. What we need is a
combination: "BEIN" or "WITHTWEEN". BAH!

Jerry
--
Engineering is the art       |      Let's talk about what
of making what you want      |      you need; you may see
from things you can get.     |      how to do without it.
---------------------------------------------------------



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

[...]

Quote:
>"BETWEEN" fixes one end, but breaks the other. What we need is a
>combination: "BEIN" or "WITHTWEEN". BAH!

IN-RANGE might be suitably non-committal.

If you want to be specific, you might look at >=&< if you come from a
C or Pascal background, or .ge.lt. if you know FORTRAN.  My math is
rusty, but I think the brackets for a range that includes its
endpoints is [] while a range that doesn't include its endpoints is
(), so maybe [WITHIN) would work?  Although square brackets tend to
mean something different in Forth.

Just some random suggestions.  Use or ignore them as you will.
Regards,

                          -=Dave
Just my (10-010) cents
I can barely speak for myself, so I certainly can't speak for B-Tree.
Change is inevitable.  Progress is not.



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:

>If you stay within the decimal system (BCDs) you can accommodate for this
>by rounding up, but if you convert between decimal and binary, then you
>get rounding errors with numbers that are rational numbers in decimal but
>irrational numbers in binary representation. In a serious of financial
>transactions these errors can then accumulate to substantial errors.

Nit: Rationality of a number has nothing to do with the base it is
written in.  Pi is irrational whether you write it in base, base 10,
or base 43.  Likewise 8/11 is always rational, whether you write it
as 8/11, 8/B, or 1000/1011.

However, whether or not a given rational number can be represented exactly
in a finite number of places to the right of the radix point _does_ very
much depend on the base.  (It happens whenever the prime factors of the
denominator of the fraction include numbers that are not prime factors
of the base being used.  So base 2 is particularly bad for fractional
numbers when it comes to exactness -- the only quantities less than
$1 that can be exactly represented using binary fixed or floating point
are $.25, $.50, and $.75.)

--

      LEGAL NOTICE:  I am a WASHINGTON STATE RESIDENT.  Unsolicited bulk
       E-mail may be billed $500 each in accordance with Chapter 19 RCW.



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?

Quote:


> >If you stay within the decimal system (BCDs) you can accommodate for this
> >by rounding up, but if you convert between decimal and binary, then you
> >get rounding errors with numbers that are rational numbers in decimal but
> >irrational numbers in binary representation. In a serious of financial
> >transactions these errors can then accumulate to substantial errors.

> Nit: Rationality of a number has nothing to do with the base it is
> written in.  Pi is irrational whether you write it in base, base 10,
> or base 43.  Likewise 8/11 is always rational, whether you write it
> as 8/11, 8/B, or 1000/1011.

NitPick:  Pi base Pi = EXACTLY 1

Nothing irrational there!  But the expression of base Pi values in other bases will generally require them to have their own expression for Pi, which may be irrational when expressed in that base.  Or, conversely, expressing what is a whole number in another base may well prove to be an irrational number in base Pi.

Like many things in life, who is "rational" depends on your point of view.  Now, let's talk about base e, and expressing the value 1.0 base Pi in base e...  And renormalization to base e is a well known calculus trick.  That kind of renormalization I think I actually understand.  It is renormalization using transfinite numbers that fries my neurons.  And there are those who count using transfinite bases!  (Not just transfinite set ordinality, but actual counting!)

Quote:
> However, whether or not a given rational number can be represented exactly
> in a finite number of places to the right of the radix point _does_ very
> much depend on the base.  (It happens whenever the prime factors of the
> denominator of the fraction include numbers that are not prime factors
> of the base being used.  So base 2 is particularly bad for fractional
> numbers when it comes to exactness -- the only quantities less than
> $1 that can be exactly represented using binary fixed or floating point
> are $.25, $.50, and $.75.)

And (trivially) $0.00

-BobC



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?


   :Arma virumque cano Troiae qui primus ab oris
   :Italiam fato profugus Laviniaque venit
   :Litora multe ille et terris jactatus et alto
   :Qui superum saevae memorem Junonis ab iram

Rewrite it in COBOL and I'll let you know.
--
the desk lisard     communa     time's taught the killing game herself



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?


   :But unlike many LISP people, COBOL and billing software developers
   :are often people with an accounting background, they are not
   :computer language scientists. They are more likely to think in
   :procedural ways than in OO and they would have a severe problem
   :with LISPs syntax.

Which is strange, given (a) the proximity of Forth, and (b) the usual
claim that Forth programmers who haven't been introduced to other
languages before Forth adapt readily to Forth. I do sometimes wonder if
the claims of "oh, they won't understand that" are based more on what
"they" are expected to understand, rather than any objective evaluation.

Anyhow, Lisp isn't OO, and Lisp does have procedural features (the PROG
form for one, which guarantees sequential evaluation).
--
the desk lisard     communa     time's taught the killing game herself



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?
...

Quote:
> Anyhow, Lisp isn't OO,

Why do you believe Lisp is not OO?  Part of the Common Lisp standard is
an object system that supersedes all other known object systems in
abstraction, flexibility and sophistication.

Quote:
> and Lisp does have procedural features (the PROG
> form for one, which guarantees sequential evaluation).

Because of Lisp's strict (as opposed to lazy) evaluation, most things in
Lisp execute in a known, often sequential order.  There are libraries
that allow lazy evaluation though, and of course you may use
multiprocessing.

Besides, very few CL programs are utilizing procedural features except
in macros if performance is crucial.  Most CL programs are pre{*filter*}ly
functional and/or object-oriented.

Robert



Sun, 20 Jan 2002 03:00:00 GMT  
 Is LISP or Latin dying?


Quote:

>[...]
>>"BETWEEN" fixes one end, but breaks the other. What we need is a
>>combination: "BEIN" or "WITHTWEEN". BAH!

>IN-RANGE might be suitably non-committal.

Or, since shorter words are better, SPAN.
(
----------
Virtually,

Bruce McFarling, Newcastle,

)



Sun, 20 Jan 2002 03:00:00 GMT  
 
 [ 433 post ]  Go to page: [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29]

 Relevant Pages 
 

 
Powered by phpBB® Forum Software