Fork me on GitHub
#clojure
<
2016-04-12
>
puhrez02:04:54

are there any really good articles to try and convince my CTO to let us (the data team) continue using clojure despite his stance that it will inhibit cross team functionality?

hiredman02:04:07

I am not entirely convinced that ctos respond to reason

hiredman03:04:46

I don't really know of anything sort of targeting that, depending on what he means by inhibiting cross teem functionality. if he means members of teams that aren't using clojure and don't know clojure won't be able to read your code, well that is kind of a fact

hiredman03:04:05

by cross team functionality he means services in language A won't interop well in services in language B, well that is the internet for you

puhrez03:04:15

What he means to say, primarily, is that given the LISP-syntax of clojure it will be too difficult to get people on it quickly.

puhrez03:04:25

so more the former which is true, but he’s trying to force scala upon us which from my experience has a much higher bootstrapping cost and is much more difficult to begin writing idiomatically. so it’s like ahhhh idk

hiredman03:04:26

let me guess, he knows scala and not clojure?

puhrez03:04:50

well he says he knows lisp and likes clojure

puhrez03:04:05

but its really a syntax thing...

stewsquared03:04:08

Huh? I was expecting he'd blame dynamic typing. I'd say scala syntax is more inhibiting.

stewsquared03:04:54

This from someone who's in the middle of onboarding Scala developers.

mpenet06:04:49

Scala give you lots of bullets to shoot yourself in the foot when you're starting imho. many ways/styles to achieve the same task. You can get up to speed and write horrible code quickly yes but I am not sure that count as a +. Clojure on the other hand has a much simpler core and concepts.

mpenet06:04:18

As for recruiting I am not sure that's true anymore. Then again there are more Scala dev on the market for sure, but that doesn't necessarly mean it ll be easier to find good devs.

borkdude07:04:48

Maybe this is more suited for #C0KL616MN 😇 ? 😉

jumar08:04:03

@puhrez Probably not exactly what you want, but I find following talk quite interesting: https://www.youtube.com/watch?v=BsLiPt90HDo&amp;list=PLZdCLR02grLrl5ie970A24kvti21hGiOf&amp;index=19

hiredman09:04:11

that reminds me, https://www.youtube.com/watch?v=VSdnJDO-xdg is a nice video which rich discussing the value of clojure

jindrichm11:04:13

What is the best way to convert LinkedHashMap with nested ArrayLists, Strings, and other LinkedHashMaps into Clojure data structures? Since into {} is shallow, I presume something from clojure.walk?

Lambda/Sierra12:04:12

clojure.walk only works on Clojure data structures. If you have Java data structures, you'll need to write your own recursive code to transform them.

jindrichm12:04:05

Ah, thanks for clarification.

virmundi12:04:40

hello. is this the place to inquire about compojure-api related questions?

leov16:04:17

@bostonaholic thanks, I'll have a look

base69818:04:21

I have this code composition issue: I have a stream, of points: [:a ["1", 10]] [:a ["4", 40]] [:b ["2" 100]]. I need to interpolate points of like keys. So :a and 😛 will be interpolated and new points added for "2" and "3". Also in the case of 😛 it extrapolates to "1". The function I have to do it handles it all as one operation, but I think it would be cleaner to do an extrapolate map, and an interpolate map, then the reduce separately. I'm having trouble thinking of a way to save the metadata I need to perform the interpolate/extrapolate. Essentially I'd have a map in the metadata for key :a, saying it's starting point was "1" and had a value of 10. Seems like a common pattern I'm missing or just too brain dead to think of

base69818:04:40

the 😛 is supposed to e \:\b

pbostrom20:04:08

I found myself about to implement deep-merge and I decided to google it. Do y'all usually just copy and paste one of the implementations listed? http://dev.clojure.org/jira/browse/CLJ-1468

symbit20:04:09

@pbostrom: I'm using a found deep merge function in prod.

pbostrom20:04:50

yeah, I think I'm going to use this one: https://github.com/puppetlabs/clj-kitchensink/blob/cfea4a16e4d2e15a2d391131a163b4eeb60d872e/src/puppetlabs/kitchensink/core.clj#L311-L332 my naive implementation was actually not that deep, it only handled 2 levels

symbit21:04:10

@pbostrom Those functions looks familiar.

vincentdm21:04:05

Does anyone know if/how I can call another lein task from within the code of my own lein plugin? (besides delegating it to a shell)

vincentdm21:04:55

In this concrete case: I want to execute lein cljsbuild ... from within my code

altuzar21:04:45

Hi! I’m having a hard time passing a little Ruby function to Clojure (it’s for a little test I did). I was able to do it in Ruby no much trouble, I'm a Rails guy, but I don’t understand almost nothing of Clojure as I only did some little things with Clojure some years ago. Is a little function to print an array of strings (and nested arrays of strings) with a each index.

altuzar21:04:20

For example, if you have this array: list = ['a stringy', ['y','e','s'], 'cheese', ['tomato']] and you call the function printList (let’s call it that way) like this printList('Goo', list), you would get the following output: Goo.0: a stringy \n Goo.1.0: y \n Goo.1.1 : e etc

altuzar21:04:54

I pasted in http://Repl.it if you want to see my little Ruby solution: https://repl.it/CEt1/0

altuzar21:04:25

Imagine you can do that little function in 2 minutes, just iterate each with index and print if its a string, or call itself recursively if not. However, to pass that to Clojure no idea, I took the FizzBuzz code for Clojure from Rosetta code but can´t understand it, it’s like backwards haha. Anyone could guide me a bit? 😁

altuzar21:04:16

So to declare the list or array, I figured out it's like this: (def List ["a stringy", ["y","e","s"], "cheese", ["tomato"]])

altuzar22:04:00

In my printList I only have this 😛

altuzar22:04:07

(defn printList [str arr]
  (map-indexed vector arr))

altuzar22:04:21

But the output expected after calling (printList "Goo" List) is:

altuzar22:04:45

Goo.0:  a stringy
Goo.1.0: y
Goo.1.1 : e
Goo.1.2: s
Goo.2: cheese
Goo.3.0: tomato

hiredman22:04:14

no it isn't

hiredman22:04:52

your 'printList' (which doesn't print anything) returns a sequence of vectors

altuzar22:04:23

yeah I know =( that's what I want to solve hehe

hiredman22:04:04

there are a number of beginning clojure guides, tutorials, and books (free and otherwise), you can find them in google

altuzar22:04:12

but don´t know how to make the loop recur and check each item to see if it´s a string or not, and call itself if it´s not

altuzar22:04:34

well I learn better trying to do things hehe

hiredman22:04:39

sure, but starting at 0 you won't get very far poking at things yourself, if you go with some learning resource you will bootstrap faster and more effectively

altuzar22:04:31

I understand your point, but all I want is to pass this Ruby code to Clojure today 😩

altuzar22:04:40

def printList(str, arr)
  arr.each_with_index do |val,index| 
    if val.is_a? String 
      puts "#{str}.#{index}: #{val}"
    else
      printList("#{str}.#{index}", val)
    end
  end
end

altuzar22:04:04

I was looking the FizzBuzz code and looks quite similar

altuzar22:04:44

This one is giving me a StackOverflowError hehe:

altuzar22:04:59

(defn printList [str arr] 
  (map (fn [n]
	(cond
		(string? n) "String"
		:else (printList "Goo" n)))
	(map-indexed vector arr)))

altuzar22:04:25

Imagine is something with the loop

lwhorton22:04:49

is there syntax for multiple function signatures that just do the same thing?

lwhorton22:04:23

(defn 
  [a b c]
  [a b]
  (log a))
for example?

jr22:04:48

(defn foo [a &]
  (log a))

lwhorton22:04:38

i guess its a bit tricker than that, conditionally applying the last arg if provided - but that’s a different question

lwhorton22:04:45

(apply fn a b (when c c))?

jr23:04:12

the last arg needs to be a seq

hiredman23:04:19

nil will work fine

mahinshaw23:04:22

(defn foo
 ([a b c] (log a))
 ([a b] (foo a b “stuff”)))

hiredman23:04:36

(which is what when returns when not)

lwhorton23:04:34

cool, thanks guys

lwhorton23:04:59

I never can get apply right - maybe I just think about it wrong… almost always easier to work around it with let blocks

cky23:04:47

@lwhorton: apply is like splatting in Ruby or Python. Obviously only sequences can be splatted.