Fork me on GitHub
#clojure
<
2016-05-20
>
tap01:05:26

Clojure user doesn’t like to use label bug in their github issue 😜 https://labs.ig.com/static-typing-promise

bcbradley01:05:02

gosh i never thought i could have this much fun programming

bcbradley01:05:06

clojure is a joy

virmundi01:05:23

wait until you need DI

virmundi01:05:30

Component....wow

bcbradley01:05:58

I'm working on making a general purpose time traveling debugger

george.w.singer01:05:11

I'm trying to figure out a way to combine core.typed and Prismatic's Schema into one namespace for learning purposes. If s denotes the schema namespace and t denotes core.typed, this is the only way I've figured out how to do it without core.typed spitting out extremely large error messages:

(t/ann ^:no-check tagged-function [s/Str :-> s/Str])
(t/tc-ignore (s/defn tagged-function :- s/Str
      [arg :- s/Str]
       arg))

;; and then when calling tagged-function
(t/tc-ignore (tagged-function "string"))
Question: Is this the only/best way to do it, or am I missing something?

bcbradley01:05:17

i simply couldn't imagine doing it in any other language, and I didn't even know about clojure until 3 days ago

bcbradley01:05:29

that should speak volumes about how powerful lisp is

sveri05:05:08

@bcbradley: Hi, do you have a link to your Code? Or is it closed?

moizsj06:05:54

Does anyone know how can I access the Class instance of a Java type from Clojure? (the equivalent of doing MyClass.class in Java)

moizsj06:05:19

The only I way is see is doing (Class/forName "FQN of class")

pavlyshyn07:05:00

hi all . Does anybody use datomic ? I looking for new architecture to build functional reactive domain modeling

pavlyshyn07:05:50

i quite keen to try datomic and datascript on client

slotkenov07:05:19

I’m having this warning:

Warning: version conflict detected: org.clojure/clojure version changes from 1.4.0 to 1.8.0
I have seen others here with a similar problem, but not really a solution. When I run boot show -p I get no version problems (have added the necessary exclusions). My Clojure version is set to 1.8.0 explicitly in boot.properties.

thachmai07:05:15

@slotkenov: check if you have a org.clojure "1.4.0" dependency in your build.boot

slotkenov07:05:13

@thachmai: not explicitly, but had a dependency in my ~/.boot/profile.boot which seemed to be the culprit. Added clojure to the exclusions there as well, now the warning is gone. Thanks!

shakthimaan07:05:34

Why do I get this error when running boot on Ubuntu 15.04 with OpenJDK-8 https://paste.fedoraproject.org/368800/ ?

pesterhazy07:05:00

@shakthimaan: try removing line 3

shakthimaan08:05:51

@pesterhazy: Thanks! that worked!

slotkenov08:05:20

Is there a convention within the Clojure community for the maximum amount of characters on a line of Clojure code? Is it 80 (the default bikeshed checks for), or does it differ per person/team/project? Or is the convention that there is no convention and should the code just be ‘readable?'

pesterhazy08:05:31

I for one don't follow that rule; sometimes it's hard if you have long function names and nested anonymous functions

thiagofm08:05:06

I would say nowadays 120 characters is fine. If you keep your functions short, I don't foresee troubles with having big lines, you will rarely have them, perhaps when you have it, there might be a reason.

hans08:05:53

Restricting the length of lines almost inevitably causes people to prefer terse identifiers or insert artificial line breaks. I much rather want to see unabbreviated identifiers and line breaks that follow the structure of the code.

shakthimaan09:05:24

What can cause a "TypeError: goog.global.setTimeout is not a function" when building with boot?

mac09:05:21

I think there is an error in the http://clojure.org page/section on multi field comparators. Does anyone know if such issues are supposed to be reported on the Clojure jira?

pesterhazy09:05:23

well goog is in javascript land

mac09:05:50

@pesterhazy: Ah yes, might be better.

martinklepsch12:05:32

I want to turn a given string into an input stream — is there something shorter than this? (java.io.ByteArrayInputStream. (.getBytes "abc"))

hans12:05:14

martinklepsch: not quite the same, granted.

martinklepsch12:05:52

y, I guess I could use that and than pass *in* to my input-stream-expecting function but that seems a bit funky 🙂

hans12:05:08

hu? how's that funky?

pesterhazy12:05:35

@martinklepsch: (-> "abc" .getBytes )

pesterhazy12:05:07

(java.io.StringBufferInputStream. "abc")

c0rrzin12:05:27

you might want to pass an encoding to .getBytes

agi_underground12:05:00

attempt №3. someone use http2 with hetty?

ghadi13:05:28

agi_underground: not with jetty but with nginx yes

agi_underground13:05:57

@ghadi: no, problem exactly with jetty( but i`m surprised that noone doesn`t try to start jetty with http2 param

agi_underground13:05:11

@ghadi: but i have a new question for you: it is enough free version of nginx for use it as reverse-proxy that will be distribute the load between jetty instances?

ghadi13:05:39

yeah it'll do it

ghadi14:05:07

1.10.0 stable was released recently, includes all the http2 goodness

agi_underground14:05:34

@ghadi: and if i will be use nginx like reverse-proxy, do i need a will http2 on jetty`s?

ghadi14:05:49

no you don't, nginx can handle it

agi_underground14:05:45

@ghadi: ok, thank you for answers!

victorbjelkholm14:05:56

Weird question maybe but why people seem to prefer ;; instead of just ; for comments?

victorbjelkholm14:05:22

is because they want it to be similar to // which many other languages uses?

victorbjelkholm14:05:40

;; accomplishes, as far as I know, the same thing as ; but obviously looks different

risto14:05:04

I'd like to know the same thing, same for ;;; or ;;;;, etc

dpsutton14:05:29

in emacs there are convenctions for the number of ;s

victorbjelkholm14:05:58

so it’s legacy coming from emacs then?

victorbjelkholm14:05:07

or maybe rather lisps in general

dpsutton14:05:11

simple comments ;, grouping of code with ;;, and 3 or 4 ; for file headers and summaries

dpsutton14:05:17

yeah i'm sure emacs just took the convention

dpsutton14:05:23

or it evolved simultaneously

victorbjelkholm14:05:04

comment seems like a good macro to use for groups of code though, rather than ;;

roberto14:05:19

I use comment a lot

dorab16:05:08

@agi_underground: Did you get a chance to look at the response from @curtis.summers yesterday regarding HTTP2 with Jetty? It appears that you can pass along the parameter to the run-jetty call like (jetty/run-jetty dummy-app {:port 5000 :h2c? true :h2? true :ssl? true :ssl-port 5443 }) rather than to the java command line. I have not tried this personally, but it seems reasonable.

agi_underground18:05:00

@dorab: yes, i try to use jetty9-adapter, but project needs not only adapter, but and ring, ring-server; when i include ring, it needs to exclude ring-jetty-adapter dependency, and this where dependency hell starting. lib-noir include ring or ring-adapter; when we include only ring-jetty9-adapter, app will be needs jetty-server, ring-core and so on. if someone can demonstrate project with working ring functionality, and custom jetty-adapter, this will be fantastic.

agi_underground18:05:11

@dorab: but today i`m asking about seting nginx as reverse-proxy, and that i think good solution. I don`t know, but think we don`t need http2 between nginx and jetty instances in this case.

chillenious19:05:12

Hi all! I'm trying to do the following in Clojure... I have data (ordered by first elem/ date) like this: ["2015-04-28" "TRIAL"]["2015-05-28" "REGULAR"]["2015-06-28" "TRIAL"]["2015-07-28" "TRIAL"]["2015-08-28" "REGULAR"]["2015-09-28" "REGULAR"]["2016-10-28" "REGULAR"] I need to pick up state changes (compared to previous in list) and detect conversions and renewals, so that I end up with a list like this: -> ["CONVERSION" "2015-05-28"]["CONVERSION" "2015-08-28"]["RENEWAL" "2015-09-28"]["RENEWAL" "2015-10-28"] Piece of cake in Java, as you simply keep a pointer to the previous record, but I'm not sure how to best approach this in Clojure. Does anyone have a suggestion?

tom19:05:59

For anyone using compojure-api, is there a best way to return an empty body?

tom19:05:20

@chillenious: how are you trying to collect the changes? Like you want a list of changes and when?

chillenious19:05:36

yep, basically

tom19:05:46

reduce'll do

chillenious19:05:55

so TRIAL -> REGULAR and REGULAR -> REGULAR

chillenious19:05:01

sorry it’s been a while and struggling with sql problems all day

chillenious20:05:38

together with partition 2 1 (so that I get a feed of current + previous)

ghadi20:05:43

@chillenious: partition-by if your data is sorted

chillenious20:05:43

well, thing is I need to detect either a change from trial -> regular, or a repetition regular - regular (and ignore trial -> trial)… partition seems perfect for that?

chillenious20:05:51

together with reduce

ikitommi21:05:09

@tom (ok) creates an empty 200 ring-response