├── .gitignore ├── AppUtils.txt ├── DevUtils.txt ├── LICENSE ├── README.md └── Utils.apl /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.bak 3 | 4 | -------------------------------------------------------------------------------- /AppUtils.txt: -------------------------------------------------------------------------------- 1 | 2 | Application runtime utilities 3 | ----------------------------- 4 | 5 | As stated in Utils.txt: 6 | 7 | 8 | Typically an application would start with a function named 'start', 9 | and ⎕LX←'Auto'. When an application is loaded, Auto gets run in order 10 | to initialize certain things, and then the application specific entry 11 | point 'start' is called. Following this procedure is necessary in 12 | order for the Application runtime utilities to function. This is 13 | because they assume certain initialization had taken place before they 14 | are called. 15 | 16 | Calling Auto without a start function causes the application to stop 17 | with a SI. At this point the Application runtime functions may be 18 | used since Auto already initialized everything. The Generic utilities 19 | and Development utilities do not have this requirement and may be used 20 | at any point. 21 | 22 | 23 | User I/O utilities (a subset of Application runtime utilities) 24 | ------------------ 25 | 26 | z←EHN v 27 | 28 | End, Help, or Nothing. This function takes a string vector and returns 29 | a three element numeric vector based on the string contents as follows: 30 | 31 | 32 | 1 0 0 = the string has 'end' 33 | 0 1 0 = the string has 'help' 34 | 0 0 1 = the string is empty 35 | 0 0 0 = the string has something else 36 | 37 | This function is used in conjunction with the other input functions 38 | (Pic, Pis, Pin, etc.) in order to cause the system to branch to a 39 | specific location in response to pre-defined user inputs. For example: 40 | 41 | end the signifies to exit a question and cause the program to go back to the 42 | previous question 43 | 44 | help this causes the system to branch to a help display message (and would normally 45 | return to the question) 46 | 47 | (nothing) this generally signifies to move forward without providing a response 48 | 49 | This function is used a lot. Typical usage: 50 | 51 | EN4:... 52 | ... 53 | EN5:→(EHN name←1 20 Pis 'Enter your name')/EN4, HP5, EN6 54 | EN6:... 55 | ... 56 | →0 57 | HP5:'My help text' 58 | →EN5 59 | 60 | 61 | --- 62 | 63 | z←s Pic p 64 | ⍝ Input single character 65 | ⍝ s = character vector of acceptible characters 66 | ⍝ p = prompt 67 | ⍝ z = binary vector = end, help, nothing, s[1], s[2], etc. 68 | 69 | Example usage: 70 | 71 | EN4:... 72 | ... 73 | EN5:→('yn' Pic 'Do you wish to continue')/EN4,HP5,EN4,EN6,EN4 74 | EN6:... 75 | -------------------------------------------------------------------------------- /DevUtils.txt: -------------------------------------------------------------------------------- 1 | 2 | Development utilities 3 | --------------------- 4 | 5 | These functions generally start with WSU∆ 6 | 7 | WSU∆DisplayFns f 8 | 9 | Display functions to the screen. f is a comma seperated list of 10 | function names to display. 11 | 12 | --- 13 | 14 | z←WSU∆FindCalls f 15 | 16 | Find all the functions a given function calls. f is the string name 17 | of a function. A list of functions the function named in f calls is 18 | returned as a character matrix. 19 | 20 | --- 21 | 22 | WSU∆PrintFunction f 23 | 24 | This prints a function definition to the printer. f is the string 25 | name of the function to print. 26 | 27 | --- 28 | 29 | WSU∆PrintWS flg 30 | 31 | This function prints an entire workspace to the default printer. flg values 32 | are as follows: 33 | 34 | 0 = print all functions 35 | 1 = print all functions except those that start with ∆ 36 | 2 = print all functions except those that start with a capitol letter 37 | 3 = print all functions except those that start with ∆ or a capitol letter 38 | 39 | Basically, you'd use 0 to print everything and 3 to excluse the utilities. 40 | 41 | --- 42 | 43 | f WSU∆ReplaceFun s 44 | 45 | This function performs a search and replace operation on a single APL 46 | function. f is the string name of the function to be operated on. s 47 | is the search and replace string that uses a helper function named 48 | ∆RD. For example: 49 | 50 | 'myFun' WSU∆ReplaceFun 'fromStr' ∆RD 'toStr' 51 | 52 | --- 53 | 54 | f WSU∆ReplaceWS t 55 | 56 | Replace string f with string t in all functions in the workspace. 57 | 58 | --- 59 | 60 | s WSU∆SearchFuns fl 61 | 62 | Search a specified list of functions for a specified string. s is the 63 | string to search for. fl is a comma seperated list of function names 64 | to search. 65 | 66 | --- 67 | 68 | WSU∆SearchWS s 69 | 70 | 71 | Search all functions in the workspace for the string s. 72 | 73 | 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | Documentation on the Utils APL workspace 3 | 4 | by Blake McBride 5 | 6 | 7 | 8 | 9 | I programmed business applications (as opposed to scientific or 10 | mathematical applications) in APL from 1980 to 1985. During that time, 11 | I developed a variety of utilities to make the construction of 12 | business applications easy. This repository represents my port of 13 | those utilities to GNU APL. 14 | 15 | The workspace contains three classes of functions as follows: 16 | 17 | 1. Application runtime utilities 18 | 2. Generic utilities 19 | 3. Development utilities 20 | 21 | In general, all of the utility functions start in an uppercase letter. 22 | It is assumed that application functions would all start with a 23 | lowercase letter in order to avoid conflicts. 24 | 25 | Typically an application would start with a function named 'start', 26 | and ⎕LX←'Auto'. When an application is loaded, Auto gets run in order 27 | to initialize certain things, and then the application specific entry 28 | point 'start' is called. Following this procedure is necessary in 29 | order for the Application runtime utilities to function. This is 30 | because they assume certain initialization had taken place before they 31 | are called. 32 | 33 | Calling Auto without a start function causes the application to stop 34 | with a SI. At this point the Application runtime functions may be 35 | used since Auto already initialized everything. The Generic utilities 36 | and Development utilities do not have this requirement and may be used 37 | at any point. 38 | 39 | Most of the Application runtime utilities are used for I/O such as 40 | input and output interaction with the user. The Generic utilities are 41 | used to handle generic functionality such as formatting a date, date 42 | conversion, stripping or parsing a string, etc. These all work 43 | stand-alone (without any pre-existing context). Lastly, the 44 | Development utilities are used by a developer to do things like print 45 | a function or workspace, search or search and replace code in a 46 | workspeace, etc. 47 | 48 | Although I have no intention of exhaustively documenting everything, I 49 | do hope to document enough to provide a good start at using these 50 | utilities. As a subject of another document, I hope to provide a 51 | rationale for the use of APL in business applications - even today! 52 | 53 | The following documents are provided: 54 | 55 | DevUtils.txt Development utilities documentation 56 | 57 | AppUtils.txt Application runtime utilities 58 | 59 | Source code at: [https://github.com/blakemcbride/APLUtils](https://github.com/blakemcbride/APLUtils) 60 | 61 | 62 | -------------------------------------------------------------------------------- /Utils.apl: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/apl --script 2 | ⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝ 3 | ⍝ ⍝ 4 | ⍝ Utils.apl 2022-03-22 06:23:09 (GMT-6) ⍝ 5 | ⍝ ⍝ 6 | ⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝⍝ 7 | 8 | ∇z←d AddDays n 9 | z←CAL n+JUL d 10 | ∇ 11 | 12 | ∇Ail ln;s;q 13 | →(1=ln←⌈ln)/LP1 14 | O(6↑'[',(⍕ln-1),']'),Mat[ln-1;] 15 | LP1:→(0=⍴q←Eoi 6↑'[',(⍕ln),']')/0 16 | →((1↓⍴Mat)=s←(⍴q)⌈1↓⍴Mat)/EN1 17 | Mat←((1↑⍴Mat),s)↑Mat 18 | EN1:Mat←(ln≠⍳1+1↑⍴Mat)⍀Mat 19 | Mat[ln;]←s↑q 20 | ln←ln+1 21 | →LP1 22 | ∇ 23 | 24 | ∇z←Aln t;i;n 25 | z←((⍴n)⍴(,(-+/∧\⌽i)⌽i)\(,i←n≠' ')/,n←'[',(⍕(n,1)⍴¯1+⍳n←1↑⍴t),']'),' ',t 26 | ⍝ t = ⎕CR of a function 27 | ⍝ z = t with line numbers in brackets added 28 | ∇ 29 | 30 | ∇Auto;Pn;Lu;Lib;Dn;Fm;Fv;Delim;Cms;Pad;Pt 31 | →(1=⍴⎕LC)/⎕LC[1]+2 32 | →0,0⍴⎕←'State indicator must be lowered.' 33 | ⎕LX←'Auto',0⍴⎕EX'FILE_IO',0⍴⎕EX'SQL' 34 | ⎕PW←132 35 | Delim←,':' ◊ Cms←'' ◊ Pad←' ' 36 | Lu←1 37 | Lib←⍬ 38 | Dn←0 39 | ⍝ Pn←0 0 40 | ⍝ Enter 41 | start 42 | Lib←0⍴⎕EX'FILE_IO',0⍴⎕EX'SQL' 43 | ∇ 44 | 45 | ∇z←Box x 46 | z←⊂(⍴x)(,x) 47 | ∇ 48 | 49 | ∇z←CAL d;y 50 | z←⌊(d-⌊365.25×y←⌊((d←,d)-122.1)÷365.25)÷30.6001 51 | z←100 100 100⊥⍉(y+∨/z∘.=1 2),(z←z-1+12×∨/z∘.=14 15),[1.5]d-(⌊365.25×y)+⌊30.6001×z 52 | ∇ 53 | 54 | ∇z←CCJ a 55 | z←(⌈0.5×(+/∧\z)-+/∧\⌽z←' '=a)⌽a 56 | ∇ 57 | 58 | ∇z←n CJ x 59 | z←((0⌈⌊0.5×n-⍴x)⍴' '),x←(¯1+(x≠' ')⍳1)↓(-((⌽x≠' ')⍳1)-1)↓x 60 | ∇ 61 | 62 | ∇z←CS x 63 | z←(¯1+(' '≠x)⍳1)↓(1-(' '≠⌽x)⍳1)↓x 64 | ∇ 65 | 66 | ∇z←CSV∆Parse v;y;d;q 67 | d←',' 68 | q←'"' 69 | ⍝ Break apart columns into separate arrays 70 | ⍝ z←1↓1↓¨(1++\(z∊d)>≠\z∊q)⊂z←(1↑d),(1↑d),v 71 | ⍝ Or, break apart columns into separate arrays, normalize embedded quotes, and remove surrounding quotes 72 | z←{((⍴⍵)⍴y,((0⌈¯2+⍴⍵)⍴1),y←~((¯1↑⍵)∊q)∧((1↑⍵)∊q)∧1<⍴⍵)/⍵←(-y)↓(⍲/(¯1+⍳⍴⍵)⌽(0 ¯1↓0,0 1↓(((⍴⍵)⍴q)∘.=⍵)),0)/⍵←⍵,(y←1=⍴,⍵)⍴' '}¨z←1↓1↓¨(1++\(z∊d)>≠\z∊q)⊂z←(1↑d),(1↑d),v 73 | ∇ 74 | 75 | ∇z←CSV∆dequote a;y;q 76 | q←'"' 77 | ⍝ remove embedded quotes from a string 78 | z←(-y)↓(⍲/(¯1+⍳⍴z)⌽(0 ¯1↓0,0 1↓(((⍴z)⍴q)∘.=z)),0)/z←a,(y←1=⍴,a)⍴' ' 79 | ⍝ remove surrounding quotes 80 | z←((⍴z)⍴y,((0⌈¯2+⍴z)⍴1),y←~(q=¯1↑z)∧(q=1↑z)∧1<⍴z)/z 81 | ∇ 82 | 83 | ∇z←L Catc R 84 | z←((z,1↓⍴L)↑L),((z←(1↑⍴L←2 Rank L)⌈1↑⍴R),1↓⍴R)↑R←2 Rank R 85 | ∇ 86 | 87 | ∇z←L Catr R 88 | z←(((1↑⍴L),z)↑L)⍪((1↑⍴R),z←(1↓⍴L←2 Rank L)⌈1↓⍴R)↑R←2 Rank R 89 | ∇ 90 | 91 | ∇Change;L;s;q 92 | →(0=1↑⍴Mat)/ER1 93 | EN1:→(EHN L←(1 ¯1,⍳1↑⍴Mat)Piv'Enter the line numbers you wish to change')/0,EN1,0 94 | LP1:→(0=⍴L)/END 95 | q←Edit Mat[''⍴L;] 96 | →((1↓⍴Mat)=s←(⍴q)⌈1↓⍴Mat)/EN2 97 | Mat←((1↑⍴Mat),s)↑Mat 98 | EN2:Mat[1↑L;]←s↑q 99 | L←1↓L 100 | →LP1 101 | END:Mat←RS Mat 102 | →0 103 | ER1: ER'There are no lines to change.' 104 | ∇ 105 | 106 | ∇Clear 107 | ⍞←(⎕UCS 27),'[2J' 108 | ⍞←(⎕UCS 27),'[1;1H' 109 | ∇ 110 | 111 | ∇z←b Convt n 112 | z←⍉((1+⌊(⍟(0=z)+z←⌈/n)÷⍟b)⍴b)⊤n 113 | ⍝ b = base 114 | ⍝ n = vector of decimal numbers 115 | ⍝ z = number n in base b 116 | ∇ 117 | 118 | ∇z←m Ctit t 119 | ⍝ Create column title 120 | ⍝ Left argument is the format mask. Each element seperated by comma 121 | ⍝ Right argument is one line of the column titles seperated by commas 122 | m←(((1↑⍴m)×⌈(1↑⍴t←','Parse t)÷+/'B'≠m[;1]),1↓⍴m)⍴m←','Parse m 123 | z←'' 124 | LP1:→(0=⍴t)/0 125 | ⍎('B'=m[1;1])/'z←z,(⍎1↓m[1;])⍴'' ''' 126 | ⍎('L'=m[1;1])/'z←z,(⍎1↓m[1;])↑t[1;]' 127 | ⍎('R'=m[1;1])/'z←z,(-⍎1↓m[1;])↑CS t[1;]' 128 | ⍎('C'=m[1;1])/'z←z,(⍎1↓m[1;])↑(⍎1↓m[1;])CJ t[1;]' 129 | ⍎('B'≠m[1;1])/'t←1 0↓t' 130 | m←1 0↓m 131 | →LP1 132 | ∇ 133 | 134 | ∇ts←DATETIME 135 | ts←⎕TS 136 | ts←(10000⊥(ts[1]),100⊥ts[2 3]),100⊥ts[4 5] 137 | ts←ts,1+ts[2]≥1200 138 | ts[2]←ts[2]-1200×ts[2]>1300 139 | ts[2]←ts[2]+1200×ts[2]<100 140 | ts←(,Dtfmt ts[1]),' ',(,Tmfmt ts[2]),(2 3⍴' AM PM')[ts[3];] 141 | ∇ 142 | 143 | ∇z←n DIV d 144 | z←(n×z)÷d+~z←d≠0 145 | ∇ 146 | 147 | ∇z←Date;t 148 | t←(4 2⍴'thstndrd')[1+t×(~z[3]∊11 12 13)∧(t←10⊤(z←⎕TS)[3])∊⍳3;] 149 | z←(Dyofwk 10000 100 100⊥z[⍳3]),' ',(Mmofyr z[2]),' ',(⍕z[3]),t,', ',⍕z[1] 150 | ∇ 151 | 152 | ∇Delete;L 153 | →(0=1↑⍴Mat)/ER1 154 | EN1:→(EHN L←(1,(1↑⍴Mat),1 0 100)Pin'Enter the line numbers to be deleted')/0,EN1,0 155 | Mat←(~(⍳1↑⍴Mat)∊L)⌿Mat 156 | O'Line numbers ',(,⍕L),' have been deleted.' 157 | →0 158 | ER1:ER 'There are no lines to delete.' 159 | ∇ 160 | 161 | ∇z←Dtfmt d 162 | z←(2 0⍕⍉d[,2;]),'/',(2 0⍕⍉d[,3;]),'/',4 0⍕⍉(d←10000 100 100⊤,d)[,1;] 163 | z←z[;1],(0 ¯1+⍴z)⍴¯1 0↓(d=' ')⊖(d←,0 1↓z),[0.5]'0' 164 | ∇ 165 | 166 | ∇z←Dyofwk x 167 | z←RS(','Parse'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday')[((⍳1<⍴,x)×⍴x)⍴x←1+7|5+JUL x;] 168 | ∇ 169 | 170 | ∇z←EHN v 171 | z←((2 8↑2 4⍴'end help')∧.=8↑v),0=⍴v←,v 172 | ∇ 173 | 174 | ∇z←ER p 175 | ⎕←⎕AV[8],'*** ',p,' ***' 176 | z←0 0⍴0 177 | →(0=⍴Cms)/0 178 | z←ER 'Error in command string; returning to manual input.',Cms←'' 179 | ∇ 180 | 181 | ∇z←Ealn t;i;n 182 | z←((⍴n)⍴(,(-+/∧\⌽i)⌽i)\(,i←n≠' ')/,n←'[',(⍕(n,1)⍴⍳n←1↑⍴t),']'),t 183 | ⍝ t = ⎕CR of a function 184 | ⍝ z = t with line numbers in brackets added 185 | ∇ 186 | 187 | ∇z←Edit x;p;t;r;s;n;b 188 | z←x 189 | p←0 190 | LP1:⎕←z 191 | →(EHN CS t←,⍞,0⍴⍞←p⍴' ')/END,HP,0 192 | →((1↑CS t)∊',/')/EN1 193 | →(~(t← CS t)∊' 0123456789')/EN0 194 | p←0⌈¯1+⎕PW⌊⍎(t≠' ')/t 195 | →LP1 196 | EN0:p←0⌈¯1+(p≤⍴z)×p←(∧/(¯1+⍳⍴,t)⊖z∘.=t)⍳1 197 | →LP1 198 | EN1:p←0 199 | z←('/'≠(⍴z)↑(t⍳',')↑t)/z 200 | →((','∊t)∧0=s←⍴r←(t⍳',')↓t←((t≠'/')∨~∧\','≠t)/t)/EN2 201 | z←((n⍴1),((s+b-n)⍴0),((⍴z)-n←(⍴z)⌊b←¯1+t⍳',')⍴1)\z 202 | z[((','∊t)ׯ1+t⍳',')+⍳s]←r 203 | →LP1 204 | EN2:z←RS z,(⍴z)↓⍞,0⍴⍞←z 205 | →0 206 | END:z←RS x 207 | →0 208 | HP:'' 209 | 'Enter / under characters you wish to delete.' 210 | 'Enter , under the character you wish to insert before.' 211 | 'Enter text you wish to insert after the first ,' 212 | 'Enter ''end'' to leave without changing the line.' 213 | 'Enter an empty ''Enter'' to leave the edit.' 214 | 'Enter a number to tab out to a column.' 215 | 'Enter text not preceeded by , to tab to that text.' 216 | 'Enter , not followed by anything to add to the end of the line.' 217 | '' 218 | →LP1 219 | ∇ 220 | 221 | ∇z←Eoi p 222 | EN0:z←((⍴Pad)+⍴p)↓⍞,0⍴⍞←p,Pad 223 | →(':'≠1↑z)/0 224 | z←1↓z 225 | ⍎(∧/' '=z)/'→0,0⍴z←'' ''' 226 | →('t'≠1↑z)/EN1 227 | →((0,PW,1 0 1)Lck 3↑1↓z)/EN0 228 | z←((⍎3↑1↓z)↑' '),LJ 3↓z 229 | →0 230 | EN1:→('c'≠1↑z)/0 231 | z←⎕PW CJ 1↓z 232 | ∇ 233 | 234 | ∇z←m Err b 235 | →(~z←∨/,b)/0 236 | b←ER m 237 | ∇ 238 | 239 | ∇z←L Estart Mat;qq;fn;bv 240 | Delim←,'∵' 241 | qq← 'add = to add; insert; or write over a line,' 242 | qq←qq,'change = to modify a line in the current text,' 243 | qq←qq,'delete = to delete a group of lines,' 244 | qq←qq,'move = to move lines from one text to another,' 245 | qq←qq,'replace = to search and replace a character string,' 246 | qq←qq,'screen = to search and list text on a screen,' 247 | qq←qq,'list = to list the present text on paper,' 248 | qq←qq,'new = to erase the present text buffer' 249 | qq←','Parse qq 250 | z←Mat 251 | fn←'Add,Change,Delete,Move,Replace,Screen,List,New' 252 | fn←','Parse fn 253 | EN1:→(2↑bv←qq Pim'Enter your edit command')/EN2,END 254 | ⍎,(2↓bv)⌿fn 255 | →(L<⍴Mat)/ER1,ER2 256 | →EN1 257 | END:→(L<⍴Mat)/ER1,ER2 258 | z←Mat 259 | →0 260 | EN2:→(0∊⍴Mat)/EN3 261 | →('yn'Pic'Do you wish to return to your original text')/(3⍴EN2),0,EN3 262 | EN3:z←'end' 263 | →0 264 | ER1:→EN1 ∆ ER'Error; text has exceeded a maximum of ',(⍕1↑L),' lines.' 265 | ER2:→EN1 ∆ ER'Error; text has exceeded a maximum of ',(⍕¯1↑L),' columns.' 266 | ∇ 267 | 268 | ∇z←a Expd v 269 | z←(,v∘.≥⍳z)/(z×⍴v)⍴(z⍴1),(z←⌈/v)⍴0 270 | →(0>a)/0 271 | z←((⍴z)×⌈a÷+/z)⍴z 272 | z←((+\z)⍳a)↑z←z,(0⌈a-+/z)⍴1 273 | ⍝ a = how many rows or columns you are going to expand 274 | ⍝ v = (how many to take),(how many blanks),(how many to take)... 275 | ⍝ z = binary vector - expand argument 276 | ∇ 277 | 278 | ∇z←a Expnd v 279 | z←(,v∘.≥⍳z)/,⍉((z←⌈/v),⍴v←1⌈|v)⍴0⌈×v 280 | →(0>a)/0 281 | z←((⍴z)×⌈a÷+/z)⍴z 282 | z←((+\z)⍳a)↑z←z,(0⌈a-+/z)⍴1 283 | ⍝ a = how many rows or columns you are going to expand 284 | ⍝ v = vector - expansion control 285 | ⍝ positive integer = number of ones 286 | ⍝ negative integer = number of zeros 287 | ⍝ 0 = the same as ¯1 288 | ⍝ z = binary vector - expand argument 289 | ∇ 290 | 291 | ∇z←f Fcj m 292 | z←(⌈0.5×(+/∧\z)-+/∧\⌽z←' '=m)⌽m←(((2=⍴⍴m)⍴⍴m),f)↑m 293 | ∇ 294 | 295 | ∇z←f Fld m 296 | z←(((2=⍴⍴m)⍴⍴m),f)↑m 297 | ∇ 298 | 299 | ∇z←f Flj m 300 | z←(¯1+⎕IO++/∧\m=' ')⌽m←(((2=⍴⍴m)⍴⍴m),f)↑m 301 | ∇ 302 | 303 | ∇z←Fn 304 | z←⍕13 32 24 60 60⊥⎕TS[2 3 4 5 6] 305 | ∇ 306 | 307 | ∇z←f Frj m 308 | z←(-¯1+⎕IO++/∧\⌽m=' ')=m←(((2=⍴⍴m)⍴⍴m),f)↑m 309 | ∇ 310 | 311 | ∇r←Iota v 312 | ⍎(3=⍴v←,v)/'→0,r←v[1]+v[2]ׯ1+⍳v[3]' 313 | r←⍳v 314 | ⍝ v[1] = first number 315 | ⍝ v[2] = increments 316 | ⍝ v[3] = how many numbers 317 | ⍝ if 0=⍴v then ⍳v 318 | ∇ 319 | 320 | ∇z←JUL d 321 | z←(⌊365.25×(d[1;])-z)+(⌊30.6001×d[2;]+1+12×z←∨/d[2;]∘.=1 2)+(d←0 100 100⊤,d)[3;] 322 | ∇ 323 | 324 | ∇r←LJ m 325 | r←(¯1+⎕IO++/∧\m=' ')⌽m 326 | ∇ 327 | 328 | ∇z←LS x 329 | ⍎'z←',((1=⍴⍴x)↑','),'(∨\'' ''∨.≠x)/x←((0,¯1↑⍴x)⍴'' '')⍪x' 330 | ∇ 331 | 332 | ∇r←v Lck n 333 | ⍝ n = string vector - to be tested 334 | ⍝ v[1] = minimum value 335 | ⍝ v[2] = max value 336 | ⍝ v[3] = numeric increment (1=integer) 337 | ⍝ v[4] = minimum number of numbers 338 | ⍝ v[5] = maximum number of numbers 339 | ⍝ r = 1 if any errors, 0 if good 340 | →(0=1↑0⍴n)/EN0 341 | →(r←(¯1↑(' '≠n)/n←,n)∊' ,')/EN1 342 | n[Omega','=n]←' ' 343 | n[Omega'-'=n]←'¯' 344 | →(r←~∧/VI n)/EN1 345 | n←⍎n 346 | EN0: →(r←((⌊/n)<1↑v)∨v[2]<⌈/n)/EN2 347 | →(r←(v[3]≠0)∧∨/(⌊r)≠⌈r←n÷(v[3]=0)+v[3])/EN3 348 | →(~r←(v[4]>⍴,n)∨v[5]<⍴,n)/0 349 | →0 ∆ ER 'Error: You must enter ',(⍕v[4]),' to ',(⍕v[5]),' numbers; Re-enter.' 350 | EN1:→0 ∆ ER n,' is not numeric; Please re-enter.' 351 | EN2:→0 ∆ ER (⍕n),' is out of range; re-enter from ',(⍕1↑v),' to ',(⍕v[2]),'.' 352 | EN3:ER 'Error: Please re-enter in increments of ',(⍕v[3]),'.' 353 | ∇ 354 | 355 | ∇t←Lcn n 356 | t←⌊/((~(⍳t)∊n)/⍳t),1+t←⌈/1,,n 357 | ∇ 358 | 359 | ∇z←po Lhf f;b 360 | ⍝ This function (along with Out and Rst) are used to print. 361 | z←1 362 | EN1:→(3↑b←'lpfs'Pic'Enter print destination: local, printer, file, or screen')/0,EN1,0 363 | Pd←((3↓b)/'LPFS'),f 364 | ∆dv←1 0 365 | →b[4 5 7]/EN2,LPR,EN3 366 | ⍎b[6]/'''File chosen: '',f' 367 | Pt←Pt,'?' 368 | →z←∆re←0 369 | EN2:→(EHN PI'Line up paper and press return.')/EN1,EN2,EN3 370 | EN3:→z←∆re←0 371 | →0 372 | LPR:OpenPrinter po 373 | z←0 374 | ∇ 375 | 376 | ∇List;L;m 377 | →(0=1↑⍴Mat)/ER1 378 | m←Ealn Mat 379 | EN1:→(EHN L←(1 ¯1,⍳1↑⍴Mat)Piv'Enter the line numbers you wish to list')/0,EN1,0 380 | 2 1⍴' ' 381 | m[L;] 382 | 2 1⍴' ' 383 | →0 384 | ER1:ER 'There are no lines to list.' 385 | ∇ 386 | 387 | ∇z←w Lst m;t 388 | z←((⌈t[1]÷z),z×t[2])⍴((z×⌈t[1]÷z←⌊w÷t[2]),(t←⍴m)[2])↑m 389 | ∇ 390 | 391 | ∇z←Mmofyr i 392 | z←RS(','Parse'January,February,March,April,May,June,July,August,September,October,November,December')[1+12|⌊i-1;] 393 | ∇ 394 | 395 | ∇Move;m;fl;tl 396 | →(0=1↑⍴m←Mat)/ER1 397 | EN1:→(EHN fl←(1,(1↑⍴m),1 0 10000)Pin'Enter the from line numbers')/0,HP1,0 398 | EN2:→(EHN tl←(0,(1↑⍴Mat),0.1 0 1)Pin'Enter the to line number')/EN1,HP2,EN1 399 | EN4:Mat←(~(⍳(⍴fl)+1↑⍴Mat)∊(tl←⌊tl)+⍳⍴fl)⍀Mat 400 | Mat[tl+⍳⍴fl;]←m[fl;] 401 | ○'The transfer is complete.' 402 | →0 403 | HP1:'Enter the line numbers you wish to move from the from text.' 404 | →EN1 405 | HP2:'Enter the line number in the present text after which the new lines will appear.' 406 | 'or enter a number between two existing lines to insert at that point,' 407 | 'or enter 0 to insert at the top.' 408 | →EN2 409 | ER1:ER'There are no lines in the present text to move.' 410 | ∇ 411 | 412 | ∇z←a Mul c 413 | ⍝ Make underline - companion function to Ctit 414 | a←','Parse a 415 | z←'' 416 | LP1:→(0=⍴a)/0 417 | ⍎('B'=a[1;1])/'z←z,(⍎1↓a[1;])⍴'' ''' 418 | ⍎('B'≠a[1;1])/'z←z,(⍎1↓a[1;])⍴c' 419 | a←1 0↓a 420 | →LP1 421 | ∇ 422 | 423 | ∇New 424 | →(0=⍴Mat)/0 425 | EN1:→('yn'Pic'clear present text')/0,EN1,0,EN2,0 426 | EN2:Mat←0 0⍴' ' 427 | ∇ 428 | 429 | ∇s←NumbStr n;d;name;count;ten;ten6;t 430 | name←' ',','Parse',thousand,million,billion,trillion' 431 | count←' ',','Parse'one,two,three,four,five,six,seven,eight,nine' 432 | ten←' ',','Parse',twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety' 433 | ten6←' ',','Parse'ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen' 434 | →(0=⌊|n←''⍴n)/EN6 435 | s←(n<0)/'negative' 436 | d←''⍴1+⍴n←⌽((1+⌊(⍟n+n=0)÷⍟1000)⍴1000)⊤n←⌊|n 437 | LP1:→(0=d←d-1)/END 438 | →(n[d]=0)/LP1 439 | t←10 10 10⊤n[d] 440 | →(0=t[1])/EN2 441 | s←s,(RS count[t[1];]),' hundred' 442 | EN2:→(t[2]=1 0)/EN5,EN3 443 | s←s,RS ten[t[2];] 444 | EN3:→(0=t[3])/EN4 445 | s←s,RS count[t[3];] 446 | EN4:s←s,RS name[d;] 447 | →(0=+/(d-1)↑n)/LP1 448 | s←s,',' 449 | →LP1 450 | EN5:s←s,RS ten6[1+t[3];] 451 | →EN4 452 | EN6:s←'zero' 453 | →0 454 | END:s←LS s 455 | ∇ 456 | 457 | ∇O c 458 | →(0=⎕NC'Pd')/EN1 459 | →('L'=1↑Pd)/0 460 | EN1:→(0≠⍴Cms)/0 461 | c 462 | ∇ 463 | 464 | ∇z←Omega v 465 | z←v/⍳⍴,v 466 | ⍝ convers a vector of 1's and 0's into a vector of the index positions of the 1's 467 | ∇ 468 | 469 | ∇OpenPrinter options 470 | →(0≠⎕NC 'FILE_IO')/LOADED 471 | →('FILE_IO'≡'lib_file_io.so'⎕FX'FILE_IO')/LOADED 472 | ⎕ES 'Error loading FILE_IO library' 473 | LOADED:∆FH←'w'FILE_IO[24]'lpr ',options 474 | ∇ 475 | 476 | ∇Out x;t 477 | ⍝ This function (along with Lhs and Rst) are used to print. 478 | ⍝ This function takes a character scalar, vector, or matrix an prints it to the printer 479 | →('LSF'=1↑Pd)/EN1,EN1,EN1 480 | ⍎(2>⍴⍴x)/'x←(1,⍴,x)⍴x' 481 | LP1:→(0=1↑⍴x)/0 482 | t←((RS x[1;]),⎕AV[11])FILE_IO[23]∆FH 483 | x←1 0↓x 484 | →LP1 485 | EN1:x 486 | ∇ 487 | 488 | ∇z←PI p;l;r 489 | ⍎(0=⍴Cms)/'Cms←((⍴Pad)+⍴,p)↓l,0⍴l←⍞,0⍴⍞←p,Pad' 490 | Cms←(1+⍴z←(¯1+Cms⍳Delim[1])↑Cms)↓Cms 491 | ∇ 492 | 493 | ∇r←d Parse v 494 | ⍝ Convert vector v into a matrix breaking at delimiter d 495 | r←(((0≠⍴v)×⍴r),⌈/r)⍴(,r∘.≥⍳⌈/r←¯1+(r,1+⍴v)-0,r←r/⍳⍴v)\(~r←v∈d)/v←,v 496 | ∇ 497 | 498 | ∇r←d Parse2 v 499 | ⍝ break up vector v accoriding to delimiter d into seperate arrays 500 | r←⊃1↓1↓¨(1++\r∊d)⊂r←(2/↑d),v 501 | ∇ 502 | 503 | ∇Pg;t 504 | →(∆LN=0)/0 505 | →(0=t←66|63-∆LN)/EN1 506 | Out(t,1)⍴' ' 507 | EN1:Out ⎕PW CJ'Page ',⍕∆PN←∆PN+1 508 | Out 2 1⍴' ' 509 | ∆LN←0 510 | ⍎(('L'≠1↑Pd)∧0=10|∆PN)/'O''Completed page '',⍕∆PN' 511 | ∇ 512 | 513 | ∇z←s Pic p;t 514 | ⍝ Input single character 515 | ⍝ s = character vector of acceptible characters 516 | ⍝ p = prompt 517 | ⍝ z = binary vector = end, help, nothing, s[1], s[2], etc. 518 | EN1:→(z←(EHN t←(¯1+(t≠' ')⍳1)↓t←PI p,' [',s,']?'),(⍴s)⍴0)/0 519 | →(z[3+⍳⍴,s]←s=1↑t)/0 520 | →EN1 ∆ ER 'Invalid entry; valid responses are: ',(,((¯1↓s),[1.5]','),' '),'or ',(¯1↑s),'.' 521 | ∇ 522 | 523 | ∇n←v Picd q;d;td 524 | ⍝ Date input - input format mm/dd/yyyy 525 | ⍝ v[1] = minimum date 526 | ⍝ v[2] = maximum date 527 | ⍝ v[3] = (optional) default value 528 | EN1:→((td≥v[1])∧v[2]≥td←10000 100 100⊥3↑⎕TS)/EN2 529 | →(EHN n←CS PI q,' [mm/dd/yyyy]?')/0,0,EN5 530 | →EN3 531 | EN2:→(EHN n←CS PI q,' or ''today'' [mm/dd/yyyy]?')/0,0,EN5 532 | →(∨/n≠(⍴n)↑'today')/EN3 533 | n←,Dtfmt 10000 100 100⊥3↑⎕TS 534 | EN3:→(~(d←d\(d←n≠'/')/n)∊' 0123456789')/ER1 535 | ⍎(1=⍴d←1↓⍎'0 ',d)/'d←,10000 100 100⊤d' 536 | →(3≠⍴d)/ER1 537 | →(0=+/v[1],d←10000 100 100⊥d[3 1 2])/EN4 538 | →(d≠CAL JUL d)/ER1 539 | →((d1↓v)/0 613 | →EN1 ∆ ER 'Error: Please re-enter from ',(⍕0⌈1↑v),' to ',(⍕1↓v),' characters.' 614 | ∇ 615 | 616 | ∇n←v Piv q;t;m;s;b;e;a 617 | ⍝ Input a list of numbers from a list of possibles 618 | ⍝ v[1] = minimum number of numbers to enter 619 | ⍝ v[2] = maximum number of numbers to enter 620 | ⍝ v[3...] = list of possible numbers to choose from 621 | ⍝ q = prompt 622 | t←⍳0 623 | n←'' 624 | s←(2≠⍴v)∧v[2]≠1 625 | ⍎(v[2]=¯1)/'v[2]←1⌈¯2+⍴v' 626 | a←s∧(m←v[2])≥¯2+⍴v 627 | LP:→(m≤⍴t)/EN3 628 | EN1:⍎'→(EHN n←CS PI q,',(s/''', or ['),(a/'a,b,'),(s/'r]'','),'''?'')/0,HP3,EN3' 629 | →(a∧∧/n=(⍴n)↑'all')/EN2 630 | →(a∧∧/n=(⍴n)↑'but')/EN4 631 | →(s∧∧/n=(⍴n)↑'range')/EN5 632 | n[Omega n='-']←'¯' 633 | →(v Vck n)/EN1 634 | t←t,n←⍎n 635 | v[2]←v[2]-⍴,n 636 | →LP 637 | EN2:→(v[1]>⍴n←2↓v)/ER3 638 | →0 639 | EN3:→(0=⍴t)/0 640 | ⍎'n←',((~s)/'''''⍴'),'t' 641 | →0 642 | EN4:→(3=⍴v)/ER1 643 | →(EHN n←(1,(¯3+⍴v),2↓v)Piv q,' - but')/EN1,0,EN1 644 | →(v[1]>⍴n←(~(2↓v)∊n)/2↓v)/ER3 645 | →0 646 | EN5:→(EHN b←((⌊/2↓v),(⌈/2↓v),0 0 1)Pin'Enter the beginning of the range')/EN1,HP1,EN1 647 | EN6:→(EHN e←(b,(⌈/2↓v),0 0 1)Pin 'Enter the ending of the range')/EN5,HP2,EN5 648 | n←((b≤2↓v)∧e≥2↓v)/2↓v 649 | →((v[1]>⍴n),v[2]<⍴n)/ER3,ER2 650 | t←t,n 651 | v[2]←v[2]-⍴n 652 | →LP 653 | HP1:'' 654 | 'Your lower bound is ',⍕⌊/2↓v 655 | '' 656 | →EN5 657 | HP2:'' 658 | 'Your upper bound is ',⍕⌈/2↓v 659 | '' 660 | →EN6 661 | HP3:'' 662 | →(~s,a)/0,HP4 663 | 'Enter all to choose all entries available.' 664 | 'Enter but to choose all entries except a few which you will' 665 | ' be prompted for.' 666 | HP4:'Enter range to choose all entries between s specified range.' 667 | '' 668 | →0 669 | ER1:→EN1 ∆ ER 'There is only one entry to choose from; the ''but'' option can not be used.' 670 | ER2:→EN1 ∆ ER 'The range you have specified is too large; re-enter up to ',(⍕v[2]),' numbers.' 671 | ER3:→EN1 ∆ ER 'You have not entered the minimum number of numbers; re-enter ',(⍕v[1]),' numbers.' 672 | ∇ 673 | 674 | ∇Pkg∆Erase pkg;t 675 | t←⎕EX ((((1↑⍴t),(1+⍴,pkg))↑t)∧.=pkg,'∆')⌿t←⎕NL 2 3 4 676 | ∇ 677 | 678 | ∇r←Pkg∆List;t 679 | ⍝ find names that have delta in them except in first column 680 | r←,∧\'∆'≠t←(∨/'∆'=0 1↓t)⌿t←⎕NL 2 3 4 681 | r←(⍴t)⍴(,' ',((×/⍴t),1)⍴t)[r+1+2ׯ1+⍳⍴r] 682 | ⍝ right strip blank columns 683 | ⍎'r←',((1=⍴⍴r)↑','),'(⌽∨\⌽'' ''∨.≠r)/r←((0,¯1↑⍴r)⍴'' '')⍪r' 684 | ⍝ sort if necessary 685 | ⍝ r←r[⍋r;] 686 | ⍝ remove duplicate rows 687 | r←(¯1↓1,∨/r≠1⊖r)⌿r 688 | ∇ 689 | 690 | ∇z←Pkg∆Present pkg;t 691 | z←∨/(((1↑⍴t),(1+⍴,pkg))↑t←⎕NL 2 3 4)∧.=pkg,'∆' 692 | ∇ 693 | 694 | ∇pkg Pkg∆Require ws 695 | ⍎(~Pkg∆Present pkg)/')COPY ',ws 696 | ∇ 697 | 698 | ∇n Pnt x;i;s;t 699 | →(0=⍴x←((x/¯1↓i),¯1↑i←1 1,⍴x)⍴x)/0 700 | ⍎(n[3]=¯1)/'n←n[1 2],1↑⍴x' 701 | n←n[1 2],((¯2+⍴n)×⌈(1↑⍴x)÷+/2↓n)⍴2↓n 702 | ⍎(n[2]=¯1)/'n[2]←⌊.5×⎕PW-(1↓⍴x)⌈(1↓⍴∆C)⌈1↓⍴∆G' 703 | i←3 704 | →(0≠∆LN)/LP1 705 | EN1:Pg 706 | ⍎(0≠1↑⍴∆P)/'Out ∆P' 707 | ⍎(0≠1↑⍴∆C)/'Out(((1↑⍴∆C),n[2])↑'' ''),∆C' 708 | ∆LN←∆LN+(1↑⍴∆P)+1↑⍴∆C 709 | LP1:→(0=⍴x)/0 710 | →((t←(n[1]>∆LN+1↑⍴∆G)∧n[1]|s)∧∆CV[6]=0),p←(∨/0=⍴x)∧0>s←1↑vw)/EN4,EN5 818 | →(∧/vw<0)/0 819 | ⍎∆CV[23]/'x←(((+\t)⍳1↓⍴x)↑t←t,(0⌈(1↓⍴x)-+/t←((⍴∆EV)×⌈(1↓⍴x)÷+/∆EV)⍴∆EV)⍴1)\x' 820 | →(∆CV[6]≠0)/LP1 821 | EN1:→(0=∆CV[6])/EN3 822 | →(0=t←∆CV[1]|∆CV[1]-∆CV[6]+∆CV[21])/EN2 823 | Out(t,1)⍴' ' 824 | EN2:⍎∆CV[15]/'Out ∆B' 825 | ∆CV[6]←0 826 | ⍎(('L'≠1↑⍴Pd)∧0=10|∆CV[4])/'O''Completed page '',⍕∆CV[4]' 827 | EN3:→p/0 828 | EN4:∆CV[4]←∆CV[4]+1 829 | →((∆CV[11]≠0)∧∆CV[11]<∆CV[5]←∆CV[5]+1)/ER1 830 | ⍎∆CV[16]/'∆P[∆CV[7];(⍳5)+¯1+∆CV[8]]←,LJ 5 0⍕∆CV[4]' 831 | ⍎∆CV[17]/'∆B[∆CV[9];(⍳5)+¯1+∆CV[10]]←,LJ 5 0⍕∆CV[4]' 832 | ⍎∆CV[12]/'Out ∆P' 833 | ⍎∆CV[13]/'Out(((1↑⍴∆C),∆CV[3])⍴'' ''),∆C' 834 | ∆CV[6]←∆CV[6]+∆CV[20] 835 | →p/EN5 836 | LP1:→(0=⍴x)/0 837 | →(0>s)/EN5 838 | →((∆CV[2]≤∆CV[6]+∆CV[22])∨(∆CV[2]≥s+∆CV[19])∧∆CV[2]<∆CV[6]+s+∆CV[22])/EN1 839 | ⍎∆CV[14]/'Out(((1↑⍴∆G),∆CV[3])⍴'' ''),∆G' 840 | Out((v,∆CV[3])⍴' '),((v←(∆CV[2]-∆CV[6]+∆CV[22])⌊s⌊1↑⍴x),1↓⍴x)↑x 841 | x←(v,0)↓x 842 | ∆CV[6]←∆CV[6]+v+∆CV[22] 843 | ⍎(0=s←s-v)/'s←1↑vw←1⌽vw' 844 | →LP1 845 | EN5:→(∆CV[2]<∆CV[6]+∆CV[21]+s←|s)/EN6 846 | Out(s,1)⍴' ' 847 | ∆CV[6]←∆CV[6]+s 848 | s←1↑vw←1⌽vw 849 | →LP1 850 | EN6:s←1↑vw←1⌽vw 851 | →EN1 852 | ER1:'*** Error: attempt to print more than ',(⍕∆CV[11]),' pages ***' 853 | → 854 | ⍝ ∆CV = integer vector - control vector 855 | ⍝ ∆EV = integer vector - column expand vector 856 | ⍝ ∆P = character matrix - page title 857 | ⍝ ∆C = character matrix - column title 858 | ⍝ ∆G = character matrix - group title 859 | ⍝ ∆B = character matrix - bottom page title 860 | ⍝ vw = numeric vector - vertical widths 861 | ⍝ x = character (any shape or rank) - data to be printed 862 | ∇ 863 | 864 | ∇n←RptBt;z 865 | z←⎕PW↑⎕PW CJ'Page' 866 | ∆B←z⍪(2,⎕PW)⍴' ' 867 | n←1,5+⌈⎕Pw÷2 868 | ∇ 869 | 870 | ∇z←L RptPt R 871 | z←(2,⎕PW)⍴' ' 872 | z←z⍪(-⎕PW)↑'Run date: ',Date,' ',Time 873 | z←z⍪' ' 874 | z←z⍪⎕PW↑⎕PW CJ L 875 | z←z⍪⎕PW↑R←⎕PW CJ R 876 | z←z⍪⎕PW↑'-'UL R 877 | z←z⍪' ' 878 | ∇ 879 | 880 | ∇Rptc x 881 | →(2≠⎕NC'∆CV')/0 882 | →(x=1 2)/EN1,EN2 883 | (-∆CV[2])Rpt'' 884 | →0 885 | EN1:→(23≠⍴∆CV)/0 886 | ⍎(∆CV[13]∧∆CV[23])/'∆C←((1↓⍴∆C)⍴∆EV)/∆C' 887 | ⍎(∆CV[14]∧∆CV[23])/'∆G←((1↓⍴∆G)⍴∆EV)/∆G' 888 | ⍎∆CV[23]/'∆EV←∆EV-0,¯1↓∆EV←(((¯1↓∆EV)≠1↓∆EV),1)/⍳⍴∆EV' 889 | ∆CV←11↑∆CV 890 | ∆DV←2↑∆DV 891 | →0 892 | EN2:¯1 Rpt ' ' 893 | ∇ 894 | 895 | ∇z←Rpts v;t 896 | →(8=⍴∆DV)/EN1 897 | ⍎∆CV[13]/'∆T←((¯1+t⍳1),0)↓((-¯1+(⌽t←∨/∆C≠'' '')⍳1),0)↓∆C' 898 | EN1:→((t∧~0∊⍴x),t←∧/v1↑v)/EN2 902 | t←(1↑⍴x)⌊1↑v 903 | ⍎∆CV[14]/'→(z←(t+∆CV[22]) Dsply ∆G)/0' 904 | →(z←t Dsply(t,1↓⍴x)↑x)/0 905 | x←(t,0)↓x 906 | v←1⌽v 907 | →LP1 908 | EN2:→(2=⍴∆DV)/EN3 909 | t←(1+∆DV[2]|∆DV[2]-∆DV[4])⌊|1↑v 910 | →(z←t Dsply(t,1)⍴' ')/0 911 | EN3:v←1⌽v 912 | →LP1 913 | ∇ 914 | 915 | ∇Rst;t 916 | ⍝ close printer 917 | →('PFLS'=1↑Pd)/EN1,EN3,EN3,EN3 918 | EN1:t←FILE_IO[25]∆FH 919 | →EN3 920 | EN3:t←⎕EX' 'Parse'Pt Pd ∆dv ∆t ∆d ∆f ∆re ∆FH' 921 | ∇ 922 | 923 | ∇Screen 924 | →(0=1↑⍴Mat)/ER1 925 | (0 0⍴' ')∆LP Ealn Mat 926 | →0 927 | ER1:ER'There are no lines to list.' 928 | ∇ 929 | 930 | ∇Sink r 931 | ∇ 932 | 933 | ∇z←Sort m;i;b 934 | →((2=⍴⍴m)∧0=1↑0⍴m)/EN1 935 | z←⍋m 936 | →0 937 | EN1:z←⍳1↑⍴m 938 | i←''⍴1+1↓⍴m 939 | LP1:→(0≥i←i-1)/0 940 | z←z[b←⍋m[;i]] 941 | m←m[b;] 942 | →LP1 943 | ∇ 944 | 945 | ∇z←Sort1 m;i;b 946 | ⍎(' '=1↑0⍴m)/'m←⎕AV⍳m' 947 | →(2≠⍴⍴m)/EN1 948 | z←⍳1↑⍴m 949 | i←''⍴1+1↓⍴m 950 | LP1:→(0≥i←i-1)/0 951 | z←z[b←⍋m[;i]] 952 | m←m[b;] 953 | →LP1 954 | EN1:z←⍋m 955 | ∇ 956 | 957 | ∇x←Sort2 m;v1;v2;n;c 958 | ⍎(0≠1↑0⍴m)/'m←⎕AV⍳m' 959 | →(2≠⍴⍴m)/EN2 960 | v2←v1←(1↑⍴m)⍴1 961 | x←0⍴c←1 962 | LP1:→(0=+/v1)/0 963 | →(1<+/(n←⌊/((v1∧v2)⌿m)[;c])=((v1∧v2)⌿m)[;c])/EN1 964 | x←x,(v2∧v1∧n=m[;c])⍳1 965 | v2←v1←v1∧~v2∧v1∧n=m[;c] 966 | →LP1,0⍴c←1 967 | EN1:v2←v2∧v1∧n=m[;c] 968 | →((c←c+1)≤1↓⍴m)/LP1 969 | x←x,v2/⍳⍴v2 970 | v1←v2←v1∧~v2 971 | →LP1,0⍴c←1 972 | EN2:x←⍋,m 973 | ∇ 974 | 975 | ∇Srl 976 | ⎕RL←1+2147483640|100⊥1↓⎕TS 977 | ⍝ sets the random number generator to start at a random place 978 | ∇ 979 | 980 | ∇z←y Subscn x 981 | z←x⌊0⌈(+⍀x)-y 982 | ⍝ subtract scan used to subtract scalar y from vector x until you run out of y 983 | ⍝ will not subtract from an element of x past 0 984 | ∇ 985 | 986 | ∇z←Time 987 | z←(,Tmfmt 100⊥((12|z[1])+(12×0=12|z[1])),z[2]),(2 3⍴' AM PM')[1+(z←⎕TS[4 5])[1]≥12;] 988 | ∇ 989 | 990 | ∇z←Tmfmt d 991 | z←(2 0⍕⍉d[,1;]),':',2 0⍕⍉(d←(2⍴100)⊤,d)[,2;] 992 | z←z[;1],(0 ¯1+⍴z)⍴¯1 0↓(d=' ')⊖(d←,0 1↓z),[0.5]'0' 993 | ∇ 994 | 995 | ∇z←a To b;c;⎕IO 996 | z←(¯1↓a),(c,c+z[2]×(×z[1]-c)×⍳⌊|(z[1]-c←¯1↑a)÷(z←2↑b,1)[2]),(1+⎕IO←1)↓b 997 | ⍝ this function is able to be part of a vector to include a run of numbers 998 | ⍝ z = (¯1↓a),( (¯1↑a) to and including b[1] in increments of b[2] or 1), 2↓b 999 | ∇ 1000 | 1001 | ∇z←Today 1002 | z←10000 100 100⊥⎕TS[⍳3] 1003 | ∇ 1004 | 1005 | ∇z←p Trunc n 1006 | z←(10*-p)×(×n)×⌊|n←n×10*p 1007 | ∇ 1008 | 1009 | ∇z←ul UL m 1010 | z←(' ',ul)[1+(∨\z)∧⌽∨\⌽z←m≠' '] 1011 | ∇ 1012 | 1013 | ∇z←c UL2 x 1014 | z←(x≠' ')\c 1015 | ∇ 1016 | 1017 | ∇z←c UL3 v 1018 | z←((,v∘.≥⍳z)/,((⍴v),z)⍴(z⍴1),(x←⌈/v)⍴0)\c 1019 | ∇ 1020 | 1021 | ∇z←Unbox x 1022 | (x z)←⊃x ⋄ z←x⍴z 1023 | ∇ 1024 | 1025 | ∇x←Unique r 1026 | x←((r⍳r)=⍳⍴r)/r 1027 | ⍝ returns a single occurance of all elements in r 1028 | ∇ 1029 | 1030 | ∇r←VI n 1031 | ⍝ Valid Input 1032 | ⍝ n = string vector 1033 | ⍝ r = binary vector where 1034 | ⍝ 1 = valid number 1035 | ⍝ 0 = not a valid number 1036 | ⍝ One result for each number in the string 1037 | n←' 'Parse(~(1⌽r)∧r←' '=n)/n←CS n 1038 | r←(1≥+/n='.')∧(∧/'-'≠0 1↓n)∧(1≠-⌿+/∧\' .'∘.≠n)∧(∧/n∈r,'.-¯ ')∧∨/n∊r←'0123456789' 1039 | ∇ 1040 | 1041 | ∇r←v Vck n 1042 | →(r←2=⍴v)/ER1 1043 | →(0=1↑0⍴n)/EN1 1044 | →(r←(¯1↑(' '≠n)/n←,n)∊' ,')/ER2 1045 | n[Omega n=',']←' ' 1046 | n[Omega n='-']←'¯' 1047 | →(r←~∧/VI n)/ER2 1048 | n←,⍎n 1049 | EN1:→(r←(v[1]>⍴n)∨v[2]<⍴n)/ER3 1050 | →(~r←∨/~n∊2↓v)/0 1051 | →0 ∆ ER (⍕n),' does not exist; please re-enter.' 1052 | ER1:→0 ∆ ER 'Error: there are no entries to choose from.' 1053 | ER2:→0 ∆ ER n,' is not numeric; please re-enter.' 1054 | ER3:ER 'Error: you must enter ',(⍕v[1]),' to ',(⍕v[2]),' numbers; re-enter.' 1055 | ∇ 1056 | 1057 | ∇WPrintWS2 ⍙x⍙;f;v;t;∆P;∆G;∆B;∆CV;⎕IO;⎕PW;Delim;Cms;Pad;w 1058 | ⍝ ⍙x⍙ = 0 = print all functions 1059 | ⍝ 1 = compress out functions with names that contain ∆ in them 1060 | ⍝ 2 = compress out functions that begin with a capitol letter 1061 | ⍝ 3 = compress out functions with ∆ or capitol letter in beginning 1062 | ⎕PW←106 1063 | ⎕IO←1 1064 | w←3↓,⊃⍎')WSID' 1065 | ⍝ v←v[Sort v←(~∨/v∧.=⍉(2,1↓⍴v)↑2 1⍴'DW')⌿v←⎕NL 2;] 1066 | Delim←,':' 1067 | Cms←0⍴Pad←' ' 1068 | →('-o landscape'Lhf'APLFL-',w)/0 1069 | f←f[Sort f←⎕NL 3 4;] 1070 | ⍎(∨/⍙x⍙=1 3)/'f←(∧/'∆'≠f)⌿f' 1071 | ⍎(∨/⍙x⍙=2 3)/'f←((f[;1]<'A')∨f[;1]>'Z')⌿f' 1072 | ∆P←(5,⎕PW)⍴' ' 1073 | ∆P[3;]←⎕PW↑t←⎕PW CJ w,' as of ',Date,' ',Time 1074 | ∆P[4;]←⎕PW↑'-'Ul t 1075 | ∆G←(1,⎕PW)⍴' ' 1076 | ∆B←(⎕PW↑⎕PW CJ'Page')⍪(2,⎕PW)⍴' ' 1077 | ∆CV←48 ¯1 0 0 0 0 0 0 1,(3+⌈⎕PW/2),1000 1078 | ¯2 0 Rpt ' )FNS'Catr ⎕PW Lst f,' ' 1079 | ⍝ ¯4 0 Rpt ' )VARS'Catr ⎕PW Lst v,' ' 1080 | ¯4 Rpt '' 1081 | LP1:→(0∊⍴f)/EN2 1082 | →(0∊⍴t←⎕CR f[1;])/EN1 1083 | ∆G[1;]←⎕PW↑' ∇ ',t[1;] 1084 | t←1 0↓Aln Rot t 1085 | ¯2 0 Rpt t⍪(1↓⍴t)↑' ∇' 1086 | f←1 0↓f 1087 | →LP1 1088 | EN1:∆G←(1,⎕PW)⍴' ' 1089 | ¯2 1 Rpt'** Locked function ',(RS f[1;]),' **' 1090 | f←1 0↓f 1091 | →LP1 1092 | EN2:¯99 Rpt '' 1093 | Rst 1094 | 'WS List complete.' 1095 | ∇ 1096 | 1097 | ∇z←WSU∆AddLineNumbers t;i;n;q 1098 | ⍝ return matrix of function with line numbers added 1099 | →(0=1↑⍴z←t←⎕CR t)/0 1100 | q←'abcdefghijklmnopqrstuvwxyz∆ABCDEFGHIJKLMNOPQRSTUVWXYZ⍙0123456789' 1101 | t←((t[;1]≠'⍝')+(t[;1]∊¯10↓q)∧0=(+/∧\t≠':')-+/∧\t∊q)⌽' ',' ',t 1102 | z←((⍴n)⍴(,(-+/∧\⌽i)⌽i)\(,i←n≠' ')/,n←'[',(⍕(n,1)⍴(⍳n←1↑⍴t)-⎕IO),']'),' ',t 1103 | ∇ 1104 | 1105 | ∇WSU∆DisplayFns f;⎕PW;t;i;⎕IO;q;h;n 1106 | ⍝ list function definitions to the screen 1107 | ⍝ f is a list of function names separated by space or comma 1108 | ⎕PW←''⍴106,⎕IO←1 1109 | f←', 'Parse f 1110 | q←'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ∆⍙0123456789' 1111 | LP1:→(0=1↑⍴f)/END 1112 | →(~0∊⍴t←⎕CR f[1;])/EN0 1113 | ' '⍪(1,⍴t)⍴t←((f[1;]≠' ')/f[1;]),' IS LOCKED' 1114 | →LP1,0⍴f←1 0↓f 1115 | EN0:h←t[1;] 1116 | t←1 0↓t 1117 | t←((t[;1]≠'⍝')+(t[;1]∊¯10↓q)∧0=(+/∧\t≠':')-+/∧\t∊q)⌽' ',' ',t 1118 | t←((⍴n)⍴(,(-+/∧\⌽i)⌽i)\(,i←n≠' ')/,n←'[',(⍕(n,1)⍴⍳n←1↑⍴t),']'),' ',t 1119 | 2 1⍴' ' 1120 | ' ∇ ',h 1121 | t 1122 | ' ∇' 1123 | f←1 0↓f 1124 | →LP1 1125 | END: 1126 | ∇ 1127 | 1128 | ∇z←WSU∆FindCalls f;ops;m;s 1129 | f←⎕CR f 1130 | m←⎕NL 3 4 1131 | ops←'⋄¨¯<≤=≥>≠∨∧×÷⌶⍫⍒⍋⌽⍉⊖⍟⍱⍲¡⌹?⍵∊⍴~↑↓⍳○*←→⊢⍷⍨⍸⍥⍣⍞⍬⊣⍺⌈⌊_∇∆∘''⎕⍎⍕⍤⌸⌷≡≢⊂⊃∩∪⊥⊤|⍝⍀⌿⍪⍙⍠ ' 1132 | f←(~f[;1]∊'1234567890 ')⌿f←ops Parse,f,' ' 1133 | z←(∨/(((1↑⍴m),s)↑m)∧.=⍉((1↑⍴f),s←(1↓⍴f)⌈1↓⍴m)↑f)⌿m 1134 | z←z[Sort z;] 1135 | ⍝ f = character vector of a function name 1136 | ⍝ z = character matrix of all functions function f calls 1137 | ⍝ note: all of the functions must be in the workspace 1138 | ∇ 1139 | 1140 | ∇WSU∆PrintFunction f;m;Pd;∆FH 1141 | →(0=1↑⍴m←WSU∆AddLineNumbers f)/ER1 1142 | Pd←,'P' 1143 | OpenPrinter '-o landscape' 1144 | Out ' ∇' 1145 | Out m 1146 | Out ' ∇' 1147 | Rst 1148 | →0 1149 | ER1:'*** Function ',f,' does not exist ***' 1150 | ∇ 1151 | 1152 | ∇WSU∆PrintWS ⍙x⍙;⎕PW;v;f;L;t;r;i;n;wa;⎕IO;q;⍙y⍙;lpp;plpp;Pd;∆FH;pr 1153 | ⍝ ⍙y⍙ = 'WSID' 1154 | ⍝ ⍙x⍙ = 0 = print all functions 1155 | ⍝ 1 = compress out functions with names that contain ∆ in them 1156 | ⍝ 2 = compress out functions that begin with a capitol letter 1157 | ⍝ 3 = compress out functions with ∆ or capitol letter in beginning 1158 | ⍝ pr = print rows (rows longer than ⎕PW can take more than one line) 1159 | ⎕PW←''⍴106,⎕IO←1 1160 | v←(~v∧.=(1↓⍴v)↑'⍙x⍙')⌿v←⎕NL 2 1161 | v←(~v∧.=(1↓⍴v)↑'⍙y⍙')⌿v 1162 | Pd←,'P' 1163 | OpenPrinter '-o landscape' 1164 | lpp←48 ⍝ Lines Per Page 1165 | plpp←lpp-6 ⍝ Printable Lines Per Page 1166 | t←⍴f←(f[Sort f←⎕NL 3 4;]),' ' 1167 | ⍎(∨/⍙x⍙=1 3)/'t←⍴f←(∧/'∆'≠f)⌿f' 1168 | ⍎(∨/⍙x⍙=2 3)/'t←⍴f←((f[;1]<'A')∨f[;1]>'Z')⌿f' 1169 | Out 3 1↑' ' 1170 | ⍝ ' )WSID ON ',Date,' at ',Time,' is ',⍙y⍙ 1171 | Out ' )WSID ON ',Date,' at ',Time,' is ',3↓,⊃⍎')WSID' 1172 | Out 2 1↑' ' 1173 | Out ' )FNS' 1174 | L←7+1↑⍴t←((⌈t[1]÷r),r×t[2])⍴((r×⌈t[1]÷r←⌊⎕PW÷t[2]),t[2])↑f 1175 | Out t 1176 | Out ' ' 1177 | t←⍴v←(v[Sort v;]),' ' 1178 | Out ' )VARS' 1179 | L←L+3+1↑⍴t←((⌈t[1]÷r),r×t[2])⍴((r×⌈t[1]÷r←⌊⎕PW÷t[2]),t[2])↑v 1180 | Out t 1181 | Out ' ' 1182 | q←'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ∆⍙0123456789' 1183 | LP1:→(0=1↑⍴f)/LP2 1184 | →(~0∊⍴t←⎕CR f[1;])/EN0 1185 | Out ' '⍪(1,⍴t)⍴t←((f[1;]≠' ')/f[1;]),' IS LOCKED' 1186 | →LP1,0⍴L←L+2,0⍴f←1 0↓f 1187 | EN0:⍙y⍙←t[1;] 1188 | t←1 0↓t 1189 | t←((t[;1]≠'⍝')+(t[;1]∊¯10↓q)∧0=(+/∧\t≠':')-+/∧\t∊q)⌽' ',' ',t 1190 | t←((⍴n)⍴(,(-+/∧\⌽i)⌽i)\(,i←n≠' ')/,n←'[',(⍕(n,1)⍴⍳n←1↑⍴t),']'),' ',t 1191 | LP4:pr←+/1⌈⌈((t≠' ')⌈.×⍳¯1↑⍴t)÷⎕PW 1192 | →((plpp1↓⍴t)∧80>1↓⍴d)/EN1 1355 | f←c↑,5 0⍕5×⍳c 1356 | f[Omega f=' ']←'-' 1357 | i←-g←¯1+g 1358 | →EN1 1359 | LP1:Clear 1360 | ⍎(~x)/'79↑n↓f' 1361 | ((1↑⍴t),79)↑(0,n)↓t 1362 | (g,79)↑(i,n)↓d 1363 | ' ' 1364 | EN1:→(EHN a←CS PI '<><> Screen number ',(⍕1 RND 1+i DIV g),' <><> ')/EN10,HP,EN3 1365 | →('bf.+;el-s'=1↑a)/EN4,EN5,EN7,EN9,EN8,0,EN6,EN11,EN12 1366 | →((1,(⌈j DIV g),0.01 0 1)Lck a)/EN1 1367 | i←(j-1)⌊(⌊100×a-⌊a)+gׯ1+⌊a←⍎a 1368 | →LP1 1369 | HP:Clear 1370 | ∆LPH 1371 | →EN1 1372 | EN3:⍎(j>i+g)/'i←i+g' 1373 | →LP1 1374 | EN4:i←0⌈i-g 1375 | →LP1 1376 | EN5:→LP1 ∆ i←0 1377 | EN6:→LP1 ∆ i←0⌈j-g 1378 | EN7:→((1,j,1 0 1)Lck 1↓a)/EN1 1379 | →LP1 ∆ i←¯1+⍎1↓a 1380 | EN8:→((1,c,1 0 1)Lck 1↓a)/EN1 1381 | →LP1 ∆ n←¯1+⍎1↓a 1382 | EN9:→(0=⍴L←,0 ¯1↓d ∆SS 1↓a)/ER1 1383 | →LP1 ∆ i←¯1+1↑(¯1+(L>1+i)⍳1)⌽L 1384 | EN10:Clear 1385 | →0 1386 | EN11:→(0=⍴L←,0 ¯1↓d ∆SS 1↓a)/ER1 1387 | →LP1 ∆ i←¯1+¯1↑(¯1+(L>i)⍳1)⌽L 1388 | EN12:→(0=⍴L←,0 ¯1↓d ∆SS 1↓a)/ER1 1389 | t ∆LP d[L;] 1390 | →LP1 1391 | ER1:→EN1 ∆ ER(1↓a),' does not exist.' 1392 | ∇ 1393 | 1394 | ∇z←∆LPH;m 1395 | m←'R20,L59' 1396 | '' 1397 | m Ctit'F, = advance to the first screen and display it' 1398 | '' 1399 | m Ctit'L, = advance to the last screen and display it' 1400 | '' 1401 | m Ctit'B, = backstep one screen an display it' 1402 | '' 1403 | m Ctit'E, = exit the local report mode' 1404 | '' 1405 | m Ctit'END, = exit the local report mode and clear the screen' 1406 | '' 1407 | m Ctit'A number, = advance to the screen number entered' 1408 | m Ctit'A.B, = advance to screen A - line B' 1409 | m Ctit'.number, = advance to the line number entered' 1410 | '' 1411 | m Ctit';number, = advance to the column number entered' 1412 | m Ctit'stext, = display all lines with text' 1413 | m Ctit'+text, = advance to the text entered' 1414 | m Ctit'-text, = scan backward and display from text' 1415 | '' 1416 | ∇ 1417 | 1418 | ∇z←L ∆RD r 1419 | z←L,⎕AV[1],r 1420 | ∇ 1421 | 1422 | ∇x←e ∆SS s;rs;old;new;so;v;i;r 1423 | →((' '=1↑0⍴e)∧' '=1↑0↑s←,s)/EN0 1424 | →⍴0⍴⎕←'Invalid data type' 1425 | EN0:rs←(⍴⍴e),⍴e 1426 | →(rs[1]=0 1 2)/S0,V1,M1 1427 | →⍴0⍴⎕←'Invalid data rank' 1428 | S0:→V1,rs←2⍴⍴e←,e 1429 | M1:e←,⎕AV[1],e 1430 | V1:old←s[⍳¯1+s⍳⎕AV[1]] 1431 | →(so←(⍴old)=⍴s)/S1 1432 | s←(1+⍴old)↓s 1433 | new←s[⍳¯1+s⍳⎕AV[1]] 1434 | S1:→((0=⍴old)∨(⍴old)>¯1↑rs)/NONE 1435 | →(0=⍴v←(((1-⍴old)↓e)=old[1])/⍳(⍴e)+1-⍴old)/NONE 1436 | i←1+0×r←⍴old 1437 | LP1:→(r