Draw some expanding arrows











up vote
9
down vote

favorite
3












This challenge is about printing a series of growing ASCII-art arrows. I'll describe the pattern in words, but it might be easier to look at what the start of this series looks like:



>
<
->
<-
-->
<--
--->
<---
---->
<----
----->
<-----
------>
<------
...


An arrow with length n contains an arrowhead (< or >) and n-1 dashes (-). A right-facing arrow has the dashes first, then a >. A left-facing arrow starts with <, and is followed by the dashes. The series consists of a length n right-facing arrow followed by a length n left-facing arrow, with n from 1 to infinity.



To complete the challenge, write a program or function that takes one input, an integer i >= 1, and outputs the first i arrows. Arrows are individual, not in right-left pairs, so for i=3 you should output:



>
<
->


You can return a list of strings, or print them one after the other. If printing, the arrows must be delimited by some consistent delimiter, which doesn't have to be a newline as in the example.



This is code-golf, so fewest bytes wins.










share|improve this question


















  • 1




    Related.
    – AdmBorkBork
    3 hours ago










  • Can we have spaces before/after each line?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yes, trailing whitespace is ok.
    – Pavel
    2 hours ago










  • And heading whitespace?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yeah, that's fine.
    – Pavel
    2 hours ago

















up vote
9
down vote

favorite
3












This challenge is about printing a series of growing ASCII-art arrows. I'll describe the pattern in words, but it might be easier to look at what the start of this series looks like:



>
<
->
<-
-->
<--
--->
<---
---->
<----
----->
<-----
------>
<------
...


An arrow with length n contains an arrowhead (< or >) and n-1 dashes (-). A right-facing arrow has the dashes first, then a >. A left-facing arrow starts with <, and is followed by the dashes. The series consists of a length n right-facing arrow followed by a length n left-facing arrow, with n from 1 to infinity.



To complete the challenge, write a program or function that takes one input, an integer i >= 1, and outputs the first i arrows. Arrows are individual, not in right-left pairs, so for i=3 you should output:



>
<
->


You can return a list of strings, or print them one after the other. If printing, the arrows must be delimited by some consistent delimiter, which doesn't have to be a newline as in the example.



This is code-golf, so fewest bytes wins.










share|improve this question


















  • 1




    Related.
    – AdmBorkBork
    3 hours ago










  • Can we have spaces before/after each line?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yes, trailing whitespace is ok.
    – Pavel
    2 hours ago










  • And heading whitespace?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yeah, that's fine.
    – Pavel
    2 hours ago















up vote
9
down vote

favorite
3









up vote
9
down vote

favorite
3






3





This challenge is about printing a series of growing ASCII-art arrows. I'll describe the pattern in words, but it might be easier to look at what the start of this series looks like:



>
<
->
<-
-->
<--
--->
<---
---->
<----
----->
<-----
------>
<------
...


An arrow with length n contains an arrowhead (< or >) and n-1 dashes (-). A right-facing arrow has the dashes first, then a >. A left-facing arrow starts with <, and is followed by the dashes. The series consists of a length n right-facing arrow followed by a length n left-facing arrow, with n from 1 to infinity.



To complete the challenge, write a program or function that takes one input, an integer i >= 1, and outputs the first i arrows. Arrows are individual, not in right-left pairs, so for i=3 you should output:



>
<
->


You can return a list of strings, or print them one after the other. If printing, the arrows must be delimited by some consistent delimiter, which doesn't have to be a newline as in the example.



This is code-golf, so fewest bytes wins.










share|improve this question













This challenge is about printing a series of growing ASCII-art arrows. I'll describe the pattern in words, but it might be easier to look at what the start of this series looks like:



>
<
->
<-
-->
<--
--->
<---
---->
<----
----->
<-----
------>
<------
...


An arrow with length n contains an arrowhead (< or >) and n-1 dashes (-). A right-facing arrow has the dashes first, then a >. A left-facing arrow starts with <, and is followed by the dashes. The series consists of a length n right-facing arrow followed by a length n left-facing arrow, with n from 1 to infinity.



To complete the challenge, write a program or function that takes one input, an integer i >= 1, and outputs the first i arrows. Arrows are individual, not in right-left pairs, so for i=3 you should output:



>
<
->


You can return a list of strings, or print them one after the other. If printing, the arrows must be delimited by some consistent delimiter, which doesn't have to be a newline as in the example.



This is code-golf, so fewest bytes wins.







code-golf ascii-art sequence






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 3 hours ago









Pavel

4,73813287




4,73813287








  • 1




    Related.
    – AdmBorkBork
    3 hours ago










  • Can we have spaces before/after each line?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yes, trailing whitespace is ok.
    – Pavel
    2 hours ago










  • And heading whitespace?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yeah, that's fine.
    – Pavel
    2 hours ago
















  • 1




    Related.
    – AdmBorkBork
    3 hours ago










  • Can we have spaces before/after each line?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yes, trailing whitespace is ok.
    – Pavel
    2 hours ago










  • And heading whitespace?
    – Olivier Grégoire
    2 hours ago










  • @OlivierGrégoire Yeah, that's fine.
    – Pavel
    2 hours ago










1




1




Related.
– AdmBorkBork
3 hours ago




Related.
– AdmBorkBork
3 hours ago












Can we have spaces before/after each line?
– Olivier Grégoire
2 hours ago




Can we have spaces before/after each line?
– Olivier Grégoire
2 hours ago












@OlivierGrégoire Yes, trailing whitespace is ok.
– Pavel
2 hours ago




@OlivierGrégoire Yes, trailing whitespace is ok.
– Pavel
2 hours ago












And heading whitespace?
– Olivier Grégoire
2 hours ago




And heading whitespace?
– Olivier Grégoire
2 hours ago












@OlivierGrégoire Yeah, that's fine.
– Pavel
2 hours ago






@OlivierGrégoire Yeah, that's fine.
– Pavel
2 hours ago












15 Answers
15






active

oldest

votes

















up vote
6
down vote














R, 69 bytes





for(i in 1:scan()-1)cat('<'[i%%2],rep('-',i/2),'>'[!i%%2],'
',sep='')


Try it online!




  • -5 bytes thanks to @Giuseppe

  • -3 bytes thanks to @Robert S.






share|improve this answer























  • strrep coerces its second argument to integer so you can use / in place of %/%
    – Giuseppe
    2 hours ago










  • you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
    – Giuseppe
    2 hours ago










  • I'm an idiot... thanks ! :D
    – digEmAll
    2 hours ago










  • @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
    – digEmAll
    2 hours ago


















up vote
3
down vote














Canvas, 10 bytes



⇵-×<n¹[↔}]


Try it here!






share|improve this answer





















  • I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
    – Pavel
    3 hours ago










  • is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
    – dzaima
    3 hours ago


















up vote
3
down vote














Python 2, 53 bytes





k=-1
exec"print'<'[k%2:]+'-'*k+k%2*'>';k+=1;"*input()


Try it online!






share|improve this answer




























    up vote
    3
    down vote














    Commodore BASIC V2 (C64), 94 bytes



    0inputn:fOi=1ton:oniaN1gO1:?"<";
    1on-(i<3)gO2:fOj=1.5toi/2:?"-";:nE
    2on-nOiaN1gO3:?">";
    3?:nE


    Not entirely sure about the byte count, this is based on the text representation for typing the valid program. It's a bit shorter on disk (91 bytes) because BASIC V2 uses a "tokenized" representation of programs.



    Online Demo



    Slightly "ungolfed":



    0 inputn:fori=1ton:oniand1goto1:print"<";    :rem read n from user, loop to n, if odd skip "<"
    1 on-(i<3)goto2:forj=1.5toi/2:print"-";:next :rem skip for i<3, print (i-1)/2 times "-"
    2 on-notiand1goto3:print">"; :rem if even skip ">"
    3 print:next :rem newline and next loop iteration





    share|improve this answer




























      up vote
      3
      down vote














      PowerShell, 62 56 50 bytes





      param($n)(0..$n|%{($j='-'*$_)+'>';"<$j"})[0..--$n]


      Try it online!



      Loops from 0 up to input $n, each iteration creating two arrow strings. Those are then indexed with 0..--$n to pull out the correct number of elements.



      Saved 6 bytes thanks to KGlasier.






      share|improve this answer























      • Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
        – KGlasier
        2 hours ago










      • Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
        – KGlasier
        2 hours ago








      • 1




        @KGlasier Awesome - thanks for the obvious golfs! :)
        – AdmBorkBork
        2 hours ago


















      up vote
      2
      down vote













      Pyth, 17 bytes



      m_W%d2+*-/d2@"><


      Output is a list of strings. Try it online here.



      m_W%d2+*-/d2@"><"dQ   Implicit: Q=eval(input())
      Trailing "dQ inferred
      m Q Map [0-Q), as d, using:
      /d2 Floored division of d by 2
      *- Repeat "-" the above number of times
      + Append to the above...
      @"><"d Modular index d into "><" - yields ">" for even d, "<" for odd
      - examples: d=4 gives "-->", d=7 gives "---<"
      _W Reverse the above if...
      %d2 ... (d % 2) != 0
      Implicit print result of the map





      share|improve this answer




























        up vote
        2
        down vote














        Java (JDK), 81 bytes





        n->{for(int i=0;i<n;)System.out.printf(i%2<1?"<%s%n":"%s>%n","-".repeat(i++/2));}


        Try it online!



        Explanations



        n->{                  // int-accepting consumer
        for(int i=0;i<n;) // for each i from 0 to n-1 included
        System.out.printf( // output on stdout with a pattern
        i%2<1 // if i is even:
        ?"<%s%n" // use the left-arrow pattern
        :"%s>%n", // else: use the right-arrow pattern
        "-".repeat(i++/2) // fill the pattern with i/2 dashes, and increment i
        ); //
        } //





        share|improve this answer






























          up vote
          2
          down vote














          SNOBOL4 (CSNOBOL4), 123 122 118 bytes



          	N =INPUT - 1
          P H =X / 2
          Y =DUPL('-',H)
          OUTPUT =EQ(H,X - H) Y '>' :S(I)
          OUTPUT ='<' Y
          I X =LT(X,N) X + 1 :S(P)
          END


          Try it online!






          share|improve this answer






























            up vote
            1
            down vote













            JavaScript (ES6), 58 bytes



            Returns a space-separated string.





            n=>(g=p=>n--?k++&1?`<${p} `+g(p+'-'):p+'> '+g(p):'')(k='')


            Try it online!






            share|improve this answer




























              up vote
              1
              down vote














              Jelly, 15 bytes



              ị⁾><;’H”-ẋƲṚ⁸¡)


              Try it online!






              share|improve this answer




























                up vote
                1
                down vote














                Haskell, 51 bytes





                (`take`do b<-['-'<$[1..n]|n<-[0..]];[b++">",'<':b])


                Try it online!



                Explanation / Ungolfed



                Using do-notation saves us a concat, using '-'<$[1..n] is shorter than replicate, and finally using infix-notation allows a pointfree function with take, undoing these would give:



                f n = take n $ concat [ [b++">", '<':b] | n<-[0..], let b = replicate n '-' ]





                share|improve this answer






























                  up vote
                  1
                  down vote













                  Haskell, 41 bytes



                  (`take`g"")
                  g p=(p++">"):('<':p):g('-':p)


                  Try it online!



                  Plain old recursion: start with an emtpy string p, collect p with a right arrow, a left arrow with p and a recursive call with p one - longer. Take the first n items of this list.






                  share|improve this answer






























                    up vote
                    1
                    down vote













                    Powershell, 51 bytes





                    param($n)0..$n|%{'-'*$_+'>';'<'+'-'*$_}|?{$n---gt0}





                    share|improve this answer




























                      up vote
                      1
                      down vote














                      V, 22 bytes



                      i>
                      <Àñäkjjé-já-ñÀGjdG


                      Try it online!






                      share|improve this answer

















                      • 1




                        This looks like some weird scandinavian language
                        – Pavel
                        1 hour ago


















                      up vote
                      1
                      down vote














                      Japt -m, 22 bytes



                      u ç'< +Uz ç'- +°Uu ç'>


                      Try it online!



                      Explanation:



                                                #Implicitly map over the range [0..input) as U
                      u #U modulo 2
                      ç'< #Print "<" that number of times (i.e. once, only if it's odd)
                      + #Concat
                      Uz #U integer divide by 2
                      ç'- #Print "-" that number of times
                      + #Concat
                      °Uu #U+1 modulo 2
                      ç'> #Print ">" that number of times (i.e. once, only if it's even)





                      share|improve this answer





















                        Your Answer





                        StackExchange.ifUsing("editor", function () {
                        return StackExchange.using("mathjaxEditing", function () {
                        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                        });
                        });
                        }, "mathjax-editing");

                        StackExchange.ifUsing("editor", function () {
                        StackExchange.using("externalEditor", function () {
                        StackExchange.using("snippets", function () {
                        StackExchange.snippets.init();
                        });
                        });
                        }, "code-snippets");

                        StackExchange.ready(function() {
                        var channelOptions = {
                        tags: "".split(" "),
                        id: "200"
                        };
                        initTagRenderer("".split(" "), "".split(" "), channelOptions);

                        StackExchange.using("externalEditor", function() {
                        // Have to fire editor after snippets, if snippets enabled
                        if (StackExchange.settings.snippets.snippetsEnabled) {
                        StackExchange.using("snippets", function() {
                        createEditor();
                        });
                        }
                        else {
                        createEditor();
                        }
                        });

                        function createEditor() {
                        StackExchange.prepareEditor({
                        heartbeatType: 'answer',
                        convertImagesToLinks: false,
                        noModals: true,
                        showLowRepImageUploadWarning: true,
                        reputationToPostImages: null,
                        bindNavPrevention: true,
                        postfix: "",
                        imageUploader: {
                        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                        allowUrls: true
                        },
                        onDemand: true,
                        discardSelector: ".discard-answer"
                        ,immediatelyShowMarkdownHelp:true
                        });


                        }
                        });














                        draft saved

                        draft discarded


















                        StackExchange.ready(
                        function () {
                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177454%2fdraw-some-expanding-arrows%23new-answer', 'question_page');
                        }
                        );

                        Post as a guest















                        Required, but never shown

























                        15 Answers
                        15






                        active

                        oldest

                        votes








                        15 Answers
                        15






                        active

                        oldest

                        votes









                        active

                        oldest

                        votes






                        active

                        oldest

                        votes








                        up vote
                        6
                        down vote














                        R, 69 bytes





                        for(i in 1:scan()-1)cat('<'[i%%2],rep('-',i/2),'>'[!i%%2],'
                        ',sep='')


                        Try it online!




                        • -5 bytes thanks to @Giuseppe

                        • -3 bytes thanks to @Robert S.






                        share|improve this answer























                        • strrep coerces its second argument to integer so you can use / in place of %/%
                          – Giuseppe
                          2 hours ago










                        • you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                          – Giuseppe
                          2 hours ago










                        • I'm an idiot... thanks ! :D
                          – digEmAll
                          2 hours ago










                        • @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                          – digEmAll
                          2 hours ago















                        up vote
                        6
                        down vote














                        R, 69 bytes





                        for(i in 1:scan()-1)cat('<'[i%%2],rep('-',i/2),'>'[!i%%2],'
                        ',sep='')


                        Try it online!




                        • -5 bytes thanks to @Giuseppe

                        • -3 bytes thanks to @Robert S.






                        share|improve this answer























                        • strrep coerces its second argument to integer so you can use / in place of %/%
                          – Giuseppe
                          2 hours ago










                        • you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                          – Giuseppe
                          2 hours ago










                        • I'm an idiot... thanks ! :D
                          – digEmAll
                          2 hours ago










                        • @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                          – digEmAll
                          2 hours ago













                        up vote
                        6
                        down vote










                        up vote
                        6
                        down vote










                        R, 69 bytes





                        for(i in 1:scan()-1)cat('<'[i%%2],rep('-',i/2),'>'[!i%%2],'
                        ',sep='')


                        Try it online!




                        • -5 bytes thanks to @Giuseppe

                        • -3 bytes thanks to @Robert S.






                        share|improve this answer















                        R, 69 bytes





                        for(i in 1:scan()-1)cat('<'[i%%2],rep('-',i/2),'>'[!i%%2],'
                        ',sep='')


                        Try it online!




                        • -5 bytes thanks to @Giuseppe

                        • -3 bytes thanks to @Robert S.







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited 2 hours ago

























                        answered 2 hours ago









                        digEmAll

                        2,36148




                        2,36148












                        • strrep coerces its second argument to integer so you can use / in place of %/%
                          – Giuseppe
                          2 hours ago










                        • you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                          – Giuseppe
                          2 hours ago










                        • I'm an idiot... thanks ! :D
                          – digEmAll
                          2 hours ago










                        • @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                          – digEmAll
                          2 hours ago


















                        • strrep coerces its second argument to integer so you can use / in place of %/%
                          – Giuseppe
                          2 hours ago










                        • you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                          – Giuseppe
                          2 hours ago










                        • I'm an idiot... thanks ! :D
                          – digEmAll
                          2 hours ago










                        • @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                          – digEmAll
                          2 hours ago
















                        strrep coerces its second argument to integer so you can use / in place of %/%
                        – Giuseppe
                        2 hours ago




                        strrep coerces its second argument to integer so you can use / in place of %/%
                        – Giuseppe
                        2 hours ago












                        you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                        – Giuseppe
                        2 hours ago




                        you can also get rid of a entirely by indexing over 0...(n-1) instead: Try it online!
                        – Giuseppe
                        2 hours ago












                        I'm an idiot... thanks ! :D
                        – digEmAll
                        2 hours ago




                        I'm an idiot... thanks ! :D
                        – digEmAll
                        2 hours ago












                        @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                        – digEmAll
                        2 hours ago




                        @Giuseppe :also I just noticed the deleted question of Robert S. I can use rep instead of strrep and save 3 bytes...(facepalm)
                        – digEmAll
                        2 hours ago










                        up vote
                        3
                        down vote














                        Canvas, 10 bytes



                        ⇵-×<n¹[↔}]


                        Try it here!






                        share|improve this answer





















                        • I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                          – Pavel
                          3 hours ago










                        • is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                          – dzaima
                          3 hours ago















                        up vote
                        3
                        down vote














                        Canvas, 10 bytes



                        ⇵-×<n¹[↔}]


                        Try it here!






                        share|improve this answer





















                        • I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                          – Pavel
                          3 hours ago










                        • is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                          – dzaima
                          3 hours ago













                        up vote
                        3
                        down vote










                        up vote
                        3
                        down vote










                        Canvas, 10 bytes



                        ⇵-×<n¹[↔}]


                        Try it here!






                        share|improve this answer













                        Canvas, 10 bytes



                        ⇵-×<n¹[↔}]


                        Try it here!







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered 3 hours ago









                        dzaima

                        14.3k21754




                        14.3k21754












                        • I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                          – Pavel
                          3 hours ago










                        • is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                          – dzaima
                          3 hours ago


















                        • I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                          – Pavel
                          3 hours ago










                        • is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                          – dzaima
                          3 hours ago
















                        I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                        – Pavel
                        3 hours ago




                        I don't know any Canvas, but is that an arrow-drawing builtin I see? kinda looks like it!
                        – Pavel
                        3 hours ago












                        is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                        – dzaima
                        3 hours ago




                        is the "reverse horizontally" built-in (also swapping > & <), sadly no arrow built-ins :p
                        – dzaima
                        3 hours ago










                        up vote
                        3
                        down vote














                        Python 2, 53 bytes





                        k=-1
                        exec"print'<'[k%2:]+'-'*k+k%2*'>';k+=1;"*input()


                        Try it online!






                        share|improve this answer

























                          up vote
                          3
                          down vote














                          Python 2, 53 bytes





                          k=-1
                          exec"print'<'[k%2:]+'-'*k+k%2*'>';k+=1;"*input()


                          Try it online!






                          share|improve this answer























                            up vote
                            3
                            down vote










                            up vote
                            3
                            down vote










                            Python 2, 53 bytes





                            k=-1
                            exec"print'<'[k%2:]+'-'*k+k%2*'>';k+=1;"*input()


                            Try it online!






                            share|improve this answer













                            Python 2, 53 bytes





                            k=-1
                            exec"print'<'[k%2:]+'-'*k+k%2*'>';k+=1;"*input()


                            Try it online!







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 3 hours ago









                            ovs

                            18.6k21059




                            18.6k21059






















                                up vote
                                3
                                down vote














                                Commodore BASIC V2 (C64), 94 bytes



                                0inputn:fOi=1ton:oniaN1gO1:?"<";
                                1on-(i<3)gO2:fOj=1.5toi/2:?"-";:nE
                                2on-nOiaN1gO3:?">";
                                3?:nE


                                Not entirely sure about the byte count, this is based on the text representation for typing the valid program. It's a bit shorter on disk (91 bytes) because BASIC V2 uses a "tokenized" representation of programs.



                                Online Demo



                                Slightly "ungolfed":



                                0 inputn:fori=1ton:oniand1goto1:print"<";    :rem read n from user, loop to n, if odd skip "<"
                                1 on-(i<3)goto2:forj=1.5toi/2:print"-";:next :rem skip for i<3, print (i-1)/2 times "-"
                                2 on-notiand1goto3:print">"; :rem if even skip ">"
                                3 print:next :rem newline and next loop iteration





                                share|improve this answer

























                                  up vote
                                  3
                                  down vote














                                  Commodore BASIC V2 (C64), 94 bytes



                                  0inputn:fOi=1ton:oniaN1gO1:?"<";
                                  1on-(i<3)gO2:fOj=1.5toi/2:?"-";:nE
                                  2on-nOiaN1gO3:?">";
                                  3?:nE


                                  Not entirely sure about the byte count, this is based on the text representation for typing the valid program. It's a bit shorter on disk (91 bytes) because BASIC V2 uses a "tokenized" representation of programs.



                                  Online Demo



                                  Slightly "ungolfed":



                                  0 inputn:fori=1ton:oniand1goto1:print"<";    :rem read n from user, loop to n, if odd skip "<"
                                  1 on-(i<3)goto2:forj=1.5toi/2:print"-";:next :rem skip for i<3, print (i-1)/2 times "-"
                                  2 on-notiand1goto3:print">"; :rem if even skip ">"
                                  3 print:next :rem newline and next loop iteration





                                  share|improve this answer























                                    up vote
                                    3
                                    down vote










                                    up vote
                                    3
                                    down vote










                                    Commodore BASIC V2 (C64), 94 bytes



                                    0inputn:fOi=1ton:oniaN1gO1:?"<";
                                    1on-(i<3)gO2:fOj=1.5toi/2:?"-";:nE
                                    2on-nOiaN1gO3:?">";
                                    3?:nE


                                    Not entirely sure about the byte count, this is based on the text representation for typing the valid program. It's a bit shorter on disk (91 bytes) because BASIC V2 uses a "tokenized" representation of programs.



                                    Online Demo



                                    Slightly "ungolfed":



                                    0 inputn:fori=1ton:oniand1goto1:print"<";    :rem read n from user, loop to n, if odd skip "<"
                                    1 on-(i<3)goto2:forj=1.5toi/2:print"-";:next :rem skip for i<3, print (i-1)/2 times "-"
                                    2 on-notiand1goto3:print">"; :rem if even skip ">"
                                    3 print:next :rem newline and next loop iteration





                                    share|improve this answer













                                    Commodore BASIC V2 (C64), 94 bytes



                                    0inputn:fOi=1ton:oniaN1gO1:?"<";
                                    1on-(i<3)gO2:fOj=1.5toi/2:?"-";:nE
                                    2on-nOiaN1gO3:?">";
                                    3?:nE


                                    Not entirely sure about the byte count, this is based on the text representation for typing the valid program. It's a bit shorter on disk (91 bytes) because BASIC V2 uses a "tokenized" representation of programs.



                                    Online Demo



                                    Slightly "ungolfed":



                                    0 inputn:fori=1ton:oniand1goto1:print"<";    :rem read n from user, loop to n, if odd skip "<"
                                    1 on-(i<3)goto2:forj=1.5toi/2:print"-";:next :rem skip for i<3, print (i-1)/2 times "-"
                                    2 on-notiand1goto3:print">"; :rem if even skip ">"
                                    3 print:next :rem newline and next loop iteration






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered 2 hours ago









                                    Felix Palmen

                                    3,261525




                                    3,261525






















                                        up vote
                                        3
                                        down vote














                                        PowerShell, 62 56 50 bytes





                                        param($n)(0..$n|%{($j='-'*$_)+'>';"<$j"})[0..--$n]


                                        Try it online!



                                        Loops from 0 up to input $n, each iteration creating two arrow strings. Those are then indexed with 0..--$n to pull out the correct number of elements.



                                        Saved 6 bytes thanks to KGlasier.






                                        share|improve this answer























                                        • Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                          – KGlasier
                                          2 hours ago










                                        • Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                          – KGlasier
                                          2 hours ago








                                        • 1




                                          @KGlasier Awesome - thanks for the obvious golfs! :)
                                          – AdmBorkBork
                                          2 hours ago















                                        up vote
                                        3
                                        down vote














                                        PowerShell, 62 56 50 bytes





                                        param($n)(0..$n|%{($j='-'*$_)+'>';"<$j"})[0..--$n]


                                        Try it online!



                                        Loops from 0 up to input $n, each iteration creating two arrow strings. Those are then indexed with 0..--$n to pull out the correct number of elements.



                                        Saved 6 bytes thanks to KGlasier.






                                        share|improve this answer























                                        • Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                          – KGlasier
                                          2 hours ago










                                        • Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                          – KGlasier
                                          2 hours ago








                                        • 1




                                          @KGlasier Awesome - thanks for the obvious golfs! :)
                                          – AdmBorkBork
                                          2 hours ago













                                        up vote
                                        3
                                        down vote










                                        up vote
                                        3
                                        down vote










                                        PowerShell, 62 56 50 bytes





                                        param($n)(0..$n|%{($j='-'*$_)+'>';"<$j"})[0..--$n]


                                        Try it online!



                                        Loops from 0 up to input $n, each iteration creating two arrow strings. Those are then indexed with 0..--$n to pull out the correct number of elements.



                                        Saved 6 bytes thanks to KGlasier.






                                        share|improve this answer















                                        PowerShell, 62 56 50 bytes





                                        param($n)(0..$n|%{($j='-'*$_)+'>';"<$j"})[0..--$n]


                                        Try it online!



                                        Loops from 0 up to input $n, each iteration creating two arrow strings. Those are then indexed with 0..--$n to pull out the correct number of elements.



                                        Saved 6 bytes thanks to KGlasier.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited 2 hours ago

























                                        answered 2 hours ago









                                        AdmBorkBork

                                        26k364226




                                        26k364226












                                        • Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                          – KGlasier
                                          2 hours ago










                                        • Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                          – KGlasier
                                          2 hours ago








                                        • 1




                                          @KGlasier Awesome - thanks for the obvious golfs! :)
                                          – AdmBorkBork
                                          2 hours ago


















                                        • Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                          – KGlasier
                                          2 hours ago










                                        • Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                          – KGlasier
                                          2 hours ago








                                        • 1




                                          @KGlasier Awesome - thanks for the obvious golfs! :)
                                          – AdmBorkBork
                                          2 hours ago
















                                        Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                        – KGlasier
                                        2 hours ago




                                        Messing around with my own solution I found a way to cut a few bytes on yours: Can save 4 bytes by wrapping the loop in brackets and indexing directly. ie param($n)(0..$n|%{($j='-'*$_++)+'>';"<$j"})[0..--$n]. So now you don't have to write $x twice.
                                        – KGlasier
                                        2 hours ago












                                        Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                        – KGlasier
                                        2 hours ago






                                        Also you can save two more bytes by not using ++ in ($j='-'*$_++) as you don't use $_ anywhere else.
                                        – KGlasier
                                        2 hours ago






                                        1




                                        1




                                        @KGlasier Awesome - thanks for the obvious golfs! :)
                                        – AdmBorkBork
                                        2 hours ago




                                        @KGlasier Awesome - thanks for the obvious golfs! :)
                                        – AdmBorkBork
                                        2 hours ago










                                        up vote
                                        2
                                        down vote













                                        Pyth, 17 bytes



                                        m_W%d2+*-/d2@"><


                                        Output is a list of strings. Try it online here.



                                        m_W%d2+*-/d2@"><"dQ   Implicit: Q=eval(input())
                                        Trailing "dQ inferred
                                        m Q Map [0-Q), as d, using:
                                        /d2 Floored division of d by 2
                                        *- Repeat "-" the above number of times
                                        + Append to the above...
                                        @"><"d Modular index d into "><" - yields ">" for even d, "<" for odd
                                        - examples: d=4 gives "-->", d=7 gives "---<"
                                        _W Reverse the above if...
                                        %d2 ... (d % 2) != 0
                                        Implicit print result of the map





                                        share|improve this answer

























                                          up vote
                                          2
                                          down vote













                                          Pyth, 17 bytes



                                          m_W%d2+*-/d2@"><


                                          Output is a list of strings. Try it online here.



                                          m_W%d2+*-/d2@"><"dQ   Implicit: Q=eval(input())
                                          Trailing "dQ inferred
                                          m Q Map [0-Q), as d, using:
                                          /d2 Floored division of d by 2
                                          *- Repeat "-" the above number of times
                                          + Append to the above...
                                          @"><"d Modular index d into "><" - yields ">" for even d, "<" for odd
                                          - examples: d=4 gives "-->", d=7 gives "---<"
                                          _W Reverse the above if...
                                          %d2 ... (d % 2) != 0
                                          Implicit print result of the map





                                          share|improve this answer























                                            up vote
                                            2
                                            down vote










                                            up vote
                                            2
                                            down vote









                                            Pyth, 17 bytes



                                            m_W%d2+*-/d2@"><


                                            Output is a list of strings. Try it online here.



                                            m_W%d2+*-/d2@"><"dQ   Implicit: Q=eval(input())
                                            Trailing "dQ inferred
                                            m Q Map [0-Q), as d, using:
                                            /d2 Floored division of d by 2
                                            *- Repeat "-" the above number of times
                                            + Append to the above...
                                            @"><"d Modular index d into "><" - yields ">" for even d, "<" for odd
                                            - examples: d=4 gives "-->", d=7 gives "---<"
                                            _W Reverse the above if...
                                            %d2 ... (d % 2) != 0
                                            Implicit print result of the map





                                            share|improve this answer












                                            Pyth, 17 bytes



                                            m_W%d2+*-/d2@"><


                                            Output is a list of strings. Try it online here.



                                            m_W%d2+*-/d2@"><"dQ   Implicit: Q=eval(input())
                                            Trailing "dQ inferred
                                            m Q Map [0-Q), as d, using:
                                            /d2 Floored division of d by 2
                                            *- Repeat "-" the above number of times
                                            + Append to the above...
                                            @"><"d Modular index d into "><" - yields ">" for even d, "<" for odd
                                            - examples: d=4 gives "-->", d=7 gives "---<"
                                            _W Reverse the above if...
                                            %d2 ... (d % 2) != 0
                                            Implicit print result of the map






                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered 3 hours ago









                                            Sok

                                            3,459722




                                            3,459722






















                                                up vote
                                                2
                                                down vote














                                                Java (JDK), 81 bytes





                                                n->{for(int i=0;i<n;)System.out.printf(i%2<1?"<%s%n":"%s>%n","-".repeat(i++/2));}


                                                Try it online!



                                                Explanations



                                                n->{                  // int-accepting consumer
                                                for(int i=0;i<n;) // for each i from 0 to n-1 included
                                                System.out.printf( // output on stdout with a pattern
                                                i%2<1 // if i is even:
                                                ?"<%s%n" // use the left-arrow pattern
                                                :"%s>%n", // else: use the right-arrow pattern
                                                "-".repeat(i++/2) // fill the pattern with i/2 dashes, and increment i
                                                ); //
                                                } //





                                                share|improve this answer



























                                                  up vote
                                                  2
                                                  down vote














                                                  Java (JDK), 81 bytes





                                                  n->{for(int i=0;i<n;)System.out.printf(i%2<1?"<%s%n":"%s>%n","-".repeat(i++/2));}


                                                  Try it online!



                                                  Explanations



                                                  n->{                  // int-accepting consumer
                                                  for(int i=0;i<n;) // for each i from 0 to n-1 included
                                                  System.out.printf( // output on stdout with a pattern
                                                  i%2<1 // if i is even:
                                                  ?"<%s%n" // use the left-arrow pattern
                                                  :"%s>%n", // else: use the right-arrow pattern
                                                  "-".repeat(i++/2) // fill the pattern with i/2 dashes, and increment i
                                                  ); //
                                                  } //





                                                  share|improve this answer

























                                                    up vote
                                                    2
                                                    down vote










                                                    up vote
                                                    2
                                                    down vote










                                                    Java (JDK), 81 bytes





                                                    n->{for(int i=0;i<n;)System.out.printf(i%2<1?"<%s%n":"%s>%n","-".repeat(i++/2));}


                                                    Try it online!



                                                    Explanations



                                                    n->{                  // int-accepting consumer
                                                    for(int i=0;i<n;) // for each i from 0 to n-1 included
                                                    System.out.printf( // output on stdout with a pattern
                                                    i%2<1 // if i is even:
                                                    ?"<%s%n" // use the left-arrow pattern
                                                    :"%s>%n", // else: use the right-arrow pattern
                                                    "-".repeat(i++/2) // fill the pattern with i/2 dashes, and increment i
                                                    ); //
                                                    } //





                                                    share|improve this answer















                                                    Java (JDK), 81 bytes





                                                    n->{for(int i=0;i<n;)System.out.printf(i%2<1?"<%s%n":"%s>%n","-".repeat(i++/2));}


                                                    Try it online!



                                                    Explanations



                                                    n->{                  // int-accepting consumer
                                                    for(int i=0;i<n;) // for each i from 0 to n-1 included
                                                    System.out.printf( // output on stdout with a pattern
                                                    i%2<1 // if i is even:
                                                    ?"<%s%n" // use the left-arrow pattern
                                                    :"%s>%n", // else: use the right-arrow pattern
                                                    "-".repeat(i++/2) // fill the pattern with i/2 dashes, and increment i
                                                    ); //
                                                    } //






                                                    share|improve this answer














                                                    share|improve this answer



                                                    share|improve this answer








                                                    edited 2 hours ago

























                                                    answered 2 hours ago









                                                    Olivier Grégoire

                                                    8,60711843




                                                    8,60711843






















                                                        up vote
                                                        2
                                                        down vote














                                                        SNOBOL4 (CSNOBOL4), 123 122 118 bytes



                                                        	N =INPUT - 1
                                                        P H =X / 2
                                                        Y =DUPL('-',H)
                                                        OUTPUT =EQ(H,X - H) Y '>' :S(I)
                                                        OUTPUT ='<' Y
                                                        I X =LT(X,N) X + 1 :S(P)
                                                        END


                                                        Try it online!






                                                        share|improve this answer



























                                                          up vote
                                                          2
                                                          down vote














                                                          SNOBOL4 (CSNOBOL4), 123 122 118 bytes



                                                          	N =INPUT - 1
                                                          P H =X / 2
                                                          Y =DUPL('-',H)
                                                          OUTPUT =EQ(H,X - H) Y '>' :S(I)
                                                          OUTPUT ='<' Y
                                                          I X =LT(X,N) X + 1 :S(P)
                                                          END


                                                          Try it online!






                                                          share|improve this answer

























                                                            up vote
                                                            2
                                                            down vote










                                                            up vote
                                                            2
                                                            down vote










                                                            SNOBOL4 (CSNOBOL4), 123 122 118 bytes



                                                            	N =INPUT - 1
                                                            P H =X / 2
                                                            Y =DUPL('-',H)
                                                            OUTPUT =EQ(H,X - H) Y '>' :S(I)
                                                            OUTPUT ='<' Y
                                                            I X =LT(X,N) X + 1 :S(P)
                                                            END


                                                            Try it online!






                                                            share|improve this answer















                                                            SNOBOL4 (CSNOBOL4), 123 122 118 bytes



                                                            	N =INPUT - 1
                                                            P H =X / 2
                                                            Y =DUPL('-',H)
                                                            OUTPUT =EQ(H,X - H) Y '>' :S(I)
                                                            OUTPUT ='<' Y
                                                            I X =LT(X,N) X + 1 :S(P)
                                                            END


                                                            Try it online!







                                                            share|improve this answer














                                                            share|improve this answer



                                                            share|improve this answer








                                                            edited 2 hours ago

























                                                            answered 2 hours ago









                                                            Giuseppe

                                                            16.4k31052




                                                            16.4k31052






















                                                                up vote
                                                                1
                                                                down vote













                                                                JavaScript (ES6), 58 bytes



                                                                Returns a space-separated string.





                                                                n=>(g=p=>n--?k++&1?`<${p} `+g(p+'-'):p+'> '+g(p):'')(k='')


                                                                Try it online!






                                                                share|improve this answer

























                                                                  up vote
                                                                  1
                                                                  down vote













                                                                  JavaScript (ES6), 58 bytes



                                                                  Returns a space-separated string.





                                                                  n=>(g=p=>n--?k++&1?`<${p} `+g(p+'-'):p+'> '+g(p):'')(k='')


                                                                  Try it online!






                                                                  share|improve this answer























                                                                    up vote
                                                                    1
                                                                    down vote










                                                                    up vote
                                                                    1
                                                                    down vote









                                                                    JavaScript (ES6), 58 bytes



                                                                    Returns a space-separated string.





                                                                    n=>(g=p=>n--?k++&1?`<${p} `+g(p+'-'):p+'> '+g(p):'')(k='')


                                                                    Try it online!






                                                                    share|improve this answer












                                                                    JavaScript (ES6), 58 bytes



                                                                    Returns a space-separated string.





                                                                    n=>(g=p=>n--?k++&1?`<${p} `+g(p+'-'):p+'> '+g(p):'')(k='')


                                                                    Try it online!







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered 2 hours ago









                                                                    Arnauld

                                                                    71.3k688298




                                                                    71.3k688298






















                                                                        up vote
                                                                        1
                                                                        down vote














                                                                        Jelly, 15 bytes



                                                                        ị⁾><;’H”-ẋƲṚ⁸¡)


                                                                        Try it online!






                                                                        share|improve this answer

























                                                                          up vote
                                                                          1
                                                                          down vote














                                                                          Jelly, 15 bytes



                                                                          ị⁾><;’H”-ẋƲṚ⁸¡)


                                                                          Try it online!






                                                                          share|improve this answer























                                                                            up vote
                                                                            1
                                                                            down vote










                                                                            up vote
                                                                            1
                                                                            down vote










                                                                            Jelly, 15 bytes



                                                                            ị⁾><;’H”-ẋƲṚ⁸¡)


                                                                            Try it online!






                                                                            share|improve this answer













                                                                            Jelly, 15 bytes



                                                                            ị⁾><;’H”-ẋƲṚ⁸¡)


                                                                            Try it online!







                                                                            share|improve this answer












                                                                            share|improve this answer



                                                                            share|improve this answer










                                                                            answered 2 hours ago









                                                                            Erik the Outgolfer

                                                                            31k429102




                                                                            31k429102






















                                                                                up vote
                                                                                1
                                                                                down vote














                                                                                Haskell, 51 bytes





                                                                                (`take`do b<-['-'<$[1..n]|n<-[0..]];[b++">",'<':b])


                                                                                Try it online!



                                                                                Explanation / Ungolfed



                                                                                Using do-notation saves us a concat, using '-'<$[1..n] is shorter than replicate, and finally using infix-notation allows a pointfree function with take, undoing these would give:



                                                                                f n = take n $ concat [ [b++">", '<':b] | n<-[0..], let b = replicate n '-' ]





                                                                                share|improve this answer



























                                                                                  up vote
                                                                                  1
                                                                                  down vote














                                                                                  Haskell, 51 bytes





                                                                                  (`take`do b<-['-'<$[1..n]|n<-[0..]];[b++">",'<':b])


                                                                                  Try it online!



                                                                                  Explanation / Ungolfed



                                                                                  Using do-notation saves us a concat, using '-'<$[1..n] is shorter than replicate, and finally using infix-notation allows a pointfree function with take, undoing these would give:



                                                                                  f n = take n $ concat [ [b++">", '<':b] | n<-[0..], let b = replicate n '-' ]





                                                                                  share|improve this answer

























                                                                                    up vote
                                                                                    1
                                                                                    down vote










                                                                                    up vote
                                                                                    1
                                                                                    down vote










                                                                                    Haskell, 51 bytes





                                                                                    (`take`do b<-['-'<$[1..n]|n<-[0..]];[b++">",'<':b])


                                                                                    Try it online!



                                                                                    Explanation / Ungolfed



                                                                                    Using do-notation saves us a concat, using '-'<$[1..n] is shorter than replicate, and finally using infix-notation allows a pointfree function with take, undoing these would give:



                                                                                    f n = take n $ concat [ [b++">", '<':b] | n<-[0..], let b = replicate n '-' ]





                                                                                    share|improve this answer















                                                                                    Haskell, 51 bytes





                                                                                    (`take`do b<-['-'<$[1..n]|n<-[0..]];[b++">",'<':b])


                                                                                    Try it online!



                                                                                    Explanation / Ungolfed



                                                                                    Using do-notation saves us a concat, using '-'<$[1..n] is shorter than replicate, and finally using infix-notation allows a pointfree function with take, undoing these would give:



                                                                                    f n = take n $ concat [ [b++">", '<':b] | n<-[0..], let b = replicate n '-' ]






                                                                                    share|improve this answer














                                                                                    share|improve this answer



                                                                                    share|improve this answer








                                                                                    edited 1 hour ago

























                                                                                    answered 2 hours ago









                                                                                    BMO

                                                                                    11k21881




                                                                                    11k21881






















                                                                                        up vote
                                                                                        1
                                                                                        down vote













                                                                                        Haskell, 41 bytes



                                                                                        (`take`g"")
                                                                                        g p=(p++">"):('<':p):g('-':p)


                                                                                        Try it online!



                                                                                        Plain old recursion: start with an emtpy string p, collect p with a right arrow, a left arrow with p and a recursive call with p one - longer. Take the first n items of this list.






                                                                                        share|improve this answer



























                                                                                          up vote
                                                                                          1
                                                                                          down vote













                                                                                          Haskell, 41 bytes



                                                                                          (`take`g"")
                                                                                          g p=(p++">"):('<':p):g('-':p)


                                                                                          Try it online!



                                                                                          Plain old recursion: start with an emtpy string p, collect p with a right arrow, a left arrow with p and a recursive call with p one - longer. Take the first n items of this list.






                                                                                          share|improve this answer

























                                                                                            up vote
                                                                                            1
                                                                                            down vote










                                                                                            up vote
                                                                                            1
                                                                                            down vote









                                                                                            Haskell, 41 bytes



                                                                                            (`take`g"")
                                                                                            g p=(p++">"):('<':p):g('-':p)


                                                                                            Try it online!



                                                                                            Plain old recursion: start with an emtpy string p, collect p with a right arrow, a left arrow with p and a recursive call with p one - longer. Take the first n items of this list.






                                                                                            share|improve this answer














                                                                                            Haskell, 41 bytes



                                                                                            (`take`g"")
                                                                                            g p=(p++">"):('<':p):g('-':p)


                                                                                            Try it online!



                                                                                            Plain old recursion: start with an emtpy string p, collect p with a right arrow, a left arrow with p and a recursive call with p one - longer. Take the first n items of this list.







                                                                                            share|improve this answer














                                                                                            share|improve this answer



                                                                                            share|improve this answer








                                                                                            edited 1 hour ago

























                                                                                            answered 1 hour ago









                                                                                            nimi

                                                                                            31.1k31985




                                                                                            31.1k31985






















                                                                                                up vote
                                                                                                1
                                                                                                down vote













                                                                                                Powershell, 51 bytes





                                                                                                param($n)0..$n|%{'-'*$_+'>';'<'+'-'*$_}|?{$n---gt0}





                                                                                                share|improve this answer

























                                                                                                  up vote
                                                                                                  1
                                                                                                  down vote













                                                                                                  Powershell, 51 bytes





                                                                                                  param($n)0..$n|%{'-'*$_+'>';'<'+'-'*$_}|?{$n---gt0}





                                                                                                  share|improve this answer























                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote










                                                                                                    up vote
                                                                                                    1
                                                                                                    down vote









                                                                                                    Powershell, 51 bytes





                                                                                                    param($n)0..$n|%{'-'*$_+'>';'<'+'-'*$_}|?{$n---gt0}





                                                                                                    share|improve this answer












                                                                                                    Powershell, 51 bytes





                                                                                                    param($n)0..$n|%{'-'*$_+'>';'<'+'-'*$_}|?{$n---gt0}






                                                                                                    share|improve this answer












                                                                                                    share|improve this answer



                                                                                                    share|improve this answer










                                                                                                    answered 1 hour ago









                                                                                                    mazzy

                                                                                                    1,985314




                                                                                                    1,985314






















                                                                                                        up vote
                                                                                                        1
                                                                                                        down vote














                                                                                                        V, 22 bytes



                                                                                                        i>
                                                                                                        <Àñäkjjé-já-ñÀGjdG


                                                                                                        Try it online!






                                                                                                        share|improve this answer

















                                                                                                        • 1




                                                                                                          This looks like some weird scandinavian language
                                                                                                          – Pavel
                                                                                                          1 hour ago















                                                                                                        up vote
                                                                                                        1
                                                                                                        down vote














                                                                                                        V, 22 bytes



                                                                                                        i>
                                                                                                        <Àñäkjjé-já-ñÀGjdG


                                                                                                        Try it online!






                                                                                                        share|improve this answer

















                                                                                                        • 1




                                                                                                          This looks like some weird scandinavian language
                                                                                                          – Pavel
                                                                                                          1 hour ago













                                                                                                        up vote
                                                                                                        1
                                                                                                        down vote










                                                                                                        up vote
                                                                                                        1
                                                                                                        down vote










                                                                                                        V, 22 bytes



                                                                                                        i>
                                                                                                        <Àñäkjjé-já-ñÀGjdG


                                                                                                        Try it online!






                                                                                                        share|improve this answer













                                                                                                        V, 22 bytes



                                                                                                        i>
                                                                                                        <Àñäkjjé-já-ñÀGjdG


                                                                                                        Try it online!







                                                                                                        share|improve this answer












                                                                                                        share|improve this answer



                                                                                                        share|improve this answer










                                                                                                        answered 1 hour ago









                                                                                                        DJMcMayhem

                                                                                                        40.7k11145308




                                                                                                        40.7k11145308








                                                                                                        • 1




                                                                                                          This looks like some weird scandinavian language
                                                                                                          – Pavel
                                                                                                          1 hour ago














                                                                                                        • 1




                                                                                                          This looks like some weird scandinavian language
                                                                                                          – Pavel
                                                                                                          1 hour ago








                                                                                                        1




                                                                                                        1




                                                                                                        This looks like some weird scandinavian language
                                                                                                        – Pavel
                                                                                                        1 hour ago




                                                                                                        This looks like some weird scandinavian language
                                                                                                        – Pavel
                                                                                                        1 hour ago










                                                                                                        up vote
                                                                                                        1
                                                                                                        down vote














                                                                                                        Japt -m, 22 bytes



                                                                                                        u ç'< +Uz ç'- +°Uu ç'>


                                                                                                        Try it online!



                                                                                                        Explanation:



                                                                                                                                  #Implicitly map over the range [0..input) as U
                                                                                                        u #U modulo 2
                                                                                                        ç'< #Print "<" that number of times (i.e. once, only if it's odd)
                                                                                                        + #Concat
                                                                                                        Uz #U integer divide by 2
                                                                                                        ç'- #Print "-" that number of times
                                                                                                        + #Concat
                                                                                                        °Uu #U+1 modulo 2
                                                                                                        ç'> #Print ">" that number of times (i.e. once, only if it's even)





                                                                                                        share|improve this answer

























                                                                                                          up vote
                                                                                                          1
                                                                                                          down vote














                                                                                                          Japt -m, 22 bytes



                                                                                                          u ç'< +Uz ç'- +°Uu ç'>


                                                                                                          Try it online!



                                                                                                          Explanation:



                                                                                                                                    #Implicitly map over the range [0..input) as U
                                                                                                          u #U modulo 2
                                                                                                          ç'< #Print "<" that number of times (i.e. once, only if it's odd)
                                                                                                          + #Concat
                                                                                                          Uz #U integer divide by 2
                                                                                                          ç'- #Print "-" that number of times
                                                                                                          + #Concat
                                                                                                          °Uu #U+1 modulo 2
                                                                                                          ç'> #Print ">" that number of times (i.e. once, only if it's even)





                                                                                                          share|improve this answer























                                                                                                            up vote
                                                                                                            1
                                                                                                            down vote










                                                                                                            up vote
                                                                                                            1
                                                                                                            down vote










                                                                                                            Japt -m, 22 bytes



                                                                                                            u ç'< +Uz ç'- +°Uu ç'>


                                                                                                            Try it online!



                                                                                                            Explanation:



                                                                                                                                      #Implicitly map over the range [0..input) as U
                                                                                                            u #U modulo 2
                                                                                                            ç'< #Print "<" that number of times (i.e. once, only if it's odd)
                                                                                                            + #Concat
                                                                                                            Uz #U integer divide by 2
                                                                                                            ç'- #Print "-" that number of times
                                                                                                            + #Concat
                                                                                                            °Uu #U+1 modulo 2
                                                                                                            ç'> #Print ">" that number of times (i.e. once, only if it's even)





                                                                                                            share|improve this answer













                                                                                                            Japt -m, 22 bytes



                                                                                                            u ç'< +Uz ç'- +°Uu ç'>


                                                                                                            Try it online!



                                                                                                            Explanation:



                                                                                                                                      #Implicitly map over the range [0..input) as U
                                                                                                            u #U modulo 2
                                                                                                            ç'< #Print "<" that number of times (i.e. once, only if it's odd)
                                                                                                            + #Concat
                                                                                                            Uz #U integer divide by 2
                                                                                                            ç'- #Print "-" that number of times
                                                                                                            + #Concat
                                                                                                            °Uu #U+1 modulo 2
                                                                                                            ç'> #Print ">" that number of times (i.e. once, only if it's even)






                                                                                                            share|improve this answer












                                                                                                            share|improve this answer



                                                                                                            share|improve this answer










                                                                                                            answered 1 hour ago









                                                                                                            Kamil Drakari

                                                                                                            2,851416




                                                                                                            2,851416






























                                                                                                                draft saved

                                                                                                                draft discarded




















































                                                                                                                If this is an answer to a challenge…




                                                                                                                • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                                • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                                  Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                                • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                                More generally…




                                                                                                                • …Please make sure to answer the question and provide sufficient detail.


                                                                                                                • …Avoid asking for help, clarification or responding to other answers (use comments instead).






                                                                                                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                                                                                Please pay close attention to the following guidance:


                                                                                                                • Please be sure to answer the question. Provide details and share your research!

                                                                                                                But avoid



                                                                                                                • Asking for help, clarification, or responding to other answers.

                                                                                                                • Making statements based on opinion; back them up with references or personal experience.


                                                                                                                To learn more, see our tips on writing great answers.




                                                                                                                draft saved


                                                                                                                draft discarded














                                                                                                                StackExchange.ready(
                                                                                                                function () {
                                                                                                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f177454%2fdraw-some-expanding-arrows%23new-answer', 'question_page');
                                                                                                                }
                                                                                                                );

                                                                                                                Post as a guest















                                                                                                                Required, but never shown





















































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown

































                                                                                                                Required, but never shown














                                                                                                                Required, but never shown












                                                                                                                Required, but never shown







                                                                                                                Required, but never shown







                                                                                                                Popular posts from this blog

                                                                                                                What visual should I use to simply compare current year value vs last year in Power BI desktop

                                                                                                                Alexandru Averescu

                                                                                                                Trompette piccolo