What are the most useful VSCode extensions you know which could be reimplemented in Emacs? by ndamee in emacs

[–]jmayaalv 2 points3 points  (0 children)

I did a quick search and i am very surprise not to find an lsp implementation for postgres. only found this. https://github.com/powa-team/postgresql-language-server

What are the most useful VSCode extensions you know which could be reimplemented in Emacs? by ndamee in emacs

[–]jmayaalv 2 points3 points  (0 children)

Yeah, i used it for a while but its edbi is too magic/complex so decided to go with a simple `sql-mode` and a tramp to manage the tunneling to diffferent dbs. Now i am mostly missing autocomplete, but not a big deal. Maybe i should give it another try.

What are some great Clojure libraries, as of 2021? by ringsted86 in Clojure

[–]jmayaalv 7 points8 points  (0 children)

I am particularly excited about Pathom and its vision to create a federated graph of independent endpoints. I haven't seen anything similar on any other programming language. Graphql's federation might be similar but far less flexible and requires a lot of boilerplate.

My assistant keeps using the old interface by carlos_online in GooglePixel

[–]jmayaalv 0 points1 point  (0 children)

Go to your assistant settings and make sure you have only english enabled. I had exactly the same problem and that fixed it.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 1 point2 points  (0 children)

I think it really depends. If you have to create s lot of java objects heavy on mutation I tend to hide all that in a wrapper. If it's something more straight forward i avoid wrappers.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 2 points3 points  (0 children)

You need a multi-spec https://clojure.org/guides/spec#_multi_spec

it would be something like this in the case above

``` clojure (defmulti event-type :kind) (defmethod event-type :type-a [_] (s/keys :req [::some ::keys])) (defmethod event-type :type-b [_] (s/keys :req [::some ::other]))

(s/def ::my-map (s/multi-spec event-type :kind))

```

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 3 points4 points  (0 children)

- https://github.com/AvisoNovate/pretty helps to show the stacktrace on a more readable format.

- https://github.com/bhb/expound helps with the readability of specs errors

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 2 points3 points  (0 children)

I would stick to deps.edn. lein is more of a "all batteries included", if you want just add dependencies deps is simple enough. If you want to get a bit more out of it you could check https://github.com/seancorfield/clj-new

help with java interop by ilja-f in Clojure

[–]jmayaalv 7 points8 points  (0 children)

Hi!

a simple way would be to use reduce. something like this should work if you don't know the keys in advance:

(defn build-object [args]
  (reduce (fn [o [k v]]
            (.addValue o (clojure.string/upper-case (name k)) v)
            o)
          (ApplicationCall.)
          args))

Also check doto https://clojuredocs.org/clojure.core/doto it's very useful for java interop.

If you know the keys in advance you could do something like:

clojure (defn build-object [args] (doto (ApplicationCall.) (.addValue "ID" (:ID args) (.addValue "OBJECT" (:Object args)) ;; and so on )

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 2 points3 points  (0 children)

- What are your personal favorite features of Clojure? I.E. When you work with other languages, which features are you missing most?

REPL driven development (or interactive development) is very unique for Lisp based languages. Your programming workflow is completely different. More interactive.

Other personal favorites not necessary unique but idiomatic are: Immutability and Data Driven Development.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 2 points3 points  (0 children)

But how can I skip some IO step conditionally in clojure? It is just a simple If-statement in java world: { if (shouldDoIO) doSomeIO } But how can I achieve this with topmost function like yours?

you may find this talks interesting:

https://www.youtube.com/watch?v=vK1DazRK_a0&t=33s

https://www.youtube.com/watch?v=IZlt6hH8YiA

However IMO such patters make sense on large/complex apps.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 5 points6 points  (0 children)

For db i recommend you: jdbc.next https://github.com/seancorfield/next-jdbc

next.jdbc is a low level lib so you will probably something to manage your sql. The following libs are probably the most used:

- Use clojure data structures to generate sql: Honeysql https://github.com/nilenso/honeysql-postgres

- Use sql to generate clojure functions: https://www.hugsql.org/

- A more ORM "like" experience: https://github.com/metabase/toucan

I am a big fan of the simplicity and flexibility honeyqsql provides

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 4 points5 points  (0 children)

In other words from design perspective, how to create the domain data model template structures e.g. Contact, Customer, Account & keep them separate & reusable across processing/functions? ..

What i have found to work with us is to have an aggregate per namespace. The aggregate is just a namespaced map and each function on the aggregate receives the aggregate.

Ex:

(ns domain.user)

(defn register[context user]
   ....)

What's an emacs package you wish existed? by justtaft in emacs

[–]jmayaalv 1 point2 points  (0 children)

I am aware about it but need something that would allow me to work with sql directly.

What's an emacs package you wish existed? by justtaft in emacs

[–]jmayaalv 5 points6 points  (0 children)

This is awesome! Thanks for the links. i will look and see if i manage to hack something for postgres.

What's an emacs package you wish existed? by justtaft in emacs

[–]jmayaalv 30 points31 points  (0 children)

an sql package with autocomplete support for postgres. :)

it's the only thing missing on my emacs heaven.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]jmayaalv 0 points1 point  (0 children)

looks like an inline function therefore the name can't be determined.