Fork me on GitHub
#beginners
<
2015-07-02
>
kharus07:07:40

Hi. Is there any way to set up multi-module project in lein where module dependencies are not via repository? I tried lein-modules and lein-sub But for clean project is I go to submodule and do lein test for example lein tries to fetch module dep from repo. I want something like gradle where it figures out that required module is just folder away and builds it on the fly.

arrdem07:07:22

@kharus leiningen checkouts are probably what you want at least for development.

arrdem07:07:50

But you still need whole projects.

iae12:07:30

So, transducers, huh.

iae12:07:34

Is it correct in implying that they are a little like a curried or partial'ed function you can compose with the (>>) operator in F#?

alexmiller12:07:26

no, they are not currying or partial application, they are reducing function composition

robert-stuttaford14:07:15

i bet alexmiller has had a lot of practice explaining transducers simple_smile

grounded_sage14:07:39

Is there a way to use autoprefixer with leiningen?

agile_geek15:07:46

@robert-stuttaford: he’s even written it in a book (Clojure Applied) 😉

iae15:07:49

Oh, the beta book!

iae15:07:02

I was looking through it the other day but I couldn't find out how much of it is already written

surreal.analysis15:07:13

Quite a bit, @iae - I’d say it’s worth getting now

roberto15:07:16

I understand it is done

iae15:07:44

Will it support 1.7? Right now the details say 1.6

roberto15:07:54

i don’t think the version of clojure matters

roberto15:07:59

it is more about best practices

roberto15:07:09

it is not a book to learn Clojure from

iae15:07:24

I see, sounds good

iae15:07:44

I haven't really found any good clojure book since most of them appear to be outdated

iae15:07:58

But Racket helped out in the understanding a lot

roberto15:07:59

Living CLojure

roberto15:07:08

that book is a good beginners book

iae15:07:40

Loving the comments.

iae15:07:07

"This book aimed at for people inexperienced with Clojure..." "Oh man, this book was too introductory for me, what gives."

roberto15:07:39

It helped me a lot. I hate comments like that

roberto15:07:46

if it wasn’t for you, then just move on

iae15:07:05

I agree.

iae15:07:19

Thanks for the suggestion, I'll give it a good look and will order if possible.

roberto15:07:46

cool, gigasquid is also around irc and slack, and is very helpful.

iae15:07:53

So, since we're on the topic on books... Mastering Clojure Macros looked fun, but I'm not sure if it's equal to an in-depth review of C++ Template Metaprogramming

iae15:07:09

A fun, incredibly deep and complex topic that is more or less not that useful in most applications

roberto15:07:38

yeah, I prefer onlisp by Paul Graham for that, or Let Over Lambda

roberto15:07:56

tho not Clojure specific, but are more mind bending

alexmiller15:07:21

iae: re Clojure Applied, it covers 1.7 topics

alexmiller15:07:45

like transducers in particular

iae16:07:18

Gonna purchase that baby tonight then

iae16:07:27

You're gonna be rich 😄

seancorfield16:07:35

@alexmiller: is that the only Clojure book that covers 1.7 stuff?

alexmiller16:07:01

well all other Clojure books came out before 1.7, so advantage us :)

alexmiller16:07:51

the coverage is integrated into the sequential processing chapter primarily. reader conditionals aren't covered.

alexmiller16:07:07

the goal of the book is explicitly not to "cover Clojure" but to cover the meat of how to use Clojure to build real stuff, assuming some prior knowledge (like reading any intro book)

alexmiller16:07:30

so many topics, esp those covered elsewhere in the pragmatic books (macros, web dev) are not covered

iae16:07:24

Excuse my ignorance, but do you mean that you don't teach macros or that you don't show off how to make pragmatic or real stuff with macros?

roberto16:07:47

Applied Clojure helped me understand Components. I could not for the life of me figure out how to use it just by reading the Readme.

roberto16:07:43

macros are not covered, if I recall correctly.

roberto16:07:57

I haven’t had the need to write any macros, tbh.

iae16:07:20

Huh, everyone that talks or asks about lisp gets them thrown in their face as a cornerstone or fundamental to the nature and productivity of lisps

iae16:07:23

That's interesting

roberto16:07:37

they are an advanced feature

roberto16:07:44

that’s how I see it.

iae16:07:13

Forgive my ignorance, but isn't that what the book would like to do, though? Show how to use advanced or useful clojure features to build real stuff?

alexmiller16:07:14

macros are not covered at all

alexmiller16:07:49

you can write real stuff without macros

alexmiller16:07:07

there are undoubtedly many topics that could be included but aren't

iae16:07:13

Fair enough

alexmiller16:07:21

gotta leave room for the 2nd ed :)

alexmiller16:07:06

we're finalizing content next week so at this point the TOC is locked

alexmiller16:07:17

based on the current production schedule, the final printed book should be available in early Sept (e-book probably late Aug)

spiralganglion16:07:56

I am very excited to read it.

seancorfield17:07:54

@iae: We have 25K lines of production Clojure and only 9 small macros.

seancorfield17:07:18

(that total includes whitespace, comments, etc)

akiva17:07:32

Isn't Clojure for the Brave and True also going to do 1.7?

seancorfield17:07:32

Clojure source 129 files 25139 total loc, 1854 fns, 670 of which are private, 309 vars, 9 macros, 29 atoms

seancorfield17:07:06

We also have a lot of tests (well, some people think it’s a lot for Clojure, some don’t):

seancorfield17:07:07

Clojure tests 60 files 7495 total loc Clojure WebDriver tests 43 files 2040 total loc

samueldev20:07:38

hello gents and ladies

samueldev20:07:43

beginner here

samueldev20:07:53

trying to use clojure.data.json in a clojurescript project

samueldev20:07:55

is... that not a thing?

samueldev20:07:11

interop clojure lib -> clojurescript?

samueldev20:07:33

attempting to import this into a lein figwheel clojurescript project: https://github.com/clojure/data.json

samueldev20:07:44

and getting no such namespace error

samueldev20:07:58

bueller 😛

donaldball20:07:21

clojure.data.json uses Java interop

samueldev20:07:00

In other words, no it does not translate to cljs ?

donaldball20:07:44

You got it. Only pure algorithms can work across clj and cljs, or could. Reader conditionals may pave the way for more cross-platform libs.

samueldev20:07:06

Is there any commonly-known way to tell, basically, if a lib I want to use is javascript-interop?

samueldev20:07:16

Or should I just tack on "clojurescript" to all my searches

samueldev20:07:26

Like does clojars indicate anywhere whether something is cljs compat?

donaldball20:07:50

That's what I'd do, though I do only tiny bits of cljs so my ignorance is vast

samueldev20:07:04

Cheers thanks

samueldev20:07:25

for cljs beginner questions

samueldev20:07:32

am I better off asking here, or in #C03S1L9DN

iae21:07:56

So, I'm pretty unhappy with my IDE, Cursive with IntelliJ. It's till too rough around the edges. I gave LightTable a whirl but it has ceased active development and I don't want to have to switch again in a few months. I haven't given emacs a try yet because the package manager errors out on me under windows; is that still the de-facto standard for lisp/clojure development?

seancorfield21:07:14

Emacs is probably still the most popular editor used for Clojure development — but it does have a steep learning curve.

seancorfield21:07:29

I would recommend using one of the curated Emacs setups as the best way to go.

seancorfield21:07:58

My whole team uses Emacs Live. Git clone the Emacs Live repo and replace your .emacs.d folder with that repo. Provides pretty much everything you’d ever need, out of the box, and is maintained and curated well.

iae21:07:20

Ooooh, I was going for a modified SLIME box, but that sounds good too

iae21:07:24

I haven't heard of Emacs Live yet

seancorfield21:07:26

Emacs Live side-steps the package manager completely, by the way.

seancorfield21:07:58

I use it on both Mac and Windows.

iae21:07:01

May I ask why? The package manager sounds useful

seancorfield21:07:28

I meant more that you probably won’t need to install any packages, if you use Emacs Live (which has its own "pack" system, making it easy to drop in new stuff and load it without messing up the core Emacs Live install stuff).

seancorfield21:07:15

At work some of us use Zenburn as a pack (instead of the default color theme pack), and I packaged up ponylang-mode as a live pack to experiment with.

iae21:07:32

Ah, I understand, thanks simple_smile

iae21:07:41

Woah, the wiggling logo is trippy

iae21:07:25

Ohohoho I connected to the lein repl

iae21:07:54

Now I just need to figure out how to do practically everything and I'm golden

iae21:07:57

It's vim all over again

stvnmllr21:07:39

look at emacs evil mode if you like vim

arrdem21:07:56

iae: ONE OF US ONE OF US

dmich21:07:17

What if one wanted to use emacs live with spacemacs? Both seem to say use this ~/.emacs.d directory?

stvnmllr21:07:58

just merge them and hope for the best 🙈

dmich22:07:03

(and how do I easily switch back to my existing ~/.emacs.d? that I been using for years?)

iae22:07:26

To the latter- backups?

arrdem22:07:37

Yeah. I keep my emacs configs under git control 😛

smnplk22:07:03

what about spacemacs, looks like it has good clojure dev support

arrdem22:07:39

spacemacks is supposed to be pretty good

dmich22:07:41

So just use spacemacs instead of emacs live?

arrdem22:07:00

I used emacs live for a while and decided it was too complicated. It tried to do too much.

dmich22:07:03

spacemacs supposed to be easier on your pinky finger

smnplk22:07:34

simple_smile Yeah, if you are a vim user, spacemacs is the way to go. Best of both worlds..

dmich22:07:53

but have to learn completely different keystrokes for everything, and different mindset, more like VIM.

smnplk22:07:24

But I do like fireplace plugin in vim, so i haven't made my mind yet.. cider vs fireplace..

dmich22:07:36

I don't use VIM (other than firefox Vimperator extension)

smnplk22:07:01

Well, there is a great vim tutorial that you can run inside spacemacs..or vim

dmich22:07:01

I still would like to be able to try these out but easily switch between.

smnplk22:07:08

by pressing "SPC h T" i think

smnplk22:07:31

you can also switch between vim mode and emacs mode in spacemacs..

dmich22:07:48

maybe by telling emacs specifically where the ~ directory each time from the Windows shortcut?

dmich22:07:36

No I mean between my current emacs setup, and these new fangled setups.

smnplk22:07:51

maybe, not sure, my emacs knowledge is limited, what i would do is just make a copy of emacs.d or whatever is that dir called

smnplk22:07:18

don't you have a dotfile .emacs or something in ~ ?

smnplk22:07:35

spacemacs uses .spacemacs

dmich22:07:02

still don't want to clobber my ~/.emacs.d folder

smnplk22:07:12

backup .emacs and emacs.d

dmich22:07:29

yea, maybe when I have more time to play with it.

iae22:07:09

So I'm a little overwehelmed right now; it comes with tons of packs and no explanation of how to use them. I suppose I either know them already or have to go into every package to figure out the essentials such as "eval this snippet" or "send to REPL" and "open lein project"

iae22:07:02

Is Clojure Mode a good plugin to start with to learn how to hack the emacs thing

iae22:07:08

Besides the official tutorial of course

johnmendonca22:07:47

@iae yeah i noticed that too when i tried spacemacs for a minute, a lot of non default config

johnmendonca22:07:21

someday when i'm ready to dive into emacs properly i will probably aim to build up a spacemacs/prelude type thing from scratch

akiva22:07:35

Don’t worry about learning it all at once. Just use helm a lot to see the keyboard commands.

iae22:07:04

@akiva: Do you mean M+x <command> and hope for the best?

samueldev22:07:08

so im using the

cljs-ajax
lib with clojurescript, and running
(type)
on the following request:
(GET "")

samueldev22:07:38

my js console outputs that the type of the above is "

goog.net.XhrIo(opt_xmlHttpFactory)
"

akiva22:07:56

@iae: not quite so cynically but Spacemacs is well documented on GitHub.

samueldev22:07:56

that basically means that I am outputting the type of the request object, right, not the type of the response?

akiva22:07:59

Right, you have to look into request object to get the actual response bits.

samueldev22:07:51

(def app-state
  (GET ""
    {:handler (fn [response] (.log js.console (type response)))}))

samueldev22:07:03

the type of the response logs out: persistentVector

samueldev22:07:14

and thusly (vector? response) evaluates to true

smnplk22:07:31

what i hate about emacs is all those 3 key strokes combos i have to do, in vim i usually did just 2

akiva22:07:44

@smnplk: And thus Spacemacs.

iae22:07:18

You sound very convinced 😄

smnplk22:07:35

heheh , true simple_smile Never thought of it this way lool, I thought they meant space as outer space..

akiva22:07:58

@samueldev: I’m used to using Liberator so I get back maps.

samueldev22:07:10

that is what im trying to get!!

samueldev22:07:27

instead i get this huge response object which is a vector containing a shit ton of bloat info that i dont need

samueldev22:07:36

and somewhere deeply nested inside is the actual collection i want

samueldev22:07:40

(JSON array from the server)

samueldev22:07:04

this is a cljs proj 😞

samueldev22:07:12

so no java interop libs for me

akiva22:07:59

Liberator’s not Java interop but I also don’t think it has CLJS libs.

iae22:07:14

@samueldev: How do you write that sweet, sweet logo? cljs

samueldev22:07:59

(colon) cljs(colon)

iae22:07:29

Beautiful!

iae22:07:27

Alright, my bedtime has arrived. Thanks for the help everyone! I'll keep hacking on emacs for the next few days to get a feel for it, but the whirldwind tour was great, a real demonstration of the variety and power simple_smile

iae22:07:32

And peaceful vim co-existence!

iae22:07:40

Who would've thought

smnplk22:07:18

goodnight @iae

samueldev23:07:19

given the following:

samueldev23:07:26

(defonce app-state
  (GET ""
    {:handler (fn [response]
                ; (js* "debugger;")
                response)
     :response-format :json
     :keywords? true}))

(defn project-view [project owner]
  (reify
    om/IRender
    (render [this]
      (dom/li nil (str (:name project) ", ")
        (dom/a #js {:href (:github-url project)} (:github-url project))))))

(defn projects-view [data owner]
  (reify
    om/IRender
    (render [this]
      (dom/div nil
        (dom/h2 nil "Project list")
        (apply dom/ul nil
          (om/build-all project-view data))))))

(om/root projects-view app-state {:target (. js/document (getElementById "app"))})

samueldev23:07:36

on the second-to-last line there

samueldev23:07:40

om/build-all

samueldev23:07:55

is saying [object Object] is not ISeqable

samueldev23:07:19

that essentially means that it needs to be in a format that Om can iterate over (a collection), and it is currently not?