serprex
Smooth ER
 Joined: Apr 2008
Posts: 106
|
 |
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_unwindingC99 states that a function need only be able to accept 127 arguments, this solution removes that limit
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
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.
|
|
|
RetroX
Master of all things Linux
 Joined: Apr 2008
Posts: 1,055
|
 |
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)
|
|
|
Game_boy
 Joined: Apr 2008
Posts: 228
|
 |
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.
|
|
|
The 11th plague of Egypt
 Joined: Dec 2009
Posts: 274
|
 |
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?
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
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.
|
|
|
Game_boy
 Joined: Apr 2008
Posts: 228
|
 |
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)
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
Reply #22 Posted on: March 27, 2010, 05:32:18 PM |
|
|
|
Bahaha, yes, all of those things.
|
|
|
Noodle
 Joined: Apr 2008
Posts: 7
|
 |
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.
|
|
|
serprex
Smooth ER
 Joined: Apr 2008
Posts: 106
|
 |
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)]
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
Reply #25 Posted on: March 28, 2010, 03:09:54 AM |
|
|
|
Man, that's hackish even by my standards. I'll do it.
|
|
|
|
|
Josh @ Dreamland
Prince of all Goldfish
 Joined: Feb 2008
Posts: 2,950
|
 |
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...)
|
|
|
|