George: Clarification of undocumented feature: Fractions?

Found a bug in the game? Post it in one of the applicable sub forums depending on the version you are using. Tech support is also available in the Tech Support subforum.
Post Reply
Jeoshua
Militia Lieutenant
Militia Lieutenant
Posts: 163
Joined: Sat Sep 06, 2008 3:48 pm

Mon Aug 04, 2014 12:54 am

I was looking through CoreCode.xml and found this little gem, today:

Code: Select all

(@ (power (list result toRange) (list gamma 100)) 0)
Nowhere on Xelerus or the Wiki does it mention anything about (power) taking list arguments, or how it works, so I decided to do a little digging. Obviously, it returns a list, so I plugged this into the debug console:

Code: Select all

(power '(1 2 3 4) '(1 2 3 4)) -> (1 2)
Okay, so that obviously didn't work, but we know that it's valid TLISP anyways. So I try a few variations with just the exponent being a list:

Code: Select all

(power 9 '(1 2)) -> 3
(power 4 '(1 2)) -> 2
Holy crap. Those are square roots!

Code: Select all

(power 27 '(1 3))->3
Cubed Roots!

Code: Select all

(power 3 '(2 1)) -> 9
They're generally applicable...
Hmm, I wonder...

Code: Select all

(power '(54 2) '(1 3)) => (6 2)
Oh my god! We have fractions!

Code: Select all

(add '(6 2) '(3 1)) -> 0
Okay. Now it's a bug. Adding two lists should return either Nil if that's not a supported function, the sum of all the variables, or even better, TREAT THEM AS FRACTIONS! This is obviously something you've already thought about, George, and something that is possible. Otherwise why would it be in the game? So I suppose this is no longer asking for clarification, but rather this is a bug report that the fractions are not more generally applicable!

Also, I find this out after spending a solid week creating and tweaking an application of Netwon's Method in TLISP so I could get cubed roots. It would have been great to know this was already in the game in some fashion before having done all that work ;)

Post Reply