How to take list to number?











up vote
1
down vote

favorite












I have a list such as:



a = {1, 2, 4, 3};


and I want to get the 'number' of the list. For this example, I want to get this number: 1243. I do not know how to get it easily. For now, my solution is:
a[[1]]*10^3+a[[2]]*10^2+a[[3]]*10^1+a[[4]];
It works. But it is too complex. I want to know a way more convenient.










share|improve this question









New contributor




user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    1
    down vote

    favorite












    I have a list such as:



    a = {1, 2, 4, 3};


    and I want to get the 'number' of the list. For this example, I want to get this number: 1243. I do not know how to get it easily. For now, my solution is:
    a[[1]]*10^3+a[[2]]*10^2+a[[3]]*10^1+a[[4]];
    It works. But it is too complex. I want to know a way more convenient.










    share|improve this question









    New contributor




    user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a list such as:



      a = {1, 2, 4, 3};


      and I want to get the 'number' of the list. For this example, I want to get this number: 1243. I do not know how to get it easily. For now, my solution is:
      a[[1]]*10^3+a[[2]]*10^2+a[[3]]*10^1+a[[4]];
      It works. But it is too complex. I want to know a way more convenient.










      share|improve this question









      New contributor




      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I have a list such as:



      a = {1, 2, 4, 3};


      and I want to get the 'number' of the list. For this example, I want to get this number: 1243. I do not know how to get it easily. For now, my solution is:
      a[[1]]*10^3+a[[2]]*10^2+a[[3]]*10^1+a[[4]];
      It works. But it is too complex. I want to know a way more convenient.







      functions special-functions






      share|improve this question









      New contributor




      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago









      Αλέξανδρος Ζεγγ

      3,6431927




      3,6431927






      New contributor




      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      user61054

      161




      161




      New contributor




      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user61054 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          2
          down vote













          a={1,2,4,3};
          FromDigits[a]

          (* 1234 *)





          share|improve this answer




























            up vote
            1
            down vote













            Other than the built-in FromDigits, we can build our wheel



            Fold[{10, 1}.{##} &, a]





            share|improve this answer




























              up vote
              0
              down vote













              Best way would be to use build-in function FromDigits as shown above.



              But just in case you'd like a convoluted way to do it, here is another option



              a = {1, 2, 4, 3};
              ToExpression[StringJoin[ToString[#] & /@ a]]


              Mathematica graphics






              share|improve this answer




























                up vote
                0
                down vote













                These are some methods I would not recommend:



                lst = {1, 2, 3, 4};

                f = (Curry[StringRiffle][""] /* ToExpression);

                g = (Through[{
                Identity,
                Length /* Range /* Reverse /* Curry[Plus][-1] /* Curry[Power, 2][10]
                }[#]] & /* MapThread[Times] /* Total);

                f[lst] (* 1234 *)
                g[lst] (* 1234 *)




                share





















                  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.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "387"
                  };
                  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
                  });


                  }
                  });






                  user61054 is a new contributor. Be nice, and check out our Code of Conduct.










                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function () {
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f187524%2fhow-to-take-list-to-number%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest















                  Required, but never shown

























                  4 Answers
                  4






                  active

                  oldest

                  votes








                  4 Answers
                  4






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes








                  up vote
                  2
                  down vote













                  a={1,2,4,3};
                  FromDigits[a]

                  (* 1234 *)





                  share|improve this answer

























                    up vote
                    2
                    down vote













                    a={1,2,4,3};
                    FromDigits[a]

                    (* 1234 *)





                    share|improve this answer























                      up vote
                      2
                      down vote










                      up vote
                      2
                      down vote









                      a={1,2,4,3};
                      FromDigits[a]

                      (* 1234 *)





                      share|improve this answer












                      a={1,2,4,3};
                      FromDigits[a]

                      (* 1234 *)






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered 1 hour ago









                      Mike Honeychurch

                      30.8k268143




                      30.8k268143






















                          up vote
                          1
                          down vote













                          Other than the built-in FromDigits, we can build our wheel



                          Fold[{10, 1}.{##} &, a]





                          share|improve this answer

























                            up vote
                            1
                            down vote













                            Other than the built-in FromDigits, we can build our wheel



                            Fold[{10, 1}.{##} &, a]





                            share|improve this answer























                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              Other than the built-in FromDigits, we can build our wheel



                              Fold[{10, 1}.{##} &, a]





                              share|improve this answer












                              Other than the built-in FromDigits, we can build our wheel



                              Fold[{10, 1}.{##} &, a]






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered 1 hour ago









                              Αλέξανδρος Ζεγγ

                              3,6431927




                              3,6431927






















                                  up vote
                                  0
                                  down vote













                                  Best way would be to use build-in function FromDigits as shown above.



                                  But just in case you'd like a convoluted way to do it, here is another option



                                  a = {1, 2, 4, 3};
                                  ToExpression[StringJoin[ToString[#] & /@ a]]


                                  Mathematica graphics






                                  share|improve this answer

























                                    up vote
                                    0
                                    down vote













                                    Best way would be to use build-in function FromDigits as shown above.



                                    But just in case you'd like a convoluted way to do it, here is another option



                                    a = {1, 2, 4, 3};
                                    ToExpression[StringJoin[ToString[#] & /@ a]]


                                    Mathematica graphics






                                    share|improve this answer























                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      Best way would be to use build-in function FromDigits as shown above.



                                      But just in case you'd like a convoluted way to do it, here is another option



                                      a = {1, 2, 4, 3};
                                      ToExpression[StringJoin[ToString[#] & /@ a]]


                                      Mathematica graphics






                                      share|improve this answer












                                      Best way would be to use build-in function FromDigits as shown above.



                                      But just in case you'd like a convoluted way to do it, here is another option



                                      a = {1, 2, 4, 3};
                                      ToExpression[StringJoin[ToString[#] & /@ a]]


                                      Mathematica graphics







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered 20 mins ago









                                      Nasser

                                      57.1k486205




                                      57.1k486205






















                                          up vote
                                          0
                                          down vote













                                          These are some methods I would not recommend:



                                          lst = {1, 2, 3, 4};

                                          f = (Curry[StringRiffle][""] /* ToExpression);

                                          g = (Through[{
                                          Identity,
                                          Length /* Range /* Reverse /* Curry[Plus][-1] /* Curry[Power, 2][10]
                                          }[#]] & /* MapThread[Times] /* Total);

                                          f[lst] (* 1234 *)
                                          g[lst] (* 1234 *)




                                          share

























                                            up vote
                                            0
                                            down vote













                                            These are some methods I would not recommend:



                                            lst = {1, 2, 3, 4};

                                            f = (Curry[StringRiffle][""] /* ToExpression);

                                            g = (Through[{
                                            Identity,
                                            Length /* Range /* Reverse /* Curry[Plus][-1] /* Curry[Power, 2][10]
                                            }[#]] & /* MapThread[Times] /* Total);

                                            f[lst] (* 1234 *)
                                            g[lst] (* 1234 *)




                                            share























                                              up vote
                                              0
                                              down vote










                                              up vote
                                              0
                                              down vote









                                              These are some methods I would not recommend:



                                              lst = {1, 2, 3, 4};

                                              f = (Curry[StringRiffle][""] /* ToExpression);

                                              g = (Through[{
                                              Identity,
                                              Length /* Range /* Reverse /* Curry[Plus][-1] /* Curry[Power, 2][10]
                                              }[#]] & /* MapThread[Times] /* Total);

                                              f[lst] (* 1234 *)
                                              g[lst] (* 1234 *)




                                              share












                                              These are some methods I would not recommend:



                                              lst = {1, 2, 3, 4};

                                              f = (Curry[StringRiffle][""] /* ToExpression);

                                              g = (Through[{
                                              Identity,
                                              Length /* Range /* Reverse /* Curry[Plus][-1] /* Curry[Power, 2][10]
                                              }[#]] & /* MapThread[Times] /* Total);

                                              f[lst] (* 1234 *)
                                              g[lst] (* 1234 *)





                                              share











                                              share


                                              share










                                              answered 8 mins ago









                                              Shredderroy

                                              1,4181115




                                              1,4181115






















                                                  user61054 is a new contributor. Be nice, and check out our Code of Conduct.










                                                  draft saved

                                                  draft discarded


















                                                  user61054 is a new contributor. Be nice, and check out our Code of Conduct.













                                                  user61054 is a new contributor. Be nice, and check out our Code of Conduct.












                                                  user61054 is a new contributor. Be nice, and check out our Code of Conduct.
















                                                  Thanks for contributing an answer to Mathematica Stack Exchange!


                                                  • 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.


                                                  Use MathJax to format equations. MathJax reference.


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





                                                  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%2fmathematica.stackexchange.com%2fquestions%2f187524%2fhow-to-take-list-to-number%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

                                                  404 Error Contact Form 7 ajax form submitting

                                                  How to know if a Active Directory user can login interactively

                                                  Refactoring coordinates for Minecraft Pi buildings written in Python