Fork me on GitHub
#beginners
<
2015-06-29
>
dima05:06:49

@yusup: try to add :java-source-paths ["src/java"] to your project.clj

ergl08:06:09

so I'm trying to split a string only on the first space, but I'm having trouble coming up with the regex

(clojure.string/split "/eval (+ 2 2)" #"???")

=> ["/eval" "(+ 2 2)"]

ergl08:06:19

I know this isn't really a clojure question, but still

slipset08:06:13

(clojure.string/split "eval foo" #" ")

slipset08:06:29

ah, see the point now, first simple_smile

slipset08:06:43

and only first

ergl08:06:29

okay, so I went ahead on looked up the doc of string/split and you can pass a limit argument

ergl08:06:54

(clojure.string/split "/eval (+ 2 2)" #" " 2)

=> ["/eval" "(+ 2 2)"]

ergl08:06:07

all fixed now

ergl08:06:38

that'll teach me to look in the docs first haha

slipset08:06:13

I guess there is a reason why RTFM exists simple_smile

slipset08:06:07

allthough, if you'd read the docs and never asked the question, I wouldn't have known that string/split takes an optional third arg.

slipset08:06:16

Without reading the docs, that is simple_smile

adi10:06:02

ergl: venturing a guess, based on the eval expression in your string ... Is it part of one-off tinkering, or are you trying to write some sort of a parser? In case it's a serious parser, you may want to have a look at instaparse.

yusup10:06:52

@trybeee: I already have java-source-paths on project.clj. It only works if I dont add additional things to source-paths in dev profile.

ergl11:06:20

@adityaathalye: I'm piping that clojure code into a clojail sandbox, so I guess syntax errors will be catched there

ergl11:06:19

I'm writing a small clojure bot for telegram, you send it /eval <s-expr> and it returns the result of evaluating that s-expr

ergl11:06:14

yeah, I'm having some problems with the telegram api though, but it's coming along nicely

xlevus14:06:50

Is there a clojars like site, that's a little more usable?

xlevus14:06:25

searching for something on clojars returns multiple forks of the same project, and next to no discernable difference between the lot

xlevus15:06:22

kinda, yeah. Although, I think 'google' is probably the best answer. Seems to be best and picking the thing you're actually looking for, and not a fork.

akiva15:06:51

I usually hit up GitHub.

arrdem18:06:52

@escherize: the clojure toolbox is pretty out of date sadly.

arrdem18:06:08

I've had better luck with google than with the libraries linked there.

arrdem18:06:22

Although there are a few gems linked there that aren't really google discoverable.

ergl21:06:04

my little bot it's all grown up now