joker

dxlr8r 2020-02-18T11:15:24.008200Z

@simen.oya has joined the channel

dxlr8r 2020-02-18T11:16:20.009Z

new to joker, wonder how entry points works.

(ns k3os.foo)

(defn -main [](println "entry point?"))
(defn main- [](println "entry point?"))
(defn main  [](println "entry point?"))
And when I run it: $ joker foo.joke I get no output

gleisonsilva 2020-02-18T14:03:55.011Z

I think you'll be better off just calling (println "...") on the bottom of your script... What I've done a lot is using joker.tools.cli to parse the arguments and then calling the right function...

👍 1
jcburley 2020-02-18T14:06:25.013700Z

Yes, Joker, like most Lisps AFAIK, just executes code like a script. So if you want to invoke a main-style function you've defined... ...just do that:

user> (main)
...

dxlr8r 2020-02-18T14:07:37.014100Z

calling main from the script leads to issues with unit testing etc.

jcburley 2020-02-18T14:10:11.014300Z

Look into *main-file* and *file* then. E.g. compare them to determine whether running the script directly or within a unit test.

dxlr8r 2020-02-18T14:12:09.014600Z

for now that seems to be an option. But ideally, joker should use the clojure standard of -main IMHO

👍 1
jcburley 2020-02-18T14:13:03.014900Z

Please Issue that then! Might be nice to have....

dxlr8r 2020-02-18T14:13:11.015200Z

I'll do that

👍 1
mpenet 2020-02-18T14:04:19.011500Z

@mpenet has left the channel

gleisonsilva 2020-02-18T14:05:01.012600Z

Hey guys! I'm trying to find a practical way to parse some XML files using Joker inside a script that I already have... Some ideas?

gleisonsilva 2020-02-18T14:30:54.017400Z

Joker has an implementation of xml-seq... all references that I found for this fn use it with clojure.data.xml or clojure.xml where there is a parse fn... but has Joker a function like that? If not, how should this fn xml-seq be used?

Candid 2020-02-19T05:48:17.018900Z

xml-seq doesn't actually parse XML. Joker currently doesn't have XML parsing functionality.