Idioms K3.Pdf

Total Page:16

File Type:pdf, Size:1020Kb

Idioms K3.Pdf Learning K programming, idiom by idiom K2/K3 version Eusebio C Rufian-Zilbermann Cover image © 2019 Eusebio C Rufian-Zilbermann. All rights reserved. Commentary and main text: Eusebio C Rufian-Zilbermann List of Idioms, original K version by: Eugene McDonnell Included Reference Documentation from: Arthur Whitney Select ideas and comments by: Stevan Apter, John Earnest, Michal Wallace Contents Introduction to K ........................................................................................................................................... 1 Why K? ...................................................................................................................................................... 1 Why study idioms? .................................................................................................................................... 3 Getting K ................................................................................................................................................... 4 Running K .................................................................................................................................................. 5 Fundamental types ................................................................................................................................... 6 Idioms ............................................................................................................................................................ 8 Direct application of verbs ........................................................................................................................ 8 575. Kronecker delta of x and y ............................................................................................................ 8 571. x but not y ..................................................................................................................................... 8 570. x implies y ...................................................................................................................................... 8 573. exclusive or ................................................................................................................................... 8 41. indices of ones in Boolean vector x................................................................................................. 9 629. error to stop execution ................................................................................................................. 9 516. multiply each column of x by y ..................................................................................................... 9 566. zero all items of Boolean x .......................................................................................................... 10 624. zero numerical array ................................................................................................................... 10 622. retain value of items marked by y, zero others .......................................................................... 10 331. identity for floating point and integer maximum, negative infinity -0i ...................................... 10 337. identity for floating point and integer minimum, positive infinity ............................................. 11 357, 544. does x match y .................................................................................................................... 11 328. number of items .......................................................................................................................... 12 411. number of rows in matrix x ......................................................................................................... 12 445. number of columns in matrix x ................................................................................................... 12 388. drop y rows from top of matrix x ................................................................................................ 12 154. range (nub; remove duplicate items) ......................................................................................... 13 70. remove duplicate rows ................................................................................................................. 13 143. indices of distinct items .............................................................................................................. 13 228. is y a row of x .............................................................................................................................. 14 232. is y a row of x .............................................................................................................................. 14 559. index of first marker in Boolean x ............................................................................................... 14 78. number from alphanumeric .......................................................................................................... 14 88. name variable according to x ........................................................................................................ 15 96. conditional execution .................................................................................................................... 15 115, 116, 117. case structure .............................................................................................................. 15 493. choose x or y depending on Boolean g ....................................................................................... 16 434. replace first item of x with y ....................................................................................................... 16 433. replace last item of x with y ........................................................................................................ 16 406. add y to last item of x .................................................................................................................. 17 449. limiting x between l and h, inclusive ........................................................................................... 17 495. indices of all occurrences of y in x .............................................................................................. 17 504. replace items of y satisfying x with g .......................................................................................... 17 569. change y to one if x ..................................................................................................................... 18 556. all indices of vector x ................................................................................................................... 18 535. avoiding parentheses using reverse ........................................................................................... 18 591. reshape vector x into 2-column matrix ....................................................................................... 18 595. one-row matrix from vector ....................................................................................................... 18 616. scalar from one-item vector ....................................................................................................... 19 509. remove y from x .......................................................................................................................... 19 510. remove blanks ............................................................................................................................. 19 496. remove punctuation characters .................................................................................................. 19 177. indices of start of string x in string y ........................................................................................... 20 45. binary representation of positive integer ..................................................................................... 20 84. scalar from Boolean vector ........................................................................................................... 20 129. arctangent y%x ............................................................................................................................ 20 561. numeric code from character ..................................................................................................... 20 241. sum over subsets of x specified by y ........................................................................................... 20 245. randomize the random seed ....................................................................................................... 21 61. cyclic counter, repeating 1 through n ........................................................................................... 21 384. drop 1st, postpend 0 ................................................................................................................... 21 385. drop last, prepend 0 .................................................................................................................... 21 178. index of first occurrence of string x in string y ............................................................................ 21 447. conditional drop of y items from array x .................................................................................... 22 448. conditional drop of last item of array x ...................................................................................... 22 549. alphabetic comparison (depends on storage values)
Recommended publications
  • Is Ja Dialect of APL? Reported by Jonathan Barman Eugene Mcdonnell - the Question Is Irrelevant
    VICTOR Vol.8 No.2 convert the noun back to verb and as a result various interesting control structures can be created. The verbal nouns thus formed can be put into arrays and some of the benefits that various people have suggested might arise from arrays of functions can be obtained. A design goal is to make compilation possible without limiting the expressive power of J. APL Technology of Computer Simulation, by A Boozin and I Popselov reported by Sylvia Camacho Both authors of this paper are academic mathematicians and their use of APL is just where one might expect it to be: in modelling linear differential equations and stochastic Markovian processes. Questions put showed that they first used APL 15 years ago on terminals to what was described as 'a big old computer'. Currently they use APL*PLUS/PC. They have set up an environment in which they can split the screen and display data graphically with some zoom facilities. This environment can be used in conjunction with raw APL while exploring the results of a model, or can be used in conjunction with data derived from APL or some other source. In fact it is often used by Pascal programmers. Most recently they have been setting up economic models to try to come to terms with the consequences of decentralisation and privatisation. They use both Roman and Cyrillic alphabets. Panel: Is Ja Dialect of APL? reported by Jonathan Barman Eugene McDonnell - The question is irrelevant. Surely proponents of J would not be thrown out of the APL community? Garth Foster - J is quite definitely not APL.
    [Show full text]
  • K.E.Iverson and APL.J
    K.E.Iverson Kenneth Iverson Charismatic mathematician who invented the APL computer programming language A GIFTED mathematician and a charismatic teacher, Ken Iverson made a highly influential contribution to the field of computer science. In the early 1960s a mathematical notation which he had developed as an aide to teaching algebra formed the basis of APL, one of the languages used in programming IBM’s early mainframe computer, the System/360. This concise and powerful language contributed substantially to IBM’s domination of the emerging computer industry during the 1960s and 1970s. Kenneth Eugene Iverson was born in Camrose, Alberta, Canada, in 1920. He demonstrated an early aptitude for mathematics ― he taught himself calculus in his teens. During the Second World War he served in the Royal Canadian Air Force as a flight engineer specialising in reconnaissance. After the war he obtained a degree in mathematics and physics from Queen’s University, Ontario, and went on to postgraduate study at Harvard where, in 1954, he obtained a doctorate in applied mathematics, and from 1955 to 1960 he was assistant professor of applied mathematics. During this period he developed a novel way of teaching algebra to students, the “Iverson notation”. It attracted the interest of IBM, which was already well established in commercial and scientific computing fields and was developing a new mainframe, the System/360. IBM recruited Iverson and three colleagues to turn his teaching notation into a program- ming language which could be used on the System/360. The result, expounded in his book A Programming Language (1962), came to be known as APL.
    [Show full text]
  • The Computational Attitude in Music Theory
    The Computational Attitude in Music Theory Eamonn Bell Submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy in the Graduate School of Arts and Sciences COLUMBIA UNIVERSITY 2019 © 2019 Eamonn Bell All rights reserved ABSTRACT The Computational Attitude in Music Theory Eamonn Bell Music studies’s turn to computation during the twentieth century has engendered particular habits of thought about music, habits that remain in operation long after the music scholar has stepped away from the computer. The computational attitude is a way of thinking about music that is learned at the computer but can be applied away from it. It may be manifest in actual computer use, or in invocations of computationalism, a theory of mind whose influence on twentieth-century music theory is palpable. It may also be manifest in more informal discussions about music, which make liberal use of computational metaphors. In Chapter 1, I describe this attitude, the stakes for considering the computer as one of its instruments, and the kinds of historical sources and methodologies we might draw on to chart its ascendance. The remainder of this dissertation considers distinct and varied cases from the mid-twentieth century in which computers or computationalist musical ideas were used to pursue new musical objects, to quantify and classify musical scores as data, and to instantiate a generally music-structuralist mode of analysis. I present an account of the decades-long effort to prepare an exhaustive and accurate catalog of the all-interval twelve-tone series (Chapter 2). This problem was first posed in the 1920s but was not solved until 1959, when the composer Hanns Jelinek collaborated with the computer engineer Heinz Zemanek to jointly develop and run a computer program.
    [Show full text]
  • How We Got to APL\1130
    How We Got To APL\1130 by Larry Breed APLBUG at CHM, 10 May 2004 APL\1130 was implemented overnight in the autumn of 1967, but it took years of effort to make that possible. In 1965, Ken Iverson’s group in Yorktown was wrestling with the transition from Iverson Notation, a notation suited for blackboards and printed pages, to a machine-executable programming environment. Iverson had already developed a Selectric typeball and was writing a high-school math textbook. By autumn 1965, Larry Breed and Stanford grad student Philip Abrams had written the first implementation in 7090 Fortran (with batch execution). Eugene McDonnell was looking for applications to run on TSM, his project’s experimental time-sharing system on a virtual-memory 7090. With his help, Breed ported the Fortran code, added I/O routines for the 1050 terminals, called the result IVSYS; and Iverson Notation went interactive. Iverson, Breed and other associates now faced issues of input and output, function definition, error handling, suspended execution, and workspaces. They also struggled with both extending the notation to multidimensional arrays and new primitives, and limiting it to what could reasonably be implemented. Whatever it was, it wasn’t “APL”; that name came later. Iverson was also collaborating with John Lawrence of Science Research Associates (SRA), an IBM subsidiary in Chicago aimed at educational markets. Lawrence had been editor of the IBM Systems Journal when it published the Iversonian tour de force “A Formal Description of System/360.” At SRA he was leading a project to make Iverson’s notation the heart of a line of instructional materials, both books and interactive computer applications.
    [Show full text]
  • Interview with Jeffrey Shallit
    numerative ombinatorics A pplications Enumerative Combinatorics and Applications ECA 2:2 (2022) Interview #S3I5 ecajournal.haifa.ac.il Interview with Jeffrey Shallit Toufik Mansour Jeffrey Shallit earned a bachelor of arts in mathematics from Princeton University in 1979. He received a Ph.D. at the Uni- versity of California, Berkeley in 1983, under the supervision of David Goldschmidt (de jure) and Manuel Blum (de facto). Currently, he is a professor of mathematics in the School of Computer Science at the University of Waterloo. Professor Shallit has given lectures and talks at many conferences and workshops. Here we list some of them: Numeration 2019, Er- win Schr¨odinger Institute, in Austria, 2019; Highlights of Logic, Games, and Automata, in Germany, 2018; LMS Keynote Ad- dress in Discrete Mathematics, in England, 2014; Fields Work- shop on Challenges in Combinatorics on Words, in 2013; High- Photo by Joe Petrik lights of AutomathA, in Austria, 2010; Distinguished Lecture Series, University of Victoria, 2002. Professor Shallit's research interests include combinatorics on words, formal languages and automata theory (especially connections with number theory), algorithmic number theory (primality testing, factoring, etc.), and the ethical use of computers. For his contributions, Professor Shallit, in 2008, was named a Distinguished Scientist by the Association for Computing Machinery. In 2020, Professor Shallit was elected as a Foreign Member of the Finnish Academy of Science and Letters. He has been the editor-in-chief of the Journal of Integer Sequences since 2002. Mansour: Professor Shallit, first of all, we These days, a good combinatorialist often would like to thank you for accepting this in- needs to know complex analysis, number the- terview.
    [Show full text]
  • Doc/Articles/Play203 I
    Doc/Articles/Play203 i Doc/Articles/Play203 Doc/Articles/Play203 ii COLLABORATORS TITLE : Doc/Articles/Play203 ACTION NAME DATE SIGNATURE WRITTEN BY March 26, 2009 REVISION HISTORY NUMBER DATE DESCRIPTION NAME 10 2009-03-25 07:33:34 follow guidelines, finish code testing. RicSherlock 9 2009-03-25 07:01:33 More work on text. Need to test code from q2 on RicSherlock 8 2009-03-24 20:56:01 RicSherlock 7 2009-03-24 20:52:59 to q2 RicSherlock 6 2009-03-23 08:29:50 update code-block syntax RicSherlock 5 2008-12-08 18:45:51 converted to 1.6 markup localhost 4 2005-12-16 10:10:38 Openning {{{ likes to sit on a line of its own OlegKobchenko 3 2005-12-15 13:08:25 format fixes ChrisBurke 2 2005-12-15 13:03:15 format fixes ChrisBurke Doc/Articles/Play203 iii Contents 1 At Play With J Giddyap 1 1.1 Methods for finding how many different finishes . .1 1.2 Methods for representing all the possible finishes . .2 Doc/Articles/Play203 1 / 5 1 At Play With J Giddyap • Eugene McDonnell The OED doesn’t have a giddyap entry; the Concise Oxford Dictionary has a giddap entry; Webster 3 has an entry for giddap, giddyap, giddyup. I think it must be a children’s word; I don’t think I’ve ever heard it used by an adult. When I was much younger I know that when I pretended I was riding a horse, I swung my imaginary whip on my imaginary horse as I pranced about, shouting giddyap with every stroke of the whip.
    [Show full text]
  • 1981 05 06 Index
    ••••••••••••••• •••••••••••• index 1981 Western APL A May/June 1981, Vol 9/No 3, 8 Actuarial/Insurance Applications Software Graphics for the Actuary, Jim Spurgeon CONSOL, Margaret Reilly July/August 1981, Vol 9/No 4, 9 March/April 1981, Vol 9/No 2, 2-4 Winnipeg Week MABRA, a new release, Hugh Hyndman and September/October 1981, Vol 9/No 5, 4 Steve Halasz May/June 1981, Vol 9/No 3, 2-5 Project Management, Ken Chakahwata American Petroleum Institute September /October 1981, Vol 9 /No 5, 3 SAGA, A Graphics Language for APL Program­ API Weekly Statistical Bulletin, Brian Hart mers, Mike Holloway July/August 1981, Vol 9/No 4, 10 November/December 1981, Vol 9/No 6, 5- 7 Unlocking the I.P. Sharp Public Libraries (The APL Conferences, Meetings Glass Box Approach), Lib Gibson January/February 1981, Vol 9/No 1, 1 APL Blossoms in SFO, Arlene Azzarello November/December 1981, Vol 9/No 6, 7 APL Club Germany E.V. Aviation March/April 1981, Vol 9/No 2, 4 APL 81 Air Transportation Seminar March/April 1981, Vol 9/No 2, 5 January/February 1981, Vol 9/No 1, 4 APL82 Heidelberg Expanded Service to the Aviation Industry July/August 1981, Vol 9/No 4, 13 July/August 1981, Vol 9/No 4, 10 APL Forum in Vienna, Gottfried Bach September/October 1981, Vol 9/No 5, 5 Expanding Audience for APL Myths, Peter Mee·kin July/August 1981, Vol 9/No 4, 12 B NY SIGAPL-A Report September /October 1981, Tech Supp 34, Back Up Schedule TS Panel Discussion on the Use of Enclosed Arrays, Back Up Schedule Roland Pesch March/April 1981, Tech Supp 31, T4 November/December 1981, Tech Supp 35, T3-T4 Third Dutch APL Mini Congress BI/DATA see Business International Data Base July/August 1981, Vol 9/No 4, 13 J.P.
    [Show full text]
  • Why I'm Still Using
    Why I’m Still Using APL Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, ON N2L 3G1 Canada www.cs.uwaterloo.ca/~shallit [email protected] What is APL? • a system of mathematical notation invented by Ken Iverson and popularized in his book A Programming Language published in 1962 • a functional programming language based on this notation, using an exotic character set (including overstruck characters) and right-to- left evaluation order • a programming environment with support for defining, executing, and debugging functions and procedures Frequency Distribution APL and Me • worked at the IBM Philadelphia Scientific Center in 1973 with Ken Iverson, Adin Falkoff, Don Orth, Howard Smith, Eugene McDonnell, Richard Lathwell, George Mezei, Joey Tuttle, Paul Berry, and many others Communicating APL and Me • worked as APL programmer for the Yardley Group under Alan Snyder from 1976 to 1979, with Scott Bentley, Dave Jochman, Greg Bentley, and Dave Ehret APL and Me • worked from 1974 to 1975 at Uni-Coll in Philadelphia as APL consultant • worked from 1975 to 1979 as APL consultant at Princeton • worked at I. P. Sharp in Palo Alto in 1979 with McDonnell, Berry, Tuttle, and others • published papers at APL 80, APL 81, APL 82, APL 83 and various issues of APL Quote-Quad • taught APL in short courses at Berkeley from 1979 to 1983 and served as APL Press representative • taught APL at the University of Chicago from 1983 to 1988 Why I’m Still Using APL Because • I don’t need to master arcane “ritual incantations” to do things
    [Show full text]
  • Contents Page Editorial: 2
    VECTOR Vol.21 No.4 Contents Page Editorial: 2 RESPONSES Thoughts on the Urn Problem Eddie Clough 4 CRCOMPARE in J Adam Dunne 7 NEWS News from Sustaining Members 10 Product Guide Gill Smith 13 DISCOVER At Play with J: Metlov’s Triumph Gene McDonnell 25 Functional Programming in Joy and K Stevan Apter 31 Function Arrays in APL Gianluigi Quario 39 LEARN A Suduko Solver in J Roger Hui 49 Sudoku with Dyalog APL John Clark & Ellis Morgan 53 APL+WebComponent (Part 2) Deploy your APL+Win Application on the Web Eric Lescasse 62 APL Idioms Ajay Askoolum 92 Review Mathematical Computing in J (Howard Peelle) Cliff Reiter 97 J-ottings 44: So easy a Child of Ten ... Norman Thomson 101 Zark Newsletter Extracts edited by Jonathan Barman 108 Crossword Solution 116 PROFIT Developer Productivity with APLX v3 and SQL Ajay Askoolum 117 Index to Advertisers 143 1 VECTOR Vol.21 No.4 Editorial: Discover, Learn, Profit The BAA’s mission is to promote the use of the APLs. This has two parts: to serve APL programmers, and to introduce APL to others. Printing Vector for the last twenty years has addressed the first part, though I see plenty more to do for working programmers – we publish so little on APL2, for example. But it does little to introduce APL to outsiders. If you’ve used the Web to explore a new programming language in the last few years, you will have had an experience hard to match with APL. Languages and technologies such as JavaScript, PHP, Ruby, ASP.NET and MySQL offer online reference material, tutorials and user forums.
    [Show full text]
  • The Advocate - Oct
    Seton Hall University eRepository @ Seton Hall The aC tholic Advocate Archives and Special Collections 10-24-1963 The Advocate - Oct. 24, 1963 Catholic Church Follow this and additional works at: https://scholarship.shu.edu/catholic-advocate Part of the Catholic Studies Commons, and the Missions and World Christianity Commons Council Discusses The Advocate Laity; ° fncl>l Publication of the Archdiocese of Newark, N. J., and Diocese of Paterson, N. J. Vol. No. 44 12, THURSDAY, OCTOBER 24, 1963 PRICK: 10 CENTS To Extend Vernacular Am Aivotrtt News Summery By MBGR. JAMES I. TUCEK VATICAN CITY The Fa- thera of the Second Vatican VATICAN CITY (NC>-For the Council this week took up first time in any ecumeni- cal study of far-ranging changes council the topic of tha in the prleits' breviary and laity has become a major sub- of paved the way tor even broad- ject debate by the Bishops er use of local languages than of the world. had been indicated earlier. The action took placa as tha Fathers periodically Inter- Other Stories Poges 2,3; rupted their current discus- Comment Poges 6, 7 sion on the laity for votes on various amendments and of the With the chapters liturgy 50th general con- schema, which they had dis- gregation Oct. 17, the third cussed last year. chapter of the schema *‘Da Ecclesia” entered full debate. TUB BBY VOTE of tha The chapter as it now stands week was that which ap- treats of “The People of' God” proved —with reservations—- and of "The Laity.” It was the third chapter of the sche- decided to split these two me.
    [Show full text]
  • Palo Alto Weekly Presents
    6°Ê888]Ê ÕLiÀÊ{ÇÊUÊÕ}ÕÃÌÊÓÇ]ÊÓä£äÊN xäZ www.PaloAltoOnline.com Palo Alto Weekly presents 1ST PLACE GENERAL EXCELLENCE Read up-to-the-minute news at www.PaloAltoOnline.com California Newspaper Publishers Association INSIDE: Local news, arts, sports, books, home and real estate … and the Best Of Palo Alto! Packard Pediatric Center for Weight Control Healthy Weight Program Packard Stanford Parents & Children’s School of Families Hospital Medicine TOGETHER WE HELPED ALBERTO LOSE 30 POUNDS. Thanks to the Packard Pediatric Weight Control Program, Alberto had a whole care team, including his mom, not just behind him, but beside him. Together at every class, the team champions lifelong healthy habits: wisdom that families can take home, to the market, or anywhere. Far more than quick-fi x calorie counting or weight loss, our approach is not just livable, it’s contagious. Alberto’s Mom lost 12 pounds herself. Having a program that inspires losses like this truly is the community’s gain. www.lpch.org To learn more about the Packard Pediatric Weight Control Program, visit pediatricweightcontrol.lpch.org or call 650-725-4424. Inside: Sports.....................................17 Movies ....................................21 Eating Out ...............................24 Best of ....................................27 Home & Real Estate .................59 Puzzles ...................................70 Palo Alto Festival of the Arts ...........Pullout Section UpfrontLocal news, information and analysis High-speed rail station a tough sell in Palo Alto Council members skeptical about building tion, modify its zoning ordinances station, members of the council’s of these structures to be about $150 to incorporate high-speed rail and High-Speed Rail Committee ex- million, which would be paid for by a local station for controversial system provide about 3,000 parking spaces pressed opinions that ranged from the city.
    [Show full text]
  • Jeff Shallit's Apl NEW FROM
    APLtarI{trWS NEW FROM APL PRESS A Source Book in API-Papers bg : Atlin D. Falkoff . Kenneth E. Iver- son 139 pages, rsBN 0-917326-10-5, (paper) $10.35 This collection of fundamental pa- pers by Adin Falkoff and Ken Iver- son provides background material for teachers and students of ApL. In a course on ApL, the focus is neces- sarily on the details of the language and its use. Often, there is not elrough time to give the purpose for any given rule, nor how one piece of the language relates to the whole. The articles in A Source Book in APL deal with the more funclarnen- tal issues of the language. These pa- pers appeared in widely scatterecl sources, over a period of many years, and many are not at all easy to find. A Source Book in APL conlains Ivelson's'Formalism in Pr.ogram APL PRESS features APL Rogues' Gallery at APL Mollieo pcLtlick (ApL 81 ming Languages," "Convenr ions PaESS) tulcl Al McDonn,ell (left) look on as Pete McDotneII (tight) sketcltes Leslie Governing Order Evaluation,', GoLdstnitlt's (1. P. Sltat2 Associutes) clTricqhlre et tlle ApL pr'lslj boo t. Leslie's like- of Language,". ttess .joitted tlLe tanks of the burgeoning "APL chat octet, ,set' Disible in, te ba,ck- "Algebra as a ',Pro- tio't rhl. gramming Style in err,," "Notation as a Tool of Thought," and "The In- ductive Method of Introducing .rrr-." Also incluclecl are "The Design of APL" and "The Evolution of epr," bv " APL PRESS GOES WEST In this issue: Jeff Shallit's apl A.
    [Show full text]