Wikipedia roa_tarawiki https://roa-tara.wikipedia.org/wiki/Pagene_Prengep%C3%A1le MediaWiki 1.47.0-wmf.18 first-letter Media Speciale Discussione Utente Discussioni utente Wikipedia Discussioni Wikipedia File Discussioni file MediaWiki Discussioni MediaWiki Template Discussioni template Aiuto Discussioni aiuto Categoria Discussioni categoria Portale 'Ngazzaminde d'u Portale TimedText TimedText talk Modulo Discussioni modulo Evento Discussioni evento Macidonie d'u Nord 0 17740 152081 152065 2026-09-04T01:01:27Z InternetArchiveBot 10009 Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5 152081 wikitext text/x-wiki {{Nota disambigua|otre segnefecate d'u termine|[[Macidonie]]}} {{Stato |nomeCorrente = Macidonie d'u Nord |nomeCompleto = Repubbleche d'a Macidonie d'u Nord<ref>{{Cita news|url=https://www.analisidifesa.it/2019/01/la-macedonia-del-nord-si-appresta-ad-aderire-a-nato-e-ue/|titolo=La Macedonia del Nord si appresta ad aderire a NATO e UE|lingua=it}}</ref> |nomeUfficiale = {{mk}}Република Северна Македонија<br/>{{sq}}''Republika e Maqedonisë së Veriut'' |linkBandiera = Flag of Macedonia.svg |paginaBandiera = Bandiere d'a Macidonie d'u Nord |linkStemma = Coat of arms of North Macedonia.svg |paginaStemma = Embleme d'a Macidonie d'u Nord |linkLocalizzazione = Europe-Macedonia.svg |linkMappa = Mappa Macedonia del Nord IT.png |lingua = [[Lingua macedone|macedone]] e [[Lingua albanese|albanese]]<ref name="CIA factbook" /><ref>Lènga co-ufficiale a livelle statale (escluse 'a difese, 'a polizie cendrale e 'a politiche monetarie) e inde unità de autogoverne locale addò le parlande sò 'u 20% o cchiù.</ref> |altrelingue = [[Lènga turche|turche]], [[Lènga romaní|romaní]], [[Lènga serbe|serbe]]<ref name="CIA factbook">{{Cita web |url=https://www.cia.gov/library/publications/resources/the-world-factbook/geos/mk.html |capitolo=North Macedonia |titolo=The World fact book |editore=CIA |accesso=25 màsce 2020 |lingua=en |dataarchivio=30 màsce 2015 |urlarchivio=https://web.archive.org/web/20150530031551/https://www.cia.gov/library/publications/resources/the-world-factbook/geos/mk.html |urlmorto=sì }}</ref> |capitale = {{simbolo|Coat of arms of Skopje.svg}} [[Skopje]] |capitaleAbitanti = 568.210 |capitaleAbitantiAnno = 2018 |governo = [[Repubbleche parlamendare]] |presidente = [[Stevo Pendarovski]] |primoMinistro = [[Dimitar Kovačevski]] |elenco capi di stato = [[Presidende d'a Macidonie d'u Nord|Presidente]] |elenco capi di governo = [[Presidende d'u Governe d'a Repubbleche d'a Macidonie d'u Nord|Presidente d'u Governe]] |indipendenza = Da 'a [[Repubbleche Socialiste Federale de Jugoslavie|Jugoslavie]],<br />25 settèmmre [[1991]] |ingressoONU = 8 abbrìle [[1993]] |superficieTotale = 25.713 |superficieOrdine = 148 |superficieAcqua = 1,9 |popolazioneTotale = 1.832.696 |popolazioneAnno = censimende 2021 |popolazioneOrdine = 148 |popolazioneDensita = 83,57 |popolazioneCrescita = 0,15% (2020)<ref name="CIA factbook" /> |nomeAbitanti = [[macedone (gruppe etniche)|Macedone]] |confini = [[Albanie]], [[Bulgarie]], [[Serbie]], [[Kosovo]] (territorije contese), [[Grecie]] |continente = [[Europe]] |orario = [[Tembe Coordinate Universale|UTC]] [[UTC+1|+1]]<br/>[[ore legale]]: [[UTC+2]] |PIL = 9630<ref name=IMF>{{Cita web |url=https://www.imf.org/external/pubs/ft/weo/2013/02/weodata/index.aspx |titolo=Dati dal Fondo Monetario Internazionale, ottobre 2013 |accesso=2 màsce 2019 |urlarchivio=https://web.archive.org/web/20190519083501/https://www.imf.org/external/pubs/ft/weo/2013/02/weodata/index.aspx |dataarchivio=19 màsce 2019 |urlmorto=no }}</ref> |PILValuta = $ |PILAnno = 2018 |PILOrdine = 135 |PILprocapite = 6100 |PILprocapiteValuta = $ |PILprocapiteAnno = 2018 |PILprocapiteOrdine = 95 |PILPPA = 21625 |PILPPAValuta = $ |PILPPAAnno = 2016 |PILPPAOrdine = 124 |PILPPAprocapite = 21465 |PILPPAprocapiteValuta = $ |PILPPAprocapiteAnno = 2012 |PILPPAprocapiteOrdine = 87 |HDI = 0,748 (alto) |HDIAnno = 2016 |HDIOrdine = 82 |TFT = 1,4 (2011)<ref>{{cita web|url=http://data.worldbank.org/indicator/SP.DYN.TFRT.IN/countries|titolo=Tasso di fertilità nel 2011|accesso=12 febbràre 2013|urlarchivio=https://web.archive.org/web/20130223053322/http://data.worldbank.org/indicator/SP.DYN.TFRT.IN/countries|dataarchivio=23 febbràre 2013|urlmorto=no}}</ref> |energia = <!-- consumo di energia pro capite - non scrivere kW/ab. che viene scritto già dal template - (consumo annuo totale in kWh diviso gli abitanti/365gg/24h) --> |targa = NMK |inno = ''[[Denes nad Makedonija]]''<br>([[Traduzione|trad.]]: ''Osce sus'a Macidonie'') |festa = [[8 settèmmre]] |note = <!-- note libere --> |stato precedente = {{YUG 1943-1992}} :([[File:Flag of the Socialist Republic of Macedonia.svg|20px|border]] [[Repubblica Socialista di Macedonia|RS Macedone]]) |tld = [[.mk]], [[.мкд]] }} 'A '''Macidonie d'u Nord''', ufficialmende '''Repubbleche d'a Macidonie d'u Nord''' ({{macedone|Република Северна Македонија|''Republika Severna Makedonija''}}; jndr'ò [[lènga albanese|albanese]]: ''Republika e Maqedonisë së Veriut''), jè 'nu [[State]] d'a [[penisole balcaniche]] acchijate jndr'â ll'[[Europe]] sud-oriendale senze sbocche sus'o mare. 'A capitale jè [[Skopje]]. Da quacche Statère jè recanosciute cumme ''Former Yugoslav Republic of Macedonia'' (jndr'ô [[Dialètte tarandine|tarandíne]] '''Repubbleche Ex Jugoslave de Macidonie''', acronime FYROM) nnande a l'adesione d'u Paìse a l'[[Organizzazione de le Nazione Aunìte]] ([[1993]]) cu quèste "denominazione provvisorie" seconne l'organizzazione, ppegghiáte pe' vije de le 'ngàzzaminde sus a 'u nome accumenzate d'a [[Grecie]]. Confine ad ovest cu l'[[Albanie]], ad est c'a [[Bulgarie]], a nord c'a [[Serbie]] e 'u [[Kosove]] e a sud c'a [[Grecie]]. 'U territorie guvernate d'a Repubbleche de Macidonie jève apprìme 'a vanne meridionale estreme d'a [[Repubbleche Socialiste Federale de Jugoslavie|Jugoslavie]]. Le confine de ôsce a die sonde state scacchiate picche nnande 'a [[Seconne uerre mondiale]], quanne 'a Jugoslavie socialiste ha ccrejète jndr'â vanne 'a ''Repubbleche Socialiste de Macidonie'', recanoscenne le [[Macedone (etnie)|Macedone]] cumme 'na nazione scucchiáte a lle 'nderne d'a Jugoslavie. Ppegghiáte 'u nome de Repubbleche de Macidonie l'[[8 settèmmre]] [[1991]], se scucchie pacifecamènde d'a Jugoslavie senze otre cangiaminde territoriale. == Note == <references /> == Otre pruggette == {{interprogetto}} {{Controllo di autorità}} == Collegaminde fore a Uicchipèdie == * {{Dmoz|World/Italiano/Regionale/Europa/Macedonia/|Macidonie}} * [https://web.archive.org/web/20200818113524/http://www.mia.com.mk/ MIA - l'Agenzie de Stambe d'a Repubbleche de Macidonie ] ;Site ufficiale d'u guverne * [https://web.archive.org/web/20060114023828/http://www.sobranie.mk/en/default.asp Assemblèe d'a Repubbleche de Macidonie ] * [https://web.archive.org/web/20120420212234/http://mzsv.gov.mk/ Ministere de l'Agricolture, e de l'Amministrazione de le Resorse Forestale e Idreche] * [http://www.culture.in.mk/ Ministere d'a Culture] * [https://web.archive.org/web/20080512152004/http://www.morm.gov.mk/index1en.htm Ministere d'a Difese] * [https://web.archive.org/web/20051216155601/http://www.economy.gov.mk/default-MK.asp Ministere de l'Economije] * [https://web.archive.org/web/20160322012317/http://www.mon.gov.mk/ Ministere de l'Educazione e d'a Scienze] * [https://web.archive.org/web/20060127020736/http://www.moe.gov.mk/ Ministere d'ô Sveluppe e d'a Pianificazione Fiseche] * [https://web.archive.org/web/20060207085654/http://www.finance.gov.mk/gb/index.html Ministere de le Finanze] * [https://web.archive.org/web/20060715140326/http://www.mfa.gov.mk/default_en.asp Ministere de le Affare Estere] * [http://www.zdravstvo.gov.mk/ Ministere d'a Sanetate] * [https://web.archive.org/web/20111026215839/http://www.mtsp.gov.mk/ Ministere d'a Fatije] * [https://web.archive.org/web/20110520005945/http://www.mls.gov.mk/ Ministere de l'Auto-Guverne Locale] * [https://web.archive.org/web/20080921183853/http://www.dtk.gov.mk/ Ministere de le Carrêscie e de l'Educazione] * [https://web.archive.org/web/20080207190128/http://www.vlada.mk/english/index_en.htm Guverne] * [https://web.archive.org/web/20080402031318/http://www.president.gov.mk/index_e.asp Presidende d'a Repubbleche de Macidonie] * [https://web.archive.org/web/20100212162223/http://www.dik.mk/ Commissione Elettorale Statale p'a Repubbleche de Macidonie] * [http://www.macedonia-history.blogspot.com Storie d'a Repubbleche de Macidonie (en, bg)] {{Europe}} {{Naziune slave}} {{Box successione|carica=Statère pe' [[innece de sveluppe umane]]|periodo=71º puèste|precedente=[[Iran]]|successivo=[[Mauritius]]}} [[Category:Repubbleche de Macidonie| ]] cms9a5ri11oevpdms7ensahm22amp97 San Marine 0 17771 152082 151770 2026-09-04T11:18:26Z TheFlagandAnthemGuy 10300 152082 wikitext text/x-wiki {{Stato |nomeCorrente = San Marine |nomeCompleto = Serenisseme Repubbleche de San Marine |nomeUfficiale = Serenissima Repubblica di San Marino |linkBandiera = Flag of San Marino.svg |paginaBandiera = Bandiere de San Marine |linkStemma = Coat of arms of San Marino.svg |paginaStemma = Stemme de San Marine |linkLocalizzazione = LocationSanMarino.svg |linkMappa = SAN MARINO-en.png |motto = Libertas<br\ />([[Dialètte tarandine|tar.]]: Franghezze) |lingua = [[Lènga tagliáne|tagliáne]] |altrelingue = [[Dialètte sammarinese]] |capitale = [[Cetate de San Marine]] |capitaleAbitanti = 4.509 |capitaleAbitantiAnno = 20-11-2024 |anni dalla fondazione = Anne d'a funnazione |anninumero = 1706 d.F.R. |governo = [[repubbleche parlamendare]] |presidente = Alice Mina e Vladimiro Selva |primoMinistro = [[Luca Beccari]] |elenco capi di governo = [[Prime ministre de San Marine|prime ministre]] |elenco capi di stato = [[Liste de le capitane reggende da 'u 2000 a ôsce|capitane reggende]] |indipendenza = [[3 settèmmre]] [[301]] (''tradizionale'')<br />[[1291]] (''recanosciute'') |ingressoONU = [[2 marze]] [[1992]] |superficieTotale = 61,19 |superficieOrdine = 231 |superficieAcqua = trascurabbele |popolazioneTotale = 33.987 |popolazioneAnno = 30-09-2024 |popolazioneOrdine = 190 |popolazioneDensita = 555 |continente = [[Europe]] |orario = [[Timbe Coordinate Universale|UTC]] +1 |PIL=940 |PILValuta= $ |PILAnno= 2001 |PILOrdine= 164 |PILprocapite=34.100 |PILprocapiteValuta= $ |PILprocapiteAnno= 2008 |PILprocapiteOrdine= 32 |valuta = [[Euro]]<ref>Jè coniate pure 'ô [[Scude sammarinese]], me se pòte ausà sule pe' raggione numismateche a San Marine.</ref> |energia = <!-- consumo di energia pro capite - non scrivere kW/ab. che viene scritto già dal template - (consumo annuo totale in kWh diviso gli abitanti/365gg/24h) --> |tld = [[.sm]] |telefono = pe' le numerazione [[Telecom Italia San Marino]] da l'[[Itaglie]] e da 'u [[Cetate d'u Vaticane|Vaticane]] 0549, da totte le otre pajèsere +378 seguite da 'u numere cu o senze [[0549]]; pe' le numerazione [[San Marino Telecom]] +378 da totte le pajèsere. |targa = RSM, SMR (da 'u [[2004]]) |inno = ''[[Inne Nazionale d'a Repubbleche]]'' de [[Federico Consolo]] d'u [[1894]] |festa = [[3 settèmmre]] |note = <!-- <sup>1</sup> [[Scude sammarinese]] (ufficialmènde inausate me no circolànde; sule pe' raggione numismateche) --> Mappe amministrative de San Marine {{coord|43|56|N|012|27|E|display=title}} {{UNESCO |tipoBene = patrimonie |nome = Monde Titane e cendre storeche de San Marine |nomeInglese = San Marino Historic Centre and Mount Titano |tipologia = Culturale |criterio = iii |anno = 2008 |pericolo = Nisciune indicazione |link = http://whc.unesco.org/en/list/12450}} }} <!-- fine della tabella - per la compilazione vedi -> Aiuto:Stato --> 'A '''Serenisseme Repubbleche de San Marine''', spesse abbreviate jndre '''Repubbleche de San Marine''' o cchijù semblicemènde jndre '''San Marine''', jè 'nu [[State]] de l'[[Europe meridionale]] acchijate jndr'â penisole tagliáne. Tène 'na grannèzze territoriale de 61,19 km² populate da 31.978 crestiáne.<ref>[https://web.archive.org/web/20120320160245/http://www.statistica.sm/on-line/Home/DatiStatistici/Popolazione.html?Categoria=2&nodo=%2Fon-line%2FHome%2FDatiStatistici%2FPopolazione%2FStrutturademografica.html Popolazzione javetande pe' castièdde - UPECEDS]</ref> Jè une de le mène populose 'mbrà lle Statère membre d'u [[Conziglie d'Europe]] e de le [[Nazione Aunìte]]. 'A capitale sove jè [[Cetate de San Marine]]. 'A [[lènga ufficiale]] jè 'u [[Lènga tagliáne|tagliáne]]. Le crestiáne sonde chiamate sammarinese. Accumenzanne da 'u [[2008]] 'u cendre storeche d'a [[Cetate de San Marine]] e 'u [[Monde Titane]] sonde state sckaffate da l'[[Organizzazione de le Nazione Aunìte pe' l'Educazione, 'a Scienze e 'a Culture|UNESCO]] 'mbrà le [[Patrimonie de l'umanetate|patrimone de l'umanetate]]<ref>[http://whc.unesco.org/en/news/450 Iscrizione 'mbrà le patrimonie de l'umanetate]</ref> 'n'quanne "testimonianze d'a condinuitate de 'na repubbleche franghe fine da 'u Medioève".<ref name="UNESCO">[http://whc.unesco.org/en/list/1245/ Schede UNESCO]</ref> == Note == <references/> == Bibbliografije == * Patrizia Battilani e Stefano Pivato (a cura di): "Il turismo nei piccoli borghi. Fra cultura e ri-definizione dell'identità urbana: il caso di San Marino", San Marine, Cendre Studie Storece Sammarinese, 2010. * [[Giosuè Carducci]]: ''La libertà perpetua di San Marino: discorso al Senato e al popolo - XXX settembre MDCCCLXXXXIV'', Bologne : Zanichelli, 1894. * Fabio Foresti: ''Quella nostra sancta libertà. Lingue, storia e società nella Repubblica di San Marino.'' Biblioteca e ricerca. Quaderni della Segretaria di Stato per la Pubblica Istruzione, Affari Sociali. Istituti Culturali e Giustizia 6. Aiep, San Marine 1998. ISBN 88-86051-66-2 *Melchiorre Delfico: ''Memorie storiche della Repubblica di San Marino.'' Meláne : Sonzogno, 1804 * [[Giovanni Spadolini]]: "San Marino, l'idea della repubblica", Firenze : Le Monnier, másce 1989. ISBN 88-00-85629-2. == Archivije == * Documendazione ca se pôte acchijà ad 'u [[Departemènde federale de le affare estere]], Berne. == 'Ndruche pure == * [[Liste de le CAP de San Marine]] * [[Forze armate e de polizie sammarinese]] * [[Polizie Civile (San Marine)]] * [[Cuèrpe d'a Gendarmerie]] * Nuclee Auniformate d'a [[Uardie de Rocche]] * [[Medaglie, decorazione ed ordene cavalleresche sammarinese]] * [[Ordene de Sand'Agate]] * [[Comunecazziúne a San Marine]] * [[Poste sammarinese]] * [[Carrêscie a San Marine]] * [[Credite Sammarinese]] * [[Cucine sammarinese]] * [[Lènghe de San Marine]] * [[Festival Calanchi]] * [[Chiesera cattoleche de San Marine]] * [[Diocese de San Marine-Mondefeltre]] * [[Parrocchie de San Marine]] * [[Passaporte sammarinese]] * [[Ambasciate d'Itaglie a San Marine]] * [[Sammarinese]] * [[Carcere de le Cappuccine]] * [[Bioscience Institute]] * [[Associazione Sammarinese Protezione Anemale|APAS - Associazione Sammarinese Protezione Anemale]] == Otre pruggette == {{interprogetto|commons=Category:San Marino|n=Categoria:San Marino}} {{Controllo di autorità}} == Collegaminde fore a Uicchipèdie == * [http://www.sanmarinosite.com 'U Purtúse d'a Repubbleche de San Marine] - 'U Purtúse d'a Repubbleche de San Marine * {{Dmoz|World/Italiano/Regionale/Europa/San_Marino/|San Marine}} * [http://books.google.it/books?id=46wOAAAAQAAJ&printsec=frontcover&dq=Memorie+storiche+della+repubblica+di+San+Marino#v=onepage&q=&f=false Memorie storeche d'a repubbleche de San Marine] de Melchiorre Delfico (1804). * {{DSS|I3370|Repubbleche de San Marine}} * [https://web.archive.org/web/20110519100338/https://sites.google.com/site/clubannobit/news/pubblicatolelencodellefamigliecheebberoriconoscimentinobiliaridallarepubblicadisanmarino Elenghe de le famigghie patrizie, nobele e titolate d'a Repubbleche de San Marine] === Schede d'u Paìse === * [https://web.archive.org/web/20070310154657/http://www.viaggiaresicuri.mae.aci.it/?san_marino Schede de San Marine da 'u site Viaggiare Secure] - Site curate da 'u Ministere de le Estere e da ll'ACI * {{en}} [https://web.archive.org/web/20200501044303/https://www.cia.gov/library/publications/the-world-factbook/geos/sm.html CIA Factbook] === Istituzione === * [http://www.consigliograndeegenerale.sm Conziglie Granne e Generale] ** [https://web.archive.org/web/20070425064959/http://www.consigliograndeegenerale.sm/new/index.php3?trwidth=535&tlwidth=215&page_right=%2Fricercaleggi%2Fcerca_leggi.php3&page_left=%2Fricercaleggi%2Fcerca_leggi_left.php3 Archivije Ligge] ** [http://www.guardiadelconsiglio.sm Uardie d'u Conziglie Granne e Generale] * [http://www.esteri.sm/ Segreterije de State pe' le Affare Estere] ** [https://web.archive.org/web/20120120035341/http://www.rapportiinternazionali.sm/ Uffice Rapporte Economece 'Ndernazionale] * [http://www.interni.segreteria.sm Segreterije de State pe' le Affare 'Nderne] ** [https://web.archive.org/web/20070203232015/http://delibere.interni.segreteria.sm/ Delibbere Congresse de State] ** [https://web.archive.org/web/20050907033332/http://www.elezioni.sm/src/elezioni/ 'A pàgene dedicate a le eleziune] ** [https://web.archive.org/web/20080625021619/http://www.elezioni2006.sm/elezioni2006/index2.jsp Eleziune polìteche 2006] * [https://web.archive.org/web/20090216191405/http://finanze.sm/ Segreterije de State pe' le Finanze e 'u Bilange] ** [https://web.archive.org/web/20090610223413/http://www.upeceds.sm/ Uffice Programmazione Economeche - Cendre Elabborazione Datère e Statisteche] ** [http://www.bcsm.sm/ Banghe Cendrale d'a Repubbleche de San Marine] ** [https://web.archive.org/web/20070126100452/http://www.esattoria.sm/index.htm Servizie de Esattorie] ** [https://web.archive.org/web/20110921160937/http://www.dichiarazionedeiredditi.sm/ Dechiarazione de le Reddite OnLine] ** [https://web.archive.org/web/20080419073857/http://www.aasfn.sm/ Aziende Autonome de State Filateleche e Numismateche] * [https://web.archive.org/web/20060908061647/http://www.industria.segreteria.sm/ Segretarije de State pe' le 'Ndustrije e l'Artigianate] ** [https://web.archive.org/web/20131205113208/http://www.cc.sm/ Camere de Commerce d'a Repubbleche de San Marine] ** [http://www.aass.sm/ Aziende Autonome de State pe' le Servizie Pubbleche] * [https://web.archive.org/web/20110629135227/http://visitsanmarino.com/ Segreterije de State p'u Turisme, Sport e Spettachele] * [https://web.archive.org/web/20070317042715/http://www.salute.sm/ Segreterije de State p'a Sanetata e 'a Sicurezze Suggiale] * [https://web.archive.org/web/20120216214154/http://www.educazione.sm/ Segreterije de State p'a Pubbleche Istruzione] * [https://web.archive.org/web/20081111143339/http://www.lavoro.segreteria.sm/ Segreterije de State p'a Fatije] * [https://web.archive.org/web/20080421033755/http://www.giuntedicastello.sm/ Segreterije de State p'a Giustizie e le Rapporte cu le Giunde de Castièdde] === Educazione === * [https://web.archive.org/web/20110511115329/http://www.unirsm.sm/ Universetate de le Studie d'a Repubbleche de San Marine] * [https://web.archive.org/web/20120216214154/http://www.educazione.sm/ Purtúse de l'Educazione] {{linkwar|4|10}} {{Europe}} [[Category:San Marine| ]] lreyeibbnu62a94a6q68vnbotlib9ny Modulo:TableTools 828 19291 152079 136451 2026-09-03T13:07:15Z Hamish 9240 Update from [[d:Special:GoToLinkedPage/enwiki/Q15408619|master]] using [[mw:Synchronizer| #Synchronizer]] 152079 Scribunto text/plain ------------------------------------------------------------------------------------ -- TableTools -- -- -- -- This module includes a number of functions for dealing with Lua tables. -- -- It is a meta-module, meant to be called from other Lua modules, and should not -- -- be called directly from #invoke. -- ------------------------------------------------------------------------------------ local libraryUtil = require('libraryUtil') local p = {} -- Define often-used variables and functions. local floor = math.floor local infinity = math.huge local checkType = libraryUtil.checkType local checkTypeMulti = libraryUtil.checkTypeMulti ------------------------------------------------------------------------------------ -- isPositiveInteger -- -- This function returns true if the given value is a positive integer, and false -- if not. Although it doesn't operate on tables, it is included here as it is -- useful for determining whether a given table key is in the array part or the -- hash part of a table. ------------------------------------------------------------------------------------ function p.isPositiveInteger(v) return type(v) == 'number' and v >= 1 and floor(v) == v and v < infinity end ------------------------------------------------------------------------------------ -- isNan -- -- This function returns true if the given number is a NaN value, and false if -- not. Although it doesn't operate on tables, it is included here as it is useful -- for determining whether a value can be a valid table key. Lua will generate an -- error if a NaN is used as a table key. ------------------------------------------------------------------------------------ function p.isNan(v) return type(v) == 'number' and v ~= v end ------------------------------------------------------------------------------------ -- shallowClone -- -- This returns a clone of a table. The value returned is a new table, but all -- subtables and functions are shared. Metamethods are respected, but the returned -- table will have no metatable of its own. ------------------------------------------------------------------------------------ function p.shallowClone(t) checkType('shallowClone', 1, t, 'table') local ret = {} for k, v in pairs(t) do ret[k] = v end return ret end ------------------------------------------------------------------------------------ -- removeDuplicates -- -- This removes duplicate values from an array. Non-positive-integer keys are -- ignored. The earliest value is kept, and all subsequent duplicate values are -- removed, but otherwise the array order is unchanged. ------------------------------------------------------------------------------------ function p.removeDuplicates(arr) checkType('removeDuplicates', 1, arr, 'table') local isNan = p.isNan local ret, exists = {}, {} for _, v in ipairs(arr) do if isNan(v) then -- NaNs can't be table keys, and they are also unique, so we don't need to check existence. ret[#ret + 1] = v elseif not exists[v] then ret[#ret + 1] = v exists[v] = true end end return ret end ------------------------------------------------------------------------------------ -- numKeys -- -- This takes a table and returns an array containing the numbers of any numerical -- keys that have non-nil values, sorted in numerical order. ------------------------------------------------------------------------------------ function p.numKeys(t) checkType('numKeys', 1, t, 'table') local isPositiveInteger = p.isPositiveInteger local nums = {} for k in pairs(t) do if isPositiveInteger(k) then nums[#nums + 1] = k end end table.sort(nums) return nums end ------------------------------------------------------------------------------------ -- affixNums -- -- This takes a table and returns an array containing the numbers of keys with the -- specified prefix and suffix. For example, for the table -- {a1 = 'foo', a3 = 'bar', a6 = 'baz'} and the prefix "a", affixNums will return -- {1, 3, 6}. ------------------------------------------------------------------------------------ function p.affixNums(t, prefix, suffix) checkType('affixNums', 1, t, 'table') checkType('affixNums', 2, prefix, 'string', true) checkType('affixNums', 3, suffix, 'string', true) local function cleanPattern(s) -- Cleans a pattern so that the magic characters ()%.[]*+-?^$ are interpreted literally. return s:gsub('([%(%)%%%.%[%]%*%+%-%?%^%$])', '%%%1') end prefix = prefix or '' suffix = suffix or '' prefix = cleanPattern(prefix) suffix = cleanPattern(suffix) local pattern = '^' .. prefix .. '([1-9]%d*)' .. suffix .. '$' local nums = {} for k in pairs(t) do if type(k) == 'string' then local num = mw.ustring.match(k, pattern) if num then nums[#nums + 1] = tonumber(num) end end end table.sort(nums) return nums end ------------------------------------------------------------------------------------ -- numData -- -- Given a table with keys like {"foo1", "bar1", "foo2", "baz2"}, returns a table -- of subtables in the format -- {[1] = {foo = 'text', bar = 'text'}, [2] = {foo = 'text', baz = 'text'}}. -- Keys that don't end with an integer are stored in a subtable named "other". The -- compress option compresses the table so that it can be iterated over with -- ipairs. ------------------------------------------------------------------------------------ function p.numData(t, compress) checkType('numData', 1, t, 'table') checkType('numData', 2, compress, 'boolean', true) local ret = {} for k, v in pairs(t) do local prefix, num = mw.ustring.match(tostring(k), '^([^0-9]*)([1-9][0-9]*)$') if num then num = tonumber(num) local subtable = ret[num] or {} if prefix == '' then -- Positional parameters match the blank string; put them at the start of the subtable instead. prefix = 1 end subtable[prefix] = v ret[num] = subtable else local subtable = ret.other or {} subtable[k] = v ret.other = subtable end end if compress then local other = ret.other ret = p.compressSparseArray(ret) ret.other = other end return ret end ------------------------------------------------------------------------------------ -- compressSparseArray -- -- This takes an array with one or more nil values, and removes the nil values -- while preserving the order, so that the array can be safely traversed with -- ipairs. ------------------------------------------------------------------------------------ function p.compressSparseArray(t) checkType('compressSparseArray', 1, t, 'table') local ret = {} local nums = p.numKeys(t) for _, num in ipairs(nums) do ret[#ret + 1] = t[num] end return ret end ------------------------------------------------------------------------------------ -- sparseIpairs -- -- This is an iterator for sparse arrays. It can be used like ipairs, but can -- handle nil values. ------------------------------------------------------------------------------------ function p.sparseIpairs(t) checkType('sparseIpairs', 1, t, 'table') local nums = p.numKeys(t) local i = 0 local lim = #nums return function () i = i + 1 if i <= lim then local key = nums[i] return key, t[key] else return nil, nil end end end ------------------------------------------------------------------------------------ -- size -- -- This returns the size of a key/value pair table. It will also work on arrays, -- but for arrays it is more efficient to use the # operator. ------------------------------------------------------------------------------------ function p.size(t) checkType('size', 1, t, 'table') local i = 0 for _ in pairs(t) do i = i + 1 end return i end local function defaultKeySort(item1, item2) -- "number" < "string", so numbers will be sorted before strings. local type1, type2 = type(item1), type(item2) if type1 ~= type2 then return type1 < type2 elseif type1 == 'table' or type1 == 'boolean' or type1 == 'function' then return tostring(item1) < tostring(item2) else return item1 < item2 end end ------------------------------------------------------------------------------------ -- keysToList -- -- Returns an array of the keys in a table, sorted using either a default -- comparison function or a custom keySort function. ------------------------------------------------------------------------------------ function p.keysToList(t, keySort, checked) if not checked then checkType('keysToList', 1, t, 'table') checkTypeMulti('keysToList', 2, keySort, {'function', 'boolean', 'nil'}) end local arr = {} local index = 1 for k in pairs(t) do arr[index] = k index = index + 1 end if keySort ~= false then keySort = type(keySort) == 'function' and keySort or defaultKeySort table.sort(arr, keySort) end return arr end ------------------------------------------------------------------------------------ -- sortedPairs -- -- Iterates through a table, with the keys sorted using the keysToList function. -- If there are only numerical keys, sparseIpairs is probably more efficient. ------------------------------------------------------------------------------------ function p.sortedPairs(t, keySort) checkType('sortedPairs', 1, t, 'table') checkType('sortedPairs', 2, keySort, 'function', true) local arr = p.keysToList(t, keySort, true) local i = 0 return function () i = i + 1 local key = arr[i] if key ~= nil then return key, t[key] else return nil, nil end end end ------------------------------------------------------------------------------------ -- isArray -- -- Returns true if the given value is a table and all keys are consecutive -- integers starting at 1. ------------------------------------------------------------------------------------ function p.isArray(v) if type(v) ~= 'table' then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end ------------------------------------------------------------------------------------ -- isArrayLike -- -- Returns true if the given value is iterable and all keys are consecutive -- integers starting at 1. ------------------------------------------------------------------------------------ function p.isArrayLike(v) if not pcall(pairs, v) then return false end local i = 0 for _ in pairs(v) do i = i + 1 if v[i] == nil then return false end end return true end ------------------------------------------------------------------------------------ -- invert -- -- Transposes the keys and values in an array. For example, {"a", "b", "c"} -> -- {a = 1, b = 2, c = 3}. Duplicates are not supported (result values refer to -- the index of the last duplicate) and NaN values are ignored. ------------------------------------------------------------------------------------ function p.invert(arr) checkType("invert", 1, arr, "table") local isNan = p.isNan local map = {} for i, v in ipairs(arr) do if not isNan(v) then map[v] = i end end return map end ------------------------------------------------------------------------------------ -- listToSet -- -- Creates a set from the array part of the table. Indexing the set by any of the -- values of the array returns true. For example, {"a", "b", "c"} -> -- {a = true, b = true, c = true}. NaN values are ignored as Lua considers them -- never equal to any value (including other NaNs or even themselves). ------------------------------------------------------------------------------------ function p.listToSet(arr) checkType("listToSet", 1, arr, "table") local isNan = p.isNan local set = {} for _, v in ipairs(arr) do if not isNan(v) then set[v] = true end end return set end ------------------------------------------------------------------------------------ -- deepCopy -- -- Recursive deep copy function. Preserves identities of subtables. ------------------------------------------------------------------------------------ local function _deepCopy(orig, includeMetatable, already_seen) if type(orig) ~= "table" then return orig end -- already_seen stores copies of tables indexed by the original table. local copy = already_seen[orig] if copy ~= nil then return copy end copy = {} already_seen[orig] = copy -- memoize before any recursion, to avoid infinite loops for orig_key, orig_value in pairs(orig) do copy[_deepCopy(orig_key, includeMetatable, already_seen)] = _deepCopy(orig_value, includeMetatable, already_seen) end if includeMetatable then local mt = getmetatable(orig) if mt ~= nil then setmetatable(copy, _deepCopy(mt, true, already_seen)) end end return copy end function p.deepCopy(orig, noMetatable, already_seen) checkType("deepCopy", 3, already_seen, "table", true) return _deepCopy(orig, not noMetatable, already_seen or {}) end ------------------------------------------------------------------------------------ -- sparseConcat -- -- Concatenates all values in the table that are indexed by a number, in order. -- sparseConcat{a, nil, c, d} => "acd" -- sparseConcat{nil, b, c, d} => "bcd" ------------------------------------------------------------------------------------ function p.sparseConcat(t, sep, i, j) local arr = {} local arr_i = 0 for _, v in p.sparseIpairs(t) do arr_i = arr_i + 1 arr[arr_i] = v end return table.concat(arr, sep, i, j) end ------------------------------------------------------------------------------------ -- length -- -- Finds the length of an array, or of a quasi-array with keys such as "data1", -- "data2", etc., using an exponential search algorithm. It is similar to the -- operator #, but may return a different value when there are gaps in the array -- portion of the table. Intended to be used on data loaded with mw.loadData. For -- other tables, use #. -- Note: #frame.args in frame object always be set to 0, regardless of the number -- of unnamed template parameters, so use this function for frame.args. ------------------------------------------------------------------------------------ function p.length(t, prefix) -- requiring module inline so that [[Module:Exponential search]] which is -- only needed by this one function doesn't get millions of transclusions local expSearch = require("Module:Exponential search") checkType('length', 1, t, 'table') checkType('length', 2, prefix, 'string', true) return expSearch(function (i) local key if prefix then key = prefix .. tostring(i) else key = i end return t[key] ~= nil end) or 0 end ------------------------------------------------------------------------------------ -- inArray -- -- Returns true if searchElement is a member of the array, and false otherwise. -- Equivalent to JavaScript array.includes(searchElement) or -- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed ------------------------------------------------------------------------------------ function p.inArray(array, searchElement, fromIndex) checkType("inArray", 1, array, "table") -- if searchElement is nil, error? fromIndex = tonumber(fromIndex) if fromIndex then if (fromIndex < 0) then fromIndex = #array + fromIndex + 1 end if fromIndex < 1 then fromIndex = 1 end for _, v in ipairs({unpack(array, fromIndex)}) do if v == searchElement then return true end end else for _, v in pairs(array) do if v == searchElement then return true end end end return false end ------------------------------------------------------------------------------------ -- merge -- -- Given the arrays, returns an array containing the elements of each input array -- in sequence. ------------------------------------------------------------------------------------ function p.merge(...) local arrays = {...} local ret = {} for i, arr in ipairs(arrays) do checkType('merge', i, arr, 'table') for _, v in ipairs(arr) do ret[#ret + 1] = v end end return ret end ------------------------------------------------------------------------------------ -- extend -- -- Extends the first array in place by appending all elements from the second -- array. ------------------------------------------------------------------------------------ function p.extend(arr1, arr2) checkType('extend', 1, arr1, 'table') checkType('extend', 2, arr2, 'table') for _, v in ipairs(arr2) do arr1[#arr1 + 1] = v end end return p 4n03zk6kcoeg4gz82mieeh94c1szcjy Modulo:Exponential search 828 21780 152080 2026-09-03T21:57:33Z Hamish 9240 [IPE-NEXT] Quick edit imported from [[:w:en:Module:Exponential search]] 152080 Scribunto text/plain -- This module provides a generic exponential search algorithm. require[[strict]] local checkType = require('libraryUtil').checkType local floor = math.floor local function midPoint(lower, upper) return floor(lower + (upper - lower) / 2) end local function search(testFunc, i, lower, upper) if testFunc(i) then if i + 1 == upper then return i end lower = i if upper then i = midPoint(lower, upper) else i = i * 2 end return search(testFunc, i, lower, upper) else upper = i i = midPoint(lower, upper) return search(testFunc, i, lower, upper) end end return function (testFunc, init) checkType('Exponential search', 1, testFunc, 'function') checkType('Exponential search', 2, init, 'number', true) if init and (init < 1 or init ~= floor(init) or init == math.huge) then error(string.format( "invalid init value '%s' detected in argument #2 to " .. "'Exponential search' (init value must be a positive integer)", tostring(init) ), 2) end init = init or 2 if not testFunc(1) then return nil end return search(testFunc, init, 1, nil) end jqqi8l27tb73lglksbukg2g3bzt3fmv