Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Align-columns/J/align-columns-1.j
Normal file
18
Task/Align-columns/J/align-columns-1.j
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'LEFT CENTER RIGHT'=: i.3 NB. justification constants
|
||||
|
||||
NB.* alignCols v Format delimited text in justified columns
|
||||
NB. y: text to format
|
||||
NB. rows marked by last character in text
|
||||
NB. columns marked by $
|
||||
NB. optional x: justification. Default is LEFT
|
||||
NB. result: text table
|
||||
alignCols=: verb define
|
||||
LEFT alignCols y NB. default
|
||||
:
|
||||
global=. dyad def'9!:x y'each
|
||||
oldbox=. 6 16 global '';'' NB. save settings
|
||||
7 17 global (11#' ');,~x NB. apply new settings
|
||||
result=. _2{:\ ": <;._2 @:,&'$';._2 y NB. parse & format text
|
||||
7 17 global oldbox NB. restore settings
|
||||
result
|
||||
)
|
||||
24
Task/Align-columns/J/align-columns-2.j
Normal file
24
Task/Align-columns/J/align-columns-2.j
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
text=: noun define
|
||||
Given$a$text$file$of$many$lines,$where$fields$within$a$line$
|
||||
are$delineated$by$a$single$'dollar'$character,$write$a$program
|
||||
that$aligns$each$column$of$fields$by$ensuring$that$words$in$each$
|
||||
column$are$separated$by$at$least$one$space.
|
||||
Further,$allow$for$each$word$in$a$column$to$be$either$left$
|
||||
justified,$right$justified,$or$center$justified$within$its$column.
|
||||
)
|
||||
|
||||
alignCols text NB. default justification
|
||||
Given a text file of many lines, where fields within a line
|
||||
are delineated by a single 'dollar' character, write a program
|
||||
that aligns each column of fields by ensuring that words in each
|
||||
column are separated by at least one space.
|
||||
Further, allow for each word in a column to be either left
|
||||
justified, right justified, or center justified within its column.
|
||||
|
||||
CENTER alignCols text NB. specify desired justification as left argument
|
||||
Given a text file of many lines, where fields within a line
|
||||
are delineated by a single 'dollar' character, write a program
|
||||
that aligns each column of fields by ensuring that words in each
|
||||
column are separated by at least one space.
|
||||
Further, allow for each word in a column to be either left
|
||||
justified, right justified, or center justified within its column.
|
||||
Loading…
Add table
Add a link
Reference in a new issue