Updates from cartesianprogramming Toggle Comment Threads | Keyboard Shortcuts

  • cartesianprogramming 12:02 on 2018/03/11 Permalink | Reply  

    Higher-order Multidimensional Programming 

    Talk I gave to the Lambda Montreal Meetup group on 7 March 2018.
    Slides: lambda-montreal-2018-03-07

    Higher-order Multidimensional Programming by John Plaice

    Wednesday, Mar 7, 2018, 6:00 PM

    460 McGill, Suite 200 Montréal, QC

    60 Functional Programmers Went

    In 1975, William W. Wadge and Edward A. Ashcroft introduced the language Lucid, in which the value of a variable was a stream. The successors to Lucid took two paths. The first path, taken by Lustre, was to restrict the language so that a stream could be provided with a timed semantics, where the i-th element of a stream appeared with the i-th tick…

    Check out this Meetup →

  • cartesianprogramming 11:58 on 2018/03/11 Permalink | Reply  

    Static analysis of C++ projects with CodeSonar 

    Talk I gave to the C++ Montréal Meetup group on 25 July 2017.
    Summary: c++-montreal-2017-07-25

    Static analysis of C++ projects with CodeSonar

    Tuesday, Jul 25, 2017, 6:00 PM

    Microsoft Montreal Office
    2000 McGill College Avenue Montréal, QC

    31 Membres Went

    L’analyse statique de programmes consiste en l’analyse d’un programme sans l’exécuter. Parmi les problèmes récurrents détectés avec l’analyse statique, nous incluons la détection d’entrées non-valides, d’utilisation de pointeurs nuls, et de dépassements de tampons. Nous présenterons un aperçu du domaine, et donnerons une démonstration en utilisant …

    Check out this Meetup →

  • cartesianprogramming 10:48 on 2012/09/01 Permalink | Reply  

    Release 0.3.1 is out 

    This release fully supports higher-order functions for TransLucid.
    It is available on sourceforge.

  • cartesianprogramming 08:39 on 2012/06/22 Permalink | Reply  

    New domain! 

    The blog’s address is now cartesianprogramming.com.

  • cartesianprogramming 22:01 on 2012/06/21 Permalink | Reply  

    On TransLucid 

    The word “TransLucid” comes from an essay by Ralph Waldo Emerson:

    This insight, which expresses itself by what is called Imagination, is a very high sort of seeing, which does not come by study, but by the intellect being where and what it sees; by sharing the path or circuit of things through forms, and so making them translucid to others.

  • cartesianprogramming 17:43 on 2012/06/21 Permalink | Reply  

    New release for TransLucid 

    The second release of TransLucid, version 0.2.0, is out. It is available at the following link.


    It includes intensions as first-class values, and higher-order functions fully work.

  • cartesianprogramming 04:02 on 2012/06/19 Permalink | Reply  

    Tournament computation in two dimensions 

    Tournament computation can also take place in two dimensions. Here, tournamentOp₂ applies a quaternary function g to a 2-dimensional variable X, and keeps doing this to the results until there is a single result.

    fun tournamentOp₂.d₁.d₂.n.g X = Y @ [d <- 0]
      dim t <- ilog.n ;;
      var Y = fby.t X (g.(NWofQuad.d₁.d₂ Y).(NEofQuad.d₁.d₂ Y).
                         (SWofQuad.d₁.d₂ Y).(SEofQuad.d₁.d₂ Y)) ;;
    end ;;

    As for the single-dimensional case, it is useful to have a way of filling a two-dimensional grid with a neutral element if we do not have a grid whose extent in every dimension is the same power of 2.

    fun default₂.d₁.m₁.n₁.d₂.m₂.n₂.val X = Y
      var Y [d₁ : m₁..n₁, d₂ : m₂..n₂] = X ;;
      var Y [d₁ : nat, d₂ : nat] = val ;;
    end ;;
  • cartesianprogramming 04:01 on 2012/06/19 Permalink | Reply  

    Tournament computation in one dimension 

    In the post on factorial, the following code appears:

    var f = tournamentOp₁.d.n.times (default₁.d.1.n.1 (#!d)) ;;

    What is going on? Let us look at the definitions from the TransLucid Standard Header:

    fun default₁.d.m.n.val X = Y
      var Y [d : m..n] = X ;;
      var Y [d : nat] = val ;;
    end ;;
    fun tournamentOp₁.d.n.g X = Y @ [d <- 0]
      dim t <- ilog.n ;;
      var Y = fby.t X (g.(LofPair.d Y).(RofPair.d Y)) ;;
    end ;;

    The default₁ function creates a stream Y varying in dimension d such that in the interval [m,n], the result will be the value of X. Everywhere else, the value of Y is the default val.

    As for tournamentOp₁, when #!t ≡ 0, the value of Y is X. When #!t > 0, each element of Y is the result of applying the binary function g to a pair of elements from Y when #!t was one less. This process is completed until there is just one element left. Since the number n is not necessarily a power of 2, we use default₁ to fill in the slots of X with the neutral element of g.

    This form of computation is called tournament computation, and writing programs this way encourages parallel implementations.

  • cartesianprogramming 03:46 on 2012/06/19 Permalink | Reply  

    The intension as first-class value 

    The origins of Cartesian Programming came from what was called Intensional Programming, in which the behavior of a program was context-dependent: a context is a set of (dimension,ordinate) pairs,
    and the program can change behavior if some of the ordinates are changed. Formally, a variable in an intensional programming language is an intension, i.e., a mapping from contexts to values.

    In TransLucid, after several failed attempts at defining the semantics of functions over these intensions, it finally dawned on us that the intension itself needs to be a first-class value. What this means is that
    the context in which an intension is created is as important as the context in which it is evaluated. Consider:

    var tempAtLocation = ↑{location} temperature ;;
    var tempInInuvik = tempAtLocation @ [location ← "Inuvik"] ;;

    What this means is that whatever the value of the location-ordinate, variable tempInInuvik would always give the temperature in Inuvik, allowing any other dimensions to vary freely. Hence

    ↓tempInInuvik @ [location ← "Paris", date ← #!date - 1] ;;

    would give the temperature in Inuvik yesterday, not in Paris yesterday.

  • cartesianprogramming 05:56 on 2012/05/22 Permalink | Reply  

    Programming with infinite arrays: Factorial 

    Here we give an example of programming with infinite arrays. We take the well-known factorial function, and calculate using tournament computation. The TransLucid source code is found below.

    We build an array f which varies with respect to dimensions t and d, effectively creating a computation tree. For example, to compute the factorial of 3, the variable f becomes

      t 1 1 2 3 1 1 ...
        1 6 1 1 1 1 ...
        6 1 1 1 1 1 ...

    and the answer is 6, picked up when t=2 and d=0.

    Similarly, for the factorial of 6, f becomes

      t   1   1   2   3   4   5   6   1   1 ...
          1   6  20   6   1   1   1   1   1 ...
          6 120   1   1   1   1   1   1   1 ...
        720   1   1   1   1   1   1   1   1 ...

    and the answer is 720, picked up when t=3 and d=0.

    When t = 0, the value of f is a d-stream such that f is the current d-index if it is between 1 to n, and 1 otherwise. When t > 0, the value of f is a d-stream such that f is the product of pairs from the (t-1) d-stream.

    fun fact.n = f
      dim d <- 0 ;;
      var f = tournamentOp₁.d.n.times (default₁.d.1.n.1 (#!d)) ;;
    end ;;
Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc