Are Databases and Functional Programming at odds?

后端 未结 10 1751
梦如初夏
梦如初夏 2020-12-12 09:21

I\'ve been a web developer for some time now, and have recently started learning some functional programming. Like others, I\'ve had some significant trouble apply many of

10条回答
  •  温柔的废话
    2020-12-12 10:13

    Databases and Functional Programming can be fused.

    for example:

    Clojure is a functional programming language based on relational database theory.

                   Clojure -> DBMS, Super Foxpro
                       STM -> Transaction,MVCC
    Persistent Collections -> db, table, col
                  hash-map -> indexed data
                     Watch -> trigger, log
                      Spec -> constraint
                  Core API -> SQL, Built-in function
                  function -> Stored Procedure
                 Meta Data -> System Table
    
    

    Note: In the latest spec2, spec is more like RMDB. see: spec-alpha2 wiki: Schema-and-select

    I advocate: Building a relational data model on top of hash-map to achieve a combination of NoSQL and RMDB advantages. This is actually a reverse implementation of posgtresql.

    Duck Typing: If it looks like a duck and quacks like a duck, it must be a duck.

    If clojure's data model like a RMDB, clojure's facilities like a RMDB and clojure's data manipulation like a RMDB, clojure must be a RMDB.

    Clojure is a functional programming language based on relational database theory

    Everything is RMDB

    Implement relational data model and programming based on hash-map (NoSQL)

提交回复
热议问题