Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [language name] was made in [year made]!
- Python was made in 1991!
- N
- N N
- NNN
- N N
- N N
- NN N
- N N N
- N NN
- N N
- N N
- NN N
- N N N
- N N N
- N N N
- N NN
- N N
- upvotes - downvotes + (2015 - languageYear) / 2
- #[year] - [language name]
- #1991 - Python
- #1991 - [Python](https://www.python.org/)
- console dose loge with "Dogescript was made in 2013!"
- such N much N
- much i as 0 next i smaller N next i more 1
- very doge is ("N" + " ".repeat(N-2) + "N").split('')
- s[i] is "N";
- console dose loge with doge.join('')
- wow
- wow
- such gcd_doge much doge, dooge
- rly dooge
- gcd_doge(dooge, doge % dooge)
- but
- rly doge smaller 0
- -doge
- but
- doge
- wow
- wow
- <empty>
- Retina was made in 2015!
- ;`^
- #
- ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
- $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
- ;`#
- <empty>
- ;`d
- N
- ;`.(?<=(?=(.*n)).*)|n
- $1
- ;`N(?=Nn.*n.*n`$)
- <space>
- ;+`N(?=.?(.)+n.* (?<-1>.)+(?(1)!)n)
- <space>
- ;`(?<=^.*n.*nN)N
- S
- ;+`(?<=n(?(1)!)(?<-1>.)+S.*n(.)+N?)N
- S
- S
- <space>
- ;`b(?=d)
- #
- ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
- $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
- ;`#
- <empty>
- ;`d
- 1
- ;`^(.+)1* 1+$
- $1
- ;`$
- #:0123456789
- ;+`^(?=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)))
- $1#$3
- #|:.*
- <empty>
- ;`^
- #
- ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
- $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
- #127
- 1#27
- 111111111122#7
- 1111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111221111111111227777777#
- ;`#
- <empty>
- ;`d
- N
- NNNNNNN
- ;`.(?<=(?=(.*n)).*)|n
- $1
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNNNN
- ;`N(?=Nn.*n.*n`$)
- <space>
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNNNN
- NNNNN N
- NNNNNNN
- NNNNNNN
- ;+`N(?=.?(.)+n.* (?<-1>.)+(?(1)!)n)
- <space>
- N N
- NN N
- NNN N
- NNNN N
- NNNNN N
- NNNNNNN
- NNNNNNN
- ;`(?<=^.*n.*nN)N
- S
- N N
- NN N
- NSN N
- NNNN N
- NNNNN N
- NNNNNNN
- NNNNNNN
- ;+`(?<=n(?(1)!)(?<-1>.)+S.*n(.)+N?)N
- S
- N N
- NN N
- NSN N
- NSSN N
- NSSSN N
- NSSSSNN
- NSSSSSN
- S
- <space>
- N N
- NN N
- N N N
- N N N
- N N N
- N NN
- N N
- ;`b(?=d)
- #
- ;+`(d*)#(?:(((((((((9)|8)|7)|6)|5)|4)|3)|2)|1)|0)
- $1$1$1$1$1$1$1$1$1$1$2$3$4$5$6$7$8$9$10#
- ;`#
- <empty>
- ;`d
- 1
- 111111111111111111 111111111111111111111111
- ;`^(.+)1* 1+$
- $1
- ;`$
- #:0123456789
- ;+`^(?=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)))
- $1#$3
- #|:.*
- <empty>
- "!9002 ni edam saw ><>"l?!;obb+0.
- &0 > :&:&:*=?; :&:&% :0=?v :&:&1-=?v :{:{-&:&,{=?v " " o
- > ~"N"o v
- + > ~"N"oao v
- 1 >"N"o v
- < /
- py -3 fish.py ascii.fish -v 5
- :&:&:*=?; If i == n*n, halt. Otherwise ...
- :&:&% Push i%n
- :0=?v If i%n == 0 ...
- >~"N"o Print "N"
- :&:&1-=?v Else if i%n == n-1 ...
- >~"N"oao Print "N" and a newline
- :{:{-&:&,{=?v Else if i%n == i//n, where // is integer division...
- >~"N"o Print "N"
- " "o Otherwise, print a space
- 1+ Increment i
- >:{:}%
- ;n{v?:/
- v~@/
- py -3 fish.py gcd.fish -v 111 87
- <~@v!?:%}:{:
- ;n{/
- /Courier findfont
- 12 scalefont
- setfont
- newpath
- 100 370 moveto
- (PostScript was made in 1982!n) show
- /asciiartN {% stack: N row col
- % output: draws an "ASCII art" N
- % PostScript doesn't allow you to pass variables directly into a function;
- % instead, you have to pass variables via the global stack. Pop the variables
- % off the stack and define them locally.
- 6 dict begin
- /row exch def
- /col exch def
- /N exch def
- % Define how much space will be between each individual "N"
- /spacing 15 def
- % Get the width of the "N". We need this to know where to draw the right-hand
- % vertical
- /endcol col spacing N 1 sub mul add def
- % One row is drawn at a time, with the bottom row drawn first, and working
- % upwards. This stack variable tracks which column the diagonal is in, and so
- % we start on the right and work leftward
- /diagcol endcol def
- % Repeat N times: draw one row at a time
- N {
- % Left-hand vertical of the "N"
- col row moveto
- (N) show
- % Right-hand vertical of the "N"
- endcol row moveto
- (N) show
- % Diagonal bar of the "N"
- diagcol row moveto
- (N) show
- % Advance to the next row. This means moving the row one space up, and the
- % diagonal position one place to the left.
- /row row spacing add def
- /diagcol diagcol spacing sub def
- } repeat
- end
- } def
- 1 100 200 asciiartN
- 3 150 200 asciiartN
- 5 230 200 asciiartN
- /modulo {% stack: x y
- % output: returns (x mod y)
- 3 dict begin
- /y exch def
- /x exch def
- % If x = y then (x mod y) == 0
- x y eq {0} {
- % If x < y then (x mod y) == x
- x y lt {x} {
- % If x > y then subtract floor(x/y) * y from x
- /ycount x y div truncate def
- /x x ycount y mul sub def
- /x x cvi def
- x
- } ifelse
- } ifelse
- } def
- /gcd {% stack: a b
- % returns the gcd of a and b
- 2 dict begin
- /b exch def
- /a exch def
- % I'm using the recursive version of the Euclidean algorithm
- % If b = 0 then return a
- b 0 eq {a} {
- % Otherwise return gcd(b, a mod b)
- /a a b modulo def
- b a gcd
- } ifelse
- } def
- /displaygcd {% stack: a b xcoord ycoord
- % displays gcd(a,b) at position (xcoord, ycoord)
- 5 dict begin
- /ycoord exch def
- /xcoord exch def
- /b exch def
- /a exch def
- /result a b gcd def
- xcoord ycoord moveto
- result 20 string cvs show
- % end
- } def
- 8 12 100 80 displaygcd
- 12 8 150 80 displaygcd
- 3 30 200 80 displaygcd
- 5689 2 250 80 displaygcd
- 234 876 300 80 displaygcd
- modulo(x, y)
- if (x = y) return 0
- elif (x < y) return x
- else return module(x - y, y)
- OP the operator. Each operator is a single character
- STACK tells what stacks are affected and how many are popped or pushed
- "o" stands for "other effect"
- HASH tells if it involves the hash
- x & y represent two values that are already on the stack, so the effect of
- the operator can be more easily described
- OP STACK HASH DESCRIPTION
- text ->m --whenever a bare word appears, it pushes that string onto
- the main stack
- _ o->m --inputs a word and pushes onto main stack
- ` m->o --output. pops from main stack and prints
- xy; mm-> yes --variable assignment. the top stack element y is assigned
- the value x
- ~ m->m yes --variable retrieval. pops from main stack, pushes contents
- of the element with that name
- x? m->c --test. pops x and pushes 0 onto control stack if x is '0' or
- an empty string, else pushes 1
- ><= m->c --comparison. pops two numbers off of stack and performs
- test, pushes 1 onto control stack if true and 0 if false
- ' m->c --pops from main stack and pushes onto control stack
- " c->m --pops from control stack and pushes onto main stack
- &| cc->c --AND/OR. pops two items from control stack, performs and/or
- respectively, and pushes result back onto control stack
- ! c->c --NOT. pops a number off of control stack, pushes 1 if 0 or
- empty string, 0 otherwise
- [] c --FOR statement (view the top number number from control stack
- and eval those many times)
- {} c --WHILE (loop until top number on control stack is 0, also
- does not pop)
- # m-> --discard. pops from main stack and destroys
- ( m->mm --pops from main stack, removes first character, pushes the
- remaining string onto stack, and pushes the removed character
- onto stack
- ) m->mm --pops from main stack, removes last character, pushes the
- remaining string onto stack, and pushes the removed character
- onto stack
- +-*/%^ mm->m --arithmetic. pops two most recent items, adds/negates
- /multiplies/divides/modulates/exponentiates them, and places
- the result on the stack
- xy@ mm->o --move. pops x and y and moves xth thing in stack to move to
- place y in stack
- x$ m->m --length. pops x and pushs length of x onto the stack
- xy: mm->o --duplication. pops x and y and pushes x onto the stack y times
- xy. mm->m --concatination. pops x and y and pushes x concatonated with y
- o --escapes out of next character, so it isn't an operator and can
- be pushed onto the stack
- , m->mm --character conversion. pops from main stack, coverts it to char
- and pushes, and converts to num and pushes
- Newlines and spaces separate different elements to be pushed
- onto the stack individually, but can pushed onto the stack using
- Element was made in 2012!`
- _+'[y~1+y;0[1+4:"2:'=1=|y~=| [#N]`"#]
- `]
- _+'[y~1+y;0[1+4:"2:'=1=|y~=|S[#N]`"#]L`]
- _+' input line, convert to #, move to c-stack
- [ FOR loop
- y~1+y; increment the y-pos
- 0 set the x-pos (the top # on the stack) to zero
- [ FOR loop
- 1+4: increment x-pos and make 3 additional copies (4 is total #)
- "2:' make a copy of the N size on the main stack
- = if x-pos == size
- 1= or if x-pos == 1
- y~=| of if x-pos == y-pos
- S (always) push a space
- [ the IF body (technically a FOR loop)
- #N if true, remove the space and push an N
- ] end IF
- ` output the pushed character
- "# remove the result of the conditional
- ] end x-pos FOR
- L` output a newline
- ] end y-pos FOR
- _'1[y~+y;[#1+3:"2:'%2<y~=| [#N]`"]
- `]
- __'{"3:~2@%'}`
- __ input the two numbers
- ' use one of the number as a condition so the WHILE loop starts
- { } a WHILE loop. Repeats while the c-stack has a true value on top
- " get the number back from the c-stack to do operations on it
- 3: make it so that there are threes copies on the stack
- ~ takes one of the copies from earlier and converts it to a zero
- 2@ take the top item on the stack and move it behind the other two #s
- % modulo operation
- ' use this number as the condition
- ` since one number is zero (and on the c-stack) print the
- other number, which is on m-stack
- Print["Mathematica was made in 1988!"]
- "Mathematica was made in 1988!"
- asciiArtN[n_] := Print @@@ SparseArray[{i_, 1 | i_ | n} -> "N", {n, n}, " "]
- asciiArtN[n_] := Block[{f},
- f[i_, 1] = "N";
- f[i_, i_] = "N";
- f[i_, n] = "N";
- f[__] = " ";
- Apply[Print, Array[f, {n, n}], 1];
- ]
- gcd = GCD
- gcd = Max[Intersection @@ Divisors[{##}]] &;
- gcd = Times[##]/LCM[##] &;
- gcd[a_, 0] := a
- gcd[a_, b_] := gcd[b, Mod[a, b]]
- gcd = If[#2 == 0, #1, #0[#2, Mod[##]]] &;
- "CJam was made in 2014!"
- ri:R'#*a_R2-,{_)S*'#+R((-zS*+}%++R<zN*
- ri:R "Read the input as integer in R";
- '#*a "Get a string of R # and wrap it in an array";
- _R2-,{ }% "Copy that string and then run this loop R-2";
- "times for the diagonal";
- _)S* "Get iteration index + 1 spaces";
- '#+ "Append the hash";
- R((-zS*+ "Append remaining spaces";
- ++ "Append and prepend the initial # string";
- R< "Take only R columns/rows. This is for";
- "tackling input 1";
- zN* "Transpose and join with new lines";
- l~{_@%}h;
- print_endline "OCaml was made in 1996!";;
- let ascii n =
- let rec ascii' = function
- | 0 -> ()
- | i ->
- let s = "N" ^ String.make (n-2) ' ' ^ "N" in
- String.fill s (n-i) 1 'N';
- print_endline s;
- ascii' (i-1)
- in ascii' n;;
- let rec gcd a b = if b = 0 then a else gcd b (a mod b);;
- 0-9 ... Push the corresponding digit.
- + ... Add the top two numbers on the stack.
- - ... Subtract the top number from the one beneath.
- # ... Discard the top of the stack.
- ^ ... Copy the top value from the voice above.
- v ... Copy the top value from the voice below.
- ? ... Read a number and push it onto the stack.
- ! ... Print the top number (and pop it from the stack).
- ( ... If the top of the stack is zero, jump past the matching ')'.
- ) ... If the top of the stack is zero, jump to the column after the matching '('.
- 9(1-)v98+^++!9v+! v88++2+!^ ! ^9-3-! v ! v2-!55+!
- 8 8+ ! 7v+! 1v+!88+^+!^4-!^ v8-^ !!!9v+ !^9+9+! v5+!
- ^98++4+! ^8-! ^4- ^ #!^6-! ^^ #5+! v ^2-!1+!
- v2-(1-)v
- 9(1-)?1-( v! (1-55+! 0 (0)# ))55+!
- 4-4+ v^-#
- v! v! v1-v!(1- ^(#^!0)# v! )v!
- 6 8+ v#
- NUMERIC_INPUT = True
- NUMERIC_OUTPUT = False
- ?( v)
- ? (^-(0 # v # ^+0)#^ !
- ^^ (##v^v+)# 0 (0 )
- 1) ^ # - 1+(#)#
- NUMERIC_INPUT = True
- NUMERIC_OUTPUT = True
- 9(1-)
- 8 8+
- 9(1-)v98+^++r9v+u v88++2+w^ _ ^9-3-a v _ v2-%55+!
- 8 8+ P 7v+l 1v+e88+^+_^4-s^ v8-^ de_9v+ n^9+9+% v5+%
- ^98++4+e ^8-d ^4- ^ #a^6-m ^^ #5+i v ^2-%1+!
- v2-(1-)v
- 9(1-)?1-( v! (1-55+! 0 (0)# ))55+!
- 4-4+ v^-#
- v! v! v1-v!(1- ^(#^!0)# v! )v!
- 6 8+ v#
- 9(1-)
- 4-4+
- 6 8+
- v2-
- ?1-
- v!
- v2-
- 9(1-)?1-( )55+!
- 4-4+
- v!
- 6 8+
- (1-)v
- v!
- v!
- 1-55+!
- v1-v!( )v!
- v#
- 0 (0)#
- v^-#
- 1- ^(#^!0)# v!
- ?( v)
- ? (^-(0 # v # ^+0)#^ !
- ^^ (##v^v+)# 0 (0 )
- 1) ^ # - 1+(#)#
- (0 # v #
- ^^ (##v^v+)#
- 1) ^ # -
- (^- signum ^+0)#
- signum 0 (0 )
- signum 1+(#)#
- DO ,1 <- #27
- DO ,1SUB#1 <- #110
- DO ,1SUB#2 <- #32
- DO ,1SUB#3 <- #72
- PLEASE DO ,1SUB#4 <- #136
- DO ,1SUB#5 <- #88
- DO ,1SUB#6 <- #136
- PLEASE DO ,1SUB#7 <- #64
- DO ,1SUB#8 <- #80
- DO ,1SUB#9 <- #46
- PLEASE DO ,1SUB#10 <- #22
- DO ,1SUB#11 <- #104
- DO ,1SUB#12 <- #184
- PLEASE DO ,1SUB#13 <- #202
- DO ,1SUB#14 <- #78
- DO ,1SUB#15 <- #48
- PLEASE DO ,1SUB#16 <- #96
- DO ,1SUB#17 <- #128
- DO ,1SUB#18 <- #162
- PLEASE DO ,1SUB#19 <- #110
- DO ,1SUB#20 <- #32
- DO ,1SUB#21 <- #114
- PLEASE DO ,1SUB#22 <- #120
- DO ,1SUB#23 <- #240
- DO ,1SUB#24 <- #128
- PLEASE DO ,1SUB#25 <- #208
- DO ,1SUB#26 <- #200
- DO ,1SUB#27 <- #52
- DO READ OUT ,1
- DO GIVE UP
- DO WRITE IN 7
- DO .1 <- .7
- DO .2 <- #1
- PLEASE DO (1010) NEXT
- DO .8 <- .3
- DO .5 <- .7
- DO .6 <- .8
- DO ,9 <- #2
- DO (100) NEXT
- DO (1) NEXT
- (100) DO (99) NEXT
- DO ,9SUB#1 <- #142
- DO ,9SUB#2 <- #114
- PLEASE DO READ OUT ,9
- DO ,9SUB#1 <- #176
- DO ,9SUB#2 <- #80
- PLEASE DO READ OUT ,9
- PLEASE GIVE UP
- (99) DO .1 <- .7
- DO .2 <- #1
- PLEASE DO (1010) NEXT
- DO .1 <- '.3~.3'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (1) PLEASE DO (3) NEXT
- PLEASE DO FORGET #1
- DO (1) NEXT
- (3) DO (4) NEXT
- PLEASE GIVE UP
- (4) DO (8) NEXT
- DO ,9SUB#1 <- #176
- DO ,9SUB#2 <- #80
- PLEASE DO READ OUT ,9
- DO .6 <- .8
- DO .1 <- .5
- DO .2 <- #1
- DO (1010) NEXT
- DO .5 <- .3
- DO .1 <- '.5~.5'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (8) DO (5) NEXT
- (5) PLEASE DO (6) NEXT
- PLEASE DO FORGET #1
- DO (5) NEXT
- (6) PLEASE DO (7) NEXT
- DO RESUME #2
- (7) DO (10) NEXT
- DO .1 <- .6
- DO .2 <- #1
- PLEASE DO (1010) NEXT
- DO .6 <- .3
- DO .1 <- '.6~.6'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (10) DO (11) NEXT
- DO (13) NEXT
- DO (14) NEXT
- DO (15) NEXT
- (11) DO (111) NEXT
- DO (112) NEXT
- (13) DO (113) NEXT
- DO (112) NEXT
- (14) DO (114) NEXT
- DO (112) NEXT
- (111) DO .1 <- .6
- DO .2 <- .8
- DO (1010) NEXT
- DO .1 <- '.3~.3'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (112) DO ,9SUB#1 <- #142
- DO ,9SUB#2 <- #114
- PLEASE DO READ OUT ,9
- DO RESUME #3
- (113) DO .1 <- .6
- DO .2 <- #1
- DO (1000) NEXT
- DO .1 <- .5
- DO .2 <- .3
- DO (1010) NEXT
- DO .1 <- '.3~.3'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (114) DO .1 <- '.6~.6'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- (15) DO ,9SUB#1 <- #252
- DO ,9SUB#2 <- #4
- PLEASE DO READ OUT ,9
- DO RESUME #2
- DO WRITE IN .5
- DO WRITE IN .6
- DO (1) NEXT
- (1) PLEASE DO (3) NEXT
- DO FORGET #1
- DO (1) NEXT
- (3) DO (4) NEXT
- DO READ OUT .5
- PLEASE GIVE UP
- (4) DO .1 <- .5
- DO .2 <- .6
- PLEASE DO (1040) NEXT
- DO .1 <- .3
- DO .2 <- .6
- PLEASE DO (1039) NEXT
- DO .2 <- .3
- DO .1 <- .5
- DO (1010) NEXT
- DO .5 <- .6
- DO .6 <- .3
- DO .1 <- '.6~.6'~#1
- PLEASE DO FORGET .1
- DO RESUME #1
- THREE FIVE
- FOUR TWO
- ONE SIX
- "Pyth was made in 2014!
- VQ+Nt+P++*NdN*t-QNdN
- Q = eval(input()) #
- for N in range(Q): # VQ
- print( ) #
- "N"+ # +N
- ( )[1:] # t
- +"N" # + N
- ( )[:-1] # P
- +(Q-N-1)*" " # + *t-QNd
- +"N" # + N
- " "*N # *Nd
- =GvwWQAGQ,Q%GQ)G
- Q = eval(input()) #
- G = eval(input()) # =Gvw
- while Q != 0: # WQ
- G, Q = Q, G % Q # AGQ,Q%GQ)
- print(G) # G
- module Main
- main : IO ()
- main = putStrLn "Idris was made in 2009!"
- module InN
- import Data.Fin
- import Data.Vect
- genN : Vect n (Vect n Char)
- genN = [[ if inN x y then 'N' else ' ' | x<-range ]| y<-range ]
- ||| Helper function, determines whether the char at coordinate (x,y)
- ||| is part of the letter:
- inN : Fin n -> Fin n -> Bool
- inN {n=S _} x y = x==0 || x==y || x==last
- $ idris ascii-n.idr
- ____ __ _
- / _/___/ /____(_)____
- / // __ / ___/ / ___/ Version 0.9.17.1-
- _/ // /_/ / / / (__ ) http://www.idris-lang.org/
- /___/__,_/_/ /_/____/ Type :? for help
- Idris is free software with ABSOLUTELY NO WARRANTY.
- For details type :warranty.
- Type checking ./ascii-n.idr
- *ascii-n> genN {n=4}
- [['N', ' ', ' ', 'N'],
- ['N', 'N', ' ', 'N'],
- ['N', ' ', 'N', 'N'],
- ['N', ' ', ' ', 'N']] : Vect 4 (Vect 4 Char)
- module gcd
- gcd' : Nat -> Nat -> Nat
- gcd' a Z = a
- gcd' a b = gcd' b $ a`mod`b
- Type checking ./gcd.idr
- *gcd> gcd' 8 12
- 4 : Nat
- *gcd> gcd' 12 8
- 4 : Nat
- *gcd> gcd' 234 876
- 6 : Nat
- ⎕←'APL WAS MADE IN 1967!'
- L[Kapl was made in 1967ÝK
- ⎕←' N'[1+((2⍴N)⍴(⍳N)∊1,N)∨(⍳N)∘.=⍳N←⎕]
- L[K nK;1-::2Rn"R:In"E1,n"(:In"J.%In[L'
- ∇R←A GCD B
- R←A
- →(B=0)/0
- R←B GCD B|A
- ∇
- ⎕←⎕ GCD ⎕
- Gr[a gcd b
- r[a
- {:b%0"/0
- r[b gcd bMa
- G
- L[L gcd L
- 'WTFZOMFG was made in 2010!n"
- /&(-.N%3 >&>s-{-(-. ).N}>{-(-. ).N}_0 'n")
- / # read the number and store it in cell 0
- & # copy it to cell 1
- ( # loop while cell 0 isn't 0
- - # decrease the value of cell 0
- .N # print "N"
- %3 # copy cell 0 to cell 3
- # a space must be added after the number. I don't know if it's a bug of the compiler or a feature.
- > # move to cell 1
- & # copy cell 1 to cell 2
- > # move cell 2
- s # let cell 2 = cell 2 - cell 3
- - # decrease the value of cell 2
- { # if cell 2 isn't 0
- - # decrease the value of cell 2
- (-. ) # while cell 2 isn't 0, decrease it and print " "
- .N # print "N"
- } # end if
- > # move cell 3
- { # if cell 3 isn't 0
- - # decrease the value of cell 3
- (-. ) # while cell 3 isn't 0, decrease it and print " "
- .N # print "N"
- } # end if
- _0 # move to cell 0
- 'n" # print a newline
- ) #
- />>/(<<&>dm<s&>>%0 <&>)<<
- Task1(name:string,year:number) {
- return name + " was made in "+ year +"!";
- }
- Task2(n:number,separator:string,space:string) {
- var result:string = "";
- for (var k = 0; k < n; k++)
- {
- for (var j = 0; j < n; j++)
- {
- var i = ((n * k) + j) % n;
- result+=(i == 0 || i == n - 1 || i == k) ? "N" : space;
- }
- result+=separator;
- }
- return result;
- }
- Task3(a:number,b:number) {
- while (a != 0 && b != 0)
- {
- if (a > b)
- a %= b;
- else
- b %= a;
- }
- if (a == 0)
- return b;
- else
- return a;
- }
- main() {
- print('Dart was made in 2011!');
- }
- asciiN(int number){
- if(number == 1){
- print('N');
- }else{
- for(var i = 1; i <= number; i++){
- String currentLine = "";
- for(var j = 1; j <= number; j++){
- if(j==1 || j == number || j == i){
- currentLine = currentLine + "N";
- }else{
- currentLine = currentLine + " ";
- }
- }
- print(currentLine);
- }
- }
- }
- int gcd(int first, int second){
- if(second > first){
- return gcd(second, first);
- }else{
- if(first == 0){
- return second;
- }else{
- if(second ==0){
- return first;
- }else{
- return gcd(second, first-second);
- }
- }
- }
- }
- package main
- import "fmt"
- func main(){
- fmt.Println("Go was made in 2009!")
- }
- package main
- import (
- "fmt"
- "strings"
- )
- func main(){
- var n int
- fmt.Scan(&n)
- for i := 0; i < n; i++ {
- a := make([]string, n, n)
- for j := 0; j < n; j++ { a[j] = " " }
- a[0] = "N"
- a[i] = "N"
- a[n-1] = "N"
- s := strings.Join(a, "")
- fmt.Println(s)
- }
- }
- package main
- import "fmt"
- func gcd(a, b int) int {
- for b != 0 {
- a, b = b, a%b
- }
- return a
- }
- func main(){
- var a, b int
- fmt.Scan(&a)
- fmt.Scan(&b)
- fmt.Println(gcd(a, b))
- }
- #(say "MuffinMC was born in 2015 out of necessity !")
- =(ascii-art
- '( =(* x #(2- $(_1))
- I I( *($(x) " ") N)
- foo '( #(. #(I $(x))) ))
- #(say ?( #(== $(_1) 1) N "N#(map foo #(.. 1 $(_1)))N" ))
- ))
- =(f'(=(* x#(2-)I I(*($(x)" ")N)g'(#(.#(I$(x)))))#(say?(#(==$(_1)1)N"N#(map g#(..))N"))))
- #(ascii-art 1)
- N
- #(ascii-art 3)
- N N
- NNN
- N N
- #(map '( #(ascii-art $(_1))) 5 7 9)
- N N
- NN N
- N N N
- N NN
- N N
- N N
- NN N
- N N N
- N N N
- N N N
- N NN
- N N
- N N
- NN N
- N N N
- N N N
- N N N
- N N N
- N N N
- N NN
- N N
- The 5 strings :
- _ _ _
- N _ _
- _ N _
- _ _ N
- _ _ _
- can be seen as resulting from splitting in groups of 3 characters
- the following infinite sequence of 4 characters :
- /---- < _ _ _ N > ----
- | |
- ---------------------/
- which, once unfolded, yields the infinite ruban :
- _ _ _ N _ _ _ N _ _ _ N _ _ _ N _ _ _ N _ _ _ N ...
- ^ ^ ^ ^
- _ _ _ | | | |
- N _ _ | | |
- _ N _ | |
- _ _ N |
- _ _ _
- Commented script
- =(ascii-art Define the 'ascii-art' variable to hold
- the function's definition.
- When called, its argument, the actual
- value of n, will be bound to the system
- variable _1, accessed as $( _1 ).
- '( '(...) quote macro-command -- protects
- its arguments, here the function
- definition, from being evaluated.
- We want to keep it literally for further evaluation.
- =(* =(*...) // assignment macro-command.
- Similar to the Lisp (let (...)...),
- not the let* !
- x #(2- $(_1)) Define the variable x to hold the value
- n-2.
- I I( Define I to be an iterator over the
- the x+1 characters sequence :
- *( $(x) " ") . x white-space characters
- N . 1 'N' character (here the atom N)
- )
- foo '( Define the variable foo as a function
- #(. to catenate ( #(. s1...) )
- #(I $(x)) the iterator's next x elements.
- )
- )
- ) End of =(*...
- #(say Print each element of:
- ?( If
- #(== $(_1) 1) n equals 1
- N the atom N,
- "N#(map foo #(.. 1 $(_1)))N" else the n strings as a string-product
- resulting from foo-computing the
- ) n middle-strings.
- )
- ))
- =(gcd '( ?( #(== $(_2) 0)
- $(_1)
- #(self $(_2) #(mod $(_1) $(_2)))) ))
- =(g'(?(#(z$(_2))$(_1)#(g$(_2)#(mod)))))
- #(gcd 225 81)
- println("Swift was made in 2014!")
- func asciin(n:Int) -> String {
- var r = 0;
- return [Int](0..<n*n).reduce("", { msg, next in
- switch next % n {
- case 0, r: return msg + "N";
- case n-1: r++; return msg + "Nn";
- default: return msg + " ";
- }
- }
- )}
- func gcd(a:Int, b:Int) -> Int {
- var g = (a, b);
- while(g.1 > 0) {
- g = (g.1, g.0 % g.1);
- }
- return g.0;
- }
- fn main()
- {
- println!("Rust was made in 2010!");
- }
- fn main()
- {
- // get commandline arguments
- // "test 3"
- let args : Vec<_> = std::env::args().collect();
- // convert 2nd argument to integer
- let n = u32::from_str_radix( args[1].as_ref(), 10 ).unwrap();
- print_n( n );
- }
- fn print_n( n: u32 )
- {
- for y in range( 0, n )
- {
- for x in range( 0, n )
- {
- if x == 0 || x == y || x + 1 == n
- {
- print!("N");
- }
- else
- {
- print!(" ");
- }
- }
- println!("");
- }
- }
- if x == 0 || x == y || x + 1 == n
- fn main()
- {
- // get commandline arguments
- // "test 453 3"
- let args : Vec<_> = std::env::args().collect();
- // convert 2nd and 3rd argument to integers
- let a = u32::from_str_radix( args[1].as_ref(), 10 ).unwrap();
- let b = u32::from_str_radix( args[2].as_ref(), 10 ).unwrap();
- let g = gcd( a, b );
- println!( "GCD of {} and {} is {}", a, b, g );
- }
- fn gcd( mut a: u32, mut b: u32 ) -> u32
- {
- while b != 0
- {
- let c = a % b;
- a = b;
- b = c;
- }
- return a;
- }
- (println "Clojure was made in 2007!")
- (defn ascii [n]
- (doseq [i (range 0 n 1)]
- (doseq [j (range 0 n 1)]
- (printf (if (or (= i j) (= j 0) (= j (dec n))) "N" " "))
- )
- (printf "n")
- )
- )
- (ascii (read))
- (defn gcd [a b]
- (if (zero? b) a (recur b (mod a b)))
- )
- (println (gcd (read) (read)))
- 'IF' I 'LT' 0 'THEN' 'SKIP' 'FI'
- .IF I .LT 0 .THEN .SKIP .FI
- IF i < 0 THEN SKIP FI
- print (("Algol 68 was made in 1968!", newline))
- C:>a68g HelloWorld.a68
- Algol 68 was made in 1968!
- INT n;
- read ((n));
- FOR i FROM 1 TO n DO
- FOR j FROM 1 TO n DO
- CO here we use an abbreviated IF clause CO
- print (( ( j = 1 OR j = i OR j = n |
- "N"
- |
- " "
- ) ))
- OD ;
- print ((newline))
- OD
- C:>a68g ASCIIart.a68
- 8
- N N
- NN N
- N N N
- N N N
- N N N
- N N N
- N NN
- N N
- COMMENT we can define our own operators in Algol 68 COMMENT
- OP % = ( INT a, b) INT:
- ((b = 0 |
- a
- |
- b % (a MOD b)
- ));
- INT i,j;
- read((i,j));
- print(( i % j , newline))
- C:>a68g GCD.a68
- 4 12
- +4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement