Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.42 KB | None | 0 0
  1. [language name] was made in [year made]!
  2.  
  3. Python was made in 1991!
  4.  
  5. N
  6.  
  7. N N
  8. NNN
  9. N N
  10.  
  11. N N
  12. NN N
  13. N N N
  14. N NN
  15. N N
  16.  
  17. N N
  18. NN N
  19. N N N
  20. N N N
  21. N N N
  22. N NN
  23. N N
  24.  
  25. upvotes - downvotes + (2015 - languageYear) / 2
  26.  
  27. #[year] - [language name]
  28.  
  29. #1991 - Python
  30.  
  31. #1991 - [Python](https://www.python.org/)
  32.  
  33. console dose loge with "Dogescript was made in 2013!"
  34.  
  35. such N much N
  36. much i as 0 next i smaller N next i more 1
  37. very doge is ("N" + " ".repeat(N-2) + "N").split('')
  38. s[i] is "N";
  39. console dose loge with doge.join('')
  40. wow
  41. wow
  42.  
  43. such gcd_doge much doge, dooge
  44. rly dooge
  45. gcd_doge(dooge, doge % dooge)
  46. but
  47. rly doge smaller 0
  48. -doge
  49. but
  50. doge
  51. wow
  52. wow
  53.  
  54. <empty>
  55. Retina was made in 2015!
  56.  
  57. ;`^
  58. #
  59. ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
  60. $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
  61. ;`#
  62. <empty>
  63. ;`d
  64. N
  65. ;`.(?<=(?=(.*n)).*)|n
  66. $1
  67. ;`N(?=Nn.*n.*n`$)
  68. <space>
  69. ;+`N(?=.?(.)+n.* (?<-1>.)+(?(1)!)n)
  70. <space>
  71. ;`(?<=^.*n.*nN)N
  72. S
  73. ;+`(?<=n(?(1)!)(?<-1>.)+S.*n(.)+N?)N
  74. S
  75. S
  76. <space>
  77.  
  78. ;`b(?=d)
  79. #
  80. ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
  81. $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
  82. ;`#
  83. <empty>
  84. ;`d
  85. 1
  86. ;`^(.+)1* 1+$
  87. $1
  88. ;`$
  89. #:0123456789
  90. ;+`^(?=1)(1*)1{9}(#(?=.*(0))|1#(?=.*(?<3>1))|11#(?=.*(?<3>2))|111#(?=.*(?<3>3))|1111#(?=.*(?<3>4))|11111#(?=.*(?<3>5))|111111#(?=.*(?<3>6))|1111111#(?=.*(?<3>7))|11111111#(?=.*(?<3>8))|111111111#(?=.*(?<3>9)))
  91. $1#$3
  92. #|:.*
  93. <empty>
  94.  
  95. ;`^
  96. #
  97.  
  98. ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
  99. $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
  100.  
  101. #127
  102. 1#27
  103. 111111111122#7
  104. 1111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111227777777#
  105.  
  106. ;`#
  107. <empty>
  108. ;`d
  109. N
  110.  
  111. NNNNNNN
  112.  
  113. ;`.(?<=(?=(.*n)).*)|n
  114. $1
  115.  
  116. NNNNNNN
  117. NNNNNNN
  118. NNNNNNN
  119. NNNNNNN
  120. NNNNNNN
  121. NNNNNNN
  122. NNNNNNN
  123.  
  124. ;`N(?=Nn.*n.*n`$)
  125. <space>
  126.  
  127. NNNNNNN
  128. NNNNNNN
  129. NNNNNNN
  130. NNNNNNN
  131. NNNNN N
  132. NNNNNNN
  133. NNNNNNN
  134.  
  135. ;+`N(?=.?(.)+n.* (?<-1>.)+(?(1)!)n)
  136. <space>
  137.  
  138. N N
  139. NN N
  140. NNN N
  141. NNNN N
  142. NNNNN N
  143. NNNNNNN
  144. NNNNNNN
  145.  
  146. ;`(?<=^.*n.*nN)N
  147. S
  148.  
  149. N N
  150. NN N
  151. NSN N
  152. NNNN N
  153. NNNNN N
  154. NNNNNNN
  155. NNNNNNN
  156.  
  157. ;+`(?<=n(?(1)!)(?<-1>.)+S.*n(.)+N?)N
  158. S
  159.  
  160. N N
  161. NN N
  162. NSN N
  163. NSSN N
  164. NSSSN N
  165. NSSSSNN
  166. NSSSSSN
  167.  
  168. S
  169. <space>
  170.  
  171. N N
  172. NN N
  173. N N N
  174. N N N
  175. N N N
  176. N NN
  177. N N
  178.  
  179. ;`b(?=d)
  180. #
  181. ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
  182. $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
  183. ;`#
  184. <empty>
  185. ;`d
  186. 1
  187.  
  188. 111111111111111111 111111111111111111111111
  189.  
  190. ;`^(.+)1* 1+$
  191. $1
  192.  
  193. ;`$
  194. #:0123456789
  195.  
  196. ;+`^(?=1)(1*)1{9}(#(?=.*(0))|1#(?=.*(?<3>1))|11#(?=.*(?<3>2))|111#(?=.*(?<3>3))|1111#(?=.*(?<3>4))|11111#(?=.*(?<3>5))|111111#(?=.*(?<3>6))|1111111#(?=.*(?<3>7))|11111111#(?=.*(?<3>8))|111111111#(?=.*(?<3>9)))
  197. $1#$3
  198.  
  199. #|:.*
  200. <empty>
  201.  
  202. "!9002 ni edam saw ><>"l?!;obb+0.
  203.  
  204. &0 > :&:&:*=?; :&:&% :0=?v :&:&1-=?v :{:{-&:&,{=?v " " o
  205.  
  206. > ~"N"o v
  207. + > ~"N"oao v
  208. 1 >"N"o v
  209.  
  210. < /
  211.  
  212. py -3 fish.py ascii.fish -v 5
  213.  
  214. :&:&:*=?; If i == n*n, halt. Otherwise ...
  215. :&:&% Push i%n
  216. :0=?v If i%n == 0 ...
  217. >~"N"o Print "N"
  218. :&:&1-=?v Else if i%n == n-1 ...
  219. >~"N"oao Print "N" and a newline
  220. :{:{-&:&,{=?v Else if i%n == i//n, where // is integer division...
  221. >~"N"o Print "N"
  222. " "o Otherwise, print a space
  223. 1+ Increment i
  224.  
  225. >:{:}%
  226. ;n{v?:/
  227. v~@/
  228.  
  229. py -3 fish.py gcd.fish -v 111 87
  230.  
  231. <~@v!?:%}:{:
  232. ;n{/
  233.  
  234. /Courier findfont
  235. 12 scalefont
  236. setfont
  237. newpath
  238.  
  239. 100 370 moveto
  240. (PostScript was made in 1982!n) show
  241.  
  242. /asciiartN {% stack: N row col
  243. % output: draws an "ASCII art" N
  244.  
  245. % PostScript doesn't allow you to pass variables directly into a function;
  246. % instead, you have to pass variables via the global stack. Pop the variables
  247. % off the stack and define them locally.
  248. 6 dict begin
  249. /row exch def
  250. /col exch def
  251. /N exch def
  252.  
  253. % Define how much space will be between each individual "N"
  254. /spacing 15 def
  255.  
  256. % Get the width of the "N". We need this to know where to draw the right-hand
  257. % vertical
  258. /endcol col spacing N 1 sub mul add def
  259.  
  260. % One row is drawn at a time, with the bottom row drawn first, and working
  261. % upwards. This stack variable tracks which column the diagonal is in, and so
  262. % we start on the right and work leftward
  263. /diagcol endcol def
  264.  
  265. % Repeat N times: draw one row at a time
  266. N {
  267. % Left-hand vertical of the "N"
  268. col row moveto
  269. (N) show
  270.  
  271. % Right-hand vertical of the "N"
  272. endcol row moveto
  273. (N) show
  274.  
  275. % Diagonal bar of the "N"
  276. diagcol row moveto
  277. (N) show
  278.  
  279. % Advance to the next row. This means moving the row one space up, and the
  280. % diagonal position one place to the left.
  281. /row row spacing add def
  282. /diagcol diagcol spacing sub def
  283.  
  284. } repeat
  285.  
  286. end
  287. } def
  288.  
  289. 1 100 200 asciiartN
  290. 3 150 200 asciiartN
  291. 5 230 200 asciiartN
  292.  
  293. /modulo {% stack: x y
  294. % output: returns (x mod y)
  295. 3 dict begin
  296. /y exch def
  297. /x exch def
  298.  
  299. % If x = y then (x mod y) == 0
  300. x y eq {0} {
  301.  
  302. % If x < y then (x mod y) == x
  303. x y lt {x} {
  304.  
  305. % If x > y then subtract floor(x/y) * y from x
  306. /ycount x y div truncate def
  307. /x x ycount y mul sub def
  308.  
  309. /x x cvi def
  310. x
  311.  
  312. } ifelse
  313. } ifelse
  314. } def
  315.  
  316. /gcd {% stack: a b
  317. % returns the gcd of a and b
  318. 2 dict begin
  319. /b exch def
  320. /a exch def
  321.  
  322. % I'm using the recursive version of the Euclidean algorithm
  323.  
  324. % If b = 0 then return a
  325. b 0 eq {a} {
  326.  
  327. % Otherwise return gcd(b, a mod b)
  328. /a a b modulo def
  329. b a gcd
  330. } ifelse
  331.  
  332. } def
  333.  
  334. /displaygcd {% stack: a b xcoord ycoord
  335. % displays gcd(a,b) at position (xcoord, ycoord)
  336. 5 dict begin
  337. /ycoord exch def
  338. /xcoord exch def
  339. /b exch def
  340. /a exch def
  341. /result a b gcd def
  342.  
  343. xcoord ycoord moveto
  344. result 20 string cvs show
  345.  
  346. % end
  347. } def
  348.  
  349. 8 12 100 80 displaygcd
  350. 12 8 150 80 displaygcd
  351. 3 30 200 80 displaygcd
  352. 5689 2 250 80 displaygcd
  353. 234 876 300 80 displaygcd
  354.  
  355. modulo(x, y)
  356. if (x = y) return 0
  357. elif (x < y) return x
  358. else return module(x - y, y)
  359.  
  360. OP the operator. Each operator is a single character
  361. STACK tells what stacks are affected and how many are popped or pushed
  362. "o" stands for "other effect"
  363. HASH tells if it involves the hash
  364. x & y represent two values that are already on the stack, so the effect of
  365. the operator can be more easily described
  366.  
  367. OP STACK HASH DESCRIPTION
  368. text ->m --whenever a bare word appears, it pushes that string onto
  369. the main stack
  370. _ o->m --inputs a word and pushes onto main stack
  371. ` m->o --output. pops from main stack and prints
  372. xy; mm-> yes --variable assignment. the top stack element y is assigned
  373. the value x
  374. ~ m->m yes --variable retrieval. pops from main stack, pushes contents
  375. of the element with that name
  376. x? m->c --test. pops x and pushes 0 onto control stack if x is '0' or
  377. an empty string, else pushes 1
  378. ><= m->c --comparison. pops two numbers off of stack and performs
  379. test, pushes 1 onto control stack if true and 0 if false
  380. ' m->c --pops from main stack and pushes onto control stack
  381. " c->m --pops from control stack and pushes onto main stack
  382. &| cc->c --AND/OR. pops two items from control stack, performs and/or
  383. respectively, and pushes result back onto control stack
  384. ! c->c --NOT. pops a number off of control stack, pushes 1 if 0 or
  385. empty string, 0 otherwise
  386. [] c --FOR statement (view the top number number from control stack
  387. and eval those many times)
  388. {} c --WHILE (loop until top number on control stack is 0, also
  389. does not pop)
  390. # m-> --discard. pops from main stack and destroys
  391. ( m->mm --pops from main stack, removes first character, pushes the
  392. remaining string onto stack, and pushes the removed character
  393. onto stack
  394. ) m->mm --pops from main stack, removes last character, pushes the
  395. remaining string onto stack, and pushes the removed character
  396. onto stack
  397. +-*/%^ mm->m --arithmetic. pops two most recent items, adds/negates
  398. /multiplies/divides/modulates/exponentiates them, and places
  399. the result on the stack
  400. xy@ mm->o --move. pops x and y and moves xth thing in stack to move to
  401. place y in stack
  402. x$ m->m --length. pops x and pushs length of x onto the stack
  403. xy: mm->o --duplication. pops x and y and pushes x onto the stack y times
  404. xy. mm->m --concatination. pops x and y and pushes x concatonated with y
  405. o --escapes out of next character, so it isn't an operator and can
  406. be pushed onto the stack
  407. , m->mm --character conversion. pops from main stack, coverts it to char
  408. and pushes, and converts to num and pushes
  409. Newlines and spaces separate different elements to be pushed
  410. onto the stack individually, but can pushed onto the stack using
  411.  
  412. Element was made in 2012!`
  413.  
  414. _+'[y~1+y;0[1+4:"2:'=1=|y~=| [#N]`"#]
  415. `]
  416.  
  417. _+'[y~1+y;0[1+4:"2:'=1=|y~=|S[#N]`"#]L`]
  418. _+' input line, convert to #, move to c-stack
  419. [ FOR loop
  420. y~1+y; increment the y-pos
  421. 0 set the x-pos (the top # on the stack) to zero
  422. [ FOR loop
  423. 1+4: increment x-pos and make 3 additional copies (4 is total #)
  424. "2:' make a copy of the N size on the main stack
  425. = if x-pos == size
  426. 1= or if x-pos == 1
  427. y~=| of if x-pos == y-pos
  428. S (always) push a space
  429. [ the IF body (technically a FOR loop)
  430. #N if true, remove the space and push an N
  431. ] end IF
  432. ` output the pushed character
  433. "# remove the result of the conditional
  434. ] end x-pos FOR
  435. L` output a newline
  436. ] end y-pos FOR
  437.  
  438. _'1[y~+y;[#1+3:"2:'%2<y~=| [#N]`"]
  439. `]
  440.  
  441. __'{"3:~2@%'}`
  442.  
  443. __ input the two numbers
  444. ' use one of the number as a condition so the WHILE loop starts
  445. { } a WHILE loop. Repeats while the c-stack has a true value on top
  446. " get the number back from the c-stack to do operations on it
  447. 3: make it so that there are threes copies on the stack
  448. ~ takes one of the copies from earlier and converts it to a zero
  449. 2@ take the top item on the stack and move it behind the other two #s
  450. % modulo operation
  451. ' use this number as the condition
  452. ` since one number is zero (and on the c-stack) print the
  453. other number, which is on m-stack
  454.  
  455. Print["Mathematica was made in 1988!"]
  456.  
  457. "Mathematica was made in 1988!"
  458.  
  459. asciiArtN[n_] := Print @@@ SparseArray[{i_, 1 | i_ | n} -> "N", {n, n}, " "]
  460.  
  461. asciiArtN[n_] := Block[{f},
  462. f[i_, 1] = "N";
  463. f[i_, i_] = "N";
  464. f[i_, n] = "N";
  465. f[__] = " ";
  466. Apply[Print, Array[f, {n, n}], 1];
  467. ]
  468.  
  469. gcd = GCD
  470.  
  471. gcd = Max[Intersection @@ Divisors[{##}]] &;
  472.  
  473. gcd = Times[##]/LCM[##] &;
  474.  
  475. gcd[a_, 0] := a
  476. gcd[a_, b_] := gcd[b, Mod[a, b]]
  477.  
  478. gcd = If[#2 == 0, #1, #0[#2, Mod[##]]] &;
  479.  
  480. "CJam was made in 2014!"
  481.  
  482. ri:R'#*a_R2-,{_)S*'#+R((-zS*+}%++R<zN*
  483.  
  484. ri:R "Read the input as integer in R";
  485. '#*a "Get a string of R # and wrap it in an array";
  486. _R2-,{ }% "Copy that string and then run this loop R-2";
  487. "times for the diagonal";
  488. _)S* "Get iteration index + 1 spaces";
  489. '#+ "Append the hash";
  490. R((-zS*+ "Append remaining spaces";
  491. ++ "Append and prepend the initial # string";
  492. R< "Take only R columns/rows. This is for";
  493. "tackling input 1";
  494. zN* "Transpose and join with new lines";
  495.  
  496. l~{_@%}h;
  497.  
  498. print_endline "OCaml was made in 1996!";;
  499.  
  500. let ascii n =
  501. let rec ascii' = function
  502. | 0 -> ()
  503. | i ->
  504. let s = "N" ^ String.make (n-2) ' ' ^ "N" in
  505. String.fill s (n-i) 1 'N';
  506. print_endline s;
  507. ascii' (i-1)
  508. in ascii' n;;
  509.  
  510. let rec gcd a b = if b = 0 then a else gcd b (a mod b);;
  511.  
  512. 0-9 ... Push the corresponding digit.
  513. + ... Add the top two numbers on the stack.
  514. - ... Subtract the top number from the one beneath.
  515. # ... Discard the top of the stack.
  516. ^ ... Copy the top value from the voice above.
  517. v ... Copy the top value from the voice below.
  518. ? ... Read a number and push it onto the stack.
  519. ! ... Print the top number (and pop it from the stack).
  520. ( ... If the top of the stack is zero, jump past the matching ')'.
  521. ) ... If the top of the stack is zero, jump to the column after the matching '('.
  522.  
  523. 9(1-)v98+^++!9v+! v88++2+!^ ! ^9-3-! v ! v2-!55+!
  524. 8 8+ ! 7v+! 1v+!88+^+!^4-!^ v8-^ !!!9v+ !^9+9+! v5+!
  525. ^98++4+! ^8-! ^4- ^ #!^6-! ^^ #5+! v ^2-!1+!
  526.  
  527. v2-(1-)v
  528. 9(1-)?1-( v! (1-55+! 0 (0)# ))55+!
  529. 4-4+ v^-#
  530. v! v! v1-v!(1- ^(#^!0)# v! )v!
  531. 6 8+ v#
  532.  
  533. NUMERIC_INPUT = True
  534. NUMERIC_OUTPUT = False
  535.  
  536. ?( v)
  537. ? (^-(0 # v # ^+0)#^ !
  538. ^^ (##v^v+)# 0 (0 )
  539. 1) ^ # - 1+(#)#
  540.  
  541. NUMERIC_INPUT = True
  542. NUMERIC_OUTPUT = True
  543.  
  544. 9(1-)
  545. 8 8+
  546.  
  547. 9(1-)v98+^++r9v+u v88++2+w^ _ ^9-3-a v _ v2-%55+!
  548. 8 8+ P 7v+l 1v+e88+^+_^4-s^ v8-^ de_9v+ n^9+9+% v5+%
  549. ^98++4+e ^8-d ^4- ^ #a^6-m ^^ #5+i v ^2-%1+!
  550.  
  551. v2-(1-)v
  552. 9(1-)?1-( v! (1-55+! 0 (0)# ))55+!
  553. 4-4+ v^-#
  554. v! v! v1-v!(1- ^(#^!0)# v! )v!
  555. 6 8+ v#
  556.  
  557. 9(1-)
  558. 4-4+
  559.  
  560. 6 8+
  561.  
  562. v2-
  563. ?1-
  564.  
  565. v!
  566.  
  567. v2-
  568. 9(1-)?1-( )55+!
  569. 4-4+
  570. v!
  571. 6 8+
  572.  
  573. (1-)v
  574. v!
  575.  
  576. v!
  577.  
  578. 1-55+!
  579.  
  580. v1-v!( )v!
  581. v#
  582.  
  583. 0 (0)#
  584. v^-#
  585. 1- ^(#^!0)# v!
  586.  
  587. ?( v)
  588. ? (^-(0 # v # ^+0)#^ !
  589. ^^ (##v^v+)# 0 (0 )
  590. 1) ^ # - 1+(#)#
  591.  
  592. (0 # v #
  593. ^^ (##v^v+)#
  594. 1) ^ # -
  595.  
  596. (^- signum ^+0)#
  597. signum 0 (0 )
  598. signum 1+(#)#
  599.  
  600. DO ,1 <- #27
  601. DO ,1SUB#1 <- #110
  602. DO ,1SUB#2 <- #32
  603. DO ,1SUB#3 <- #72
  604. PLEASE DO ,1SUB#4 <- #136
  605. DO ,1SUB#5 <- #88
  606. DO ,1SUB#6 <- #136
  607. PLEASE DO ,1SUB#7 <- #64
  608. DO ,1SUB#8 <- #80
  609. DO ,1SUB#9 <- #46
  610. PLEASE DO ,1SUB#10 <- #22
  611. DO ,1SUB#11 <- #104
  612. DO ,1SUB#12 <- #184
  613. PLEASE DO ,1SUB#13 <- #202
  614. DO ,1SUB#14 <- #78
  615. DO ,1SUB#15 <- #48
  616. PLEASE DO ,1SUB#16 <- #96
  617. DO ,1SUB#17 <- #128
  618. DO ,1SUB#18 <- #162
  619. PLEASE DO ,1SUB#19 <- #110
  620. DO ,1SUB#20 <- #32
  621. DO ,1SUB#21 <- #114
  622. PLEASE DO ,1SUB#22 <- #120
  623. DO ,1SUB#23 <- #240
  624. DO ,1SUB#24 <- #128
  625. PLEASE DO ,1SUB#25 <- #208
  626. DO ,1SUB#26 <- #200
  627. DO ,1SUB#27 <- #52
  628. DO READ OUT ,1
  629. DO GIVE UP
  630.  
  631. DO WRITE IN 7
  632. DO .1 <- .7
  633. DO .2 <- #1
  634. PLEASE DO (1010) NEXT
  635. DO .8 <- .3
  636. DO .5 <- .7
  637. DO .6 <- .8
  638. DO ,9 <- #2
  639.  
  640. DO (100) NEXT
  641. DO (1) NEXT
  642.  
  643. (100) DO (99) NEXT
  644. DO ,9SUB#1 <- #142
  645. DO ,9SUB#2 <- #114
  646. PLEASE DO READ OUT ,9
  647. DO ,9SUB#1 <- #176
  648. DO ,9SUB#2 <- #80
  649. PLEASE DO READ OUT ,9
  650. PLEASE GIVE UP
  651.  
  652. (99) DO .1 <- .7
  653. DO .2 <- #1
  654. PLEASE DO (1010) NEXT
  655. DO .1 <- '.3~.3'~#1
  656. PLEASE DO FORGET .1
  657. DO RESUME #1
  658.  
  659. (1) PLEASE DO (3) NEXT
  660. PLEASE DO FORGET #1
  661. DO (1) NEXT
  662.  
  663. (3) DO (4) NEXT
  664. PLEASE GIVE UP
  665.  
  666. (4) DO (8) NEXT
  667. DO ,9SUB#1 <- #176
  668. DO ,9SUB#2 <- #80
  669. PLEASE DO READ OUT ,9
  670. DO .6 <- .8
  671. DO .1 <- .5
  672. DO .2 <- #1
  673. DO (1010) NEXT
  674. DO .5 <- .3
  675. DO .1 <- '.5~.5'~#1
  676. PLEASE DO FORGET .1
  677. DO RESUME #1
  678.  
  679. (8) DO (5) NEXT
  680.  
  681. (5) PLEASE DO (6) NEXT
  682. PLEASE DO FORGET #1
  683. DO (5) NEXT
  684.  
  685. (6) PLEASE DO (7) NEXT
  686. DO RESUME #2
  687.  
  688. (7) DO (10) NEXT
  689. DO .1 <- .6
  690. DO .2 <- #1
  691. PLEASE DO (1010) NEXT
  692. DO .6 <- .3
  693. DO .1 <- '.6~.6'~#1
  694. PLEASE DO FORGET .1
  695. DO RESUME #1
  696.  
  697. (10) DO (11) NEXT
  698. DO (13) NEXT
  699. DO (14) NEXT
  700. DO (15) NEXT
  701.  
  702. (11) DO (111) NEXT
  703. DO (112) NEXT
  704.  
  705. (13) DO (113) NEXT
  706. DO (112) NEXT
  707.  
  708. (14) DO (114) NEXT
  709. DO (112) NEXT
  710.  
  711. (111) DO .1 <- .6
  712. DO .2 <- .8
  713. DO (1010) NEXT
  714. DO .1 <- '.3~.3'~#1
  715. PLEASE DO FORGET .1
  716. DO RESUME #1
  717.  
  718. (112) DO ,9SUB#1 <- #142
  719. DO ,9SUB#2 <- #114
  720. PLEASE DO READ OUT ,9
  721. DO RESUME #3
  722.  
  723. (113) DO .1 <- .6
  724. DO .2 <- #1
  725. DO (1000) NEXT
  726. DO .1 <- .5
  727. DO .2 <- .3
  728. DO (1010) NEXT
  729. DO .1 <- '.3~.3'~#1
  730. PLEASE DO FORGET .1
  731. DO RESUME #1
  732.  
  733. (114) DO .1 <- '.6~.6'~#1
  734. PLEASE DO FORGET .1
  735. DO RESUME #1
  736.  
  737. (15) DO ,9SUB#1 <- #252
  738. DO ,9SUB#2 <- #4
  739. PLEASE DO READ OUT ,9
  740. DO RESUME #2
  741.  
  742. DO WRITE IN .5
  743. DO WRITE IN .6
  744.  
  745. DO (1) NEXT
  746.  
  747. (1) PLEASE DO (3) NEXT
  748. DO FORGET #1
  749. DO (1) NEXT
  750.  
  751. (3) DO (4) NEXT
  752. DO READ OUT .5
  753. PLEASE GIVE UP
  754.  
  755. (4) DO .1 <- .5
  756. DO .2 <- .6
  757. PLEASE DO (1040) NEXT
  758. DO .1 <- .3
  759. DO .2 <- .6
  760. PLEASE DO (1039) NEXT
  761. DO .2 <- .3
  762. DO .1 <- .5
  763. DO (1010) NEXT
  764. DO .5 <- .6
  765. DO .6 <- .3
  766. DO .1 <- '.6~.6'~#1
  767. PLEASE DO FORGET .1
  768. DO RESUME #1
  769.  
  770. THREE FIVE
  771.  
  772. FOUR TWO
  773. ONE SIX
  774.  
  775. "Pyth was made in 2014!
  776.  
  777. VQ+Nt+P++*NdN*t-QNdN
  778.  
  779. Q = eval(input()) #
  780. for N in range(Q): # VQ
  781. print( ) #
  782. "N"+ # +N
  783. ( )[1:] # t
  784. +"N" # + N
  785. ( )[:-1] # P
  786. +(Q-N-1)*" " # + *t-QNd
  787. +"N" # + N
  788. " "*N # *Nd
  789.  
  790. =GvwWQAGQ,Q%GQ)G
  791.  
  792. Q = eval(input()) #
  793. G = eval(input()) # =Gvw
  794. while Q != 0: # WQ
  795. G, Q = Q, G % Q # AGQ,Q%GQ)
  796. print(G) # G
  797.  
  798. module Main
  799.  
  800. main : IO ()
  801. main = putStrLn "Idris was made in 2009!"
  802.  
  803. module InN
  804.  
  805. import Data.Fin
  806. import Data.Vect
  807.  
  808. genN : Vect n (Vect n Char)
  809. genN = [[ if inN x y then 'N' else ' ' | x<-range ]| y<-range ]
  810.  
  811. ||| Helper function, determines whether the char at coordinate (x,y)
  812. ||| is part of the letter:
  813. inN : Fin n -> Fin n -> Bool
  814. inN {n=S _} x y = x==0 || x==y || x==last
  815.  
  816. $ idris ascii-n.idr
  817. ____ __ _
  818. / _/___/ /____(_)____
  819. / // __ / ___/ / ___/ Version 0.9.17.1-
  820. _/ // /_/ / / / (__ ) http://www.idris-lang.org/
  821. /___/__,_/_/ /_/____/ Type :? for help
  822.  
  823. Idris is free software with ABSOLUTELY NO WARRANTY.
  824. For details type :warranty.
  825. Type checking ./ascii-n.idr
  826. *ascii-n> genN {n=4}
  827. [['N', ' ', ' ', 'N'],
  828. ['N', 'N', ' ', 'N'],
  829. ['N', ' ', 'N', 'N'],
  830. ['N', ' ', ' ', 'N']] : Vect 4 (Vect 4 Char)
  831.  
  832. module gcd
  833.  
  834. gcd' : Nat -> Nat -> Nat
  835. gcd' a Z = a
  836. gcd' a b = gcd' b $ a`mod`b
  837.  
  838. Type checking ./gcd.idr
  839. *gcd> gcd' 8 12
  840. 4 : Nat
  841. *gcd> gcd' 12 8
  842. 4 : Nat
  843. *gcd> gcd' 234 876
  844. 6 : Nat
  845.  
  846. ⎕←'APL WAS MADE IN 1967!'
  847.  
  848. L[Kapl was made in 1967ÝK
  849.  
  850. ⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]
  851.  
  852. L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'
  853.  
  854. ∇R←A GCD B
  855. R←A
  856. →(B=0)/0
  857. R←B GCD B|A
  858.  
  859. ⎕←⎕ GCD ⎕
  860.  
  861. Gr[a gcd b
  862. r[a
  863. {:b%0"/0
  864. r[b gcd bMa
  865. G
  866.  
  867. L[L gcd L
  868.  
  869. 'WTFZOMFG was made in 2010!n"
  870.  
  871. /&(-.N%3 >&>s-{-(-. ).N}>{-(-. ).N}_0 'n")
  872.  
  873. / # read the number and store it in cell 0
  874. & # copy it to cell 1
  875. ( # loop while cell 0 isn't 0
  876. - # decrease the value of cell 0
  877. .N # print "N"
  878. %3 # copy cell 0 to cell 3
  879. # a space must be added after the number. I don't know if it's a bug of the compiler or a feature.
  880. > # move to cell 1
  881. & # copy cell 1 to cell 2
  882. > # move cell 2
  883. s # let cell 2 = cell 2 - cell 3
  884. - # decrease the value of cell 2
  885. { # if cell 2 isn't 0
  886. - # decrease the value of cell 2
  887. (-. ) # while cell 2 isn't 0, decrease it and print " "
  888. .N # print "N"
  889. } # end if
  890. > # move cell 3
  891. { # if cell 3 isn't 0
  892. - # decrease the value of cell 3
  893. (-. ) # while cell 3 isn't 0, decrease it and print " "
  894. .N # print "N"
  895. } # end if
  896. _0 # move to cell 0
  897. 'n" # print a newline
  898. ) #
  899.  
  900. />>/(<<&>dm<s&>>%0 <&>)<<
  901.  
  902. Task1(name:string,year:number) {
  903. return name + " was made in "+ year +"!";
  904. }
  905.  
  906. Task2(n:number,separator:string,space:string) {
  907. var result:string = "";
  908. for (var k = 0; k < n; k++)
  909. {
  910. for (var j = 0; j < n; j++)
  911. {
  912. var i = ((n * k) + j) % n;
  913. result+=(i == 0 || i == n - 1 || i == k) ? "N" : space;
  914. }
  915. result+=separator;
  916. }
  917. return result;
  918. }
  919.  
  920. Task3(a:number,b:number) {
  921. while (a != 0 && b != 0)
  922. {
  923. if (a > b)
  924. a %= b;
  925. else
  926. b %= a;
  927. }
  928.  
  929. if (a == 0)
  930. return b;
  931. else
  932. return a;
  933. }
  934.  
  935. main() {
  936. print('Dart was made in 2011!');
  937. }
  938.  
  939. asciiN(int number){
  940. if(number == 1){
  941. print('N');
  942. }else{
  943. for(var i = 1; i <= number; i++){
  944. String currentLine = "";
  945. for(var j = 1; j <= number; j++){
  946. if(j==1 || j == number || j == i){
  947. currentLine = currentLine + "N";
  948. }else{
  949. currentLine = currentLine + " ";
  950. }
  951. }
  952. print(currentLine);
  953. }
  954. }
  955. }
  956.  
  957. int gcd(int first, int second){
  958. if(second > first){
  959. return gcd(second, first);
  960. }else{
  961. if(first == 0){
  962. return second;
  963. }else{
  964. if(second ==0){
  965. return first;
  966. }else{
  967. return gcd(second, first-second);
  968. }
  969. }
  970. }
  971. }
  972.  
  973. package main
  974. import "fmt"
  975.  
  976. func main(){
  977. fmt.Println("Go was made in 2009!")
  978. }
  979.  
  980. package main
  981.  
  982. import (
  983. "fmt"
  984. "strings"
  985. )
  986.  
  987. func main(){
  988. var n int
  989. fmt.Scan(&n)
  990.  
  991. for i := 0; i < n; i++ {
  992. a := make([]string, n, n)
  993. for j := 0; j < n; j++ { a[j] = " " }
  994.  
  995. a[0] = "N"
  996. a[i] = "N"
  997. a[n-1] = "N"
  998.  
  999. s := strings.Join(a, "")
  1000. fmt.Println(s)
  1001. }
  1002. }
  1003.  
  1004. package main
  1005.  
  1006. import "fmt"
  1007.  
  1008. func gcd(a, b int) int {
  1009. for b != 0 {
  1010. a, b = b, a%b
  1011. }
  1012. return a
  1013. }
  1014.  
  1015. func main(){
  1016. var a, b int
  1017. fmt.Scan(&a)
  1018. fmt.Scan(&b)
  1019.  
  1020. fmt.Println(gcd(a, b))
  1021. }
  1022.  
  1023. #(say "MuffinMC was born in 2015 out of necessity !")
  1024.  
  1025. =(ascii-art
  1026. '( =(* x #(2- $(_1))
  1027. I I( *($(x) " ") N)
  1028. foo '( #(. #(I $(x))) ))
  1029. #(say ?( #(== $(_1) 1) N "N#(map foo #(.. 1 $(_1)))N" ))
  1030. ))
  1031.  
  1032. =(f'(=(* x#(2-)I I(*($(x)" ")N)g'(#(.#(I$(x)))))#(say?(#(==$(_1)1)N"N#(map g#(..))N"))))
  1033.  
  1034. #(ascii-art 1)
  1035.  
  1036. N
  1037.  
  1038.  
  1039. #(ascii-art 3)
  1040.  
  1041. N N
  1042. NNN
  1043. N N
  1044.  
  1045.  
  1046. #(map '( #(ascii-art $(_1))) 5 7 9)
  1047.  
  1048. N N
  1049. NN N
  1050. N N N
  1051. N NN
  1052. N N
  1053.  
  1054. N N
  1055. NN N
  1056. N N N
  1057. N N N
  1058. N N N
  1059. N NN
  1060. N N
  1061.  
  1062. N N
  1063. NN N
  1064. N N N
  1065. N N N
  1066. N N N
  1067. N N N
  1068. N N N
  1069. N NN
  1070. N N
  1071.  
  1072. The 5 strings :
  1073. _ _ _
  1074. N _ _
  1075. _ N _
  1076. _ _ N
  1077. _ _ _
  1078.  
  1079. can be seen as resulting from splitting in groups of 3 characters
  1080. the following infinite sequence of 4 characters :
  1081.  
  1082.  
  1083. /---- < _ _ _ N > ----
  1084. | |
  1085. ---------------------/
  1086.  
  1087.  
  1088. which, once unfolded, yields the infinite ruban :
  1089.  
  1090. _ _ _ N _ _ _ N _ _ _ N _ _ _ N _ _ _ N _ _ _ N ...
  1091. ^ ^ ^ ^
  1092. _ _ _ | | | |
  1093. N _ _ | | |
  1094. _ N _ | |
  1095. _ _ N |
  1096. _ _ _
  1097.  
  1098. Commented script
  1099.  
  1100. =(ascii-art Define the 'ascii-art' variable to hold
  1101. the function's definition.
  1102. When called, its argument, the actual
  1103. value of n, will be bound to the system
  1104. variable _1, accessed as $( _1 ).
  1105.  
  1106. '( '(...) quote macro-command -- protects
  1107. its arguments, here the function
  1108. definition, from being evaluated.
  1109. We want to keep it literally for further evaluation.
  1110.  
  1111. =(* =(*...) // assignment macro-command.
  1112. Similar to the Lisp (let (...)...),
  1113. not the let* !
  1114.  
  1115. x #(2- $(_1)) Define the variable x to hold the value
  1116. n-2.
  1117.  
  1118. I I( Define I to be an iterator over the
  1119. the x+1 characters sequence :
  1120. *( $(x) " ") . x white-space characters
  1121. N . 1 'N' character (here the atom N)
  1122. )
  1123.  
  1124. foo '( Define the variable foo as a function
  1125. #(. to catenate ( #(. s1...) )
  1126. #(I $(x)) the iterator's next x elements.
  1127. )
  1128. )
  1129. ) End of =(*...
  1130.  
  1131. #(say Print each element of:
  1132. ?( If
  1133. #(== $(_1) 1) n equals 1
  1134. N the atom N,
  1135. "N#(map foo #(.. 1 $(_1)))N" else the n strings as a string-product
  1136. resulting from foo-computing the
  1137. ) n middle-strings.
  1138. )
  1139. ))
  1140.  
  1141. =(gcd '( ?( #(== $(_2) 0)
  1142. $(_1)
  1143. #(self $(_2) #(mod $(_1) $(_2)))) ))
  1144.  
  1145. =(g'(?(#(z$(_2))$(_1)#(g$(_2)#(mod)))))
  1146.  
  1147. #(gcd 225 81)
  1148.  
  1149. println("Swift was made in 2014!")
  1150.  
  1151. func asciin(n:Int) -> String {
  1152. var r = 0;
  1153. return [Int](0..<n*n).reduce("", { msg, next in
  1154. switch next % n {
  1155. case 0, r: return msg + "N";
  1156. case n-1: r++; return msg + "Nn";
  1157. default: return msg + " ";
  1158. }
  1159. }
  1160. )}
  1161.  
  1162. func gcd(a:Int, b:Int) -> Int {
  1163. var g = (a, b);
  1164. while(g.1 > 0) {
  1165. g = (g.1, g.0 % g.1);
  1166. }
  1167. return g.0;
  1168. }
  1169.  
  1170. fn main()
  1171. {
  1172. println!("Rust was made in 2010!");
  1173. }
  1174.  
  1175. fn main()
  1176. {
  1177. // get commandline arguments
  1178. // "test 3"
  1179. let args : Vec<_> = std::env::args().collect();
  1180.  
  1181. // convert 2nd argument to integer
  1182. let n = u32::from_str_radix( args[1].as_ref(), 10 ).unwrap();
  1183. print_n( n );
  1184. }
  1185.  
  1186. fn print_n( n: u32 )
  1187. {
  1188. for y in range( 0, n )
  1189. {
  1190. for x in range( 0, n )
  1191. {
  1192. if x == 0 || x == y || x + 1 == n
  1193. {
  1194. print!("N");
  1195. }
  1196. else
  1197. {
  1198. print!(" ");
  1199. }
  1200. }
  1201. println!("");
  1202. }
  1203. }
  1204.  
  1205. if x == 0 || x == y || x + 1 == n
  1206.  
  1207. fn main()
  1208. {
  1209. // get commandline arguments
  1210. // "test 453 3"
  1211. let args : Vec<_> = std::env::args().collect();
  1212.  
  1213. // convert 2nd and 3rd argument to integers
  1214. let a = u32::from_str_radix( args[1].as_ref(), 10 ).unwrap();
  1215. let b = u32::from_str_radix( args[2].as_ref(), 10 ).unwrap();
  1216. let g = gcd( a, b );
  1217. println!( "GCD of {} and {} is {}", a, b, g );
  1218. }
  1219.  
  1220. fn gcd( mut a: u32, mut b: u32 ) -> u32
  1221. {
  1222. while b != 0
  1223. {
  1224. let c = a % b;
  1225. a = b;
  1226. b = c;
  1227. }
  1228. return a;
  1229. }
  1230.  
  1231. (println "Clojure was made in 2007!")
  1232.  
  1233. (defn ascii [n]
  1234. (doseq [i (range 0 n 1)]
  1235. (doseq [j (range 0 n 1)]
  1236. (printf (if (or (= i j) (= j 0) (= j (dec n))) "N" " "))
  1237. )
  1238. (printf "n")
  1239. )
  1240. )
  1241.  
  1242. (ascii (read))
  1243.  
  1244. (defn gcd [a b]
  1245. (if (zero? b) a (recur b (mod a b)))
  1246. )
  1247. (println (gcd (read) (read)))
  1248.  
  1249. 'IF' I 'LT' 0 'THEN' 'SKIP' 'FI'
  1250.  
  1251. .IF I .LT 0 .THEN .SKIP .FI
  1252.  
  1253. IF i < 0 THEN SKIP FI
  1254.  
  1255. print (("Algol 68 was made in 1968!", newline))
  1256.  
  1257.  
  1258. C:>a68g HelloWorld.a68
  1259. Algol 68 was made in 1968!
  1260.  
  1261. INT n;
  1262. read ((n));
  1263. FOR i FROM 1 TO n DO
  1264. FOR j FROM 1 TO n DO
  1265. CO here we use an abbreviated IF clause CO
  1266. print (( ( j = 1 OR j = i OR j = n |
  1267. "N"
  1268. |
  1269. " "
  1270. ) ))
  1271. OD ;
  1272. print ((newline))
  1273. OD
  1274.  
  1275. C:>a68g ASCIIart.a68
  1276. 8
  1277. N N
  1278. NN N
  1279. N N N
  1280. N N N
  1281. N N N
  1282. N N N
  1283. N NN
  1284. N N
  1285.  
  1286. COMMENT we can define our own operators in Algol 68 COMMENT
  1287. OP % = ( INT a, b) INT:
  1288. ((b = 0 |
  1289. a
  1290. |
  1291. b % (a MOD b)
  1292. ));
  1293. INT i,j;
  1294. read((i,j));
  1295. print(( i % j , newline))
  1296.  
  1297.  
  1298. C:>a68g GCD.a68
  1299. 4 12
  1300. +4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement