Fork me on GitHub
#babashka
<
2020-03-12
>
borkdude09:03:31

vim-iced supports socket-repl completion for babashka: https://twitter.com/uochan/status/1237852655025704960

jjttjj14:03:54

Is there an easy way to get a minimal macroexpansion example in sci? I'm trying stuff like this:

...
(:require [sci.impl.interpreter :as scii]
          [sci.impl.opts :as opts]
          [sci.impl.analyzer :as ana])
...
(scii/macroexpand (opts/init {}) `(when true "f"))

=> 
Error: No protocol method HasName.getName defined for type null: 

borkdude14:03:28

@jjttjj What are you trying to do?

jjttjj14:03:50

Actually I just got it,

(vars/with-bindings
  (when-not @vars/current-ns
    {vars/current-ns opts/user-ns})
  (scii/macroexpand (opts/init nil) `(when true "f")))

jjttjj14:03:08

I'm trying to implement hoplon/javelin for sci 😅

borkdude14:03:22

Can't you do:

user=> (require '[sci.core :as sci])
nil
user=> (sci/eval-string "(macroexpand '(when true \"f\"))")
(if true (do "f"))
?

jjttjj14:03:43

Maybe it is better to just pr-str the forms and eval the string your way

jjttjj19:03:27

@borkdude fwiw, you have the order of the form and env macro args reversed in the readme of sci :)

borkdude19:03:17

@jjttjj fixed