This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-02
Channels
- # boot (227)
- # carry (1)
- # cljs-dev (3)
- # cljsjs (2)
- # cljsrn (19)
- # clojars (2)
- # clojure (93)
- # clojure-belgium (1)
- # clojure-dev (2)
- # clojure-italy (1)
- # clojure-spec (22)
- # clojure-uk (5)
- # core-async (15)
- # cursive (33)
- # emacs (8)
- # ethereum (1)
- # hoplon (3)
- # jobs (2)
- # leiningen (1)
- # off-topic (24)
- # om (32)
- # perun (1)
- # protorepl (1)
- # re-frame (13)
- # reagent (53)
- # rethinkdb (4)
- # ring-swagger (1)
- # vim (12)
- # yada (14)
@bcbradley Try w/prewalk
in your lispify
function...
…ah, but you need to check map-entry?
as well
oh wow I didn't know that was a function
i've got a solution now anyway that is a bit clearer:
(defn lispify-hiccup [[keyword tags & children]]
(let [foo (symbol "html.core" (name keyword))]
(if (string? (first children))
(list foo tags (first children))
(apply list foo tags (clojure.core/map lispify-hiccup children)))))
(defn lispify [s]
(w/prewalk (fn [e] (if (and (vector? e) (not (map-entry? e))) (apply list e) e)) s))
prewalk
preserves the MapEntry type, postwalk
does not
To me, that feels like a bug.
I created http://dev.clojure.org/jira/browse/CLJ-2031 for that to be evaluated.
@bcbradley: you don't, since clojars no longer uses gpg keys
that's local, not from clojars - lein is trying to sign your deploy. take a look at https://github.com/technomancy/leiningen/blob/master/doc/GPG.md
>>> To disable signing of releases, set :sign-releases
to false in the :repositories
entry you are targeting. If you do this, everyone who is depending on your library will not be able to confirm that the copy they get has not been tampered with, so this is not recommended.
FWIW @bcbradley Using Boot makes this process easier since you can push
to Clojars without any of the GPG baggage that Leiningen still has.
@bcbradley afaik clojars signing is not about encrypting jars, it s just a way to provide a way to confirm its origin
what does clojure.lang.ExceptionInfo: Could not find artifact org.clojure:clojure:jar:1.8.0 in http://clojars.org mean?
here is my build.boot:
(set-env!
:source-paths #{"src"}
:dependencies '[[org.clojure/clojure "1.8.0"]]
:repositories [["" {:url ""}]])
(task-options!
pom {:project 'html
:version "1.0.0"
:description "Tools for writing html as clojure"
:url ""
:scm {:url ""}
:license {"MIT" ""}})
@bcbradley: clojure itself is hosted in maven central, not clojars. Your :repository
entry is replacing the default list of repos. so maven central is no longer in the list
you don't need to specify repos unless you need one not in the default list, and clojars is in that list
I also figured out that build-jar and push-release come from adzerk, so i have to :dependencies '[[adzerk/bootlaces "0.1.13"]]
but now I'm getting a different error, it writes pom.xml and pom.properties, writes the jar, installs the jar and says CLOJARS_USER and CLOJARS_PASS were not set; please enter your Clojars credentials
@bcbradley: you would put [html "1.0.1"]
in the :dependencies
vector of the other other project
That's called destructuring. Google it - your first results will likely be good guides (that I've referred to time and time again : ) @hejcz
I was reading some random tutorials about destructuring. Just couldn't find this particular example explanation. However you're right it's even on the http://clojure.org
@hejcz which part is hard to read/understand? (the destructuring, or the usage of :keys
)?
oh ok so (list :a 2 5 3 :b 8 2 3)
returns (as expected a list of (:a 2 5 3 :b 8 2 3)
(note that :a and 😛 are just keywords)
@hejcz https://gist.github.com/john2x/e1dca953548bfdfb9844 explains it better than i can do
@dzannotti thanks! I was just trying to find a proof that destructuring list like a map is not somehting wrong 🙂
what's idiomatic way to do count-by operation? I've done with reduce + case, and it looks pretty long https://gist.github.com/YurySolovyov/7fd36108ae365a9defa145b9fa519b7f
@yury.solovyov frequencies
e.g., (->> items (map :type) frequencies)
Works, amazing
I need an ordered-map; I currently use flatland, but that’s essentially unmaintained (I’ve submitted PRs that have fixed bugs that got review but haven’t been merged after >>1mo), so if I can remove a dependency I’ll be pretty happy
array-maps are impl details
I don't know why array-map
is a function
if it's not small it will turn into a hash-map as soon as you modify it
so not useful for most ordering purposes
that definitely explains my hesitation even though I couldn’t get it to not be ordered on the repl; I didn’t realize that it autopromoted
@lvh, there's a fork (?) that adds cljs support and may be more actively maintained: https://github.com/frankiesardo/linked
An ordered map is such a useful data structure
Also the one thing that php got right :)
@lvh are you doing lookups by key?
eeh, something like that I guess
Can anyone make any recommendations of things to study for someone who wants to get a job doing Clojure? This hypothetical person has a strong background in OO programming, but is just ok at functional concepts as well as just ok at Clojure? I have a friend...
@ballpark http://www.braveclojure.com/clojure-for-the-brave-and-true/ helped me the most (once i read and understood that, i was able to dig into other books about clojure that i couldn't understand to start with), i think that coming from OO the biggest block it's the mind shift required, and dealing with the frustration of "i already know how to do X in 10 imperative languages"
@dzannotti Thanks for the suggestion. I just bought it!
^ I bought it thanks to your suggestion
fwiw i don't think that clojure is a language that you can pick up in a week or so (like switching between imperative languages), takes a much longer time, but eventually you'll never want to go back to anything else 🙂
and by you, i meant anyone with a lenghty experience in OO, not you personally of course
@ballpark Given "your friend" has a background in OOP, after reading Brave and True as an introduction, move on to Clojure Programming by Emerick et al (on O’Reilly) and then maybe Clojure Applied
Above all, consider that you^H^H^Hthey will have to let go of pretty much everything they’ve learned about OOP: no assignments, no loop with indexes, no mutable iterators, no mutable state, essentially letting go of data encapsulation, and relearning polymorphism. That shift is what is the hardest for most OOP folks. But it’s definitely worth it.
Thanks seancorfield and dzannotti!
is there a way to tell clojure from which file a function/macro is being evaluated? I know you can find it with meta, but as soon as I evaluate that function from other namespace (other file) I cant seem to find a way to get the filename from the calling file. I think maybe some macroexpansion would do the trick here?