Deriving Practical Implementations of First-Class Functions
Total Page:16
File Type:pdf, Size:1020Kb
Load more
Recommended publications
-
Trip Hazzard 1.7 Contents
Trip Hazzard 1.7 Contents Contents............................................ 1 I Got You (I Feel Good) ................... 18 Dakota .............................................. 2 Venus .............................................. 19 Human .............................................. 3 Ooh La La ....................................... 20 Inside Out .......................................... 4 Boot Scootin Boogie ........................ 21 Have A Nice Day ............................... 5 Redneck Woman ............................. 22 One Way or Another .......................... 6 Trashy Women ................................ 23 Sunday Girl ....................................... 7 Sweet Dreams (are made of this) .... 24 Shakin All Over ................................. 8 Strict Machine.................................. 25 Tainted Love ..................................... 9 Hanging on the Telephone .............. 26 Under the Moon of Love ...................10 Denis ............................................... 27 Mr Rock N Roll .................................11 Stupid Girl ....................................... 28 If You Were A Sailboat .....................12 Molly's Chambers ............................ 29 Thinking Out Loud ............................13 Sharp Dressed Man ......................... 30 Run ..................................................14 Fire .................................................. 31 Play that funky music white boy ........15 Mustang Sally .................................. 32 Maneater -
Songs by Artist 08/29/21
Songs by Artist 09/24/21 As Sung By Song Title Track # Alexander’s Ragtime Band DK−M02−244 All Of Me PM−XK−10−08 Aloha ’Oe SC−2419−04 Alphabet Song KV−354−96 Amazing Grace DK−M02−722 KV−354−80 America (My Country, ’Tis Of Thee) ASK−PAT−01 America The Beautiful ASK−PAT−02 Anchors Aweigh ASK−PAT−03 Angelitos Negros {Spanish} MM−6166−13 Au Clair De La Lune {French} KV−355−68 Auld Lang Syne SC−2430−07 LP−203−A−01 DK−M02−260 THMX−01−03 Auprès De Ma Blonde {French} KV−355−79 Autumn Leaves SBI−G208−41 Baby Face LP−203−B−07 Beer Barrel Polka (Roll Out The Barrel) DK−3070−13 MM−6189−07 Beyond The Sunset DK−77−16 Bill Bailey, Won’t You Please Come Home? DK−M02−240 CB−5039−3−13 B−I−N−G−O CB−DEMO−12 Caisson Song ASK−PAT−05 Clementine DK−M02−234 Come Rain Or Come Shine SAVP−37−06 Cotton Fields DK−2034−04 Cry Like A Baby LAS−06−B−06 Crying In The Rain LAS−06−B−09 Danny Boy DK−M02−704 DK−70−16 CB−5039−2−15 Day By Day DK−77−13 Deep In The Heart Of Texas DK−M02−245 Dixie DK−2034−05 ASK−PAT−06 Do Your Ears Hang Low PM−XK−04−07 Down By The Riverside DK−3070−11 Down In My Heart CB−5039−2−06 Down In The Valley CB−5039−2−01 For He’s A Jolly Good Fellow CB−5039−2−07 Frère Jacques {English−French} CB−E9−30−01 Girl From Ipanema PM−XK−10−04 God Save The Queen KV−355−72 Green Grass Grows PM−XK−04−06 − 1 − Songs by Artist 09/24/21 As Sung By Song Title Track # Greensleeves DK−M02−235 KV−355−67 Happy Birthday To You DK−M02−706 CB−5039−2−03 SAVP−01−19 Happy Days Are Here Again CB−5039−1−01 Hava Nagilah {Hebrew−English} MM−6110−06 He’s Got The Whole World In His Hands -
(Pdf) of from Push/Enter to Eval/Apply by Program Transformation
From Push/Enter to Eval/Apply by Program Transformation MaciejPir´og JeremyGibbons Department of Computer Science University of Oxford [email protected] [email protected] Push/enter and eval/apply are two calling conventions used in implementations of functional lan- guages. In this paper, we explore the following observation: when considering functions with mul- tiple arguments, the stack under the push/enter and eval/apply conventions behaves similarly to two particular implementations of the list datatype: the regular cons-list and a form of lists with lazy concatenation respectively. Along the lines of Danvy et al.’s functional correspondence between def- initional interpreters and abstract machines, we use this observation to transform an abstract machine that implements push/enter into an abstract machine that implements eval/apply. We show that our method is flexible enough to transform the push/enter Spineless Tagless G-machine (which is the semantic core of the GHC Haskell compiler) into its eval/apply variant. 1 Introduction There are two standard calling conventions used to efficiently compile curried multi-argument functions in higher-order languages: push/enter (PE) and eval/apply (EA). With the PE convention, the caller pushes the arguments on the stack, and jumps to the function body. It is the responsibility of the function to find its arguments, when they are needed, on the stack. With the EA convention, the caller first evaluates the function to a normal form, from which it can read the number and kinds of arguments the function expects, and then it calls the function body with the right arguments. -
Stepping Ocaml
Stepping OCaml TsukinoFurukawa YouyouCong KenichiAsai Ochanomizu University Tokyo, Japan {furukawa.tsukino, so.yuyu, asai}@is.ocha.ac.jp Steppers, which display all the reduction steps of a given program, are a novice-friendly tool for un- derstanding program behavior. Unfortunately, steppers are not as popular as they ought to be; indeed, the tool is only available in the pedagogical languages of the DrRacket programming environment. We present a stepper for a practical fragment of OCaml. Similarly to the DrRacket stepper, we keep track of evaluation contexts in order to reconstruct the whole program at each reduction step. The difference is that we support effectful constructs, such as exception handling and printing primitives, allowing the stepper to assist a wider range of users. In this paper, we describe the implementationof the stepper, share the feedback from our students, and show an attempt at assessing the educational impact of our stepper. 1 Introduction Programmers spend a considerable amount of time and effort on debugging. In particular, novice pro- grammers may find this process extremely painful, since existing debuggers are usually not friendly enough to beginners. To use a debugger, we have to first learn what kinds of commands are available, and figure out which would be useful for the current purpose. It would be even harder to use the com- mand in a meaningful manner: for instance, to spot the source of an unexpected behavior, we must be able to find the right places to insert breakpoints, which requires some programming experience. Then, is there any debugging tool that is accessible to first-day programmers? In our view, the algebraic stepper [1] of DrRacket, a pedagogical programming environment for the Racket language, serves as such a tool. -
A Practical Introduction to Python Programming
A Practical Introduction to Python Programming Brian Heinold Department of Mathematics and Computer Science Mount St. Mary’s University ii ©2012 Brian Heinold Licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported Li- cense Contents I Basics1 1 Getting Started 3 1.1 Installing Python..............................................3 1.2 IDLE......................................................3 1.3 A first program...............................................4 1.4 Typing things in...............................................5 1.5 Getting input.................................................6 1.6 Printing....................................................6 1.7 Variables...................................................7 1.8 Exercises...................................................9 2 For loops 11 2.1 Examples................................................... 11 2.2 The loop variable.............................................. 13 2.3 The range function............................................ 13 2.4 A Trickier Example............................................. 14 2.5 Exercises................................................... 15 3 Numbers 19 3.1 Integers and Decimal Numbers.................................... 19 3.2 Math Operators............................................... 19 3.3 Order of operations............................................ 21 3.4 Random numbers............................................. 21 3.5 Math functions............................................... 21 3.6 Getting -
Making a Faster Curry with Extensional Types
Making a Faster Curry with Extensional Types Paul Downen Simon Peyton Jones Zachary Sullivan Microsoft Research Zena M. Ariola Cambridge, UK University of Oregon [email protected] Eugene, Oregon, USA [email protected] [email protected] [email protected] Abstract 1 Introduction Curried functions apparently take one argument at a time, Consider these two function definitions: which is slow. So optimizing compilers for higher-order lan- guages invariably have some mechanism for working around f1 = λx: let z = h x x in λy:e y z currying by passing several arguments at once, as many as f = λx:λy: let z = h x x in e y z the function can handle, which is known as its arity. But 2 such mechanisms are often ad-hoc, and do not work at all in higher-order functions. We show how extensional, call- It is highly desirable for an optimizing compiler to η ex- by-name functions have the correct behavior for directly pand f1 into f2. The function f1 takes only a single argu- expressing the arity of curried functions. And these exten- ment before returning a heap-allocated function closure; sional functions can stand side-by-side with functions native then that closure must subsequently be called by passing the to practical programming languages, which do not use call- second argument. In contrast, f2 can take both arguments by-name evaluation. Integrating call-by-name with other at once, without constructing an intermediate closure, and evaluation strategies in the same intermediate language ex- this can make a huge difference to run-time performance in presses the arity of a function in its type and gives a princi- practice [Marlow and Peyton Jones 2004]. -
Advanced Tcl E D
PART II I I . A d v a n c Advanced Tcl e d T c l Part II describes advanced programming techniques that support sophisticated applications. The Tcl interfaces remain simple, so you can quickly construct pow- erful applications. Chapter 10 describes eval, which lets you create Tcl programs on the fly. There are tricks with using eval correctly, and a few rules of thumb to make your life easier. Chapter 11 describes regular expressions. This is the most powerful string processing facility in Tcl. This chapter includes a cookbook of useful regular expressions. Chapter 12 describes the library and package facility used to organize your code into reusable modules. Chapter 13 describes introspection and debugging. Introspection provides information about the state of the Tcl interpreter. Chapter 14 describes namespaces that partition the global scope for vari- ables and procedures. Namespaces help you structure large Tcl applications. Chapter 15 describes the features that support Internationalization, includ- ing Unicode, other character set encodings, and message catalogs. Chapter 16 describes event-driven I/O programming. This lets you run pro- cess pipelines in the background. It is also very useful with network socket pro- gramming, which is the topic of Chapter 17. Chapter 18 describes TclHttpd, a Web server built entirely in Tcl. You can build applications on top of TclHttpd, or integrate the server into existing appli- cations to give them a web interface. TclHttpd also supports regular Web sites. Chapter 19 describes Safe-Tcl and using multiple Tcl interpreters. You can create multiple Tcl interpreters for your application. If an interpreter is safe, then you can grant it restricted functionality. -
On “Strict Machine” by Goldfrapp
On “Strict Machine” by Goldfrapp Sam Jowett Four months, fifteen days in. Honeymoon Phase meant to mellow out. Passion ought to neutralize. But how fucking wrong is that. Chrysalis shredding—not just clothes—but those thoughts. True selves emerge. Polyester veneer of politeness is now scraped clean. Goldfrapp The culprit: a single nail, obsidian sharp. Goldfrapp’s satin clad, ebony-gloved fingers. Needle digs into vinyl. You dig into my skin. “Wonderful Electriccccccc.” The lyric “Strict Machine” sashays over the bridge. We saunter past discarded inhibitions. The chorus awaits, an Black Cherry eruption with a single revelation: 04/2003 I’m in love! Mute I’m in love! I’m in love! “Felt Mountain,” their debut, was the bait. But just like us, hints flirted beneath the cabaret instrument gloss. Even masquerades can only hide appearances for so long. A truth awaited. Not to be whispered, but rather gasped aloud. “Strict Machine” dictates: Dressed in white noise. Little else. This is the inverse of a sophomore slump. Former trip-hop ambience is usurped by electroclash riptide. Siren synths draw us closer. Entrapping me to you. Lyrics our parents warned us about. Trent Reznor wishes he could be this lethal. Dance. It does not ask. It demands. Sitting is heresy. Head thrashing, body sweating. This is not some damn waltz. Hands do not clasp in graceful arcs. Rather, bodies meet perpendicular. Entwine inversely. Arms twist. Disorientation until we can’t tell each other apart. You tell me you can tie cherry stems with your tongue. I tell you I can whisper “Black Cherry” nothings into your ear. -
CSE341, Fall 2011, Lecture 17 Summary
CSE341, Fall 2011, Lecture 17 Summary Standard Disclaimer: This lecture summary is not necessarily a complete substitute for attending class, reading the associated code, etc. It is designed to be a useful resource for students who attended class and are later reviewing the material. This lecture covers three topics that are all directly relevant to the upcoming homework assignment in which you will use Racket to write an interpreter for a small programming language: • Racket's structs for defining new (dynamic) types in Racket and contrasting them with manually tagged lists [This material was actually covered in the \Monday section" and only briefly reviewed in the other materials for this lecture.] • How a programming language can be implemented in another programming language, including key stages/concepts like parsing, compilation, interpretation, and variants thereof • How to implement higher-order functions and closures by explicitly managing and storing environments at run-time One-of types with lists and dynamic typing In ML, we studied one-of types (in the form of datatype bindings) almost from the beginning, since they were essential for defining many kinds of data. Racket's dynamic typing makes the issue less central since we can simply use primitives like booleans and cons cells to build anything we want. Building lists and trees out of dynamically typed pairs is particularly straightforward. However, the concept of one-of types is still prevalent. For example, a list is null or a cons cell where there cdr holds a list. Moreover, Racket extends its Scheme predecessor with something very similar to ML's constructors | a special form called struct | and it is instructive to contrast the two language's approaches. -
Proceedings of the Demonstrations at the 14Th Conference of the European Chapter of the Association for Computational Linguistics
EACL 2014 Proceedings of the Demonstrations at the 14th Conference of the European Chapter of the Association for Computational Linguistics April 26-30, 2014 Gothenburg, Sweden GOLD SPONSORS SILVER SPONSOR BRONZE SPONSORS MASTER'S PROGRAMME IN LANGUAGE SUPPORTERS TECHNOLOGY EXHIBITORS OTHER SPONSORS HOSTS c 2014 The Association for Computational Linguistics ii Order copies of this and other ACL proceedings from: Association for Computational Linguistics (ACL) 209 N. Eighth Street Stroudsburg, PA 18360 USA Tel: +1-570-476-8006 Fax: +1-570-476-0860 [email protected] ISBN 978-1-937284-75-6 iii Preface: General Chair Dear readers, Welcome to EACL 2014, the 14th Conference of the European Chapter of the Association for Computational Linguistics! This is the largest EACL meeting ever: with eighty long papers, almost fifty short ones, thirteen student research papers, twenty-six demos, fourteen workshops and six tutorials, we expect to bring to Gothenburg up to five hundred participants, for a week of excellent science interspersed with entertaining social events. It is hard to imagine how much work is involved in the preparation of such an event. It takes about three years, from the day the EACL board starts discussing the location and nominating the chairs, until the final details of the budget are resolved. The number of people involved is also huge, and I was fortunate to work with an excellent, dedicated and efficient team, to which I am enormously grateful. The scientific program was very ably composed by the Program Committee Chairs, Sharon Goldwater and Stefan Riezler, presiding over a team of twenty-four area chairs. -
Specialising Dynamic Techniques for Implementing the Ruby Programming Language
SPECIALISING DYNAMIC TECHNIQUES FOR IMPLEMENTING THE RUBY PROGRAMMING LANGUAGE A thesis submitted to the University of Manchester for the degree of Doctor of Philosophy in the Faculty of Engineering and Physical Sciences 2015 By Chris Seaton School of Computer Science This published copy of the thesis contains a couple of minor typographical corrections from the version deposited in the University of Manchester Library. [email protected] chrisseaton.com/phd 2 Contents List of Listings7 List of Tables9 List of Figures 11 Abstract 15 Declaration 17 Copyright 19 Acknowledgements 21 1 Introduction 23 1.1 Dynamic Programming Languages.................. 23 1.2 Idiomatic Ruby............................ 25 1.3 Research Questions.......................... 27 1.4 Implementation Work......................... 27 1.5 Contributions............................. 28 1.6 Publications.............................. 29 1.7 Thesis Structure............................ 31 2 Characteristics of Dynamic Languages 35 2.1 Ruby.................................. 35 2.2 Ruby on Rails............................. 36 2.3 Case Study: Idiomatic Ruby..................... 37 2.4 Summary............................... 49 3 3 Implementation of Dynamic Languages 51 3.1 Foundational Techniques....................... 51 3.2 Applied Techniques.......................... 59 3.3 Implementations of Ruby....................... 65 3.4 Parallelism and Concurrency..................... 72 3.5 Summary............................... 73 4 Evaluation Methodology 75 4.1 Evaluation Philosophy -
Language Design and Implementation Using Ruby and the Interpreter Pattern
Language Design and Implementation using Ruby and the Interpreter Pattern Ariel Ortiz Information Technology Department Tecnológico de Monterrey, Campus Estado de México Atizapán de Zaragoza, Estado de México, Mexico. 52926 [email protected] ABSTRACT to explore different language concepts and programming styles. In this paper, the S-expression Interpreter Framework (SIF) is Section 4 describes briefly how the SIF has been used in class. presented as a tool for teaching language design and The conclusions are found in section 5. implementation. The SIF is based on the interpreter design pattern and is written in the Ruby programming language. Its core is quite 1.1 S-Expressions S-expressions (symbolic expressions) are a parenthesized prefix small, but it can be easily extended by adding primitive notation, mainly used in the Lisp family languages. They were procedures and special forms. The SIF can be used to demonstrate selected as the framework’s source language notation because advanced language concepts (variable scopes, continuations, etc.) they offer important advantages: as well as different programming styles (functional, imperative, and object oriented). • Both code and data can be easily represented. Adding a new language construct is pretty straightforward. • Categories and Subject Descriptors The number of program elements is minimal, thus a parser is − relatively easy to write. D.3.4 [Programming Languages]: Processors interpreters, • run-time environments. The arity of operators doesn’t need to be fixed, so, for example, the + operator can be defined to accept any number of arguments. General Terms • There are no problems regarding operator precedence or Design, Languages. associativity, because every operator has its own pair of parentheses.