| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| The formatting facilities in J appear to be very limited; there is no equivalent to APL2 picture format, and 8!:n seems to be a small subset of #FMT. In particular, 8!:n seems to be designed to format only numbers, with no provision for interspersing numbers with text. There seem to be no equivalents to the A, G<...>, and <...> (insert text) specifiers for #FMT, nor is there a Z qualifier for zero padding. I can display the time of day in a readable form by entering something like }.,'r<:00>3.0' (8!:2) <. _3{. 6!:0 '' but this wouldn't work for, say, an angle in degrees, minutes, and seconds since angles can be negative and the negative sign would be inserted after the zero background padding rather than before it. I would like to see 8!:n beefed up to include more of the capabilities of #FMT in order to simplify the task of porting APL code to J. --- Brian |
|
#2
| |||
| |||
| On Dec 16, 10:01 pm, brian.b.mcguinn...@lmco.com wrote: > The formatting facilities in J appear to be very limited; there is no > equivalent to APL2 picture format, > and 8!:n seems to be a small subset of #FMT. In particular, 8!:n > seems to be designed to format only > numbers, with no provision for interspersing numbers with text. There > seem to be no equivalents to the > A, G<...>, and <...> (insert text) specifiers for #FMT, nor is there a > Z qualifier for zero padding. > > I can display the time of day in a readable form by entering something > like}.,'r<:00>3.0' (8!:2) <. _3{. 6!:0 '' > > but this wouldn't work for, say, an angle in degrees, minutes, and > seconds since angles can be negative > and the negative sign would be inserted after the zero background > padding rather than before it. > > I would like to see 8!:n beefed up to include more of the capabilities > of #FMT in order to simplify the > task of porting APL code to J. > > --- Brian There are several utilities that do format. As examples there are utilities in dates, format, printf that may be of interest for you. Examples of printf can be seen using the printf lab. Verb datefmt may also be of interest to you. It is helpful to use find in files and look for format in system The dyadic ": in the dictionary may give you what you want |
|
#3
| |||
| |||
| On Dec 17, 6:01 am, brian.b.mcguinn...@lmco.com wrote: > The formatting facilities in J appear to be very limited; there is no > equivalent to APL2 picture format, > and 8!:n seems to be a small subset of #FMT. In particular, 8!:n > seems to be designed to format only > numbers, with no provision for interspersing numbers with text. There > seem to be no equivalents to the > A, G<...>, and <...> (insert text) specifiers for #FMT, nor is there a > Z qualifier for zero padding. > > I can display the time of day in a readable form by entering something > like}.,'r<:00>3.0' (8!:2) <. _3{. 6!:0 '' > > but this wouldn't work for, say, an angle in degrees, minutes, and > seconds since angles can be negative > and the negative sign would be inserted after the zero background > padding rather than before it. > > I would like to see 8!:n beefed up to include more of the capabilities > of #FMT in order to simplify the > task of porting APL code to J. > > --- Brian The 8!: family was modelled pretty closely on []fmt (see definition in http://www.jsoftware.com/help/dictionary/dx008.htm ). It is a subset in some respects, a superset in others. I suggest that you post some examples of your requirements to the J programming forum. Chris |
|
#4
| |||
| |||
| Thanks for the suggestions. I will look into these options. It just surprises me that, given the frequency with which people need to intermingle text and numbers in the output from computer programs, and the support given for this in many languages, that it is not supported by 8!:n in J. --- Brian |
|
#5
| |||
| |||
| On Dec 19, 9:58 am, brian.b.mcguinn...@lmco.com wrote: > Thanks for the suggestions. I will look into these options. > It just surprises me that, given the frequency with which > people need to intermingle text and numbers in the output > from computer programs, and the support given for this in > many languages, that it is not supported by 8!:n in J. Certainly you can mix text and numbers: (8!:2) 123;' Main St. ';12345 123 Main St. 12345 It is hard to answer vague complaints - much better that you give specific examples of what you want in the J programming forum. |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.