Pages: 1 2
Author Topic: Collisions  (158,405 Views)
Offline (Unknown gender) serprex

Smooth ER
Developer
Joined: Apr 2008
Posts: 106
View profile WWW
Reply #15 Posted on: March 27, 2010, 01:19:49 PM
It isn't slow. Inlinining+Compiler Optimizations will make it faster than a generic loop. See http://en.wikipedia.org/wiki/Loop_unwinding

C99 states that a function need only be able to accept 127 arguments, this solution removes that limit
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #16 Posted on: March 27, 2010, 01:21:53 PM
Not that I think anyone that needs the min() or max() of that many arguments shouldn't be using an array and iterating it him/herself.
It's just nice to shed GM's limits.
Offline (Unknown gender) RetroX

Master of all things Linux
Contributor
Joined: Apr 2008
Posts: 1,055
View profile
Reply #17 Posted on: March 27, 2010, 01:30:32 PM
Quote from: serprex on March 27, 2010, 02:14:22 AM
It's called parsing. You parse the fold into multiple calls. Get it? Because you parse it. Also inlining makes it nice. But you don't parse for that
Yes, I asked josh about it earlier and found that out.

Personally, I think that it would be easier to just make a function with cstdarg and take-in a number of arguments and then count the arguments and put it in with the parser.  That would also solve the problem of mean(). (of course, choose() could be parsed like min() and max(), I guess)
Offline (Unknown gender) Game_boy

Member
Joined: Apr 2008
Posts: 228
View profile
Reply #18 Posted on: March 27, 2010, 01:56:40 PM
Where is the list of implemented functions in SVN? The one on the website isn't up to date (I think) and I remember an earlier testing release had a list of functions in a text file.
Offline (Unknown gender) The 11th plague of Egypt

Member
Joined: Dec 2009
Posts: 274
View profile
Reply #19 Posted on: March 27, 2010, 01:59:23 PM
Just a little doubt. In GM the lists declared inside an object are accessible form every object.
I don't know why, but they seem to be "global". What will happen now?
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #20 Posted on: March 27, 2010, 02:06:24 PM
Game_boy:
Not at present; I could generate one, but I don't think some of the systems I coded are all in there. Like text file manipulation and DLL's.

The 11th plague of Egypt:
Assuming you're talking about ds_lists, they are global. Don't worry, this new system won't break ds_list; it'll supply an alternative to them. Lists are stored somewhat like sprites; a global array of things GM users don't understand, which they can access by an integer from absolutely anywhere. So, a=ds_list_create() will add to that list, "list a;" won't.
Offline (Unknown gender) Game_boy

Member
Joined: Apr 2008
Posts: 228
View profile
Reply #21 Posted on: March 27, 2010, 03:56:09 PM
Quote from: Josh @ Dreamland on March 27, 2010, 02:06:24 PMa global array of things GM users don't understand

This gave me an awesome and disturbing mental image. So this array encircles the world and contains everything that every GM user doesn't understand? Everything? Including Yoyo's business model, how their computer works, cheesy Wotsits, how to code multplayer that doesn't fail, the Central Limit Theorem, and quantum mechanics?

(Yes, I do understand what you really meant)
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #22 Posted on: March 27, 2010, 05:32:18 PM
Bahaha, yes, all of those things.
Offline (Unknown gender) Noodle

Member
Joined: Apr 2008
Posts: 7
View profile
Reply #23 Posted on: March 27, 2010, 09:52:58 PM
Ah, I remember the variable-number-of-parameters conundrum. The folding technique is good for min and max, but thats all. Mean and choose will both need an alternative method of parsing.
Offline (Unknown gender) serprex

Smooth ER
Developer
Joined: Apr 2008
Posts: 106
View profile WWW
Reply #24 Posted on: March 28, 2010, 03:05:53 AM
Mean can be parsed mean(a,b,c) -> add(a,add(b,c))/argc
Choose can be parsed choose(a,b,c) -> *((var*[]){&a,&b,&c})[randint(argc)]
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #25 Posted on: March 28, 2010, 03:09:54 AM
Man, that's hackish even by my standards. I'll do it.
Offline (Unknown gender) serprex

Smooth ER
Developer
Joined: Apr 2008
Posts: 106
View profile WWW
Reply #26 Posted on: March 28, 2010, 12:30:04 PM
Hassle is that & requires lhs, so it won't work on rhs expressions
Offline (Unknown gender) Josh @ Dreamland

Prince of all Goldfish
Developer
Joined: Feb 2008
Posts: 2,950
View profile
Reply #27 Posted on: March 28, 2010, 03:04:10 PM
Actually, are you sure that casting that initializer as var will properly allocate them? (I'd cast as variant anyway, but...)
Pages: 1 2