[Tutor] factorial

cino hilliard hillcino368@hotmail.com
Mon May 12 15:31:15 2003


True, C is the culprit on ^. since BCX is a basic to win32 lcc  translator, 
we were able to "emulate"
the pow() function in C with ^ to about a 99% success rate in free style 
coding ie., sin(30)^x vs
(sin(30))^x etc. Parantheses did wonders in the emulation to make the 
translation to the awkward
and somewhat unreadable pow() function. It is fairy clearin my esignature  
below but for compound
expressions it gets hairy. I asked the Win32 lcc to see if ^ could be 
programmed to no response.
Since variables, numbers, constants, and functions are kept track of, it 
seems to me boolean operators
could be tested for to produce correct results. Perhaps a pre parser to scan 
the source and produce
the c code BCX does! Actually, with Python's indentation syntax, a step 
further would be the use of
superscripting as in

3      3     3      3      3
2 + 13 + 33 + 43 = 49

For this we could designate a special font for powers and the interpreter 
(compilerI wish) would have to
detect this. Of course Ascii would be out. Then we could have subscripted 
arrays etc. we would use
the ^ symbol but the editor would superscript for us. subscript? maybe ~


Just dreaming

2^3 + 13^3 + 33^3 + 43^3 = 49^3

2**3 + 13**3 + 33**3 + 43**3 = 49**3

pow(2,3) +pow(13,3) +pow(33,3) +pow(43,3)  = pow(49,3) +




>From: "Jeff Shannon" <jeff@ccvcorp.com>
>To: tutor@python.org
>CC: cino hilliard <hillcino368@hotmail.com>
>Subject: Re: [Tutor] factorial
>Date: Mon, 12 May 2003 11:18:12 -0700
>
>cino hilliard wrote:
>
>>Thanks for the reply Jeff,
>>
>>I was taking the easyway out and thus doing more work on the import 
>>function.
>>
>>The power ^ idea comes from my use of basic, Pari etc. We were able to do 
>>it in BCX which the
>>moderator held out for a long time but clever users perfected the code. 
>>Then,I guess asking that
>>Fortran start using ^ vs ** would be pretty much uh? Thanks for you 
>>advice.
>
>
>I think that it's really C's fault.  C started using ^ as a bitwise XOR 
>operator, and Python borrowed that usage from there.
>
>Jeff Shannon
>Technician/Programmer
>Credit International
>
>

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.  
http://join.msn.com/?page=features/virus