Fork me on GitHub
#clojure-uk
<
2017-01-14
>
paulspencerwilliams08:01:00

@glenjamin Is that route on Strava? Can you share it?

paulspencerwilliams10:01:51

Bringing it back on topic... Too scratch an itch, I'd like to write a mobile app for tracking my fuel usage and mileage to understand TCO of my lease car. In particular, I'd like to take photos of my odometer, and fuel receipt, and OCR both to get mileage, and litres / cost of petrol to add to a db. It would be a good little side project for digging into React Native, but I'm wondering whether to try and embed OCR into the project or have a little microservice that does that aspect if it.. Any advice?

glenjamin11:01:36

a numeric keypad is almost certainly faster than OCR 😛

paulspencerwilliams11:01:57

Hehe, possibly so. Could always take photo and queue them for ocr / manually typing at more convenient time than sitting on forecourt with a car behind beeping to get on the pump ;-)

glenjamin11:01:55

I made a little web app for recording my expenses, considered doing OCR but instead i just attach a photo and punch in the info

glenjamin11:01:01

still only takes a few seconds

dominicm11:01:02

Does anybody else find it just painfully hard to write code outside of Clojure now?

glenjamin11:01:56

I find most of my non-clojure code takes on clojure-like aspects

paulspencerwilliams11:01:15

My day job is primarily using Spring. I do find in frustrating spending so much effort on incidental complexity. All the class definitions when maps would do the job etc.

paulspencerwilliams11:01:52

Saying that, I still find OO to work well in some situations and like Ruby for that. And i enjoy swift development.

paulspencerwilliams12:01:11

Afternoon just ;-)

dominicm12:01:41

I even miss the great primitives that Clojure has.

dominicm12:01:00

It's ok to mutate state in js and python, and I have to do weird crap like this

dominicm12:01:51

https://github.com/clojure-vim/async-clj-omni/blob/master/rplugin/python3/deoplete/sources/async_clj.py#L98-L104 You know what I really want? a promise. But python, in all it's many threading constructs. Doesn't have promises.

dominicm12:01:00

So I mutate state then set a lock, it's just... it feels gross

dominicm13:01:56

Early morning. Go back to sleep

agile_geek13:01:30

I've been up since 6 just haven't logged on to Slack

paulspencerwilliams13:01:22

@dominicm worse, I've maybe 6 times in the last week committed the following kinda code.

device = deviceRepository.save(device); 

paulspencerwilliams13:01:49

reassignment 🤢

dominicm13:01:13

I barf when I see:

(defn foo [x]
  (let [x (+ 1 x)]
    ...))

rickmoynihan13:01:56

got to say the above code doesn’t offend me. Will almost always try and use a threading macro or something else to avoid naming it… but sometimes there’s no other good name… and I’ve seen a lot of bugs due to people forgetting to return x2 instead of x

rickmoynihan13:01:27

definitely should try and avoid it… but I don’t think its universally bad, there's always a tradeoff.

rickmoynihan13:01:35

strictly speaking its also not reassignment, its shadowing 🙂

rickmoynihan13:01:30

Also I think if the first thing you have is a let bind and the first thing it does is shadow an argument, that’s ok… I think the problems happen when the shadowing is in the middle of a bunch of bindings.

agile_geek13:01:44

I try to avoid shadowing but not at the expense of good naming.

rickmoynihan13:01:22

an additional consideration is that the argument name is exported in the documentation… IIRC you might be able rename it in docs with :arglists metadata… but would be a bit of a faf

mattford14:01:53

hmmm - launching a clojure repl via cider in Emacs is super slow to initialise.

mattford14:01:02

Is that a known thing?

dominicm14:01:27

cider middleware is a bit slow, yup.

dominicm14:01:37

but, you do it once & forget

glenjamin19:01:10

i re-use names all the time in non-clojure when working with immutable functions

glenjamin19:01:29

lack of threading or pipe operators usually means it’s the neatest of the remaining options

seancorfield19:01:13

@dominicm: yeah, every now and then I have to go back and work on our legacy code base and I get so frustrated with the workflow (no REPL, side effects everywhere, ugly loops). Before Clojure I used to quite enjoy working on that dynamic OOP scripting stuff!

dominicm19:01:10

I always thought Python was cool. Now I know how lame it is.

paulspencerwilliams20:01:25

Oh, I forgot the lack of REPL. The inability to play with code when exploring apis is so hard.