Jim Cheung

Monday, November 04, 2019

watched a talk about a clojure library: noprompt/meander: Tools for transparent data transformation

"Meander: Declarative Explorations at the Limits of FP" by Jimmy Miller

the hello world example is quite interesting:

transform

{:name "Jimmy"
 :address
 {:address1 "123 street ave"
  :address2 "apt 2"
  :city "Townville"
  :state "IN"
  :zip "46203"}}

to this structure:

{:name "Jimmy"
 :address {:line1 "123 street ave"
           :line2 "apt 2"}
 :city-info {:city "Townville"
             :state "IN"
             :zipcode "46203"}}

it's simple and also readable:

(m/match person
         {:name ?name
          :address
          {:address1 ?address1
           :address2 ?address2
           :city ?city
           :state ?state
           :zip ?zip}}

         {:name ?name
          :address {:line1 ?address1
                    :line2 ?address2}
          :city-info {:city ?city
                      :state ?state
                      :zipcode ?zip}})

Monday, November 25, 2019

trying neovim with conjure for clojure development:

$ midir -p ~/.config/nvim
$ curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

add to ~/.config/nvim/init.vim:

call plug#begin('~/.local/share/nvim/plugged')

Plug 'Olical/conjure', { 'tag': 'v2.1.0', 'do': 'bin/compile' }
Plug 'eraserhd/parinfer-rust'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }

call plug#end()

let g:deoplete#enable_at_startup = 1
call deoplete#custom#option('keyword_patterns', {'clojure': '[\w!$%&*+/:<=>?@\^_~\-\.#]*'})

install python module for deoplete:

$ pip3 install --user --upgrade pynvim

open nvim and execute:

:PlugInstall

start a repl server:

$ clojure -J-Dclojure.server.jvm="{:port 5678 :accept clojure.core.server/io-prepl}"

create a edn for conjure:

.conjure.edn:

{:conns {:dev {:port 5678}}}

edit a .clj file, use <leader>ee to eval s-exp

reference:

Blog Archive