Fork me on GitHub

Can this be simplified?

(map #(map first %) [[[1 2] [3 4]] [[5 6]]])
 => ((1 3) (5))


same items, different shape

+user=> (for [x [[[1 2] [3 4]] [[5 6]]] [y] x] y)
(1 3 5)


@noisesmith Thanks, I ended up with this (partial map (partial map first))


is there some way to report to clojars that a project doesn’t work anymore? The postgresql project there is way out of date and no longer works for inserts…I just spent a good 3 or 4 hours trying to figure out what I was doing wrong 😛


I'm sure it still works if you combine it with the right jdbc version


in that case they could at least put something in there saying that it’s no longer compatible with new versions of the jdbc and go to the right repo for compatibility


all these deps are explicit (, java.jdbc, db drivers) and many combos won't work, but the older ones still work in the right combination, if they ever worked


usually the approach is to treat old deploys as immutable


i assumed it was an official repo because it’s called postgresql/postgresql, if it was someguy/postgresql i would have looked for an alternative (and maybe found the official central repo earlier)


i get it but what im saying is this isn’t very user friendly, especially since the error doesnt actually make it clear what’s wrong.


I think the main problem is you shouldn't be looking for postgresql on clojars


it's a java project, like most mainstream java stuff they deploy to maven - someone mirrored to clojars once and used their name


(may even have been the postgres driver devs but I doubt it)


Fair enough, but being that I’m pretty new to the clojure/java ecosystem I honestly have no idea what’s official and what isn’t.


I assumed clojars was official because that’s where lein looks


OK - good rule of thumb is that java code is canonical on maven or sonatype, and clojure stuff is canonical on clojars


lein looks in maven before clojars iirc


in any case it would be good to have clojars or someone make a note on that repo for future noobs like me making that mistake heh


that's fair - I don't know if they have that power with the current site design - my mental model is that it's like github where each project controls what ends up on their clojars page


but I'm not sure, honestly


I agree that it's good for people to understand where the artifacts they use come from, and how they got there


Suggestions on making something like the following fast? - You're given information that a password is 14 characters in length, that it is composed of [a-Z] exclusively, and that it contains a single dictionary word. - You want to limit the cartesian product of all possible selections over [[a-Z] [a-Z] [a-Z] ...] given you know that a dictionary word must exist within the passphrase. Right now I'm doing something like

(c/cartesian-product (repeat 15 (map char (concat (range 65 91) (range 97 123))))


Note: It is possible for a dictionary word itself to appear in mixed case: "QQQDeALeRQQQ" for example


Basically I am generating a massive set of sequences #{[\A \A \A \B] [\A \A \A \C] [\A \A \A \D] [\A \f \o \o] ...}, and I want to keep only the ones that contain somewhere in the sequence #{[\t \h \e] [\f \o \o] ...}


So in that example, [\A \f \o \o] wouldn't be filtered out.


the fact that it contanis a dictikonay word is almost useless


the word 'a' is a dictionar word, so just words of the form a + 14 other letters is going to give you 52^14 possibilities


(Math/pow 52 14)


Usually in these cases you exclude stopwords and/or short ones


even if you limiktd to 5+ letter words, you'd still have atleast:

(Math/pow 52 10)


@qqq yeah I thought I was going to cut the search space in half, but ignoring words less than 3,4,5,6,7 characters does almost nothing in terms of time complexity.


The easy answer is to just compute every single sequence and try them all, but it still seems like enough information (14 char, a-Z) to cut the total brute force work significantly. Maybe partitioning and hashing segments of every sequence could be useful. Then you could search whether a word’s hash exists as a segment.


Seems like it should be faster to iterate over the dictionary and then build passwords around each of those words. Ie. if it’s “apple” then you’re adding X characters of padding before, and Y characters of padding after, where X+Y+length(“apple”)=14. The padding are sequences of integers (1,2,3,4 ...) converted to base 52 where the digits are [a-Z].


Hi, I wasn't aware of CLJ-1814 before (satisfies? being too slow). What approach would be recommended while CLJ-1814 is being worked on to dispatch only if a protocol is satisfied?


I know about letfn. It doesn't work well for me, as I'm trying to write:

(let [f1 (fn00 ....)
  f2 (fn00 ...)
  f3 (fn00 ...)]
where fn00 is a macro that helps me define functions, and f1/f2/f3/ are mutually recursive does clojure have a mutually recursive let ?


(I don't want to use declare as these bindings are not meant to be global)


why wouldn't your macro work in letfn?


because letfn wants me to do

(letfn [(foo [args] body)]
whereas for my macro, I do (def foo (fn00 [args] body)))


perhaps tehre's another way to use letfn that I am unaware of


you could just change the macro?


change which macro? change letfn or change fn00 ?


fn00 - that seems like a trivial difference if the alternative is rewriting let


the problem with letfn is -- it's not going to call my macro fn00


that's easy to fix with another macro


Hi. Is there anything like (or the Perl lib WWW:Mechanize from which it was derived)? I.e., a stateful http lib where you can fill in and submit forms etc.


@qqq letfn uses letfn* which I think has the shape you request. I guess that would be relying on an implementation detail though.