Fork me on GitHub
#clojure-uk
<
2019-06-26
>
otfrom07:06:53

I'm not sure if @cbrfereday is here or not

Ben Hammond07:06:49

Charlotte's back in Londonshire nowadays

Ben Hammond07:06:06

Nick Ogden is still based in Glasgow I think

Ben Hammond07:06:01

https://previ.se/ also has at least one clojure guy working out of Glasgow

jasonbell07:06:20

Morning, or should I say “Eeh Ohhh”

acron09:06:13

Morning

👏 4
Ben Hammond10:06:38

if I want to drop the first element of a vector is (comp vec next) my best option?

Ben Hammond10:06:57

pop seems promising, but works on the wrong end

Ben Hammond10:06:12

#(dissoc % 0) didn't work disappointingly

bronsa10:06:05

#(subvec % 1) if you don't care about keeping the first element in memory

Ben Hammond10:06:33

ah perfick. thank you

samoleary10:06:01

would (drop 1 %) be appropriate? returns a lazy seq

acron10:06:37

rest too, but returns seq

jasonbell11:06:32

Just done my ClojureX proposal…. have you done yours? https://docs.google.com/forms/d/e/1FAIpQLSfVgdajHWMYOGh02jXRt02-Px54dnPHjeZP1PrF89D2yJGllA/viewform Just call me #ClickbaitJase 🙂

❤️ 4
djtango11:06:28

performance considerations of (subvec ...) vs (drop ...) are different quite IIRC - I think subvec was constant time operation

bronsa12:06:56

both are constant time for n=1 (true that drop is linear!, but in this case it wouldn't matter), although drop has a slightly larger constant factor -- but the important thing is the data structure they return: subvec returns a vector while drop returns a seq, operation on those have highly different time complexities

djtango13:06:51

good point

djtango11:06:03

though bronsa is correct to point out that subvec holds the original vector in memory

practicalli-johnny12:06:39

I like testing out function performance with time or even better https://github.com/hugoduncan/criterium and then investigate why (time permitting)

jasonbell12:06:00

Different Hugo to the one I know.

Ben Hammond12:06:52

are you sure he's not called Duncan Hugo?

bronsa12:06:56

both are constant time for n=1 (true that drop is linear!, but in this case it wouldn't matter), although drop has a slightly larger constant factor -- but the important thing is the data structure they return: subvec returns a vector while drop returns a seq, operation on those have highly different time complexities

Ben Hammond12:06:56

oh he looks like the grandfather in 'Derry Girls'

Ben Hammond12:06:15

I assume that's an underlying theme that I completely missed

jasonbell12:06:12

Nah different chap in Derry Girls

otfrom13:06:43

the grandad in Derry Girls is Ser Barristan Selmy from GoT

dharrigan14:06:04

You know, I've been a happier since I disabled my parinfer, doing it by hand seems to suit me better 🙂

dharrigan14:06:18

Sorry, was that on topic? 🙂

otfrom14:06:31

I have to admit that I'm a bit confused by parinfer.

otfrom14:06:24

is the "re-arranges the parens when you change the whitespace" doing lisp in a python like fashion?

dharrigan15:06:56

Yes, it magically arranges the parens for you

dharrigan15:06:07

TBH, it just got in the way

dharrigan15:06:15

most of the time it worked

👍 4
alexlynham15:06:03

what’s wrong with paredit?

alexlynham15:06:27

(not trolling, just trying to understand what the use case for parinfer is)

dharrigan15:06:43

It's backed by science 🙂

Ben Hammond15:06:02

I found parinfer caused quite alot of bugs

Ben Hammond15:06:23

and consumed more time than I though it was worth

mccraigmccraig15:06:55

i tried parinfer once and didn't like it

alexlynham15:06:08

this seems like lots of maths and faff for an academic exercise when structural editing just works:tm:

Ben Hammond15:06:09

its a cool idea

Ben Hammond15:06:19

but didn't work for me

mccraigmccraig15:06:23

neither paredit nor smartparens have ever given me any hassle

☝️ 4
alexlynham15:06:47

your scientists spent so long wondering whether they could, they never stopped to consider whether they should

Ben Hammond15:06:23

parinfer does have a lower barrier to entry than paredit

alexlynham15:06:02

idk I taught it to our apprentice in an hour flat on monday

alexlynham15:06:56

after six weeks of wax on wax off with visually balancing parens though I guess anything was a step up and worth grokking 😂

alexlynham15:06:22

but yes you’re probs right @ben.hammond

Ben Hammond15:06:26

how do you feel about rainbow parens?

Ben Hammond15:06:32

(I find them distracting)

alexlynham15:06:36

love ’em, used to hate ’em

mccraigmccraig15:06:44

call me a minimalist, but i don't really want anything more than slurp, barf, kill-sexp, forward-sexp, backward-sexp

8
alexlynham15:06:59

I found that I needed a more obnoxious colour scheme so that they blend in, @otfrom can confirm

Ben Hammond15:06:01

wouldn't want to be without split

dharrigan15:06:09

I do like my rainbow parens

dharrigan15:06:19

it's my bling

otfrom15:06:24

I love everything about @alex.lynham's colour scheme except the bright pink the the org-tables 😉

otfrom15:06:10

if I decide to do a pull request for that would you accept it? 😉

alexlynham15:06:41

probably, I don’t use org as much as you do (and I like the pink!) - but I can see what you mean, it should probably be an accent and not one of the main bits…

alexlynham15:06:56

trying to picture in my head what it looks like - got a screenshot?

Ben Hammond16:06:49

oooh wasn't there a BBC (micro) mode for that

alexlynham16:06:05

that needs to be inverted I reckon

alexlynham16:06:30

background colour as per main (or the light blue accent) and then pink for the text 😛

alexlynham16:06:42

my mistake, the org bit hasn’t had as much love

alexlynham16:06:46

put in a PR!

otfrom16:06:13

will do. 🙂

otfrom15:06:48

I like a combo of paredit and aggressive indent (so I get the white space clues, but I use the parens to move around the whitespace)

mccraigmccraig15:06:06

i like rainbow-parents

Ben Hammond15:06:16

does everyone have a different indent

Ben Hammond15:06:28

and a tug-of-love every time they edit a file

otfrom15:06:29

I like rainbow-parents too. Esp during pride month

mccraigmccraig15:06:32

i don't like aggressive-indent, it messes up git commits in a team

otfrom15:06:05

If you are going to use aggressive indent it does need to match with your coding standards

otfrom15:06:12

then it shouldn't mess up the git commits

Ben Hammond15:06:30

can't you get your git setup to change the whitespace

Ben Hammond15:06:56

I've never bothered, but I vaguely remember that it is possible

mccraigmccraig15:06:03

@otfrom can you get the exact same indent config across different editors ?

otfrom15:06:06

yeah, you can use a formatter (or have it as a part of your pipeline). I would want my emacs indentation to match whatever the formatter was going to do

otfrom15:06:45

@mccraigmccraig possibly not the same config (as it wouldn't be in elisp), but I would have thought roughly the same values (as it is all about the spaces unless you are some sort of tab using monster)

alexlynham15:06:58

on a different team we had a git pre hook that linted so even if your editor moved stuff around it was linted pre push

otfrom15:06:27

linted or formatted?

alexlynham15:06:27

that worked p well across like 4-5 diff editors and 8 devs

otfrom15:06:33

using something like cljformat?

mccraigmccraig15:06:42

can you do that on GH @alex.lynham ?

alexlynham15:06:48

linted and formatted, sorry

alexlynham15:06:00

nah it was a git hook that ran a cli utility

alexlynham15:06:17

was a node and python project though, so easier to have opinions in some ways

alexlynham15:06:32

lisp weenies are unique ❄️s

otfrom15:06:59

cljformat is pretty good and emacs clojure mode should follow it IIRC

alexlynham15:06:42

it’s one of those things where atm my formatter is paredit so I’m happy for it to get outsourced to a tool as long as the config isn’t mentalllll

dharrigan16:06:04

I use clj-format now and again, but I find that my vim plugins do a good job of keeping everything formatted correctly

otfrom16:06:43

yeah, clj-format and clojure-mode should produce the same indentation (or at least that is the intention IIUC)

seancorfield16:06:52

I don't view parinfer/paredit as an either/or situation -- I have both installed in Atom. I like paredit for explicit structural editing and I like parinfer for general code writing and when I'm move blocks of code around. I agree that parinfer sometimes does the wrong thing tho'...

Edward Hughes22:06:06

For what it's worth, that strikes me as an expression of the core LISP philosophy. The language should support the tools (or their construction) best fit to the problem at hand, and you shouldn't feel pigeonholed by your tech.

mccraigmccraig17:06:39

maybe i'm missing the point @seancorfield - what does parinfer do for you that isn't structural editing ?

seancorfield17:06:18

Because it re-structures the code as you indent/undent it -- which I find useful.

seancorfield17:06:02

I can copy'n'paste a block of lines and then move it right/left into the right place, and all the parens are taken care of.

seancorfield17:06:55

I do both -- structural editing and "regular" cut'n'paste/copy'n'paste -- which makes it less of a transition as I work across different types of files. If I was only ever editing "Lisp", I'd probably stick to more structural editing.

thomas17:06:00

I use Atom as well with parinfer and I like it... and yes, sometimes it gets things wrong... but then again... so do I.

mccraigmccraig17:06:33

ah, ok - i generally have smartparens and strict-mode in emacs, kill will only ever kill a sexp and if you select a region which isn't a whole sexp and try and kill it you get an error

mccraigmccraig17:06:06

so you use the same kill/yank ops you use in non-lisp buffers, but they magically never mess up your lisp

Edward Hughes22:06:06

For what it's worth, that strikes me as an expression of the core LISP philosophy. The language should support the tools (or their construction) best fit to the problem at hand, and you shouldn't feel pigeonholed by your tech.