Pages: « 1 2
  Print  
Author Topic: Collisions  (Read 19368 times)
Offline (Female) serprex
Reply #15 Posted on: March 27, 2010, 08:19:49 am
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
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
Logged
Offline (Male) Josh @ Dreamland
Reply #16 Posted on: March 27, 2010, 08:21:53 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #17 Posted on: March 27, 2010, 08:30:32 am

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
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)
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) Game_boy
Reply #18 Posted on: March 27, 2010, 08:56:40 am
Member
Joined: Apr 2008
Posts: 228

View Profile
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.
Logged
Offline (Unknown gender) The 11th plague of Egypt
Reply #19 Posted on: March 27, 2010, 08:59:23 am
Member
Joined: Dec 2009
Posts: 274

View Profile
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?
Logged
Offline (Male) Josh @ Dreamland
Reply #20 Posted on: March 27, 2010, 09:06:24 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Unknown gender) Game_boy
Reply #21 Posted on: March 27, 2010, 10:56:09 am
Member
Joined: Apr 2008
Posts: 228

View Profile
a 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)
« Last Edit: March 27, 2010, 11:29:40 am by Game_boy » Logged
Offline (Male) Josh @ Dreamland
Reply #22 Posted on: March 27, 2010, 12:32:18 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Bahaha, yes, all of those things.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) Noodle
Reply #23 Posted on: March 27, 2010, 04:52:58 pm

Member
Location: England
Joined: Apr 2008
Posts: 7

View Profile Email
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.
Logged
Offline (Female) serprex
Reply #24 Posted on: March 27, 2010, 10:05:53 pm
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
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)]
« Last Edit: March 28, 2010, 07:16:00 am by serprex » Logged
Offline (Male) Josh @ Dreamland
Reply #25 Posted on: March 27, 2010, 10:09:54 pm

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Man, that's hackish even by my standards. I'll do it.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Female) serprex
Reply #26 Posted on: March 28, 2010, 07:30:04 am
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
Hassle is that & requires lhs, so it won't work on rhs expressions
Logged
Offline (Male) Josh @ Dreamland
Reply #27 Posted on: March 28, 2010, 10:04:10 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
Actually, are you sure that casting that initializer as var will properly allocate them? (I'd cast as variant anyway, but...)
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: « 1 2
  Print