Poll: Is this question well formatted?
Yes
No
[Show Results]
 
Post Reply 
Text wrap mode
06-25-2021, 09:51 AM
Post: #1
Text wrap mode
Hello

Does hp have some kind of text wrap mode so that output such as 654765675865784866587657655555465 is displayed as:
6547656758
6578486658
7657655555
465
Instead of a list that goes off screen?

Use case: I need to find the divisors using idivis() of a four digit number and then examine that list to determine the factors that sum to a particular value.
Find all posts by this user
Quote this message in a reply
06-27-2021, 11:13 PM (This post was last modified: 06-27-2021 11:19 PM by matalog.)
Post: #2
RE: Text wrap mode
You could display a number split into a set amount of numbers per line, as a string that was suitably formatted, using MSGBOX(), that would suffice to view what you have asked for.

If you want to use the numbers, you could set the list to be displayed around the screen, by programming the location of output text.

If you need to use the numbers you are displaying, you might be better to have them as a menu, where you can select them, after the list is converted into a menu, and a string, using DRAWMENU(), multiple times if necessary.
Find all posts by this user
Quote this message in a reply
06-28-2021, 01:57 AM
Post: #3
RE: Text wrap mode
Thanks, I found the answer was to manipulate lists (see photos)


Attached File(s) Thumbnail(s)
       
Find all posts by this user
Quote this message in a reply
06-28-2021, 11:40 AM
Post: #4
RE: Text wrap mode
Unlike Python, CAS string is 1-based:

CAS> wrap(s,n) := transpose(makelist(k->s[k:k+n],1,len(s)+1,n))
CAS> s := "654765675865784866587657655555465"
CAS> wrap(s, 10)

\(\left(\begin{array}{c}
\mathrm{6547656758} \\
\mathrm{6578486658} \\
\mathrm{7657655555} \\
\mathrm{465}
\end{array}\right) \)
Find all posts by this user
Quote this message in a reply
06-28-2021, 06:40 PM
Post: #5
RE: Text wrap mode
CAS> unwrap:=(sw)->(Σ(sw[n],n,1,length(sw)))[1]

CAS> unwrap(wrap(s,10))

"654765675865784866587657655555465"

-road
Find all posts by this user
Quote this message in a reply
06-29-2021, 12:51 PM
Post: #6
RE: Text wrap mode
(06-28-2021 11:40 AM)Albert Chan Wrote:  Unlike Python, CAS string is 1-based:

CAS> wrap(s,n) := transpose(makelist(k->s[k:k+n],1,len(s)+1,n))
CAS> s := "654765675865784866587657655555465"
CAS> wrap(s, 10)

\(\left(\begin{array}{c}
\mathrm{6547656758} \\
\mathrm{6578486658} \\
\mathrm{7657655555} \\
\mathrm{465}
\end{array}\right) \)
That works in XCas but gives syntax error on prime, with cursor at s[k:k+n ☆ ]
Find all posts by this user
Quote this message in a reply
06-29-2021, 05:36 PM
Post: #7
RE: Text wrap mode
It works on my calculator. Make sure you are using makelist() and not MAKELIST()

-road
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)