Fork me on GitHub
#beginners
<
2016-05-05
>
paradoxquine03:05:19

i have a project.clj and made a simple indentation fix to the compiler options and now it's not outputting anything—neither the compiled file nor any errors or warnings. anyone mind taking a look, i'm sure it's some stupid mistake: https://goo.gl/G68uFe

paradoxquine03:05:43

(i tried undoing about 30 times and testing each one and none of the undo steps work either now)

paradoxquine03:05:17

oh, it isn't recompiling if out/main.js already exists, even though my compiler flags have changed. that's strange behavior

jwm17:05:10

no, that is normal

jwm17:05:34

all build systems work off file change date

lucaska17:05:45

So say I want to take a vector of vectors, turn the first vector into keys, and map each of the remaining vectors to those keys as new vector containing maps?

lucaska17:05:15

When I type it out, it feels like the code just wrote itself, lol. The reality is not as close. 😄

jeremyraines18:05:02

I am really struggling due to not having a good understanding of java Files and various types of streams (like ZipInputStream), when they are like files and when they are not. Can anyone recommend a good read on this?

jeremyraines18:05:05

for example, I’m confused by the fact that this doesn’t create a file on disk ( “hey”)

lucaska18:05:59

(spit “file.txt” “hey”) works 😄

lucaska18:05:15

does that function need 2 args?

d-side18:05:56

(doc spit) to find out simple_smile

jeremyraines18:05:05

well, I’m actually trying not to write to disk but this was me giving up, deciding to write to disk, and failing

jswart18:05:53

@jeremyraines: the docs https://clojuredocs.org/clojure.java.io/file give a hint that a java.io.File object is created. Typically in java you can’t just do something, you have to set up a bunch of objects and then call methods on them.

jswart18:05:02

That as an intuition might help the process

lucaska18:05:03

The docs for http://clojure.java.io/file does not say it creates a file, as much as it returns one?

jswart18:05:17

but clojure has some wrappers in the case of spit/slurp

lucaska18:05:44

You might have to apply whatever function saves it to disk? If thats what you meant

jeremyraines18:05:50

I am trying to go through the contents of a zip file and do something with each one. I can get the entries, but I can’t coerce them into files

jeremyraines18:05:21

it fails at line 5, because it can’t find a file at that path, but it says it expects a File object, and I don’t know what is different between what it expects and what (io/file “foo”) creates, b/c it looks like a java.io.File object to me

jswart18:05:35

can you not call (.toString (ZipEntry. “zip-file-part-00”)) ?

jswart18:05:39

and manipulate the string?

jeremyraines18:05:18

maybe? That kind of circles back to my original question of trying to step back and get some overall understanding of this. i.e. how do files, streams, strings relate, when do I have to close them, when do they get written to disk, etc

jeremyraines18:05:45

but the specific help is definitely appreciated as well

jeremyraines18:05:01

@jswart the working parts of that gist are cribbed right from that answer already simple_smile

jswart18:05:30

that should help build some familiarity with file IO

jeremyraines18:05:33

thanks, I’ll definitely read that

jswart18:05:57

I’m working right now but you can ping me personally if you get really stuck and I’ll answer when I can

lucaska19:05:10

Thats a great book

lucaska19:05:36

Mostly because of Kanye using a Slap Chop. Also I learned some Clojure.

jeremyraines20:05:24

here’s a working version. Still don’t understand 100% but definitely learned a few things:

prokaktus22:05:50

Om also same story.

lucaska22:05:34

"Nobody should start to undertake a large project. You start with a small trivial project, and you should never expect it to get large. If you do, you'll just overdesign and generally think it is more important than it likely is at that stage. Or worse, you might be scared away by the sheer size of the work you envision. So start small, and think about the details. Don't think about some big picture and fancy design. If it doesn't solve some fairly immediate need, it's almost certainly over-designed. And don't expect people to jump in and help you. That's not how these things work. You need to get something half-way useful first, and then others will say "hey, that almost works for me", and they'll get involved in the project.” - Linus Torvalds

gowder22:05:10

Something that I spent an hour banging my head against the wall about: filtering vector a based on applying a function to vector b. in case any of my fellow clojure noobs have similar issues: https://gist.github.com/paultopia/02afbbf9c165590d81c1a662da2556da

rcanepa22:05:04

Hi everyone!… I have a question related to namespace’s compilation order. In namespace A I have a Record definition and in file B I have a Protocol definition. File B import Record from file A and then extend it (implement the protocol). However, when I try to compile my project I get the following error: java.lang.ClassNotFoundException: scv2backend.component.redis.Redis, compiling:(scv2backend/models/auth.clj:1:1). So, if I am right, file B is being compiled first. Then, I found that if I require file A from file B (while importing the Record too) everything works ok (no compilation error). Why does it happens?, why doesn’t importing a class/record force a different compilation order?

lucaska22:05:31

@prokaktus: Unreliable how? In maintenance?

prokaktus22:05:42

@lucaska: yeah. If core maintainer just burned out or decided to switch his priorities, what will happen with project.

lucaska23:05:36

I guess that depends on how interested someone is in taking it on.

bwstearns23:05:36

I've just come up with several arguments for and against this idea in the time it took me to type the original but I'd like to see what others think of it. If fear of project abandonment is a major barrier to clojure library adoption then maybe braveclojure (as an example, looking at the opensource page right now) could add some notion of maintainer succession (and a corresponding call for successor-maintainers) to its open source directory?

bwstearns23:05:48

I saw one library (the Taxi selenium webdriver) that seemed to have been gapped in terms of maintainers even though it looked overall like it was a great project. If it turns out that Clj libraries need only a couple major contributors at any given time (which is what those graphs might indicate) then relying on minor contributors to step up might be more risky as the whole team might actually vanish all at once. Maybe explicit succession plans are useful so when life/work/busses take the maintainer away from the project there's someone with at least the nod to go ahead. edit to add: of course downside, might discourage more even distribution of contributions, and of course how invested is the next-up guy/gal if they're not already committing code, etc.