[HN Gopher] Pure Programming Language
       ___________________________________________________________________
        
       Pure Programming Language
        
       Author : tosh
       Score  : 80 points
       Date   : 2024-02-27 17:38 UTC (5 hours ago)
        
 (HTM) web link (agraef.github.io)
 (TXT) w3m dump (agraef.github.io)
        
       | elbear wrote:
       | A "Why Pure?" section would be useful. The symbolic manipulation
       | part is something I haven't encountered in other mainstream
       | languages (at the level of the language). It's equivalent to
       | Python's SymPy, right?
        
         | elpatokamo wrote:
         | There is a section in GitHub, which is where most of the
         | documentation seems to be anyway. This FAQ is linked directly
         | from the website.
         | 
         | https://github.com/agraef/pure-lang/wiki/FAQ#why-pure
        
         | lebean wrote:
         | Giving you a reason why would make it unpure. To be a pure
         | language, one should use it solely for the pure pleasure of
         | using it.
        
         | sterlind wrote:
         | Yes, Pure is a term-rewriting system, similar to SymPy.
         | Transformation rules define patterns to match in expressions,
         | what bindings to capture from the match, and what to transform
         | the matched pattern into. This is also how the XL language
         | seemed to work.
         | 
         | The major difference between a term-rewriting system and a
         | general-purpose functional/declarative language is that you
         | don't need to define everything. Expressions will be
         | transformed until they can't anymore, and then they're left
         | alone. So you can e.g. implement symbolic differentiation as a
         | set of rules, and take the derivative of a symbolic expression,
         | because the variables (or even entire functions!) just don't
         | need to be defined.
         | 
         | The king of all term-rewriting systems is (imo) Mathematica.
         | It's extraordinarily powerful, capable of matching subtrees and
         | variable arity expressions and it's perfect for doing card
         | tricks with algebraic identities. Unfortunately proprietary.
         | 
         | Sadly, term-rewriting languages are languishing. Even Pure is
         | pretty dead.
        
           | bloaf wrote:
           | Its a shame, because there is a lot of really cool stuff you
           | can do when you're able to work with your code in algebraic
           | terms.
           | 
           | Just as one simple example:
           | 
           | Suppose you have defined some expressions that describe how
           | to read/write data from a database, and you have used them to
           | define a workflow-expression that retrieves a bunch of data,
           | does some math on it, and displays the result.
           | 
           | In Mathematica, you can plug that whole workflow-expression
           | into the "Simplify" function and it will potentially
           | eliminate entire database calls if it realizes you've got
           | stuff like "GetData[y]*(GetData[x]-GetData[x])" in your
           | result that will always evaluate to 0.
           | 
           | You can even do things like define a high "complexity" of
           | your GetData functions to make the Simplify function look for
           | an algebraic form that will minimize calls to the database,
           | even if it has to make the algebra look uglier.
        
       | shayarma wrote:
       | i do like new programming languages. learning swift was fun at
       | the time.
        
       | zengid wrote:
       | Looks like a fast embeddable functional lang for doing math or
       | dsp. Cool!
        
       ___________________________________________________________________
       (page generated 2024-02-27 23:00 UTC)