Fork me on GitHub
#clojure
<
2016-02-07
>
jethroksy01:02:06

@profil not sure what you mean, but you'd either had to use SSEs or send a separate request get new data anyway.

sonelliot02:02:12

Is there a non-blocking get all messages on channel function in core.async? Sort of like poll-all! or similar?

shayanjm03:02:06

Has anyone here worked on abstractions over regular expressions (or some other string matching mechanism)? Specifically looking to build some abstraction where non-technical users can build out filters that essentially “compile” to executable regexps

shayanjm03:02:13

in some capacity

jethroksy03:02:15

Clojure regex expressions are very similar to java's

jethroksy03:02:20

Less the escaping I think

jethroksy03:02:25

They are instances of java's regex but the literal to create one minimises the need for escaping, so you might need to do some editing after you created your regex with this

jethroksy03:02:47

@sonelliot I'm assuming your chan is buffered since you have items in them. Perhaps running seq on your buffer element would help: http://tgk.github.io/2013/10/inspect-core-async-channels.html

crocket03:02:34

Working with string is unsafe.

crocket03:02:55

People usually practice stringly typed programming even in haskell.

sonelliot05:02:02

@jethroksy thanks for the info. I'll give that a go!

adamkowalski07:02:11

what is the idiomatic way to perform updates to atoms if I have a map and I would like to change multiple key value pairs in one go

adamkowalski07:02:13

right now I am using #(swap! my-atom update-in [:key-i-want-to-modify] function-to-bring-about-modification )

adamkowalski07:02:34

but its seems like this only is pleasant for trivial updates

jaen07:02:28

@adamkowalski: didn't have need to try it yet, but take a look at this - https://github.com/nathanmarz/specter

adamkowalski10:02:40

@jaen thank you, this looks amazing

jaen10:02:34

Spoko ; d

kul15:02:48

any project on github using environ with boot?

reefersleep16:02:46

I want to get the result of calling (f (f (f x))), where the number of nestings is arbitrary. Something like (defn nested-calls [fn initial n] (last (take n (iterate fn initial)))). It seems to me like this is one of those things where there is most definitely a core function that does exactly this, which would be more idiomatic to call rather than to construct my made-up nested-calls fn, but I haven't come across it. Does anyone know if there is such an fn in Clojure core?

niwinz16:02:37

user=> (doc iterate)
-------------------------
clojure.core/iterate
([f x])
  Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effect

niwinz16:02:52

hmm, I'm wrong, you are already using iterate so I misunderstood your question

solicode16:02:15

@reefersleep: I’m not sure if there’s a single function in core that combines all those together. Though I might use nth in place of combining last and take.

reefersleep18:02:26

@niwinz: Yeah, I thought that maybe there is something "related" to iterate simple_smile

meow20:02:00

try into with a transducer if necessary

meow20:02:21

or this:

(defn produce
  "Returns a lazy sequence of colls from a recursive, axiomatic,
   transformative process."
  [seed prep-f get-xf]
  (letfn [(process
            [coll]
            (lazy-seq
              (when (seq coll)
                (let [new-coll (into (empty coll) (get-xf coll) (prep-f coll))]
                  (cons new-coll (process new-coll))))))]
    (process seed)))

reefersleep20:02:36

@hden: I am already using a loop/recur construct, but thought that it was a bit cumbersome. I've used loop/recur many times, and it has seemed cumbersome ever since the third time or so, because all I want to do it is to recur until a counter has reached zero. I'm thinking that

(loop [result coll
       counter counter]
  (if (zero? counter)
    result
    (let [new-result (... do stuff here)]
      (recur new-result
             (dec counter)))))
is really too much boilerplate to do that.

meow20:02:03

I don't like to use loop/recur.

reefersleep20:02:20

@solicode: Cheers for the tip, that is neater.

meow20:02:50

into is my goto swiss army knife for data transformation

reefersleep20:02:29

@meow: I haven't gotten into into yet simple_smile

meow20:02:04

produce is just a fully parameterized do everything function I wrote

reefersleep20:02:17

@meow: I'll have to have a look at your producewhen my brain's fueled up on sleep.

meow20:02:39

it is part of a library

reefersleep20:02:56

Could you give an example of your usage of produce?

meow20:02:21

Lots of examples in there using produce for cellular automata and Lindenmeyer Systems.

reefersleep20:02:02

damnit, that's what I was doing (creating a Lindenmeyer implementation)

meow20:02:12

steel my code

reefersleep20:02:16

Thought I was being quick on the draw simple_smile

meow20:02:29

make it better

reefersleep20:02:27

Contains functions I do not know yet... Again, when I've had sleep. simple_smile

reefersleep20:02:43

Looks lovely minimal.

reefersleep20:02:05

I was planning on exercising my implementation with quil too!

meow20:02:31

why damnit - my quil code sucks

meow20:02:43

never finished it

reefersleep20:02:54

thought I was being (somewhat) original

meow20:02:02

no time now - someone needs to take it over

meow20:02:22

plenty of space left to be original

meow20:02:39

I just laid the foundation

reefersleep20:02:51

Cool simple_smile I'll have a look at it all.

meow21:02:02

thank you

reefersleep21:02:30

Let me just push my latest changes, then you can see my impl - I think/hope it's simple enough to read through, even without documentation

reefersleep21:02:43

it's a mix of WIP code and code I think works, though

meow21:02:59

can't read code any more - not in that headspace any more

meow21:02:45

too much time multitasking multiple chat applications and working crazy hours

meow21:02:01

no focus

meow21:02:18

I am only reactive and proactive

meow21:02:43

I no longer write code

reefersleep21:02:45

What're you working with?

reefersleep21:02:01

Looked like you had a knack though!

meow21:02:37

#C0J20813K facebook Kik fetlife slack

meow21:02:21

and online roleplaying

meow21:02:37

and looking for moar

meow21:02:04

😎 <-- sadist shades

meow21:02:49

¯\(ツ)

meow21:02:54

all for Braid development

reefersleep21:02:59

Not sure I understood that. You don't develop Braid yourself?

reefersleep21:02:11

Think I read about it on the Clojure or ClojureScript subreddit

reefersleep21:02:24

Sounds like a good idea simple_smile

meow21:02:22

That's correct - I leave the code writing to others.

stig23:02:13

@moxaj: is that because the macro is expanded at compile time, but the binding happens at run time?

moxaj23:02:22

@stig nope, no macros involved here. Map returned a lazy sequence, and by the time it was evaluated, the binding was already gone

stig23:02:16

oh! I saw the \` and ~@ and thought “macro” without noticing the defn rather than defmacro :-O

moxaj23:02:43

@stig yeah, I'm messing with runtime code generation

moxaj23:02:34

@stig so now I have to decorate all my map calls with doalls 😞

stig23:02:39

Cool, TIL you could do that :-)

stig23:02:08

I thought and ~@` was macro specific until now

stig23:02:28

how are you supposed to mark up a single backtick on its own in markdown? :-)

moxaj23:02:19

that was supposed to work, I give up

moxaj23:02:03

markdownlivepreview lied to me

stig23:02:08

` works, but the extra line is a bit… much :-)

stig23:02:23

that’s seven backticks back to back.

moxaj23:02:20

discussing this here reminds me of https://xkcd.com/541/

meow23:02:22

is too funny