Poll: Is this question well formatted? Yes No

 Text wrap mode
06-25-2021, 09:51 AM
Post: #1
 DuckEgg Junior Member Posts: 3 Joined: Jun 2021
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.
06-27-2021, 11:13 PM (This post was last modified: 06-27-2021 11:19 PM by matalog.)
Post: #2
 matalog Senior Member Posts: 349 Joined: May 2021
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.
06-28-2021, 01:57 AM
Post: #3
 DuckEgg Junior Member Posts: 3 Joined: Jun 2021
RE: Text wrap mode
Thanks, I found the answer was to manipulate lists (see photos)

Attached File(s) Thumbnail(s)

06-28-2021, 11:40 AM
Post: #4
 Albert Chan Senior Member Posts: 2,650 Joined: Jul 2018
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)$$
06-28-2021, 06:40 PM
Post: #5
 roadrunner Senior Member Posts: 446 Joined: Jun 2015
RE: Text wrap mode
CAS> unwrap:=(sw)->(Σ(sw[n],n,1,length(sw)))[1]

CAS> unwrap(wrap(s,10))

"654765675865784866587657655555465"

-road
06-29-2021, 12:51 PM
Post: #6
 Stevetuc Senior Member Posts: 313 Joined: Jan 2014
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 ☆ ]
06-29-2021, 05:36 PM
Post: #7
 roadrunner Senior Member Posts: 446 Joined: Jun 2015
RE: Text wrap mode
It works on my calculator. Make sure you are using makelist() and not MAKELIST()

-road
 « Next Oldest | Next Newest »

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