Thomas The proposed solution makes a conversion from numerical to characters:
datatype smoutput ":123 NB. smoutput displays arg and 123 NB. returns empty of the same type literal You could also separate the digits and keep them as integers with Antibase-Base: datatype smoutput 10 10 10#:123 1 2 3 integer 10 10 10#.|.10 10 10#:123 321 |. &. (10 10 10 & #:) 123 321 In this last expression, parentheses are necessary, since & has "long left scope". Without them, 10 10 10 becomes an (illegal) arg to &. Under. Good luck! Le 2019-04-09 à 19:55, Linda Alvord a écrit : > 2+".|. ":246531 > 135644 > > > > One way. > > Linda > Sent from my Verizon, Samsung Galaxy smartphone > > > -------- Original message -------- > From: Thomas Bulka <thomas.bu...@posteo.de> > Date: 4/9/19 4:07 PM (GMT-05:00) > To: programm...@jsoftware.com > Subject: [Jprogramming] Beginner's Question: How to reverse a number's digits? > > Hi everyone, > > while working my way through the problems on Project Euler, I stumbled > over a question which might be completely trivial - however, I have not > been able to find an answer, yet. > > Say, I want to reverse the digits of a number (that is, I want to turn > 123 into 321) - how do I do that? Of course, |. does not work, since 123 > is not an array. Is there a way to turn a number into a string (and the > other way round). Or is there a better way? > > Probably I've been looking in the wrong direction, so I'd very much > appreciate any help on that topic. > > Thank you very much in advance! > > Regards, > > Thomas > > ---------------------------------------------------------------------- > For information about J forums see > https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7Cf69f3c61d2fd425a0ea308d6bd26fc8f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636904372470654581&sdata=FLaoBJxFMS39WvxI7mVKWUuj%2B6BZJ2vPUXq1ZCpWgDI%3D&reserved=0 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm