OCaml development setup
Jul. 26th, 2022 21:49- opam
- opam init
- opam install dune merlin
- opam install ocaml-lsp-server
- nvim-lspconfig/ocamllsp
- customized Neovim settings
opam initopam install dune merlinopam install ocaml-lsp-serverOver the course of my software engineer career I continue to do code related tasks most of my time, so development setup is an integral part of my work environment.
Even with my latest project, where I'm a "one-man army" of a data engineering unit and I oversee whole process and wear a variety of role hats, this is still true and setup efficiency affects me every day.
For different reasons, including my detestment of the JetBrains company as elitist group no different from Google themselves and also being a Russian company, few years ago I left their products completely, after being a legit paying user for quite some time. I could not say that I didn't like IDEA at the time, but everything has an end and IDEA had its own point of no return to me.
Since then I took more marginalized approach (which is more mainstream nowadays though) and base my setup on Neovim editor with relevant to a programming language of a moment set of plugins and configurations. One who's interested to see, feel free to roam through its configuration.
In short, my setup includes Neovim (usually latest build from master branch) with all LSP ecosystems wihin Neovim itself and from languages I use like Scala/Metals, Java/JDTLS, Rust/Rust-Analyzer, Python/Pyright and others.
Such an approach allows to unify editing experience while easily switching between very different programming ecosystems. And don't forget that it enables actual ergonomics in how you type and move your hands (so stuff like RSI is delayed).
SELECT 
    expression1, expression2, ... expression_n
FROM 
    tables
WHERE 
    conditions
MINUS
SELECT 
    expression1, expression2, ... expression_n
FROM 
    tables
WHERE 
    conditions;
import org.osgi.framework._
class Activator extends BundleActivator {
    def start(bc: BundleContext):Unit = { Console.println("started") }
    def stop(bc: BundleContext):Unit = { Console.println("stopped") }
}
[root@saule ~]# vmadm list
UUID                                  TYPE  RAM      STATE             ALIAS
...
e810ea3c-ac05-48e5-9a80-0c42bca99a6e  OS    512      running           postgres
3eb5876f-4577-4791-99d0-4b16b4cbe3d1  OS    800      running           nexus
bea2edbb-443c-4291-8007-5d67cd038acf  OS    2048     running           teamcity
e8bec698-0cdd-45f1-a039-dfbd591864e9  OS    4096     running           hq
obr:repo add <repo-url/.meta/obr.xml>
obr:list // to list all artifacts from proxy-repo added in step 7
obr:deploy <artifact>
felix:start <its id>
  def m = [1:1,2:2]
  m.collect {it -> it.key + '=' + it.value}.join(',')
  class B {List xs}
  def a = [1,2,null, 3]
  def b = new B()
  b.xs = a
  def c = b.xs.sum {i = it -> i != null ? i : 0}
  println c
// 6
  // структура из распарсенного xml
  // a.b.c.d.e, где e - интовое поле
  result = a.b?.c?.sum 
{ i = it?.d?.e  
  -> 
  i != null 
    ? i 
    : 0 
}
  result = a.b?.c?.sum 
{ it?.d?.e != null 
? it?.d?.e 
: 0 }