Skip to content
Snippets Groups Projects
Commit a829464b authored by Mirar (Pontus Hagland)'s avatar Mirar (Pontus Hagland)
Browse files

permute added

Rev: lib/modules/Array.pmod:1.17
Rev: lib/modules/Calendar.pmod/Swedish.pmod:1.11
parent 40b919e8
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,23 @@ array shuffle(array arr)
return(arr);
}
array permute(array a,int n)
{
int q=sizeof(a);
int i;
a=a[..]; // copy
while (n && q)
{
int x=n%q;
n/=q;
q--;
if (x) [a[i],a[i+x]]=({ a[i+x],a[i] });
i++;
}
return a;
}
int search_array(mixed *arr, mixed fun, mixed ... args)
{
......
inherit Calendar.ISO;
inherit Calendar.ISO:ISO;
void create()
{
......@@ -11,13 +11,9 @@ void create()
"fredag","lrdag","sndag"});
}
constant ISO_Week=::Week;
constant ISO_Year=::Year;
constant ISO_Day=::Day;
class Week
{
inherit ISO_Week;
inherit ISO::Week;
string name()
{
......@@ -27,7 +23,7 @@ class Week
class Year
{
inherit ISO_Year;
inherit ISO::Year;
array(array(string)) _namedays;
mapping(string:int) _nameday_lookup;
......@@ -88,7 +84,7 @@ class Year
class Day
{
inherit ISO_Day;
inherit ISO::Day;
array(string) names()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment