This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-26
Channels
- # admin-announcements (1)
- # beginners (1)
- # boot (252)
- # braveandtrue (1)
- # cider (17)
- # clojure (58)
- # clojure-chicago (3)
- # clojure-russia (125)
- # clojure-uk (2)
- # clojurescript (38)
- # hoplon (3)
- # lein-figwheel (11)
- # leiningen (1)
- # mount (2)
- # off-topic (3)
- # om (9)
- # onyx (39)
- # parinfer (24)
- # proton (7)
- # protorepl (7)
- # quil (4)
- # re-frame (16)
- # reagent (5)
- # ring-swagger (18)
- # yada (1)
I don't quite know how to import types. Why can I do this:
product=> (use 'amalloy.ring-buffer)
nil
product=> (ring-buffer 3)
#amalloy/ring-buffer [3 ()]
but not this:
product=> (import 'amalloy.ring-buffer.RingBuffer)
ClassNotFoundException amalloy.ring-buffer.RingBuffer java.net.URLClassLoader.findClass (URLClassLoader.java:381)
or:
product=> (import '[amalloy.ring-buffer RingBuffer])
ClassNotFoundException amalloy.ring-buffer.RingBuffer java.net.URLClassLoader.findClass (URLClassLoader.java:381)
My understanding is that you can get speedups from it. I am trying but failing quite miserably to remember where I saw the benchmark, however this post (https://blog.juxt.pro/posts/typed-clojure.html) seems to imply that the speedups aren't as awesome as they could be if the compiler were type-hint aware, so the bulk of improvements might be primarily from the assurances that you're not going to run into type issues at runtime, which is still pretty cool.
i think a good statically typed language needs to embody types at a very low level. bolted-on static typing quickly becomes annoying, and with lisps in particular as they usually interfer with interactive, repl-based development.
for me it is "lisp" or "statically typed". i can see the merits of both, but i see them as being basically incompatible.
@isaac_cambron: try amalloy.ring-buffer$RingBuffer if RingBuffer is a nested class
@crocket: yes. all attempts i have seen to retrofit static typing on lisps were basically unsuccessful as they interfered with the "lisp way" of developing too much.
@crocket: as i said, i see statically typed development to be basically incompatible with interactive, repl-based development. that does not have anything to do with parentheses.
@crocket: right. i tried to use it once. that kind of repl is basically the same kind that python, perl and ruby have. an interactive evaluator that you can use to try out things, but not your central point of focus while developing actual programs.
@hans that's a really useful insight, never thought about it that way
I feel there's a general under-appreciation of interactive, repl-based development in many Clojure teams, some even end up using Clojure like Java, Ruby, C++ and it's merely just the 'typing' end of a build pipeline - whether under a fancy name like 'continuous delivery' it's basically swimming against lisp and then you start hearing complaints about the lack of types 😉
I've always been drawn to the idea that interactive development shouldn't stop when you go into production - but that always provokes a torrent of disagreement I usually keep quiet!
devops, for me, should be more about ops-becoming-devs, rather than today's devs-becoming-ops
I am trying to use react-bootstrap components in Clojure script using Cljs-js packages. The problem is I try to convert react component into reagent. React component --------------------------------------------------------------------------------------- const tabsInstance = ( <Tabs defaultActiveKey={2} position="left" tabWidth={3}> <Tab eventKey={1} title="Tab 1">Tab 1 content</Tab> <Tab eventKey={2} title="Tab 2">Tab 2 content</Tab> <Tab eventKey={3} title="Tab 3" disabled>Tab 3 content</Tab> </Tabs> ); ReactDOM.render(tabsInstance, mountNode); Reagent ------------------------------------------------------------------------------------- (def tab (reagent/adapt-react-class (aget js/ReactBootstrap "Tab"))) (def tabs (reagent/adapt-react-class (aget js/ReactBootstrap "Tabs"))) (defn left-tabs [] [:div [tabs {:default-active-key "{2}" :position "left" :tab-width "{3}"} [tab {:event-key "{1}" :title "Tab 1"} "Tab 1 contant"] [tab {:event-key "{2}" :title "Tab 2"} "Tab 2 contant"] [tab {:event-key "{3}" :title "Tab 3"} "Tab 3 contant"]]) how to write this ""eventKey={3}"" in Clojure script
I am trying to figure out how to determine the locale at runtime… the examples all seem to be hardcoded
Hi, i have question about clojure.jdbc, i use jdbc/with-db-transaction
to stitch a few operations together (insert, update, delete etc), and since autoCommit
is set to False in with-db-transaction
by default, my delete statements didnt work. What is the best way to overwrite that config within the transaction?
lumengxi: that behavior is going to depend on the database you use and what transaction isolation level you use
@crocket: http://shenlanguage.org/ It has lots of awesome weirdness to it but it seems like there are about 10 people using it.
So it seems like resources need to be addressed with a normalized path that only has / separators? I.e. (io/resource "mydir/my-file.txt")
I'm having trouble finding resources on a Windows machine where I've been using local File separators
resources are byte streams the classloader gives you, and where the classloader gets them is kind of abstract
they could come a file on the classpath, they could come from inside a jar file, the classloader could just make them up
https://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#getResource%28java.lang.String%29 and they are indeed spec'ed as being '/' separated
Thank you that was super helpful. This all makes perfect sense I just wanted confirmation as all my systems are / systems anyway. And it's probably a good time for me to read the classloader docs. Thanks again
I've finally gotten around to upgrading my project from 1.6 to 1.7, but I'm having some issues with protocols. Specifically, when just loading things in the repl, I'm getting "No implementation of method" errors. My project Uberjars fine, so I suspect it's some sort of load order type thing. Before I dig too deep, is there some big thing I need to do differently in 1.7. to get my protocol implementations to work? I looked at the changes file but nothing jumped out.
(the reify
calls in question look fine, fwiw)
Oh, right. Always a good idea
I feel like I jump on IRC every once in a while and ask a very confused question like that, get exactly that answer, and it usually works
Not really an option for me, unfortunately
without it, my startup time is measured in minutes
that's its own problem i should figure out
in the meantime...
There's definitely some of that. I have the strong suspicion that I'm in the top 1% of core.async users
well, good news! rm -r on target
fixed my protocol problem. so thanks!
Yeah, core.async is wonderful, but it isn't very friendly to the compiler
you should be careful, if rm -rf target fixes you problems, you may also have been running using stale code for a while, so you could end up exposing code paths for the first time that you thought you were exercising for a while
Eh, when upgrading major clojure versions, existential dread comes standard