This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-10-26
Channels
- # admin-announcements (1)
- # beginners (167)
- # boot (117)
- # boulder-clojurians (1)
- # cbus (1)
- # clara (3)
- # clojure (87)
- # clojure-conj (2)
- # clojure-japan (2)
- # clojure-russia (23)
- # clojure-spain (3)
- # clojure-za (2)
- # clojurescript (184)
- # community-development (8)
- # core-async (7)
- # core-matrix (4)
- # cursive (36)
- # data-science (74)
- # datascript (3)
- # datomic (171)
- # events (6)
- # hoplon (83)
- # ldnclj (5)
- # ldnproclodo (1)
- # lein-figwheel (2)
- # leiningen (19)
- # liberator (2)
- # off-topic (5)
- # om (227)
- # onyx (5)
- # re-frame (142)
- # reagent (4)
- # yada (5)
If i create a library and want to use it on another project, must I put in on clojars or can I just load from github ?
hmm the Clojure Applies book says: Clojars, Maven Central Repository or a self-hosted maven repo
@clojuregeek: tools like lein assume it will be in a maven repo of some kind
my boss was hoping I can grab a release of our library from github (as a jar) and use it ... but I am not sure how .... he wants to open source it at some point .. but he is not ready for me to publish to clojars yet
our http://travis.ci build is failing because one repo can't get the other one
@clojuregeek: if the repo is a dependency of the project you’re trying to build, a self-hosted maven repo is the way to go. If you’re feeling lazy, you can check it out from source on the CI box and run lein install
.
there is no way to say bundle the jar file of the dependancy with the project that needs it, so http://travis.ci can run the tests ?
I believe lein uberjar
does that for you. But I assumed you were trying to build from source.
i make a jar file and run it as a lambda on aws
but thats how I use it now
then boss wants to use http://travis.ci
so the clojure project can't say "get this dependency from a git hub release zip file, here's the url"
You know, I’ve never tried it. Only things I know are local repo and private maven repo. I’ll snoop around for a bit.
ok .. i can't find anything about it so far.. and nothing in Clojure Applied book .... thanks!
one option is to make the .travis-ci.yml file have an install
that wgets the file and adds it to the local maven cache
ok the jar file to wget .. would be in a private repo..
you could also add it to your project as a git submodule and have travis check out the whole shebang
would save you the wget
then cd in and lein install
. cd out and build
if i require
[foo.bar :as bar] [foo.bar.baz :as baz]
why can’t i do
bar.baz/my-func
@thedavidmeister: I'd guess performance. With the namespace portion of the symbol being complete on its own, then a hashmap lookup can be used. Otherwise you get into slower string substitution and multiple match possibilities
wouldn’t that just be something a dev could do themselves if they profiled and found that level of micro optimisation is needed?
also, if it worked, you could always run a tool over your code to “expand” all the namespaces
to speed it up
bar.baz
would expand to foo.bar.baz
oh, I missed the obvious one about require
actually loading the namespace and running the top level forms
I mean, that would kind of defeat the purpose of fully qualified symbols - being guaranteed to refer to only one thing. If you require foo.bar
as bar
and then expect a child namespace baz
to be referrable through bar
- how could you possibly refer to something in a namespace that is actually called bar.baz
?
i wouldn't
the :as
is the bit i control
@thedavidmeister: This doesn't quite answer why but: http://stuartsierra.com/2015/05/10/clojure-namespace-aliases
isn’t that the same issue with aliases in say, SQL?
If you need the actual "why" then you'd have to dig into Compiler.java
. Especially the maybeResolve...
yeah so, i’m not sure why you can’t alias a part of a FQN
not the “why” as in “where in the code"
but “why” as in “what’s the tradeoff here? what do we gain by not being able to do it?"
“what would we lose if we had it?"
like, a namespace is strictly a heirarchy
as i understand it
i should be able to alias to any level of that heirarchy
just like a part of a file system path
I'd say that it's very bad form, technically it'd certainly be possible. But I would hate reading a source that uses that kind of referencing
well, i’m using hoplon
so i’m making html elements in a folder
i’m getting down to
elements/form/atoms/textfield
actually i’d love to be able to require
or just
elements/form/textfield
it doesn’t really matter
the point is that it would be nice to get
elements/form mapped to something
then have folders within that
and know i’m dealing with form elements
without needing to require every single element at the top of the file
makes refactoring the DOM structure more work
and I come from PHP, so you might hate a lot of source that I work with all the time @rauh 😉
Often people use ztellman/potemkin
to collect vars into a single namespace from a structured implementation. If that's what you're looking for
potentially
i’m not 100% sure what i’m looking for
i’m just used to being able to use namespaces like directory structures
rather than needing it to be FQN 100% of the time, or a FQN shorthand
i don’t know enough about clojure to understand the problems that might cause
so the things that you lose are performance, and knowing require
has already been loaded the namespace and ran the top level forms. (think defs, multimethods, etc)
If you're new then I'd just recommend you to stick with the verbose method of importing the stuff you want. You could def. "script" this with clojure, maybe adapting this code: http://stackoverflow.com/questions/21634507/require-child-namespace-as-shorthand-in-clojure
yeah, so basically i just have to write lots of requires
not the end of the world
its possible to build your own lookup implementation around the one in clojure using string concatination, resolve
, and load
, but it wouldn't be easy/normal
which seems like it might do some of the work for me
but in the other direction
sublime
no idea what that is
googles
oh ok cool
yeah that might help a bunch
kk, getting the ide now
ok, opened cursive
i feel like i just stepped into a plane cockpit
so, i put in (textfield)
how do i make it require my-project.elements.form.textfield
thedavidmeister: make sure to check out the introduction to cursive, the very first steps detail how to strip away all those “plane cockpit” details
hmm, anyone else had problems with the “emacs tab” thing?
so, not sure if it’s me or cursive or hoplon or whatever
but i just get lots of “foo cannot be resolved"
even though it compiles fine
soz, going back to sublime >.<
too much “magic” going on in cursive
@thedavidmeister: ping @cfleming in #C0744GXCJ - he is the author of cursive and a great and helpful guy. I do know that Cursive struggles sometimes to grok macros...
i’m trying to figure out a better way of writing
(defn back-and-forth-translation [text url api-key]
(let [lang "en-ja"
params {:lang lang :text text :key api-key}
first-translation (run-translation url params)]
(run-translation url (assoc params :lang (reverse-lang lang) :text first-translation))))
basically i build up some params, run a function, take that result and then run that same function with new params. i suppose i could use ->
to be a little neater but is there a better way?if you do lein jar
does it use the branch you are on, or always master?
it uses what is in you working directory
thanks
a little context and follow-up question:
@comma: ->
doesn’t quite fit because you need to wrap the text parameter in a hash
ordnungswidrig: yeah i noticed that shortly afterwards when i decided to implement it myself 😕
how do people generally work on forks? What I’m doing is forking a project, making my changes and creating a jar. Then I install that with lein-localrepo, and change the deps of the project where I’m testing it to (attempt to) use the localrepo version
I’m missing my gem “foo”, github: “bar/baz”
I guess most will rename the project to „bar/baz“ locally and increment the revision in a sensible way
@jeremyraines: I rename the project, install it using lein install
, and then include that version in the project I want to use.
hmm. But still do the localrepo stuff? What does the rename & version bump accomplish? If I change, for example [michael-blume/lein-marginalia “0.9.0”]
to [lein-marginalia “0.9.0”]
that it would only find the local version
*I assume that it would find only the local version. But I didn’t see any install messages, so I don’t know. Would expect an error at least if that were wrong
oh, you should change it to „jeremyraines/lein-marginalia“ and lein install it
.
then the dependency on [„jeremyraines/lein-marginalia „0.9.0“] should find it locally
(or even on clojars when you release if)
I see that the difference between lein jar
and lein install
is that it generates the pom.xml and installs it into local repo
is the difference between what I did and that just the generation of the pom.xml?
which I think lein-localrepo attempts to do if it isn’t provided
not sure.
need to go, be back later, sorry 😞
ok, thanks to you both. Gives me some more avenues to explore and hopefully a faster process
honeysql
is great as is yesql
. There was a newer lib which some people preferred over yesql
- cannot recall - let me search...
http://www.clojure-toolbox.com is also a great place
awesome, thank you @colin.yates
no, I can’t find it - darn.
if you have the use-case it addresses then I really can’t recommend honey-sql
enough.
honey-sql looks interesting, but the docs are lacking. It doesn’t seem to specify how to connect to a db.
honeysql allows for composable queries, while yesql is fine if your queries are defined completely ahead of time
it doesn’t - you construct a map and then ‘render’ it effectively which produces a vector of [sql params] which you then pump into the standard jdbc lib
yep - first result from googling 'honeysql example': http://stackoverflow.com/questions/18817516/composing-clojure-honeysql-where-clause
it’s the usual success you get when it is just data
recently had to implement a web scraper, and used Enlive for the first time. It was so nice compared to using Geb.
I hack on honeysql a little, so if there’s something you think it should be able to do but isn’t, feel free to ping me as well
@jeremyraines: if you are working on two projects at the same time you should look at https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#checkout-dependencies
thanks, I’ll check that out
here’s what I was working on, but failed. (The deps part was OK thanks to the help above). If anyone would like to hack on this, either online or at the conj, I’d be really interested
and that was a side effect of producing this: http://jeremyraines.com/noise.html . . . was going mad that I couldn’t document things inside of a let
block
ah crap, uploaded the version produced by my failed attempt. oh well, will fix it later.
hmm, apparently I now need something like “lein uninstall”. When I was working on those forked repos, and did lein install, now my main project will only use those as deps. I think I now understand why I was told to bump the version numbers ...
@jeremyraines: rm ~/.m2/repository/marginalia -rf
will wipe all the versions from the local cache, and will redownload next time you need it
awesome, thanks