<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged design</title>
<link>https://ask.clojure.org/index.php/tag/design</link>
<description></description>
<item>
<title>Clojure and Clojurescript as options for an Electronic Health Record project</title>
<link>https://ask.clojure.org/index.php/11595/clojure-clojurescript-options-electronic-health-project</link>
<description>&lt;p&gt;I am the founder of a company that is building a next-generation Electronic Health Record system. The software will have both web and mobile UIs and make heavy use of bleeding-edge Natural Language Understanding and Artificial Intelligence.&lt;/p&gt;
&lt;p&gt;I am exploring programming language options and am very interested in Clojure because of its functional language paradigm, robust support for concurrency, and reputation for high expressivity, among other things.&lt;/p&gt;
&lt;p&gt;I am seeking input about the major pros and cons for this kind of project.&lt;/p&gt;
&lt;p&gt;My company website is &lt;a rel=&quot;nofollow&quot; href=&quot;https://mpathysoftware.com/&quot;&gt;https://mpathysoftware.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11595/clojure-clojurescript-options-electronic-health-project</guid>
<pubDate>Sat, 19 Feb 2022 16:09:36 +0000</pubDate>
</item>
<item>
<title>design considerations for extracting values from properties file</title>
<link>https://ask.clojure.org/index.php/11336/design-considerations-extracting-values-from-properties</link>
<description>&lt;h3&gt;Description&lt;/h3&gt;
&lt;p&gt;Hi everyone!  I've got a Spring Boot config file  I'm parsing.  Values don't really matter:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;server.port: 8000
spring.application.name: some application
spring.datasource.driver-class-name: org.whatever.Driver
spring.datasource.password: some_password
spring.datasource.platform: postgres
spring.datasource.url: jdbc:postgresql:does_not_matter
spring.datasource.username: some_username
spring.jpa.database: POSTGRESQL
some.service.endpoint: http://whatever
some.other.service.endpoint: http://something_else
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I'm trying to extract / group different parts of that file, and I'm looking for what the suggested / idiomatic way of doing this is.  I'm trying to follow the &quot;data &amp;gt; functions &amp;gt; macros&quot; idiom and the &quot;better 100 functions for one data structure&quot;.&lt;/p&gt;
&lt;p&gt;Specifically, I'm looking to parse / group the web endpoints, and then the database properties, in order to validate them using some business logic.&lt;/p&gt;
&lt;p&gt;I've already parsed the file using &lt;code&gt;java.util.Properties&lt;/code&gt;, so that's not of interest here.  The file above is converted to a map.&lt;/p&gt;
&lt;h3&gt;Solution 1&lt;/h3&gt;
&lt;p&gt;Create a separate function for each &quot;grouping&quot; I want that parses what I want and returns a new map with just the data I want.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;defn get-endpoints [props]&lt;/code&gt; returns&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{
    &quot;some.service.endpoint&quot; &quot;http://whatever&quot;,
    &quot;some.other.service.endpoint&quot; &quot;http://something_else&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;`&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;defn get-database-properties [props]&lt;/code&gt; etc.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Solution 2&lt;/h3&gt;
&lt;p&gt;Add additional keys to the original map to group what I want.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;defn parse-groupings [props]&lt;/code&gt; returns&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    {
        &quot;server.port&quot; &quot;8000&quot;,
        &quot;spring.application.name&quot; &quot;some application&quot;,
        &quot;spring.datasource.driver-class-name&quot; &quot;org.whatever.Driver&quot;,
        ;; the rest of the original properties
       :groupings {
            :web-endpoints {
               ;; web endpoints go here
           },
           :database-props {
             ;; database properties get embedded here
           }

    }
&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Solution ???&lt;/h3&gt;
&lt;p&gt;There's a lot more solutions, of course, but I'm wondering what the community recommends.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11336/design-considerations-extracting-values-from-properties</guid>
<pubDate>Wed, 01 Dec 2021 21:07:31 +0000</pubDate>
</item>
<item>
<title>What would transducers-first Clojure look like?</title>
<link>https://ask.clojure.org/index.php/11132/what-would-transducers-first-clojure-look-like</link>
<description>&lt;p&gt;Rich says in the &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/about/history&quot;&gt;History of Clojure&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;I think transducers are a fundamental primitive that decouples critical logic from list/sequence processing and construction, and if I had Clojure to do all over I would put them at the bottom.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This fascinates me, and I am really curious what would transducers-first Clojure look like? I don't really expect Rich to answer here (I should have asked this at his HOPL talk...) but perhaps someone who is closer to core might have some insight.&lt;/p&gt;
&lt;p&gt;I would love to see a Clojure where transducers are the default and &lt;em&gt;easiest&lt;/em&gt; way to solve things, where all the tutorials and gists and example code everywhere around would be using them and a context (vector, lazy, first etc.) was only chosen at the edges. Currently it is &lt;em&gt;easier&lt;/em&gt; (but perhaps not &lt;em&gt;simpler&lt;/em&gt;) to write lazy code than transducing code.&lt;/p&gt;
&lt;p&gt;I am wondering if transducers-first Clojure would address the above or would it mostly be about the plumbing behind a clojure.core similar to the current one.&lt;/p&gt;
&lt;p&gt;For my personal case, I actively have to fight laziness - I don't think I encountered a single place in our codebase where it would be beneficial but as it's still the easiest way of writing clojure I have to put in extra effort to not accidentally venture over to lazy land and to spot these patterns in PRs of others.&lt;/p&gt;
&lt;p&gt;I would love a clojure.core2 where transducers are the default, it's easy to write transducing code, potentially with less typing/ceremonies, the likes of comp and into [] etc. And stepping over to lazy land is always an opt-in thing, like the impure parts of clojure - stm, transients etc. I'm not entirely sure how a core library like that would look but it's something I'd love to try.&lt;/p&gt;
&lt;p&gt;Moreover, there are some transducer-specific optimisations like &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/cgrand/xforms#on-key-value-pairs&quot;&gt;https://github.com/cgrand/xforms#on-key-value-pairs&lt;/a&gt; that could be considered. And perhaps there could also be a way to use the multiple-coll arities of map as part of a transducer somehow.&lt;/p&gt;
&lt;p&gt;There could also be more baked-in support for an xform arg in functions that currently take a coll to preprocess them, like run! and str/join - if you actively use transducers you start to notice things like 'hey, I don't even need a collection there' and start to look for different transducing contexts - so instead of (count (into [] xform input)) you'd go (x/count xform input)&lt;/p&gt;
</description>
<category>Transducers</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/11132/what-would-transducers-first-clojure-look-like</guid>
<pubDate>Sat, 02 Oct 2021 19:32:19 +0000</pubDate>
</item>
<item>
<title>Function calls to generate docstrings?</title>
<link>https://ask.clojure.org/index.php/10161/function-calls-to-generate-docstrings</link>
<description>&lt;p&gt;I was curious if a function could be defined like the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn my-cli-func
  (docstr 
    :description &quot;Some CLI function with complex args to do something cool&quot;
    [[&quot;-p&quot; &quot;--port&quot; :port &quot;Port to listen for connections on&quot;]])
  [args]
  &quot;...&quot;)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The intention is that docstr could generate a docstring in a consistent format I can validate and such. That did not work as I get an error about where the Parameter declaration should be.&lt;/p&gt;
&lt;p&gt;I'm guessing it could be done with a &lt;code&gt;defn&lt;/code&gt; wrapper macro but probably not worth the hassle right now.&lt;/p&gt;
&lt;p&gt;I was curious if there was a design decision to not allow meta programming there or if it's some kind of mechanical restriction due to the implementation. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10161/function-calls-to-generate-docstrings</guid>
<pubDate>Wed, 10 Feb 2021 05:36:58 +0000</pubDate>
</item>
<item>
<title>Was auto-currying ever a consideration early in Clojure's design\development?</title>
<link>https://ask.clojure.org/index.php/8381/currying-consideration-early-clojures-design-development</link>
<description>&lt;p&gt;A question popped into my head today: Was auto-currying ever on the table for Clojure's design or implementation?&lt;/p&gt;
&lt;p&gt;Let's say you have:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(defn add
  [x y]
  (+ x y))&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;(map (add 2) [1 2 3 4 5])&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If Clojure auto-curried, that would result in &lt;code&gt;[3 4 5 6 7]&lt;/code&gt; but currently it results in an error due to arity mismatch. To me, I feel that behavior would be more productive than an error. So I'm curious about why such a feature was deliberately avoided if it was ever on the table. &lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8381/currying-consideration-early-clojures-design-development</guid>
<pubDate>Fri, 09 Aug 2019 22:49:08 +0000</pubDate>
</item>
<item>
<title>Clojure for Ecommerce platform?</title>
<link>https://ask.clojure.org/index.php/8215/clojure-for-ecommerce-platform</link>
<description>&lt;p&gt;We are trying to build a Ecommerce website using Clojure and ClojureScript. There are bunch of libraries and frameworks available to use, is there any recommendations for the libraries and framework to be use?&lt;/p&gt;
</description>
<category>Other</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8215/clojure-for-ecommerce-platform</guid>
<pubDate>Sat, 27 Jul 2019 09:49:24 +0000</pubDate>
</item>
<item>
<title>What is an opensource clojure project you like for its architecture, design choices?</title>
<link>https://ask.clojure.org/index.php/8198/what-opensource-clojure-project-architecture-design-choices</link>
<description>&lt;p&gt;What is an opensource clojure project you like for its architecture, design choices?&lt;/p&gt;
&lt;p&gt;Can you explain why in abstract manner and perhaps give some links pointing to code?&lt;/p&gt;
&lt;p&gt;It could be also something  on the component level,  like you used a channel or a clever  clojure datastructure for solving a problem&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8198/what-opensource-clojure-project-architecture-design-choices</guid>
<pubDate>Fri, 26 Jul 2019 12:13:32 +0000</pubDate>
</item>
</channel>
</rss>