Fork me on GitHub
#babashka
<
2021-05-02
>
borkdude09:05:05

Merging this in the next version of bb:

$ ./bb -e '(with-precision 20 :rounding CEILING (/ 1M 3))'
0.33333333333333333334M
:D

borkdude11:05:58

@mike1452 Now alignment works for me: https://github.com/clj-kondo/clj-kondo.lsp/blob/master/bb.edn with (setq clojure-align-separator 'entire). Before it would stop aligning after blank lines.

mike_ananev11:05:34

@borkdude 👍. I continue to play with babashka. Can't stop enjoying it after years with bash, python, groovy.

😊 6
mike_ananev18:05:41

how to catch output of ?

(babashka.tasks/clojure "-Spath")
I need to build clojure project classpath from deps.edn and send it to javac utility as -cp parameter.

borkdude18:05:35

@mike1452

(with-out-str (babashka.tasks/clojure "-Spath"))
:)

mike_ananev18:05:11

huh! yeah, I'm a bit tired today 🙂

borkdude18:05:46

well, it only works because it's designed that way, it could have been different

borkdude22:05:08

@mike1452 Very cool! Any reason you are not using :depends rather than (run 'task)?

borkdude22:05:57

You could do this in :init: (def cformat clojure.core/format) and then use cformat in the rest of your tasks, for shorter naming, or (alias 'core 'clojure.core)

mike_ananev22:05:20

yeah, good advices! :depends and run are both good, but I wanted to call another task in particular place in code (or execution time), so I used run

👍 3
mike_ananev22:05:21

Yes! It works!

mike_ananev22:05:00

You can try it

clojure -X:new :template org.rssys.apptemplate :name com.example/app01
Then create java/src folder and put there some class like
package com.example;

public class Hello01{
    public static void sayHello (){
        System.out.println("hello from Hello01");
    }
}
Then uncomment "java/src" in deps.edn and call Hello01 from main

borkdude22:05:17

I guess bb was a bit too liberal with its default imports compared to clojure...

borkdude22:05:34

bb -e 'File'
java.io.File

$ clj -M -e 'File'
Syntax error compiling at (REPL:0:0).
Unable to resolve symbol: File in this context

borkdude22:05:34

because this isn't compatible with normal Clojure, I might revert that so it would probably be better to write java.io.File

mike_ananev22:05:00

ok, I'll rewrite it tomorrow.