Fork me on GitHub
#clojure
<
2015-09-02
>
jeffmk00:09:47

Ah looks like a nice light wrapper, I will check it out.

redbeardymcgee01:09:26

suddenly, i can' t make a new project with lein, while I've just done so an hour ago

redbeardymcgee01:09:13

I don't even know what I changed because I stopped to have a break and game a bit

redbeardymcgee01:09:52

could not locate clojure/data/priority_map__init.class or clojure/data/priority_map.clj on classpath

firthh01:09:47

have you made any changes to ~/.lein/profiles.clj ?

redbeardymcgee01:09:10

i don't think i did after my previous test, but i'm having a look

redbeardymcgee01:09:40

hm, i had a figwheel plugin in there. I don't think i meant to put it in there...

firthh01:09:36

you could try moving profiles.clj somewhere else and see if it's the cause of the issue

redbeardymcgee01:09:53

i commented the figwheel vector and it is fine now

redbeardymcgee01:09:29

thanks for the tip

firthh01:09:35

no problem

afhammad07:09:21

Where can i place database connection config that specifies per env config and is git ignorable?

rymndhng08:09:12

hmm, presumably you can gitignore whatever you wan t:)

rymndhng08:09:46

i like to use environ though — and when you load environ, it looks for an EDN file at .lein-env

pupeno09:09:30

I’m not very familiar with the JVM. How do I refer to a jar that is a dependency of my project when specifying it as a -javaagent in the command line? is this related to the CLASSPATH?

tsdh11:09:52

You can access the foo-bar field of a (deftype FooBar [foo-bar] ...) using both (.foo-bar my-foo-bar) and (.foo_bar my-foo-bar). The latter is proposed by CIDER's autocompletion (probably because that's the name of the corresponding field in the generated class). Is there any reason to prefer one over the other?

afhammad12:09:23

lein doc says that profiles.clj maps are recursively merged with those in project.clj but its actually overriding mine. https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md#merging

afhammad12:09:57

I have :profiles {:dev {:env {:y true}}} in project.clj and {:dev {:env {:x true}}} in profiles.clj, (env :x) is there but (env :y) returns nil in repl.

nberger12:09:18

It is explained in that leiningen doc as "Remember that if a profile with the same name is specified in multiple locations, only the profile with the highest "priority" is picked – no merging is done. The "priority" is – from highest to lowest –profiles.clj, project.clj, user-wide profiles, and finally system-wide profiles.". But that's missed many times, and the environ's readme doesn't help

afhammad12:09:38

hmm yeh i didnt see that part

pupeno14:09:12

According to https://github.com/technomancy/leiningen/blob/master/sample.project.clj, :bootclasspath true will place the agent jar on the bootstrap classpath, but this doesn’t seem to be happening and I’m not sure how to debug it. Where should this jar be present?

afhammad20:09:41

@martinklepsch: thanks! I actually ended up doing something similar.

cigitia21:09:07

Is there a way to get a null transducer that’s pithier or more idiomatic than (map identity)?

tcsavage21:09:06

just identity?

tcsavage21:09:17

I think that works...

akiva21:09:10

identity isn’t a tranducer.

tcsavage21:09:12

(sequence (comp (filter even?) identity (partition-all 3)) (range 20))

akiva21:09:13

It only takes one argument and simply returns that argument. A transducer works on a collection.

tcsavage21:09:49

No. A transducer is a function on reducing functions. It takes a reducer and returns a new reducer

tcsavage21:09:03

Identity fits the bill

akiva21:09:36

I can see where you’re coming from but I think that’s a bit too liberal of an interpretation.

akiva21:09:38

Also, I don’t think you can use identity without an input whereas that’s part of what makes a transducer a transducer.

tcsavage21:09:22

Not sure what you mean. Can you give an example?

akiva21:09:46

Actually, not presently. I’ve a Skype call in a couple of minutes. I’ll return after though.

tel21:09:23

if you’re supposed to compose transducers with (comp) then identity really ought to be the, well, identity

tel21:09:38

after all (= (comp) identity)

tcsavage22:09:39

Though actually looking into it, while I feel (map identity) should be equivalent to identity, there is something slightly funky going on inside map

tel22:09:20

a map that doesn’t have (= (map identity) identity) is simply not a map simple_smile

tel22:09:39

well, actually, it should be

tel22:09:52

(= #(map identity %) identity)

tel22:09:04

which probably resolves the funkiness too

tel22:09:20

because transducers have that short circuiting behavior

tcsavage22:09:38

The transducer returned by map builds a reducer supporting any number of inputs

tcsavage22:09:41

(apply f input inputs)

tcsavage22:09:58

which will blow up when f is identity and inputs is not empty

tcsavage22:09:17

but I don't know under what circumstances that is called

tcsavage22:09:24

Other than that, you can just plug identity into the definition of map and it obviously simplifies to identity on rf

rauh22:09:09

@cigitia: I think (map identity) is perfectly idiomatic. Though you could use completing or even identity (just like by itself) if you want

rauh22:09:27

(into [] completing [1 2 3]) ;; -> [1 2 3]

meow22:09:34

identity is not a transducer, and (map identity) is definitely pithy in my book 😉

rauh22:09:09

But the name completing could be slightly misleading. Though it is an identity transducer

meow22:09:16

the required shape of a transducer is described here: http://clojure.org/transducers

meow22:09:47

(fn [xf]
  (fn ([] ...)
      ([result] ...)
      ([result input] ...)))

tcsavage22:09:15

It uses identity by default so why isn't it a transducer?

tel22:09:15

pkobrien: how is identity not of that shape given that xf must be of the 0/1/2 arity shape itself?

meow22:09:28

(defn identity
  "Returns its argument."
  {:added "1.0"
   :static true}
  [x] x)

tcsavage22:09:45

A transducer takes a 0/1/2 arity reducer and returns a new one correct?

meow22:09:07

identity is odd

tcsavage22:09:30

Is this a valid transducer?

(fn
    ([] (rf))
    ([result] (rf result))
    ([result input] (rf result input)))

tcsavage22:09:03

(fn [rf]
  (fn
    ([] (rf))
    ([result] (rf result))
    ([result input] (rf result input))))

tcsavage22:09:13

forgot the outer function simple_smile

meow22:09:07

What's somewhat confusing is that there are transducers, and there are functions that return transducers

meow22:09:23

The shape of a transducer is

(fn ([] ...)
      ([result] ...)
      ([result input] ...))

meow22:09:35

botched formatting

rauh22:09:03

@tcsavage: Unless you care about specifially erroring on >2 arity, then this snippet is equal to (fn [rf] rf)

meow22:09:09

the shape I posted earlier is that of a function that returns a transducer

rauh22:09:30

But yes, it's a valid transducer

tcsavage22:09:36

@rauh so identity then?

rauh22:09:41

Yes! 😉

meow22:09:44

that having been said, identity works in some cases where a transducer is called for

tcsavage22:09:16

I don't see why it wouldn't work in every case though?

meow22:09:41

@rauh: got a quick example of 2-arity xf where identity would fail?

rauh22:09:04

It would work in every case. It just calls the reducer

meow22:09:15

simple stuff works and my brain is fried right now - long day

meow22:09:16

it isn't a transducer in some regards, yet works like one for all practical purposes, yes?

meow22:09:47

so (map identity) is overkill?

rauh22:09:03

Well, I guess we can call identity a transducer since it can be used as one

meow22:09:16

Very cool

meow22:09:38

@tcsavage: You were correct! :thumbsup:

tcsavage22:09:33

and quite frankly, if it weren't a transducer, both map and comp would be rather broken

meow22:09:05

@tel: you get a as well 😉

meow22:09:41

I finally got my L-system code to be transducer friendly today - big conceptual breakthrough for me - been struggling with how to leverage transducers with the darn things for days now. Old dogs, new tricks, gotta lose my OO habits, etc. simple_smile

rauh22:09:05

I saw it earlier. Looks cool

rauh22:09:21

Didn't have too much time though. Is there a demo somewhere?

tcsavage22:09:20

I'll have to check it out

meow22:09:27

@rauh: Thanks. Not much to demo at this point other than stuff like:

(comment
  (take 5 (fibonacci-sequence-basic))
  (take 5 (fibonacci-sequence-stochastic))
  (take 5 (generational-stochastic-sequence))
  )

rauh22:09:58

I see, don't know enough about these systems frankly

meow22:09:18

But I'm going to be working on turtle graphics using canvas with react and generating music via overtone

rauh22:09:47

Ha, that sound interesting

meow22:09:01

Easy way to produce fractals or simulate the growth/branching of plants

meow22:09:54

Just a simple rewriting system, but you can do a lot with it and I haven't seen any implementations that really knocked me out so I wrote one.

meow22:09:58

Like all my Clojure projects, I'm still learning a lot. But I feel like my code is getting better and is starting to come together quicker.

meow22:09:29

@rauh: You've certainly helped me a lot, especially with transducers, which I love.

rauh22:09:08

I'm glad you like them. I like them too a lot. They're fun. And yes, I did notice your improvements. Your code looks a lot better

rauh22:09:31

Are you doing clojure in your day job?

meow22:09:11

I'm semi-retired, so this is sort of my day job right now. simple_smile

akiva22:09:10

[Just a brief check-in] I wonder if we’re conflating a reducing function with a transducer. I think identity would qualify as the former but not the latter.

akiva22:09:52

A reducing function is the kind of function you'd pass to reduce… and A transducer (sometimes referred to as xform or xf) is a transformation from one reducing function to another. (http://clojure.org/transducers)

akiva22:09:11

I think ultimately it’s more an academic rather than practical discussion. Interesting, though.