for (1..10 X* 1..10).map(*.fmt('%3d')).rotor(10) {.fmt.say}
say ((1..10) <<*>> (1..10,)).fmt('%3d', '\n')
say (1..10 X* 1..10).rotor(10).fmt("%3d", "\n")
Citace od: gll kdy 19. 12. 2016, 20:58:37Kód [Vybrat] Rozbalitsay (1..10 X* 1..10).rotor(10).fmt("%3d", "\n")Vaše zaostalé jazyky bez metaoperátorů se nechytají.
mapM_ putStrLn ((([1..10] >>=) . (printf "%4d" .) . (*)) <$> [1..10 :: Int])
Citace od: andy kdy 19. 12. 2016, 23:34:53Citace od: gll kdy 19. 12. 2016, 20:58:37Kód [Vybrat] Rozbalitsay (1..10 X* 1..10).rotor(10).fmt("%3d", "\n")Vaše zaostalé jazyky bez metaoperátorů se nechytají.http://pointfree.io/ mi vygenerovalo tohle:Kód [Vybrat] RozbalitmapM_ putStrLn ((([1..10] >>=) . (printf "%4d" .) . (*)) <$> [1..10 :: Int])Ale to už je cvičení na IQ testy - kdo pochopí, co to dělá.... (já bych to nepochopil).
Citace od: gll kdy 20. 12. 2016, 00:53:30Tak tohle je drsné. To bych nechtěl po někom zdědit. Perl 6 dokáže být stručnější a současně čitelnější bez použití složitých konceptů.
mapM_ putStrLn $ map (concatMap (printf "%4d")) [ map (*x) [1..10] | x <- [1..10 :: Int]]
Citace od: spasitel kdy 20. 12. 2016, 09:07:23tvl co za prasarny to pisete? to jako musi byt radost s vama pracovat, kdyz nekdo po vas musi cist tyhle sracky
+++++++++++++>++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++<...>+.<...>+.<...>+.<...>+.<...>+.<...>+.<...>+.<...>+.<...>+.<..>--------.-.<<.>...>++.<...>++.<...>++.<...>++.<..>-------.-.<..>+.+.<..>-.+++.<..>---.+++++.<..>-----.+++++++.<..>------.--.<<.>...>+++.<...>+++.<...>+++.<..>--------.+.<..>-.++++.<..>----.+++++++.<..>------.-.<..>+.++.<..>--.+++++.<..>----.---.<<.>...>++++.<...>++++.<..>-------.+.<..>-.+++++.<..>----.--.<..>++.++.<..>--.++++++.<..>-----.-.<..>+.+++.<..>--.----.<<.>...>+++++.<..>----.-.<..>+.++++.<..>---.--.<..>++.+++.<..>--.---.<..>+++.++.<..>-.----.<..>++++.+.<..>.-----.<<.>...>++++++.<..>-----.+.<..>-.+++++++.<..>------.++.<..>-.---.<..>+++.+++.<..>--.--.<..>++.++++.<..>---.-.<..>++.------.<<.>...>+++++++.<..>------.+++.<..>--.-.<..>+.++++++.<..>-----.++.<..>-.--.<..>++.+++++.<..>----.+.<..>.---.<..>++++.-------.<<.>...>++++++++.<..>-------.+++++.<..>----.++.<..>-.-.<..>++.----.<..>++++.++++.<..>---.+.<..>.--.<..>+++.-----.<..>++++++.--------.<<.>...>+++++++++.<..>--------.+++++++.<..>------.+++++.<..>----.+++.<..>--.+.<..>.-.<..>++.---.<..>++++.-----.<..>++++++.-------.<..>++++++++.---------.<<.>..>+.-.<..>++.--.<..>+++.---.<..>++++.----.<..>+++++.-----.<..>++++++.------.<..>+++++++.-------.<..>++++++++.--------.<..>+++++++++.---------.<.>+.-..
Citace od: andy kdy 20. 12. 2016, 01:03:05Citace od: gll kdy 20. 12. 2016, 00:53:30Tak tohle je drsné. To bych nechtěl po někom zdědit. Perl 6 dokáže být stručnější a současně čitelnější bez použití složitých konceptů.No vždyť jsem to taky musel dát do toho generátoru point-free syntaxe, sám bych to nevyrobil... normálně to vypadá takhle:Kód [Vybrat] RozbalitmapM_ putStrLn $ map (concatMap (printf "%4d")) [ map (*x) [1..10] | x <- [1..10 :: Int]]A to už je v pohodě čitelné
[ map (*x) [1..10] | x <- [1..10 :: Int]]
Citace od: Tuxik kdy 20. 12. 2016, 10:44:30ale nevynikla ta krása
Citace od: Tuxik kdy 19. 12. 2016, 06:40:15No tak si to užijte v céčku, když jinak nedáte...Kód [Vybrat] Rozbalit#include <stdio.h>#include <string.h>#define XSIZE 10#define YSIZE 10int main() { int number, x, y, max_len, cur_len, spaces; char number_str[10]; snprintf (number_str, 10, "%d", XSIZE*YSIZE); max_len = strlen(number_str); for (y=1; y<=YSIZE; y++) { for (x=1; x<=XSIZE; x++) { number = x*y; snprintf (number_str, 10, "%d", number); cur_len = strlen(number_str); for (spaces=cur_len; spaces<=max_len; spaces++) printf ("%s", " "); printf ("%s", number_str); } printf ("%s", "\n"); }}
#include <stdio.h>#include <string.h>#define XSIZE 10#define YSIZE 10int main() { int number, x, y, max_len, cur_len, spaces; char number_str[10]; snprintf (number_str, 10, "%d", XSIZE*YSIZE); max_len = strlen(number_str); for (y=1; y<=YSIZE; y++) { for (x=1; x<=XSIZE; x++) { number = x*y; snprintf (number_str, 10, "%d", number); cur_len = strlen(number_str); for (spaces=cur_len; spaces<=max_len; spaces++) printf ("%s", " "); printf ("%s", number_str); } printf ("%s", "\n"); }}
Citace od: andy kdy 19. 12. 2016, 02:17:04Trošku mi to připomíná https://wiki.haskell.org/The_Fibonacci_sequence
@fib = 0, 1, *+* ... *;