Tschingt
Knižnica na prekombinovanie čísla 5
.
Inšpirované knižnicou five.js a reimplementovanie z Javascriptu do jazyka Scala.
Tschingt znamená 5 (päť) v retorománskom jazyku.
Oproti implementácii v Javascripte nastali tieto zmeny:
slovakian
metóda premenovaná naslovak
-
pridaná
romansh
metóda kvôli pomenovaniu knižnice
Pozri GitHub repozitár pre viac informácií.
Použitie
Build.sbt
1 2 |
libraryDependencies += "com.pidanic" % "tschingt_2.12" % "0.8.1" |
Importuj modul
1 2 |
import com.pidanic.tschingt.Five |
Základy s 5
1 2 3 4 5 6 |
Five() // 5 val five = Five() five // 5 five(); // 5 |
Pravidlo piatich
1 2 |
five.law; // The Law of Fives states simply that: All things happen in fives, or are divisible by or are multiples of five, or are somehow directly or indirectly appropriate to 5. The Law of Fives is never wrong. |
Sčítanie
1 2 |
five() + five(); // 10 |
Násobenie
1 2 |
five() * five(); // 25 |
Delenie
1 2 |
five() / five(); // 1 |
Kombinatorika
1 2 |
five.factorial; // 120 |
Všelijaké 5-tky
1 2 3 4 5 6 7 8 9 10 11 |
five.upHigh // ⁵ five.downLow // ₅ five.tooSlow // 5, with a ~500 millisecond delay five.roman // V five.morseCode // ..... five.negative // -5 five.loud() // FIVE five.loud("piglatin") // IVEFAY five.smooth // S five.bucks // $5.00 |
Kryptografia
1 2 3 |
five.mdFive // 30056e1cab7a61d256fc8edd970d14f5 five.golden // 1.618033988749895 |
5 v iných jazykoch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
five.arabic // خمسة five.azerbaijani // beş five.basque // bost five.belarusian // пяць five.bosnian // pet five.bulgarian // пет five.catalan // cinc five.chinese() // 五 five.chinese("pinyin") // wǔ five.chinese("financial") // 伍 five.choctaw // tahlapi five.croatian // pet five.czech // pět five.dothraki // mek five.dovah // hen five.dutch // vijf five.elvish() // lempë five.elvish("quenya") // lempë five.elvish("sindarin") // leben five.english // five five.esperanto // kvin five.estonian // viis five.finnish // viisi five.french // cinq five.german // fünf five.greek // πέντε five.hebrew // חמש five.hindi // पांच five.hungarian // öt five.icelandic // fimm five.indonesian // lima five.irish // cúig five.italian // cinque five.japanese // 五 five.kannada // ಐದು five.klingon // vagh five.korean // 오 five.latin // quinque five.latvian // pieci five.lithuanian // penki five.maltese // ħamsa five.mongolian // таван five.nepali // पाँच five.norwegian // fem five.persian // پنج five.piglatin // ivefay five.polish // pięć five.portuguese // cinco five.punjabi // ਪੰਜ five.romanian // cinci five.romansh // tschingt five.russian // пять five.serbian // pet five.sinhala // පහ five.slovak // päť five.slovenian // pet five.spanish // cinco five.swedish // fem five.tamil // ஐந்து five.telugu // ఐదు five.thai // ห้า five.turkish // beş five.ukrainian // п’ять five.welsh // pump |
Číselné sústavy
1 2 3 4 5 6 |
five.binary // 101 five.octal // 5 five.hex // 5 five.base(4) // 11 five.base(3) // 12 |
Kontrola
1 2 |
five.isFive(10) // false |
Filter, Map and Reduce
1 2 3 4 |
five.filter(List(5, 1, 5)) // List(5, 5) five.map(List(1, 2, 3)) // List(5, 5, 5) five.reduce(List(1, 2, 3)) // 5 |
Novinky
1 2 3 4 5 6 7 8 9 10 11 12 13 |
five.fab // List("Juwan Howard", "Ray Jackson", "Jimmy King", "Jalen Rose", "Chris Webber") five.jackson // List("Jackie", "Tito", "Jermaine", "Marlon", "Michael") five.furious // List("Tigress", "Viper", "Crane", "Monkey", "Mantis") five.luniz // "I Got 5 on It" five.r // "£5" five.funk // "5 bad boys with the power to rock you" five.high // "o/" five.members // List("Sean Conlon", "Ritchie Neville", "Scott Robinson", "Jason 'J' Brown", "Abz Love") five.discography // List("5ive", "Invincible", "Kingsize") five.singles // List("Slam Dunk (Da Funk)", "When the Lights Go Out", "Got the Feelin'", "Everybody Get Up", "It's the Things You Do", "Until the Time Is Through", "If Ya Gettin'" Down", "Keep On Movin'", "Don't Wanna Let You Go", "We Will Rock You", "Let's Dance", "Closer to Me", "Rock the Party", "I Wish It Could Be Christmas Everyday") five.famous // List("Julian", "Dick", "George", "Anne", "Timmy") five.fiveFiveFive // "Interstella 5555: The 5tory of the 5ecret 5tar 5ystem" |
Rotácia
1 2 |
five.rot("five.js") //"knaj.ox" |
Asynchrónne použitie
1 2 3 4 5 |
five.async(five => { // five.isSuccess // five == 5 }) |
Unikód
1 2 3 4 5 6 |
five.oclock; // "?" five.oclockSomewhere; // "?" five.guys; // "?" |
Meny
1 2 3 |
five.euro; // "5€" five.dollar; // "$5" |
Vývoj
Zdrojový kód
Všetka logika sa nachádza v jednom súbore:
1 2 |
Five.scala |
Testy
1 2 |
sbt test |
Licencia
MIT