Loading ...
Sorry, an error occurred while loading the content.

Re: [extremeperl] Book: Higher Order Perl

Expand Messages
  • Terrence Brannon
    ... To wit: [06:28] [autrijus] shapr: I m changing the Pugs evaluator into a compiler [06:28] [autrijus] shapr: without touching a line in Eval.hs [06:28]
    Message 1 of 58 , Mar 29 4:38 AM
    • 0 Attachment
      Adam Turoff <adam.turoff@...> writes:

      > The strong typing allows the compiler to do more advanced reasoning
      > about your program.

      To wit:

      [06:28] [autrijus] shapr: I'm changing the Pugs evaluator into a
      [06:28] [autrijus] shapr: without touching a line in Eval.hs
      [06:28] [shapr] wow
      [06:28] [autrijus] shapr: simply by redefining the Eval monad and some
      TH magic

      TH is template haskell, a Ph.D project at Oxford to add
      metaprogramming to Haskell using Haskell. And a monad is a way of
      programming where you take (1) a container type for a datum [e.g. a
      list container for integers] (2) a function which operates on the
      datum [e.g. a negation function on integers] and (3) an operator,
      called "bind" and written >>=, which combines
      the function with the items in the container to produce a new

      Most haskell code is based around monads, so that you can take the
      same container of data and get different output by simply providing
      a different datum operating function.


      mydata = [1 .. 10] -- a list of integers from 1 to 10

      myfun1 = (-1 * ) -- a function which multiplies an integer by -1
      myfun2 = (5 + ) -- a function which adds 5 to an integer

      then because we can only return data and never overwrite our original:

      mydata >>= myfun1 -- yields [0..10]
      mydata >>= myfun2 -- yields [6..10]

      we can take the output container of data [e.g. a list of numbers] and
      pump it right into another monad:

      mydata >>= myfun1 >>= myfun2

      So you can basically apply Unix pipe philosophy to containers of
      anything instead of just plain text!

      In "The Essence of Functional Programming" by Phil Wadler:


      Wadler shows in mini-form what Autrijus is doing on a grand scale:
      taking data in a container and refiltering it in different ways to
      model different computation/compilation strategies.

      Carter's Compass: I know I'm on the right track when,
      by deleting something, I'm adding functionality.
    • Tom Vilot
      ... Wait. That sounds like Rob .... ;c) (kidding) ... Wait. That *also* sounds like Rob ... ... (not kidding!)
      Message 58 of 58 , Apr 8, 2005
      • 0 Attachment
        Greg C wrote:

        > Consider: projects A and B have identical goals. In project A, you
        > have free
        > rein in your choice of software and hardware tools. However, the
        > manager sets
        > arbitrary deadlines, likes to stand behind people and criticize their
        > code as
        > they type,

        Wait. That sounds like Rob ....
        ;c) (kidding)

        > On project B, the choice of langauge and hardware are made for you and
        > there's
        > only one computer per two programmers. On the other hand, the manager
        > sees his
        > people as people, negotiates requirements and schedules on a realistic
        > basis,
        > trusts his people, follows a set of best practices (be it XP or some
        > other) and
        > chases everyone out of the office at 5:30.

        Wait. That *also* sounds like Rob ...


        (not kidding!)
      Your message has been successfully submitted and would be delivered to recipients shortly.