Fork me on GitHub
#clojure
<
2016-10-15
>
andrewboltachev00:10:15

When I have a character like \a or \newline, is there a way of getting it's representation (like (symbol "\a") or what is really appropriate here) back?

didibus00:10:28

What do you mean by its representation?

andrewboltachev00:10:02

@didibus UPD: In fact, I was wrong. prn would do it right for me:

didibus00:10:12

"\a" is the reader representation of it. Once read in, it becomes java.lang.Character

didibus00:10:24

The prn functions are for when you want to print reader friendly strings, and the print functions are for when you want human readable strings

didibus00:10:58

Well, its the pr functions to be precise

andrewboltachev00:10:06

Yes, thank you. I'm mostly using prn

andrewboltachev00:10:27

Oh, didn't know about pr šŸ™‚

andrewboltachev00:10:42

one w/o newline should be

didibus00:10:55

So you've got pr, pr-str, prn, prn-str

didibus01:10:17

The -str variant return a string instead of printing to sysout

didibus01:10:47

and ya, the "n" means newline

didibus01:10:35

Those are for reader readable strings. And then print, print-str, println, println-str are the equivalent for human readable strings

andrewboltachev01:10:16

Now, I rather want a pretty-printer which is reader-friendly and colored at the same time. E.g. aprint is colored (which is good), but tends to truncate output

didibus01:10:07

Hum, I don't know of one.

didibus01:10:33

You have to know that the newline variants like println and prn are not thread safe. The order of the newline and the preceding string are not guaranteed, so you could end up with a newline before or after in the case of a race condition

andrewboltachev01:10:23

Yes, btw, I were once solving this with core.async (when I had e.g. reducers/fold concurrent stuff in play) ā€” instead of (println x) I were doing (put! debug-ch x) and had a go-loop to print these messages

didibus01:10:19

Hum, I normally just do (print (str x \newline))

andrewboltachev01:10:29

didn't know about this. interesting, why isn't println doing kinda the same?

didibus01:10:28

I had a conversation about it with Alex Miller a while ago, and it seems that's just not what they want it to do. Couldn't really understand why not.

andrewboltachev01:10:18

uhm, good to know. These internals are sometimes interesting

andrewboltachev01:10:55

may be it's some legacy/Java thing that they use...

didibus01:10:22

Someone had mentioned that if you implement println as (print (str ...)) then if you try to println an infinite sequence you would out-of-memory

didibus01:10:02

Don't know if that was the real reasoning behind it or not. I guess it would be a trade off between the race condition or the potential of out-of-memory errors.

josh.freckleton03:10:51

Why does Transit (CLJ) mutate objects to accomplish it's conversions? (My question is embedded as a comment on the previous snippet)

geoffs03:10:47

Not a transit dev, but basically that example is about interoperating with the standard java machinery for reading/writing to arbitrary data sources/sinks.

geoffs03:10:20

Reading and writing from strings is great, and I don't know but I would assume transit has that as well. But for e.g. a REST API data transport format, reading from a Reader and writing to a Writer makes more sense.

geoffs03:10:38

for one thing, it can be done incrementally, instead of needing the whole contents to reside in memory at once

geoffs03:10:02

which is what would happen if you first needed to read it into a string.

geoffs03:10:08

@josh.freckleton not sure if that actually speaks to what you aren't liking. Because I also could read that this is a complain about that being the first example on the Transit README.

josh.freckleton03:10:50

@geoffs That makes sense about interop. And I don't mean to complain, but this just took me completely by surprise, so, apologies to anyone I offended, because I know they're working hard to create free open source awesomeness. Is there a Transit option for referentially transparent (non-side-effecting) code for reading/writing?

geoffs04:10:44

huh. I would have thought so, but I'm not seeing it.

sveri10:10:14

Hi, leiningen has the complement function for test selectors, so (complement :integration) will run anything but the :integration tests. Do you know if there is a way to exclude more test? like (complement :integration :web ...)

sveri10:10:16

Never mind, I was not aware I could write simple functions, so something like this: (fn [m] (not (or (:web m) (:integration m)))) does it

pvinis11:10:52

how can i call start-server from aleph.http in a boot task? i keep getting aleph.netty$start_server$reify__5742 cannot be cast to clojure.lang.IFn

dominicm12:10:53

@pvinis you need to put identity at the end of your boot task then it will work. Boot tasks should return a function

rcanepa15:10:27

Hi everyone! ā€¦ I would really appreciate a hand on a little ā€œsetupā€ problem Iā€™m dealing with right now. I want to embed the Pentaho reporting engine on an application Iā€™m currently building. However, I canā€™t properly configure the leiningen project.clj file to fetch the required dependencies. The Pentaho libraries can be found here: http://repository.pentaho.org/ and my project.clj look like this.

rcanepa15:10:21

I believe that my ā€˜:repositoriesā€™ configuration is wrong, but Iā€™m not sure how to fix it. Obviously, this is my first time trying to add dependencies from a repository different than Clojars.

rcanepa16:10:49

I changed :repositories [[ā€œpentahoā€ "]]. I didnā€™t get any error. I guess now everything is fine.

andrewboltachev16:10:02

Hi everyone. Is Clojars up?

andrewboltachev16:10:52

my lein deps (on existing project) or lein new figwheel foobar commands hang forever (not sure if the issue with the latter one might be related to Clojars)

anmonteiro16:10:03

@andrewboltachev seems like it is. you can check it in the future here: http://status.clojars.org/

anmonteiro16:10:19

(also tried to download something just to make sure)

andrewboltachev16:10:59

('cause I used to be checking their Twitter instead)

andrewboltachev16:10:23

If it took for me 2min16sec to install deps for a fresh "lein new fighweel ..." project, what can be wrong? My network connectivity? http://dpaste.com/2YXWREP

maximgb23:10:31

Hi, can someone help me with basic JavaFX application? I'm stuck at passing aot class reference into javafx.application.Application/launch method. My app can't resolve the class aot'ed.