User loginNavigation |
archivesFunction arity with currying and call-by-push-valueIn λ-calculus, all functions are unary, and n-ary functions are encoded through currying. But knowing the arity of a function can be useful for optimization — a curried function starts computing only after applying it to at least N arguments, and this N can be useful to know.
Below I explain the details. Applications of arity: But function arity is a tricky concept in λ-calculus. For instance, id should be unary, Haskell's ($) is binary, but ($) is defined as equal to id: ($) :: (a -> b) -> a -> b So, a notion of arity seems tricky, and one of my colleague keeps repeating it's a bad idea. Today, while reading a paper using CBPV (Hammer et al. 2014), I got a hunch that the call-by-push-value (CBPV) λ-calculus seems to allow for a natural notion of arity. But Googling does not find this spelled out anywhere, maybe because CBPV seems typically used in theoretical contexts. I'm So, why should CBPV help? (1) It distinguishes values (A) and computations (C): Computations are either functions (A -> C) which take values and return computations, or base computations F A which wrap values in a "return" expression: C ::= A -> C | F A So, the return type of a function is wrapped by the F constructor. In particular, this distinguishes A1 -> A2 -> F A3 (a binary function) from A1 -> F (U (A2 -> F A3)), a unary function returning another unary function. (2) Moreover, we also distinguish partial and full applications: since a full application produces a result of type F A, we need to use the elimination form for F. Thus, after conversion to CBPV, we can distinguish syntactically between partial and full applications. Questions: Bibliography: Liu, Y. A., and Teitelbaum, T. Caching intermediate results for program improvement. In Proceedings of the 1995 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation (New York, NY, USA, 1995), PEPM '95, ACM, pp. 190—201. New Wiki about Structured Backus-Naur Form?Hi all :) I'm thinking about extending Wikipedia with a new page: Structured BNF. Is anyone interested in helping in changing content or lecturing it before I publish it? I would appreciate any comment, even if you think that this is not a thing to place in Wiki. Higher abstraction through NLP and automatic code derivation?While waiting for my plane and thinking about a what a VHDL/Verilog killer would look like, I had a very (un!)original idea: describe what is to be done in English, and let the killer do the code derivation. Here is an example of a description of how I want my blob detection (a computer vision application) be done on incoming images: blob detection, image processing This description is enough for a human to write the code, but not so for a computer, that has no understanding of any of these words. Now my question is, is there anyone working on this? To start working on this, here is what I want to do (in my spare time): I like to hear your reasons on why it is or is not possible! |
Browse archivesActive forum topics |
Recent comments
22 weeks 3 days ago
22 weeks 3 days ago
22 weeks 3 days ago
44 weeks 4 days ago
48 weeks 6 days ago
50 weeks 3 days ago
50 weeks 3 days ago
1 year 1 week ago
1 year 5 weeks ago
1 year 5 weeks ago