5 ms·
The main development goal of clojure is to write the database. The development idea is actually from the database, not the FP. This seems a tenuous theory. Clo
by weavejester 7y ago
The main development goal of clojure is to write the database. The development idea is actually from the database, not the FP.
This seems a tenuous theory. Clojure has been described as a language for data processing, but this isn't the same as basing the design on relational databases. Clojure isn't even relational; its data is generally kept in standard collection types, rather than relations.
I'd describe Clojure as a dynamically typed, functional Lisp that emphisizes open data models and explicit time.
- lincpa 7y agoI think that mapping the data type of Clojure to the RMDB data model can achieve RMDB theory, simple operation, convenient viewing, high performance, and reliable results. I think the open data model is not an excellent and safe engineering practice. Map to static type RMDB schema, similar to RMDB with schema and data as the core, with sql operation, simple and reliable. Unrestricted open data model + dynamic type is not a good combination for constructing a complex large system.
- collyw 7y agoits data is generally kept in standard collection types, rather than relations. Isn't that the same as relational databases once you dig a layer deeper?
- cgrand-net 7y agoNo, it's hierarchical (because we nest collection types) vs relational.
- lincpa 7y agoIn RMDB(For example postgresql), Database is hierarchical nest collection types. It is also consistent with Clojure. ```clojure {:table01 {:row01 {:col-array [0 1 2] :col-json "{\"a\": \"Hello\"}" :col-text "abc"} :row02 {}} :table02 {:row01 {} :row02 {}}} ``` In addition, postgresql supports inheritance, which is also hierarchical nest collection types.
- weavejester 7y agoWhile Postgres supports hierarchical data in the form of JSON, that doesn't mean it's a form of relational data, it just means Postgres supports both. Clojure doesn't have good tools in its core library for working with relational data. There's no core type that explicitly represents a relation, and Clojure lacks functions for many basic relational algebra operations. For example, how would you perform a natural join across your data structure?
- lincpa 7y agoIn programming, data modeling is the most important. Convert(or design) data to hash-map, join (or merge) by key. it can write commonly used operations as functions, try to row (or col) operations as much as possible, and join all data only when necessary(reduce the row-join). ```clojure (def a {:a-id-01 {:a-name "a1"} :a-id-02 {:a-name "a2"}}) (def b {:b-id-01 {:a-id :a-id-01 :b-name "b2"} :b-id-02 {:a-id :a-id-02 :b-name "b2"}}) (->> b :b-id-01 :a-id a :a-name) ;=> ;"a1" (let [x (b :b-id-01)] (->> x :a-id a (merge x ,))) ;=> ;{:a-id :a-id-01, ; :b-name "b2", ; :a-name "a1"} ```
- weavejester 7y agoYou're describing a language whose data model is hierarchical, not relational. In your code you first convert a relation into a hierarchy of collections. Why would you need to do that if Clojure used a relational data model?
- lincpa 7y agoIn RMDB, database data model (db,table, row, col, value[array,json, int, text, etc.] ) is hierarchical. Relation is a logical model mapping of data structures, it is just a logical thinking that exists in the brain. SQL, Prolog, clojure.core, minikanren can be used for relational operations.
- 7y ago