Fork me on GitHub
#clojure-uk
<
2017-04-13
>
thomas07:04:32

mogge 😼

mccraigmccraig08:04:17

good morning ☔

Rachel Westmacott08:04:13

one of my favs today (by name at least) but also randomly picked:

clojure.core/lazy-cat
([& colls])
Macro
  Expands to code which yields a lazy sequence of the concatenation
  of the supplied colls.  Each coll expr is not evaluated until it is
  needed. 

  (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))

dominicm08:04:15

interesting… so is concat not lazy?

davesnowdon09:04:36

Good morning people

bronsa09:04:22

concat is lazy

bronsa09:04:49

(def a (concat (range) (range)))

bronsa09:04:05

it's not explicitely lazy but it preserves the laziness aspect of the underlying collections

bronsa09:04:34

lazy-cat is not that useful

bronsa09:04:37

IIRC lazy-cat was added to clojure before lazy-seq was a thing

bronsa09:04:54

then lazy-seq was added and lazy-cat was rewritten in terms of lazy-seq and kept in core to preserve backwards compatibility

bronsa09:04:11

I might be wrong but that's how I remember it happening

bronsa09:04:54

the reason why you would use lazy-cat instead of bare concat is on e.g. recursive definitions

bronsa09:04:37

(def foo (lazy-cat x (map f foo)) works, (def foo (concat x (map f foo))) doesn't because foo is still unbound

bronsa09:04:38

so while both lazy-cat and concat return lazy collections, lazy-cat has lazy evaluation semantics (by virtue of being a macro) while concat has strict evaluation semantics

Rachel Westmacott09:04:53

thus lazy-cat lets you write my favourite line of code: (def fibs (lazy-cat [0 1] (map + fibs (rest fibs))))

bronsa09:04:16

but it's hardly useful beside that line :)

mccraigmccraig11:04:20

mixed feelings when : you find a bug in your system of record, but can resolve it, at least temporarily, without writing any code

thomas14:04:10

@mccraigmccraig not writing code is (almost) always a good thing.

mccraigmccraig14:04:38

the not writing code bit was the good bit! that i managed to get a cassandra materialized view into a state where it randomly returned wrong answers was somewhat disturbing

glenjamin14:04:33

does anyone here have (or has had) an “environments manager” at their work? Any idea what they do or what they’re for?

thomas14:04:09

@glenjamin no idea what such a person would do... but sounds rather new-age.

glenjamin15:04:30

it’s on an old lift-and-shift programme of work for a bunch of waterfally IT systems

glenjamin15:04:34

so i suspect the opposite

mccraigmccraig15:04:45

build environments ? deployment environments ? is it an ops role ?

glenjamin15:04:42

from what i can tell it’s a project manager-type role for deciding who gets to do what on test environments

jonpither20:04:40

sounds useful

jonpither20:04:13

I was once on a project where our consultancy successfully billed a 'software configuration manager', someone who advised on SVN