269 research outputs found

    Projection Factorisations in Partial Evaluation

    Get PDF
    Partial evaluation is becoming ever more promising as a programming tool. Early partial evaluators depended over much on the source program being written in a particular style, and needed certain ad hoc optimisations to produce good results. The practice of partial evaluation is now fairly well developed but the theoretical underpinnings are not equally well understood. A partial evaluator takes a program, together with some of the input to the program, and produces a new program. This new, or residual, program is an optimised version of the old, having taken the input data into account. Work undertaken at DIKU in Copenhagen has shown the importance of prior analysis of the program. This binding-time analysis discovers which values within the program may bo computed during partial evaluation-called static values and which values may not the dynamic values. In this thesis we propose using domain projections in binding-time analysis. This allows a greater level of data separation than before because values are no longer treated atomically. In particular, we are able to pinpoint static values within data structures containing both static and dynamic parts. An interesting consequence of using domain projections is that we are able to demonstrate an intimate relationship between binding-time analysis and strictness analysis. Dependent sum and product are familiar from constructive type theory. We give a less familiar domain-theoretic definition and show how projections determine particular dependent sums. The practical application of this result is to generate residual functions whose types depend on the static values from which they wore produced. Certain optimising techniques, such as tag removal and arity raising, arise as a direct, consequence. We extend the use of projections to polymorphic programs, giving a practical application of developments in the theory of polymorphism. Polymorphic functions are regarded as natural transformations between appropriate functors. This leads to three benefits: polymorphic functions are analysed once and the result reused; the static input to polymorphic functions is described by polymorphic projections, which reduces the search space of the analysis; and polymorphic functions are specialised to polymorphic values, leading to polymorphic residual functions

    Type-Inference Based Short Cut Deforestation (nearly) without Inlining

    Get PDF
    Deforestation optimises a functional program by transforming it into another one that does not create certain intermediate data structures. In [ICFP'99] we presented a type-inference based deforestation algorithm which performs extensive inlining. However, across module boundaries only limited inlining is practically feasible. Furthermore, inlining is a non-trivial transformation which is therefore best implemented as a separate optimisation pass. To perform short cut deforestation (nearly) without inlining, Gill suggested to split definitions into workers and wrappers and inline only the small wrappers, which transfer the information needed for deforestation. We show that Gill's use of a function build limits deforestation and note that his reasons for using build do not apply to our approach. Hence we develop a more general worker/wrapper scheme without build. We give a type-inference based algorithm which splits definitions into workers and wrappers. Finally, we show that we can deforest more expressions with the worker/wrapper scheme than the algorithm with inlining

    Survivability: The Human Element

    Get PDF
    Modern warship design is facing a number of drivers in terms of design, procurement and operation and these have both direct and indirect impacts on issues such as survivability and the human element. Guidance has been developed regarding Human Factors Integration (HFI), but this has generally focussed on detail design and fatigue. The UK MOD HFI Initiative describes HFI with 7 more holistic domains which are seen to have wider ship design impacts. This paper considers three current drivers on warship design for their impacts on survivability in the context of the human element. There were seen to be some interactions between different aspects of modern warship design and operation that again require a more holistic assessment of HF issues. The paper concludes that, although a more holistic approach is required, the increasing computerisation of the preliminary ship design process should allow tools to be developed to support this

    Structure and Properties of Traces for Functional Programs

    Get PDF
    The tracer Hat records in a detailed trace the computation of a program written in the lazy functional language Haskell. The trace can then be viewed in various ways to support program comprehension and debugging. The trace was named the augmented redex trail. Its structure was inspired by standard graph rewriting implementations of functional languages. Here we describe a model of the trace that captures its essential properties and allows formal reasoning. The trace is a graph constructed by graph rewriting but goes beyond simple term graphs. Although the trace is a graph whose structure is independent of any rewriting strategy, we define the trace inductively, thus giving us a powerful method for proving its properties

    Singular and Plural Functions for Functional Logic Programming

    Full text link
    Functional logic programming (FLP) languages use non-terminating and non-confluent constructor systems (CS's) as programs in order to define non-strict non-determi-nistic functions. Two semantic alternatives have been usually considered for parameter passing with this kind of functions: call-time choice and run-time choice. While the former is the standard choice of modern FLP languages, the latter lacks some properties---mainly compositionality---that have prevented its use in practical FLP systems. Traditionally it has been considered that call-time choice induces a singular denotational semantics, while run-time choice induces a plural semantics. We have discovered that this latter identification is wrong when pattern matching is involved, and thus we propose two novel compositional plural semantics for CS's that are different from run-time choice. We study the basic properties of our plural semantics---compositionality, polarity, monotonicity for substitutions, and a restricted form of the bubbling property for constructor systems---and the relation between them and to previous proposals, concluding that these semantics form a hierarchy in the sense of set inclusion of the set of computed values. We have also identified a class of programs characterized by a syntactic criterion for which the proposed plural semantics behave the same, and a program transformation that can be used to simulate one of them by term rewriting. At the practical level, we study how to use the expressive capabilities of these semantics for improving the declarative flavour of programs. We also propose a language which combines call-time choice and our plural semantics, that we have implemented in Maude. The resulting interpreter is employed to test several significant examples showing the capabilities of the combined semantics. To appear in Theory and Practice of Logic Programming (TPLP)Comment: 53 pages, 5 figure

    A Reflection on Types

    Get PDF
    The ability to perform type tests at runtime blurs the line between statically-typed and dynamically-checked languages. Recent developments in Haskell’s type system allow even programs that use reflection to themselves be statically typed, using a type-indexed runtime representation of types called \{}\textit{TypeRep}. As a result we can build dynamic types as an ordinary, statically-typed library, on top of \{}\textit{TypeRep} in an open-world context

    How functional programming mattered

    Get PDF
    In 1989 when functional programming was still considered a niche topic, Hughes wrote a visionary paper arguing convincingly ‘why functional programming matters’. More than two decades have passed. Has functional programming really mattered? Our answer is a resounding ‘Yes!’. Functional programming is now at the forefront of a new generation of programming technologies, and enjoying increasing popularity and influence. In this paper, we review the impact of functional programming, focusing on how it has changed the way we may construct programs, the way we may verify programs, and fundamentally the way we may think about programs

    Upregulation of Trem2 expression occurs exclusively on microglial contact with plaques

    Get PDF
    Using spatial cell-type-enriched transcriptomics, we compare plaque-induced gene (PIG) expression in microglia touching plaques, neighboring plaques, and far from plaques in 18-month-old APPNLF/NLF knock-in mice with and without the Alzheimer’s disease risk mutation Trem2R47H/R47H. We report that, in AppNLF/NLF mice, expression of 35/55 PIGs, is exclusively upregulated in microglia that are touching plaques. In 7 PIGs including Trem2 this upregulation is prevented by the Trem2R47H/R47H mutation. Unlike in young mice, knockin of the Trem2R47H/R47H mutation does not significantly decrease the Trem2 expression but decreases protein levels by 20% in the absence of plaques. On plaques, despite the mutation preventing increased gene expression, TREM2 protein levels increased by 1.6-fold (compared to 3-fold with Trem2WT/WT) and microglial density increased 20-fold compared to 30-fold. Hence microglia must touch plaques before Trem2 gene expression is increased but small changes in protein expression can increase microglia density without a change in gene expression
    corecore