Fork me on GitHub
#beginners
<
2017-08-24
>
coetry02:08:50

I can’t get garden in my repl

coetry02:08:09

I get this error:

#object[TypeError TypeError: goog.net.jsloader.load is not a function]
TypeError: goog.net.jsloader.load is not a function
    at adzerk.boot_reload.client.patch_goog_base_BANG_.goog.global.CLOSURE_IMPORT_SCRIPT ()
    at Object.goog.importScript_ ()
    at Object.goog.writeScripts_ ()
    at Object.goog.require [as require__] ()
    at Object.clojure.browser.repl.bootstrap.goog.require ()
    at eval (eval at <anonymous> (), <anonymous>:1:6)
    at 
    at 
    at cljs.core.MultiFn.G__12138__2 ()
    at cljs.core.MultiFn.G__12138 [as call] (

coetry02:08:25

when I require it like: (require '[garden.core :refer [css]])

coetry02:08:53

I have [garden “1.3.2”] in my build.boot file

phinneas04:08:40

I'm thinking of adding clojure to my repertoire of languages and was wondering if anyone had a good suggestion for beg/mid level project to. Hold.

akiroz04:08:15

@coetry hmm.... that doesn't look like a problem specific to garden, can you require other libraries in your repl?

seancorfield04:08:01

@akiroz We tracked it down to goog.net.jsloader.load being removed in the latest Google closure library but couldn't figure out what to do to the dependencies to make everything work together...

seancorfield04:08:30

(in the #boot channel if your interesting in my fumbling attempts to figure it out!)

seancorfield04:08:06

@phinneas Are you looking for an existing project to contribute to, or are you asking about what sort of projects to use to learn Clojure?

seancorfield04:08:33

I would say: work through Clojure for the Brave and True and then have a go at the Clojure Koans, and maybe some of the http://4clojure.com puzzles. Also Living Clojure (book) and then maybe Clojure Applied and/or the 3rd Ed of Programming Clojure (book, currently in beta).

cjhowe05:08:03

also http://codefights.com has some clojure challenges

emilaasa08:08:12

@phinneas I started out about 2 days ago and would enjoy teaming up for the struggle ahead

gdeer8115:08:27

@phinneas I'm trying to write a talk about learning clojure by doing fun things. since you're just learning for the sake of learning you might be a good case study for my talk. message me if you're interested

seancorfield16:08:40

@gdeer81 You should get together with @yogidevbear since he's writing a talk about learning Clojure too!

yogidevbear06:08:59

@gdeer81 I'd be happy to have a chat some time if you want 👍

gdeer8114:08:50

cool, if I survive this hurricane we'll definitely talk 😃

yogidevbear06:08:57

Wow, just seen the news. Good luck!

felipebarros06:08:58

I'm a beginner and a hard learner, so if you guys need someone to experiment on, just PM me. 🙂

chang09:08:24

@gdeer81 I'm also interested in this. Whatever learning experiment I'm down for it.

shrimpywu18:08:32

:profiles {:uberjar {:aot :all
                       :cljsbuild {:jar true
                                   :builds {:app {:compiler
Hi everyone, is there a way to add a customer build step right after "compiler" and before jar packing? In my case I would like to touch some of the output file after they are compiled.

noisesmith19:08:38

yes, you can set :uberjar {:prep-tasks [...]} - just remember to add “compile” and “javac” if you need them because you end up replacing the exiting list of steps

shrimpywu20:08:22

@U051SS2EU thank you! let me give it a try

noisesmith20:08:22

the output of lein help sample should have something about this if you scroll through it

shrimpywu20:08:36

doesn't seems so. I got not result from lein help sample | grep -i pre-tasks

noisesmith20:08:06

prep-tasks, not pre-tasks

shrimpywu20:08:25

ah.. my bad. i see it now!

shrimpywu21:08:42

https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L253 there is only a brief description, not actual sample. let me do some google search see if there is a sample how to use it to invoke some custom function or shell script. if you have a sample, that would be great 🙂

noisesmith21:08:44

the sample shows it

:prep-tasks [["protobuf" "compile"] "javac" "compile"]

noisesmith21:08:17

you can add shell commands via the lein-shell plugin

noisesmith21:08:56

to do arbitrary code, you’ll probably want to make a small lein plugin (there might be some hack for making project.clj load an run code from a namespace though)

shrimpywu21:08:08

maybe i am just too new to this. currently i have below task

:profiles {:uberjar {:aot :all
                       :cljsbuild {:jar true
                                   :builds {:app {:compiler
I was thinking i can update it to be something like this
some how define a task that do
{:aot :all
                       :cljsbuild {:jar true
                                   :builds {:app {:compiler

:profiles {:uberjar {:prep-tasks [ "above task", "my custom task"]}}

shrimpywu21:08:09

am I have wrong understanding how on "prep-tasks"

noisesmith21:08:09

what is “above task”

shrimpywu21:08:40

some how define a task that for
{:aot :all
                       :cljsbuild {:jar true
                                   :builds {:app {:compiler

noisesmith21:08:55

those are not actions, those are configs

noisesmith21:08:45

:profiles {:uberjar {:prep-tasks [["cljsbuild" "once" "app"] "compile"]}} invokes the tasks that use those configs

shrimpywu21:08:22

thanks for the detail explanation, so does it mean I will have to define "cljsbuild" somewhere before :profiles {:uberjar {:prep-tasks [["cljsbuild" "once" "app"] "compile"]}} like

:cljsbuild {: jar true
                 : builds {:app {: compiler ... }}}

:profiles {:uberjar {:prep-tasks [["cljsbuild" "once" "app"] "compile"]}}

noisesmith21:08:25

no - the prep tasks should all be valid lein commands

noisesmith21:08:36

the :cljsbuild key in your project defines config that the cljsbuild plugin uses, it doesn’t define the task itself or make it run

noisesmith21:08:17

unless by define you mean configure

shrimpywu22:08:12

i read more about it, seems like these are tasks before code compiling. What I want is i would like to do something after code is compiled

noisesmith22:08:18

compile is one of the steps

noisesmith22:08:21

you decide the order

noisesmith22:08:29

you can even leave compile out altogether if you want

shrimpywu22:08:09

but all the sample i saw from internet are have "compile" at the end like your sample :profiles {:uberjar {:prep-tasks [["cljsbuild" "once" "app"] "compile"]}} i don't see how can I modify the compiled file right after compile but before packing the jar. if you don't mind, can you create a sample project?

noisesmith23:08:32

if the thing you want done isn’t a lein plugin task, you need to either use lein-shell to launch a program that can do it, or make a plugin

noisesmith23:08:38

you would do this after “compile”

hmaurer19:08:04

Hi! I have a small problem on an app I am working on which I am not sure how to solve. Could someone experienced guide me through how they would approach it?

noisesmith19:08:31

sure, what’s going on?

hmaurer19:08:57

@U051SS2EU hi! I’ll try to explain it briefly:

hmaurer19:08:32

The outline is that I am taking a JSON payload through an API which I need to convert in a form suitable to be transacted to Datomic

hmaurer19:08:38

This involves the following steps:

hmaurer19:08:55

for every attribute in a list of namespaced attributes, e.g. :person/first-name, :person/last-name, :thing/id, extract the relevant field from the input JSON object (which you can assume is a map here). In the JSON object the field names are not namespaced, and are in camelCase

hmaurer19:08:06

so for example, for the 3 attributes aforementioned the payload would be:

hmaurer19:08:18

{firstName: ...., lastName: ...., id: ....}

hmaurer19:08:44

(you can assume the field names will never collide, even if they belong to different namespaces in clojure keywords)

hmaurer19:08:10

furthermore, I need to transform the values based on some properties linked to the namespaced attribute

hmaurer19:08:47

e.g., one of the namespaced attributes might be :person/address, which holds a reference (here, a Datomic ID) to an Address entity

noisesmith19:08:53

my approach would be to make a hash-map from the key that goes into the datomic object, to a function taking N args (including the namespaced keyword itself, and the json payload at least)

hmaurer19:08:18

basically, I need to do a sort of select-keys with a map step for each key

hmaurer19:08:44

ah, so each key would have a function which extracts its data?

noisesmith19:08:19

so then it’s trivial to create the data you need, given the list of keys wanted

hmaurer19:08:32

then you would (into {} (map (fn [k f] [k (f input)]) key-fns))?

hmaurer19:08:44

@U051SS2EU I have got an extra requirement: some keys may not be present in the input (e.g. for an “update” scenario), but I need to differentiate between a key that is not present and a key that is null

hmaurer19:08:57

right not if the key is not present I return a dummy :not-found value, which I filter after

hmaurer19:08:08

do you have a cleaner way to do this within the approach you suggested?

noisesmith19:08:44

you can make (find m k) one of the args

noisesmith19:08:56

find returns nil if not found, [k v] if k is found

hmaurer19:08:48

thank you!

hmaurer19:08:32

To be clear, I could solve it in “dumb” ways, but I feel there might be a clean approach which I am unaware of

hmaurer19:08:04

The task requires some explanation, which is why I am not dumping it here 🙂

shrimpywu23:08:01

Hi Experts, with Leiningen, can we pass clojure compiler options, e.g renamePrefixNamespace https://github.com/google/closure-compiler-js/blob/master/usage.txt