#clojure log - Aug 12 2013

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:05 xeqi: blr: you could use standard ring sessions, or perhaps stateful sessions from lib-noir

0:08 BufferUnderpants: Alright, so I have this multimethod in Clojurescript...

0:09 blr: xeqi: ok, any caveats with ring sessions - would that be appropriate for storing an 150-200k deserialised document?

0:09 BufferUnderpants: And I'm trying to dispatch on type

0:10 How do I do it for a string?

0:10 The compiler is ominously outputting "WARNING: Use of undeclared Var my.namespace/String"

0:16 xeqi: blr: heh, that wouldn't work for a cookie store. might work for a memory store, but I don't know when sessions are cleaned up

0:16 blr: so I will probably need to use something like ring-jdbc-session and h2

0:17 xeqi: blr: or just save it in a db normally, and store an id to it in the session

0:17 blr: xeqi: I'm not legally allowed to persist this data

0:18 xeqi: :/

0:18 brehaut: hi blr

0:18 blr: so effectively I only want it to live as long as the api client's session

0:18 hey brehaut :)

0:18 brehaut: blr: i havent looked at the scroll back in detail, but memcached?

0:19 or is that still to persisted

0:19 blr: sure that would work actually

0:20 brehaut: blr: are you using some clojure at your place of employment?

0:21 blr: thinking about it :)

0:21 brehaut: nice :)

0:21 blr: have you used spyglass brehaut? api looks nice enough

0:21 brehaut: i havent even heard of it

0:21 link?

0:21 clojurebot: unlink: and constantly is just a function that takes any arguments and returns whatever argument is given

0:21 blr: http://clojurememcached.info/articles/getting_started.html

0:22 brehaut: huh

0:24 blr: that looks pretty straight forward

0:24 blr: yeah, I think I'll give that a shot, thanks

0:24 brehaut: blr: nice that connections arent dynamically bound

0:25 and the clojurewerkz guys seem to do decent librarys

0:33 callen: brehaut: more importantly, documentation

0:34 blr: yes, we like documentation

0:43 dnolen: BufferUnderpants: js/String

0:44 BufferUnderpants: you can't refer to global things outside of CLJS without js/foo

2:00 xsyn: Hi all

2:00 what's the best way to run a jetty app in production?

2:00 behind nginx?

2:55 papyrus: hi

2:56 www.clojure.org is dead. why ?

2:56 i want to get information about clojure , but i can't.

2:59 katratxo: papyrus: try without the www

2:59 papyrus: no. it does not work.

3:00 Foxboron: works here.

3:00 jack_rabbit: papyrus, it's fine here.

3:00 katratxo: papyrus: it works for me

3:00 papyrus: i am in korea.

3:00 jack_rabbit: papyrus, try a different DNS server.

3:00 And clear your DNS cache.

3:01 callen: papyrus: and

3:01 papyrus: thanks.

3:01 i will try.

3:02 supersym: or opendns if you care about security/privacy a bit more ;0

3:02 screw up a smiley how typical monday morning

3:03 mornin'

3:04 jack_rabbit: supersym, looks like a monday morning smiley.

3:04 ;0

3:04 ^What I look like on Monday morning.

3:05 morrifeldman: Is it possible to get 'lein test' to run in color?

3:10 supersym: lol

3:11 morrifeldman: I doubt its built in natively but you could use something like https://github.com/ams-clj/clansi

3:17 morrifeldman: supersym: Thanks! clansi looks pretty cool.

3:48 H4ns: another beginner question: having a map {:a {:x 1} :b {:x 2}}, what, is the canonical way to retrieve a sequence of all values of :x (=> [1 2] here)?

3:50 TEttinger: ,(map $(:x (val %)) {:a {:x 1} :b {:x 2}})

3:50 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: $ in this context, compiling:(NO_SOURCE_PATH:0:0)>

3:50 TEttinger: ,(map #(:x (val %)) {:a {:x 1} :b {:x 2}})

3:50 clojurebot: (1 2)

3:50 TEttinger: that's a pretty terse example

3:50 H4ns: nice, thanks!

3:51 TEttinger: if you wanted more self-explanatory, H4ns, there's ##(map (fn [kv] (:x (val kv))) {:a {:x 1} :b {:x 2}})

3:51 lazybot: ⇒ (1 2)

3:52 TEttinger: mapping over a hashmap has each call go over both the key and the value as one thing, a MapEntry (called kv here, for key-value)

3:52 H4ns: TEttinger: #(...) is "equivalent" to (fn [%] ...), is that right?

3:52 TEttinger: yes

3:52 H4ns: i like that, thanks!

3:53 TEttinger: and it works with ,(#(+ %1 %2 %3) 5 7 9)

3:53 ,(#(+ %1 %2 %3) 5 7 9)

3:53 clojurebot: 21

3:53 H4ns: i like terse. when i want verbose, i can always return to common lisp :)

3:53 TEttinger: you can have a lot of arguments I think, not sure what the max is but you usually only need one or two

3:54 % is the same as %1

3:55 H4ns: TEttinger: thanks again! i can go for here. i'll probably ask some more beginner level questions until someone gets annoyed and tells me.

3:56 TEttinger: haha

3:56 `google 4clojure

3:56 &google 4clojure

3:56 lazybot: java.lang.RuntimeException: Unable to resolve symbol: google in this context

3:56 TEttinger: I don't know what the bots have for syntax

3:56 4clojure is great

3:57 simple-seeming clojure problems for beginners, and as you get better they get harder

3:58 H4ns: TEttinger: nice. putting that onto my list of things to do.

4:10 supersym: H4ns: I've found using LightTable (instarepl) quite useful as well, to learn clojure/syntax, since it visually remains (intermediate) values next to the expressions. The eval-as-you-type may be a bit annoying though :P

5:03 callen: I didn't have fantastic luck with LightTable, although it's nifty and I get the appeal of it.

5:03 I'm actually still looking for a good solution to debugging in Clojure. The only thing really saving me is that Clojure code doesn't really commend the use of a debugger quite like a language that relies heavily on stateful mutation does.

5:04 Foxboron: shoudl write a stacktrace parser

5:04 should*

5:06 talios: IntelliJ's LaClojure has a responably good(ish) debug story the last I looked at it

5:06 depending on your code I guess :)

5:07 supersym: callen: I get that... and admittingly, it (lt) does also hide/obfuscate some reader stuff from plain sight

5:07 ro_st: have you guys tried ritz?

5:08 hugod gave a comprehensive demo of it at ClojureWest

5:08 not sure if the vid is up yet

5:08 supersym: also typos become costly in time so you need to ns-unmap stuff or restart the JVM because your typo'd variables are in memory too :D

5:08 ro_st: nop

5:08 clojurebot: Titim gan éirí ort.

5:08 supersym: lol wut?

5:08 silly bot

5:09 benedikt: How do i get the ip adress of the connecting client in clojure.contrib/socket-server?

5:09 callen: supersym: I'm an emacs user so I don't really *NEED* LightTable, I just recommend it to people who are a little green and just want to tinker with some Clojure.

5:09 I really just want a nice debugger for Clojure.

5:17 benedikt: and what is is the backlog parameter?

5:19 mercwithamouth: is anyone using light table on serious projects yet? I'm still a green clojure developer but so far i like it, at the very least the instarepl tool

5:19 benedikt: nevermind, that was straight from java (saw when i looked at the source)

5:20 ro_st: mercwithamouth: you might want to look at nightcode.info too

5:21 mercwithamouth: ro_st: =P not bad

5:21 i was going to say...one of the things that made me attempt clojure was the repl in the android store. do they plan on making either of these tools available on tablets? Not necessarily important but it would be cool

5:22 ro_st: i'm sure there are folks hard at work making clojure wholly available on android

5:23 mercwithamouth: Nice...

5:24 paomian: who use compjure

5:24 ro_st: lots of us!

5:24 compojure, anyway

5:25 paomian: I can not understand it

5:26 callen: mercwithamouth: I'm pretty sure ibdknox is using LightTable while making LightTable.

5:26 that's probably how he knows what to improve.

5:26 mercwithamouth: callen: very true...i have to say so far the user experience isn't bad at all

5:26 callen: it could fairly be called a non-trivial project, but ultimately the IDE/editor you use...really isn't important.

5:28 using Node webkit on his part was a pretty clever coup for solving the "cross-platform app" problem without making something ugly like a Swing app.

5:29 mercwithamouth: callen: now that i agree on. i talked to him briefly when i first peeked at clojure and this chatroom

5:30 Okasu: supersym: "You fall without rising." -- bot said.

5:32 callen: What do you use now as debugger for clojure? Ritz? It becames annoying quickly once you enable break-on-exception thing, but breakpoints doesn't work without it. :/

5:34 callen: yep, I tried nrepl-ritz and limit-break.

5:34 both are broken in their special snowflake ways, making both essentially useless.

5:34 I sincerely hope I never write code that truly *requires* a debugger in Clojure, because on that day, I will be fucked.

5:35 Okasu: callen: Ha-ha, true that.

5:35 ro_st: +1. write code that doesn't need debugging.

5:35 not always possible, but doable a lot more than you'd otherwise think!

5:35 callen: er, yeah.

5:36 I've definitely run into plenty of code that requires it and it's totally unavoidable.

5:36 not but two weeks ago, I wrote a function that traversed the entire heap of its own process and used mem locations and type tags to track something down.

5:36 in Python, that is.

5:36 ro_st: of course. i guess it depends entirely on what sort of thing you're doing

5:36 if you're writing device drivers, you're going to need a debugger. a rest service, notosomuch :-)

5:37 callen: you'd think so, but when you're using hairy frameworks like Django...

5:38 with LazyRefs and the like skulking about...

5:38 ro_st: ah, i'm talking about with Clojure

5:39 callen: oh sure.

5:39 ro_st: all bets are off when it comes to using sOOp

5:40 sOOP

5:45 Apage43: and.. yeah

5:46 my project now has a tiny embedded expression language

5:48 instaparse made that easier than I expected

5:57 ro_st: nice Apage43

6:07 H4ns: is clojure.tools.trace the recommended way to trace?

6:10 noncom: if i want to have a record with mutable fields, do i simply make the fields atoms or agents?

6:11 Apage43: if you *really* need to, why not just put the record in an atom?

6:13 noncom: Apage43: my task is to simulate a big particles system. While in Java it would do with simple class and its instances, in Clojure I am still looking for a solution. For the needs of simulation I need the fastest way with the least footprint..

6:13 Apage43: do your particles affect each other?

6:13 noncom: so i think that a whole record in the atom will have a bigger footprint (esp. when scaled up to 1000000 record instances)

6:13 H4ns: when i added a new depencency to my lein project, can i fetch and load it without restarting my jvm?

6:14 Apage43: actually regardless of that

6:14 noncom: Apage43: yes, in general case particles must be able to interact with each other

6:14 ro_st: H4ns: look at github.com/cemerick/pomegranate

6:14 noncom: this is probably one of the times it's probably best not to use immutable datastructures

6:14 Apage43: i'd put the whole particle system in an atom

6:15 ro_st: for performance reasons. if you do want to, though, an atom which gets updated once per 'frame' of computation

6:15 H4ns: ro_st: thanks

6:15 Apage43: right. So the renderer can (deref) the one atom that holds the whole system

6:15 ro_st: with the whole world in it. otherwise you're looking at the bazooka of mutation, STM with refs

6:15 Apage43: and has a snapshot it can work off of to draw with

6:15 ro_st: yes

6:16 noncom: well, yes, i definitely not need immutability in this very place of the system

6:16 if only clojure would let to jump away into the mutable world for in-place computations...

6:16 sigh.

6:16 Apage43: transient/persistent!

6:16 ro_st: noncom: nothing stopping you from doing that

6:16 Apage43: or just use java types

6:17 noncom: yes, here goes java.. transients are great, but not for cases like this one. If i am to use transients, then why not to fall back to raw nio buffers..

6:17 ro_st: there's nothing wrong with -local- mutation

6:18 noncom: i could store all the system i a couple of big nio buffers

6:18 Apage43: transient/persistent! are still useful, for the reason I mentioned aboe

6:18 noncom: ro_st: nothing wrong, except for that it is rather cumbersome in comparison to java's i = i++

6:18 omg i just wrote shit

6:19 but never the less, int a = 5; int b = a + 1; ... whats faster?

6:19 Apage43: you use transient/persistent! in your updating, and then your renderer can still take a snapshot of the system it knows won't get mutated under it

6:20 noncom: so ok, should i store the records in transient structures?

6:20 or only coordinates?

6:20 what about boxing/unboxing for numbers?

6:20 Apage43: no, you just write the update function you'd normally write if you weren't using transients

6:20 then .. hm

6:20 hard to explain transients

6:21 noncom: i know what they are..

6:21 but i am not accustomed with patterns of their use

6:21 Apage43: transients really shouldn't leave the function they're created in, typically

6:22 noncom: so a particle that has x, y and z coordinates

6:22 ro_st: noncom: i'd suggest solving your problem 'in the slow' with idiomatic clojure, and then bringing in defrecord / transients etc to improve the performance

6:22 noncom: i have the slow solution already, so it is the time

6:22 ro_st: and using a good old atom to store your world in from calc-step to calc-step

6:23 noncom: for me it came out that using a {} of atoms is faster than using an atom of {}

6:23 ro_st: ok. then you're in research land to find how defrecord, transients, or coding against java colls directly will help you

6:23 noncom: ro_st: yeah, that's what i was feeling like for the past couple of days...

6:24 still, tell me, would you work with all the records in a transient way or simpy work with a [] of x y z inside each record transiently

6:24 ?

6:26 ro_st: to be perfectly honest, i don't know. i've never used records or transients before

6:27 noncom: yeah, me too have no big experience with those... just used transients a couple-o-times...

6:29 i would make a donation to anyone who'd write a good article on transients and boxing in clojure. and records for the second part...

6:33 Apage43: sketch of what I'm thinking https://www.refheap.com/17520

6:34 clgv: noncom: what exactly is your question on transients?

6:36 Apage43: derp derp

6:36 edited some things i just forgot to type in there

6:51 mercwithamouth: are there any major differences between 1.3 and 1.5? I'm debating on getting the pragmatic programmers book...or should i go with the manning meaps? Right now i'm going through the oreilly book

6:52 Ember-: mercwithamouth: new libraries etc, core language is pretty much the same

6:52 at least I don't remember any differences out of the blue

6:52 there might be some

6:53 cemerick: mercwithamouth: reducers and reader literals are the biggest changes...which is to say, not much. I don't think I'd include the latter in a book, even today.

6:53 clgv: mercwithamouth: you could also read the O'Reilly one

6:54 Ember-: reducers are cool but their use scenario is pretty limited

6:54 mercwithamouth: Ember-: ok, as long as there haven't been major syntax/fundamental changes ..which i suppose would never be the case

6:54 Ember-: when they are useful, they really are

6:54 mercwithamouth: clgv: yeah i'm using the oreilly one now.

6:54 Ember-: mercwithamouth: no syntax changes or anything like that

6:54 or well, usage of :use is today preferred to be done via :require

6:54 but :use is still there

6:55 mercwithamouth: too rich for my blood at the moment, reducers

6:56 clgv: mercwithamouth: you can learn the basics with older books but need to get the updates after that...

6:58 Apage43: reducers basically fit where you're transforming a collection into a value (which may be another collection)

6:58 mercwithamouth: ->> is the same as 'reduce'?

6:58 Apage43: emphasis on collection, not sequence

6:58 cemerick: Apage43: the tl;dr is that reducers superset transients

6:58 Ember-: mercwithamouth: no, that's used on function chaining

6:59 Apage43: cemerick: that's a good way of putting it

6:59 Ember-: (->> foo (bar 1)) is same as (bar 1 foo)

6:59 Apage43: I've got an app where I've done a bit of both, that I'm looking at, and the transient stuff could easily (and probably more cleanly) be changed to reducers

6:59 mercwithamouth: ahh i see

7:00 https://gist.github.com/jaycfields/3804058/raw/439d5f921d87764923ecc9f190006952a3594464/gistfile1.clj

7:00 Ember-: mercwithamouth: and you can pass as many function as you like after ->>

7:00 mercwithamouth: ^ ...i like o_O;

7:00 Ember-: (->> foo (bar 1) (blergh 3)) is same as (blergh 3 (bar 1 foo))

7:02 Apage43: its there basically to move stuff around to be nicer to read

7:02 mercwithamouth: hmm i'll touch on that later. i'm jumping around. i just saw it in a blog post

7:03 but after you said chaining the example made immediate sense

7:06 noncom: Apage43: sorry, been away for lunch, now examining the code...

7:08 clgv: my question on transients: how to combine them with unboxed arithmetics so as to attain the highest calculation speed, the lesser footprint and transgress as little as possible from idiomatic traditional clojure syntax. and for the second part - extend these techiques to describe the usage of records in them

7:09 ideally i would like to get the same speed as in plain java but inside clojure (let it be in special places, but at least something)

7:09 clgv: noncom: oh. unboxed values are only possible in `vector-of` afaik.

7:10 noncom: for example, what about (unboxed ... ) for that, just like (transient!)

7:10 i guess not possible for tech reasons..

7:10 clgv: oh, sad..

7:12 Apage43: ok, i see the example.. the collection itself is transient but not the particles or numbers... that's at least something, but hard i crave on unboxed numbers..

7:13 Apage43: well you could use (vector-of)s instead of records for the same thing

7:16 clgv: noncom: well, in defrecords you can also have primitive values in the predefined attributes - but I double you get an unboxed value through keyword access - you'll need to use interop access

7:16 s/double/doubt/

7:17 Apage43: https://www.refheap.com/17522 ; as vector-ofs

7:17 noncom: when i used to program in java, i had to write "public" many times and i often missed the "l" letter for some reason...

7:19 clgv: well ordinary reduce will box the values again

7:20 noncom: Apage43: i guess i'll have to collect mutable numbers separately from other data and use the (vector-of) approach.. or explore the nio approach for collections.. there was vertigo by zach tellman, which handles nio-mapped structs...

7:21 clgv: noncom: you'll need primitive functions as well to avoid boxing

7:21 noncom: clgv: ugh, right...

7:22 clgv: noncom: and a reduce like macro that expands to a loop-recur. since anonymous functions cant be defined as primitive functions atm

7:22 noncom: so i may as well go back to java for all that part of my program..

7:23 clgv: noncom: depending on your current knowledge that might be the faster option.

7:23 noncom: and cleaner i think

7:24 clgv: do you mean that if my knowledge of clojure was better, i could avoid java fallback?

7:24 clgv: noncom: not encessarily. for example there is a lib to do fast computations on arrays which has the kind of macros I just mentioned

7:25 noncom: hiphip?

7:25 clgv: noncom: I just needed to google the name. might be the one. it was mentioned with core.matrix on the mailing list

7:27 noncom: yes, I think thats the one I meant

7:27 noncom: alright, i will do more explorations and measurements on this side, before going to java!

7:27 clgv: noncom: but arrays are mutable, so you have to be careful there in case you want to use immutable specific features of clojure

7:28 noncom: clgv: immutability is often of no need in complex calculation algos

7:29 but still concurrency... needs it..

7:29 clgv: noncom: I know. usually you can convert the overall result to an immutable data structure for the analysis phase...

7:34 mercwithamouth: how would one go about adding two lists??? (+ (list 1 2 3) list (4 5 6)) ???

7:34 lazybot: mercwithamouth: How could that be wrong?

7:34 mercwithamouth: ???

7:34 lazybot: mercwithamouth: How could that be wrong?

7:34 mercwithamouth: thought so =P

7:36 clgv: ,(map + '(1 2 3 4) '(5 6 7 8))

7:36 clojurebot: (6 8 10 12)

7:36 clgv: mercwithamouth: ^^

7:37 noncom: mercwithamouth: clgv: probably better use vectors, not lists?

7:41 clgv: noncom: what do you mean?

7:42 noncom: i mean that is not it better to use vectors for working with collections of numbers?

7:43 clgv: noncom: he wanted to know how to add a list of numbers hence the example.

7:44 cemerick: if you're using apply, map, etc., lists and vectors are equivalent

7:48 benedikt: How cam i can do (.start (Thread. (fn [] (do-stuff)))) in a lein-repl without importing it from Java first?

7:49 s/cam/come

7:50 clgv: benedikt: you can write out the full class name. but maybe you just want to use (future (do-stuff))

7:50 benedikt: clgv: what?

7:50 clgv: i'm asking why I did *not* have to import it from the java namespaces

7:51 clgv: benedikt: oops read it wrong. it is java.lang.Thread then. java.lang is imported automatically

7:51 benedikt: clgv: ah, that explains it. :)

7:51 clgv: what did you think i was asking and what problem does using (future ..) solve?

7:52 noncom: future is same as Thread stuff you described. all clojure functions implement Runnable..

7:52 clgv: clgv: I thought you ask the negation and it might be java.util.concurrent.Thread or something ;)

7:52 I read it to quickly

7:53 benedikt: `future` does almost the same. except that it uses a threadpool with a fixed maximum number of threads

7:53 benedikt: and you have easier access to the return value of the calculation

7:54 benedikt: clgv: so you can use `future` instead of interoping with java to start a new thread?

7:54 Ember-: you really should use futures with concurrent programming

7:54 in java too

7:55 http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html

7:55 clgv: benedikt: informally speaking yes. you should use future in clojure instead of creating a thread yourself

7:56 Ember-: and in Java you should use Executors... :)

7:56 instead of firing of raw threads yourself

7:56 of+f

7:56 benedikt: clgv: i'm sort of new to clojure yet and i learn stuff by hacking away with it informally, so informal explenations are fine.

7:56 clgv: benedikt: fine :)

7:56 Ember-: if you start your thread like that you lose all control of it from the outside world

7:57 benedikt: so instead of writing (.start (Thread. (stuff))) i should just do (future (stuff)) ?

7:57 Ember-: with futures you can do all kinds of stuff if you wish

7:58 benedikt: (future (stuff)) will create a future, but does not launch it

7:58 clgv: benedikt: yes. you can do (let [f (future (do-stuff))] (println "wait for result - results =" @f))

7:58 Ember-: benedikt: http://clojuredocs.org/clojure_core/clojure.core/future

7:58 clgv: Ember-: thats just plainly wrong!

7:58 Ember-: clgv: you are right

7:59 I had to rethink, I was wrong with that statement

7:59 it *is* launched

7:59 had to actually launch REPL to check if what I just said was bullshit

7:59 and it was

7:59 benedikt: I had skimmed through that documention. Ill spend more time on it tonight, when i'm not a my work and supposed to write corporate boring code.

7:59 Ember-: sorry :/

7:59 benedikt: Ember-: :) happens

7:59 Ember-: anyway, you can deference the future to get the return value

8:00 which blocks until the thread is ready

8:02 #@(future "wat")

8:02 ,@(future "wat")

8:02 clojurebot: #<SecurityException java.lang.SecurityException: no threads please>

8:02 Ember-: aww

8:09 Okasu: &,@(future "wat")

8:09 lazybot: java.lang.SecurityException: You tripped the alarm! future-call is bad!

8:09 jtoy_: does rename-keys still exist in clojure? I cant seem to call it

8:09 benedikt: Ember-: and i cant deref a (Thread.) ?

8:10 Ember-: benedikt: no, Threads don't have a return value per se

8:11 benedikt: see https://www.refheap.com/240eaef9a859ab1aae074a9a8

8:11 benedikt: Ember-: but a future has?

8:11 kmicu: "The brighter the green is, the more often the code has been run. Hovering over any of the lines will give you a tooltip with the absolute number of times."

8:11 Ember-: first call without dereferencing returns a future

8:11 kmicu: http://dominik.honnef.co/posts/2013/08/writing_go_in_emacs__cont__/

8:11 jtoy_: ah, its for set, how can I rename a key in a map?

8:11 Ember-: second one with dereferencing waits until the calculation is done and returns that

8:12 benedikt: Ember-: makes sense

8:13 Ember-: so you can just save your future into a var and read from there when you need it

8:13 jtoy_: nm

8:13 Ember-: and be certain that the thread has completed before you try to read from it

8:14 benedikt: Ember-: isn't this just consistent with derefing in clojure? the first example (refheap) just spins off the thread and lets it do it's thing, but when you derefed it waits (does it block?) until the thread is done to be able to retrieve the return value?

8:14 so derefing "forces" it to return you the value, thus it makes (time) wait until it has completed it's task

8:15 clgv: benedikt: yes. you deref a future to get its value. your are free to choose when you want to deref it thoug

8:15 benedikt: clgv: so derefing *can* block, but if you deref at the appropriate time in code, it doesn't have to block

8:16 Ember-: yeah, kinda of :)

8:16 benedikt: i like clojure.

8:16 Ember-: if the thread has completed when you deref the future it will just return the value calculated

8:16 if it is still pending then it blocks

8:17 benedikt: yeah, thats brilliant

8:17 Ember-: I guess most of the ppl on this channel like Clojure ;P

8:17 bosie: Ember-: i find it a shitty alternative to haskell really

8:17 Ember-: bosie: different languages, different purposes in many ways

8:17 haskell embraces typing

8:17 benedikt: Ember-: you had to suspect that there were a few haskellers lurking around

8:17 bosie: Ember-: i am kidding

8:18 Ember-: bosie: aww, you trolled me!

8:18 benedikt: bosie: it's ok. i like haskellers too :)

8:18 bosie: benedikt: i wish i liked haskell but i never quite managed to wrap my head around it :/

8:18 benedikt: though thats my fault and not haskell's

8:18 Ember-: haskell is still on my "to-be-learned" list

8:19 haven't done anything even semi-serious with it

8:19 just random twiddling around

8:19 benedikt: bosie: same here. i attempted learning it three times now, i always get a little further. i think it's one of those things that will just "click" one day

8:19 Ember-: like lisps

8:19 :)

8:19 I remember when I got my "lisp enlightment"

8:19 clgv: benedikt: you can even ask the future whether it is ready to be dereferenced without waiting time `future-done?`

8:19 bosie: benedikt: the fact its not used commercially is a wee bit of a problem as well

8:20 Ember-: after getting the "lisp enlightment" suddenly all other syntaxes seemed stupid and cumbersome

8:20 benedikt: bosie: i write c# for a living. companies never use the fun stuff!

8:20 clgv: nice!

8:20 Ember-: before that all those friggin' parenthesis made me insane!

8:20 bosie: benedikt: beats me doing java ;)

8:21 Ember-: benedikt: I write java and clojure for living :)

8:21 most likely the next project is in java if I don't manage to convince the customer that it should be done with clojure :/

8:21 benedikt: Ember-: yeah. Im enlightened too.

8:21 bosie: Ember-: clj for whom?

8:21 Ember-: bosie: working at this company called Solita in Finland

8:21 benedikt: Ember-: are you finnish?

8:21 Ember-: yup

8:23 bosie: benedikt: "To ensure excellent service to all our customers, we expect our employees to be able to speak Finnish." guess that makes your question moot ;)

8:23 Ember-: that looks like a consultancy?

8:23 benedikt: bosie: i speak swedish and they speak swedish in finland

8:24 Ember-: bosie: yeah, kinda of. We do that stuff too

8:24 bosie: benedikt: how many non-finns speak finnish properly though?

8:24 sebastianb: not, perkele, one

8:24 Ember-: bosie: it's more like delivering projects to a customer and providing the all things needed for delivering a successful project

8:24 benedikt: bosie: one. Thats Linus Torvalds and he is already finnish.

8:24 sebastianb: (I'm sorry for that:P)

8:25 Ember-: like ux design, development, testing, IT infrastructure devops stuff and so on

8:25 hyPiRion: bosie: wrong question. How many Finnish speak English properly? :) I would be surprised if it's less than 95%

8:25 bosie: hyPiRion: if the company requires you to speak proper finnish...

8:25 Ember-: how is this not consultancy?

8:25 hyPiRion: oh, I didn't read that :(

8:26 opqdonut: there are a couple of finnish software companies that insist on using finnish

8:26 but most use english as their official language

8:26 hyPiRion: "Well, it's can't be harder than learning a new computer language"

8:26 bosie: hyPiRion: hah. i would bet good money i can learn haskell quicker and to a higher profeciency than finnish

8:27 opqdonut: a russian coworker of mine studied finnish for 3 years to pass the citizenship exam

8:27 Ember-: bosie: well yeah, I kinda see consultancy more of work where you send this one or several guys to tell how to do stuff, not actually *do* it

8:27 hyPiRion: bosie: me too. I bet I could learn D, OCaml, Haskell and APL before I would've learned Finnish properly.

8:27 bosie: Ember-: ok, not here i think. we do deliver ;)

8:28 Ember-: hehe, same here

8:28 and we do that also with Clojure :)

8:28 we've done two projects with clojure now, both successes

8:28 bosie: Ember-: in what area?

8:28 Ember-: was enough for our management, now we're going to do a lot more projects with Clojure

8:28 bosie: web applications

8:28 bosie: Ember-: isn't a success in the consultancy business when you get follow up work cos your code was so buggy they had to get someone to fix all the bugs? ;)

8:29 Ember-: bosie: hehe, no. We don't do that kind of consultancy :)

8:29 we believe that a well made project gives you new projects

8:29 hyPiRion: I think I do that, not intentionally though.

8:29 Ember-: and the better you do the project the less it will bother you later

8:30 bosie: hyPiRion: including bugs?

8:30 Ember-: if you get paid for the 'bother' though...

8:30 hyPiRion: bosie: https://twitter.com/hyPiRion/status/366344191166525442

8:30 yes.

8:30 including fixing them

8:30 bosie: hyPiRion: cant read twitter. i activated GSD

8:30 Ember-: bosie: yeah, but if the company believes in *keeping* the good guys in, then that's pretty short sighted :)

8:30 bosie: which is pure irony, now i just waste time on irc ;)

8:30 Ember-: since the good guys deliver quality and with quality comes the customers

8:30 hyPiRion: bosie: yet here you are, on IRC. :)

8:31 "I love it when I introduce a new bug by fixing an older one. Good to know I won't be out of work for the rest of my life, though." - quote me

8:31 yesterday

8:31 bosie: hyPiRion: ah, sorry to hear

8:31 Ember-: and hyPiRion about the amount of finns who can speak english decently: unfortunately it's not 95%, it's wors

8:32 but of people actually *using* the internet (not just using the bank's web site) I think 95% is pretty accurate

8:32 bosie: Ember-: what do you reckon is the # for the two proper citis?

8:33 Ember-: citis?

8:33 hyPiRion: Ember-: Ah, right. Sounds like the same ratio as in Norway, Sweden, Denmark, Iceland etc.

8:33 Ember-: ah, amount of people in cities?

8:33 bosie: Ember-: cities

8:33 Ember-: hyPiRion: indeed

8:33 bosie: Ember-: how many people speak english in helsinki (you can include espoo)/turku/tampere

8:33 Ember-: ah...

8:34 well, I think there it is pretty close to that 95%

8:34 it gets worse when you go to countryside

8:34 but not THAT much

8:34 bosie: ye

8:34 not like they see foreigners in sodankyla

8:34 Ember-: they do

8:35 and each and every person under 35 years has had to learn at least 6 years of english in school

8:35 in Finland

8:35 bosie: Ember-: same here but that really doesnt mean much

8:35 Ember-: and all our tv shows are subtitled, not dubbed

8:35 thank god

8:35 :P

8:35 bosie: Ember-: they couldn't order a coke in english, let alone keep a conversation going ;)

8:36 Ember-: i bet that helps more than school

8:36 Ember-: one couldn't be without the other

8:36 drop either one and the amount of english speakers drop dramatically

8:37 but hell, I should do some work too

8:37 bosie: hehe cu

8:37 Ember-: not just chat in IRC

8:37 ->

8:49 birdspider: hi, is there a equal/= function that produces false when comparing 'identical' vectors and lists ? i.e (=~ [] '()) false

8:51 llasram: birdspider: Not off the top of my head. Why do you want that?

8:53 noncom: birdspider: you can easily write one

8:53 birdspider: llasram, trying to solve http://www.4clojure.com/problem/65 with http://pastebin.com/es3i6k41

8:55 hyPiRion: birdspider: list? vector? map? set? can be used

8:55 although not pretty

8:55 *elegang

8:55 birdspider: hyPiRion, not in the example I posted

8:56 hyPiRion, see "Special Restrictions"

8:56 llasram: birdspider: I think the point of this is to empirically test how core abstraction functions act differently on the provided input

8:56 Remember that all the Clojure core structures are immutable (at least in public interfaces)

8:56 So you can "mutate" them however you want without being impolite about your imput

8:56 s,imput,input,

8:57 hyPiRion: birdspider: ah. Logged in, the way llasram explained it is how I solved it.

8:58 birdspider: hyPiRion, ah my bad, didn't think login was required to see the problems

8:58 hyPiRion: birdspider: it's not, but it's required if you want to see your own solution :)

8:59 I just looked at the problem, not its constraints at first.

8:59 TimMc: Those restrictions miss some predicates.

9:01 llasram: TimMc: I don't think the problem is intended for people who already know enough Clojure to work out which predicates they can use to "cheat" :-)

9:01 TimMc: Fair, although sequential? was included in the list of restrictions.

9:02 hyPiRion: llasram: psh, 4clojure is a great way to learn how reify works. At least you could do that in the past.

9:02 IamDrowsy: and it's fun to look at the different "hacky approaches"

9:03 TimMc: Does this problem also fall to the shitty map literal solution?

9:03 Ah, nope.

9:30 supersym: hmm... I wonder what fun things I could do with clj + e.g. http://www.webkb.org/bin/categSearch.cgi?categ=%23dog&recursLink=%3C

9:45 H4ns: clj-time or something else for date+time handling (printing and parsing)?

9:47 ambrosebs: Does a CLJS deftype have any meaning if it is referenced like a var? cljs.core.Subvec vs. cljs.core/Subvec?

10:06 mercwithamouth: so clojure people..if you could make up a checklist of things to go through to learn most languages...what would you write down?

10:20 rbxbx: mercwithamouth: ethos, syntax, semantics, tooling, testing

10:20 wakeup: hi all

10:20 Okasu: mercwithamouth: Learn Ada, C, Scheme, Haskell. Voilà you know most of the languages outthere without even touching them.

10:20 rbxbx: mercwithamouth: not sure what level of granularity you're looking for

10:21 wakeup: I am fighting with clojure.tools.logging and log4j.

10:21 * Okasu haven't really learned clojure, just came from CL/Scheme.

10:22 wakeup: How do I make logging to print all levels to mx *nrepl* buffer?

10:22 tried binding *force*, *tx-agent-levels*...

10:22 guess nrepl ignores my log4j.properties, which is ok

10:24 mercwithamouth: rbxbx: i'm more so looking for a guide line to become functional in most languages...a blueprint to learn.

10:25 i use several languages but i'm just comparing my method of learning to other peoples

10:25 wakeup: mercwithamouth: learn common lisp, after that other languages tend

10:25 to be easy

10:25 haskell if you want to go deep into dunctional territory I guess.

10:26 also is there a prefered configuration file library for clojure?

10:27 Okasu: wakeup: Wakeup, CL isn't functional at all.

10:27 mercwithamouth: preferred configuration file library.... was that question for me?

10:27 wakeup: no, not exclusively

10:27 mercwithamouth: oh ok

10:27 * mercwithamouth backs away =P

10:28 wakeup: Okasu: No, but people have implemented a lot of functional stuff using it

10:28 Okasu: wakeup: You can do the same using C, what was your argument again?

10:29 wakeup: when you do functional stuff in CL, you also get to know how its implemented

10:29 kmicu: detects Defending Preferred PL Syndrome.

10:29 wakeup: Okasu: It's a really good language noone should skip, and as far as I understood he was asking for interesting languages to learn.

10:31 hyPiRion: Well, Haskell is good if you want to constrict yourself to functional programming.

10:31 Okasu: It's a language one should skip if one wants to lean functional programming. Better stick to Scheme. CL -- standardtized mess of all lisp dialects around 90s.

10:31 kmicu: "It's not Lisp that sucks, it's Common Lisp that sucks."

10:31 Okasu: kmicu: Indeed.

10:32 wakeup: lol

10:32 kmicu: Okasu: Scheme indeed.

10:34 wakeup: Don't listen to the religious guys mercwithamouth, just look into what people use for real work and pick whatever you think is interesting. But don't buy into the "X sucks" attitudes, these guys have no idea.

10:35 For instance, I am programming clojure not because I want to, but for a client. While I'd prefer other languages, clojure is a very good choice for this project.

10:36 kmicu: After I heard from Erik Meijer that PHP is interesting, I do not believe Paul Graham about CL suckiness.

10:36 Just kiddin'. Only trolling ;]

10:37 Okasu: kmicu: Well, maybe PHP is interesting as fractal of bad design? :D

10:38 kmicu: "but if you look at it from a little bit of a distance most languages are more similar unless you go to say Prolog or Datalog or Haskell. But the rest, F#, Scala, C#, JavaScript, PHP, they are all languages that have objects, that have mutable state, that have closures, Clojure is maybe somewhere between Haskell and that"

10:38 http://www.infoq.com/interviews/meijer-monads

10:46 wakeup: So how do I make clojure.tools.logging log to my *nrepl* buffer?

10:49 dnolen: ambrosebs: prefer the second one, there is no differences in meaning and there are fewer promises about the first one.

10:51 mdrogalis: wakeup: Been wondering that one for a long time. I think it has to do with the fact that tools.logging uses agents under the hood.

10:51 wakeup: And how do I direct clojure.tools.logging to a file?

10:51 mdrogalis: Agents stdout isn't on the main thread.

10:51 wakeup: Use a log4j config file.

10:52 wakeup: okay

10:52 I need to decide that at runtime though (if I want to log to stderr or a file)

10:52 now don

10:52 mdrogalis: Uhh..

10:53 Once at start up time? Or does it change a lot?

10:53 wakeup: no once at startup

10:53 mdrogalis: wakeup: Use pre-hooks, put them in their own files. One batch of prehooks for stderr logging, another batch for file logging. https://github.com/MichaelDrogalis/dire

10:54 Import whichever batch of prehooks based on the build, or whatever main file you pick.

10:54 wakeup: hmm no that won't do

10:55 mdrogalis: Can you explain a bit more, maybe?

10:56 wakeup: Well the specification says "a command line option to direct logging output to a given file."

10:56 mdrogalis: (if (file-logging? args) (require 'hooks))

10:56 In some ideal world. :)

10:57 gdev_: Has the notion of logs as data still so new that even clojurists default to log files?

10:58 s/Has/is

10:58 wakeup: gdev_: sshhh!

10:58 gdev_: Sorry =_=

10:58 wakeup: mdrogalis: what keeps me from getting and BINDING the logging output stream?

10:59 gdev_: I wouldn't even bother with logging, but this is work for a client

10:59 and I say that as someone running a webserver that doesn't log by design

10:59 mdrogalis: gdev_: It's clearly a school assignment.

11:00 Ah, nevermind

11:00 Didn't read up - sorry.

11:00 wakeup: no it's not ;)

11:00 I don't really get why I need this dire thing to direct logging output.

11:01 gdev_: When I tutor java students I still make them think about data and events instead of lines if text and files

11:01 mdrogalis: wakeup: It was just a suggestion. You don't have to use it to accomplish your goal.

11:03 wakeup: Just a second: (defn fooo [arg] "bar") <- "bar" is the docstring right?

11:03 Fer`: gdev_: do you log in edn or something?

11:03 wakeup: or does it have to be (defn foo "bar" [arg]) ?

11:04 mdrogalis: wakeup: 2nd way is correct

11:04 wakeup: fuuuuu

11:04 H4ns: "why not alienate the CL suckers if one can?" :D

11:04 krejzywafel: yes yes yes

11:04 wakeup: yeah right

11:06 gdev_: It helps prevent narcissistic systems so yes edn is preferred.

11:06 wakeup: as if the weird braces and destructuring syntax wasn't butthead enough

11:06 and then: WITH-OUT-STR

11:06 H4ns: wakeup: i'm not sure that this is the right place to bitch about clojure, though :)

11:06 wakeup: true

11:06 Fer`: gdev_: you don't run into any problems when the file is really big?

11:06 wakeup: tried that last week

11:07 krejzywafel: X is fuuuuu, cuz it is not like CL, true story...

11:08 wakeup: krejzywafel: there is a certain element of surprise when a "lisp" does every conceivable lispy thing a bit different

11:08 H4ns: i must say i find clojure pretty slick. today i used clojure.data/diff and it is teh rocks

11:08 nDuff: wakeup: haven't you had this exact same rant here earlier?

11:08 krejzywafel: wakeup: fuuuuuu

11:08 H4ns: wakeup: #lispcafe

11:08 nDuff: wakeup: it turned into a flamewar then too. No need for a rerun.

11:08 wakeup: I am gonna stop now

11:09 but just for my defense: always keeping it civil, kust said it's surprising

11:09 noncom: if i'm making a Date related library for ClojureScript, is it fine to base it on the js/Date or is that class a bad thing, like the default Java DateTime is adviced to be replaced with JodaTime in usage?

11:09 H4ns: nDuff: when he's not ranting about clojure here, he's ranting about cl in #lisp :)

11:09 wakeup: H4ns: so not true

11:10 I have given that up years ago

11:10 but I did suggest porting CL in #cat-v.org

11:10 noncom: is there an advices substitution for javascript/clojurescript?

11:10 wakeup: fun times...

11:10 mdrogalis: H4ns: I was about to laugh if you said he alternates between ranting about Clojure & ClojureScript

11:10 wakeup: after all they did port python

11:10 krejzywafel: wakeup: just against your defense - you did not just said it's suprising, you just said it's "fuuuuuuu"

11:11 wakeup: krejzywafel: that was actually directed at me having noticed this very late

11:14 gdev_: Fer I don't log to an edn file, it's just what I serialize the data in

11:15 Edn in action

11:15 noncom: my main concern in creating a clojurescript date library is to allow a good work with to/from string conversion and using formats

11:16 or maybe there is one existing?

11:17 mdrogalis: noncom: Does clj-time not port?

11:31 H4ns: say if i have a map {:a 1 :b 2 :c 3} and i want to convert that into {:x 1 :y 2} (i.e. create a new map with a few values from the old map, stored under new keys), is there a built-in operation for that? i.e. (remap {:a :x :b :y} {:a 1 :b 2 :c 3})?

11:34 hyPiRion: ,(-> {:a 1 :b 2 :c 3} (select-keys [:a :b]) (clojure.set/rename-keys {:a :x :b :y}))

11:34 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.set>

11:34 mdrogalis: H4ns: select-keys combo'ed with `rename`, I think it is

11:34 hyPiRion: Nice :)

11:34 hyPiRion: ,(require 'clojure.set)

11:34 clojurebot: #<SecurityException java.lang.SecurityException: denied>

11:34 hyPiRion: Boo

11:34 mdrogalis: nope.jpg

11:35 H4ns: nice, thanks!

11:35 hyPiRion: ,(require '[clojure.set])

11:35 clojurebot: nil

11:35 hyPiRion: ,(-> {:a 1 :b 2 :c 3} (select-keys [:a :b]) (clojure.set/rename-keys {:a :x :b :y}))

11:35 clojurebot: {:y 2, :x 1}

11:35 hyPiRion: there.

11:35 wakeup: Whats LET* in clojure?

11:35 hyPiRion: wakeup: let

11:36 wakeup: let evaluates/binds sequential?

11:36 hyPiRion: yes

11:41 wakeup: java.lang.IllegalStateException: replace already refers to: #'clojure.string/replace in namespace [...]

11:41 mdrogalis: refer-clojure

11:41 Check it out

11:41 wakeup: What did I do? (tried to :use clojure.string)

11:42 justin_smith: wakeup: do you have a function called replace?

11:42 hyPiRion: wakeup: you should try to use namespaces, e.g. (:require [clojure.string :as s]), then do s/replace or similar.

11:43 otherwise names from the :use'd namespaces clash with others if they have the same name.

11:43 mdrogalis: wakeup: Also, use :require. Avoid :use.

11:44 gvickers: why not destructure it. (def n {:a 1 :b 2 :c 3}) (def newmap (let [{x :a y :b}n] {:x x :y y}))

11:46 H4ns: gvickers: i want to avoid repeating the keys. it seems i need to write a select-rename function.

11:51 hyPiRion: H4ns: (defn select-rename [map keymap] (-> map (select-keys (keys keymap)) (clojure.set/rename-keys keymap))) ?

11:51 I think that would do what you'd like

11:51 justin_smith: ,(let [m {:a 0 :b 1 :c 2}] (reduce (fn [m' [k k']] (assoc m' k' (k m))) {} [[:a :x] [:b :y] [:c :z]]))

11:51 clojurebot: {:z 2, :y 1, :x 0}

11:52 justin_smith: rename-keys, nice, I wasn't aware of that one

11:55 noncom: mdrogalis: afaik clj-time is based on JodaTime, and there is no equivolent for JavaScript

11:55 seangrove: Wow, people building inheritance systems on lein's profiles


11:57 hyPiRion: seangrove: I wouldn't be surprised if lein profiles are turing complete.

11:57 justin_smith: hyPiRion: ~(they are)

11:57 `fogus: and self-aware


11:58 justin_smith: (if that was too opaque, you can put arbitrary code inside a syntax-quote, and access the full clojure language)

11:59 seangrove: technomancy is going to have to answer for some of the sins his work has enabled

11:59 seancorfield: nearly all of my project.clj files have some ~(embedded code) in them

12:00 `fogus: seancorfield: You must have larger build reqs than me because I've never had the need. What kinds of things require that?

12:01 seancorfield: we determine heap size from an env var or default to 512MB, we also add/remove several JVM opts based on which platform we're on and/or which environment tier we're in

12:02 it's just easier to do that than to have separate profiles for each env

12:02 technomancy: seancorfield: for the platform stuff please take a look at https://github.com/technomancy/leiningen/pull/1228

12:02 justin_smith: In my case it is for passing in env vars so that a lib can see credentials, without having to store the credentials in git.

12:02 `fogus: seancorfield: Oh so we do have similar requirements... but I do that in Bash scripts. ;-)

12:02 seancorfield: we try to have all our stuff auto-self-configure based on environment info

12:02 technomancy: would like to get feedback on that from someone who would actually use it

12:05 wink: .oO( skynet )

12:08 mdrogalis: noncom: Ah, right right.

12:12 seancorfield: i'm at the courthouse right now for jury service so i'm kinda restricted on what i can work on :)

12:21 wakeup`: How do I check a reader for end of file?

12:22 mdrogalis: wakeup`: What kind of reader?

12:22 wakeup`: *IN*

12:23 mdrogalis: http://stackoverflow.com/questions/2034059/how-to-read-lines-from-stdin-in-in-clojure

12:24 wakeup`: I take that as a "not at all"?

12:25 tbaldridge: wakeup`: on many platforms (JVM included) the proper way to check for EOF is to read until read returns -1

12:25 wakeup`: what is consuming the stream?

12:26 wakeup`: tbaldridge: read

12:26 tbaldridge: wakeup`: http://docs.oracle.com/javase/7/docs/api/java/io/Reader.html#read()

12:29 wakeup`: for example the clojure LispReader wraps all this and allows you an option to either return a user defined value on EOF or to throw an error.

12:30 mdrogalis: tbaldridge: I'm having a great time with core.async now that I understand it. Really, really well done man.

12:32 tbaldridge: mdrogalis: thanks! I can't take all the credit though. Rich, dnolen, alex miller, ghadi and many others did a ton of work too.

12:33 mdrogalis: tbaldridge: A good effort :)

12:37 konr`: Is there any already-existing function that given [:foo :foo :bar] returns something like {:foo 2 :bar 1}?

12:38 tbaldridge: ,(doc frequencies)

12:38 clojurebot: "([coll]); Returns a map from distinct items in coll to the number of times they appear."

12:38 konr`: thanks!

12:38 tbaldridge: ,(frequenceis [:foo :foo :bar])

12:38 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: frequenceis in this context, compiling:(NO_SOURCE_PATH:0:0)>

12:38 tbaldridge: and I can't spell

12:38 ,(frequencies [:foo :foo :bar])

12:38 clojurebot: {:foo 2, :bar 1}

12:49 seangrove: Is wolfes being flooded, or flooding?

12:55 rasmusto: wolfes is doing something (or maybe comcast is)

13:18 bhauman: wolfes must work at a lot of different coffee shops

13:21 technomancy: join/part hiding is a beautiful thing

13:22 bhauman: technomancy: currently looking for config setting in ui. or rather is it some esoteric irc command?

13:23 justin_smith: bhauman: with erc it is a config

13:23 technomancy: bhauman: varies by client

13:23 bhauman: justin_smith: technomancy: thanks guys

13:35 TimMc: technomancy: I use a ridiculously simple irssi script called "smartnoise" that hides joins/parts for people who (I think) haven't spoken recently.

13:37 kmicu: Same here http://dev.weechat.org/post/2008/10/25/Smart-IRC-join-part-quit-message-filter

13:38 bhauman: I have one more simple irc question that I''ve been meaning to ask. How do you do those cool status messages?

13:38 justin_smith: bhauman: /me ...

13:39 or is that not what you mean?

13:39 * bhauman is thinking

13:39 * bhauman is thinking this is what he meant

13:39 bhauman: justin_smith: thanks man

13:39 callen: I use /me everywhere, including outside of IRC.

13:39 bhauman: i bet

13:40 callen: bhauman: you should look things up more.

13:40 satisfying one's curiosity is good :)

13:40 justin_smith: I first picked it up in a mud, and used it accidentally found out it worked in irc

13:40 bhauman: thanks for the tip

13:40 callen: ahhh MUDs.

13:41 those taught a lot of people to program.

13:41 bhauman: callen: I use clojurescript, thus I have a tendency to look things up

13:41 callen: scripting the grinding phase of the game :)

13:42 justin_smith: yes, I started with that, then they saw how good my scripts were and elevated me to a builder, then saw the scripts I was putting on mobs and made me a developer for the mud engine

13:43 * justin_smith implemented objects that would act as registers in order to build an assembly language in a mob scripting language that did not do numeric calculations natively

13:48 * bhauman is finishing up a blog post on building the iPhone game Dots in clojurescript with core.async

13:49 TimMc: justin_smith: Haha, nice.

13:49 scottj: bhauman: link to blog (not post) where that will appear?

13:49 gvickers: ditto^^

13:50 bhauman: http://rigsomelight.com

13:50 scottj: bhauman: thanks

13:50 bhauman: scottj: gvickers: if you want to read it now I'd love some people to give me feedback

13:54 scottj: bhauman: no thanks

13:54 bhauman: scottj: no worries

13:55 benkay: lysis

13:55 (wrong term)

13:58 francis_wolke: Could someone please explain to me how exactly we are seeing a 4 in the return list in this form? (let [form '(/ 4 4)]

13:58 [(eval form)

13:58 (apply (first form) (rest form))

13:58 (apply / '(4 4 ))])

13:58 I

13:58 I'm quite confused... :/

13:59 dnolen: ,(apply '/ [4 4])

13:59 clojurebot: 4

13:59 francis_wolke: thanks.

13:59 hiredman: the symbol / is not the same as the function that the symbol / resolves/evals to

14:00 justin_smith: ,(apply 'anything [4 4])

14:00 clojurebot: 4

14:00 justin_smith: ,(apply '☃ [4 4])

14:00 clojurebot: 4

14:01 konr`: haha

14:01 justin_smith: ,(apply '☃ ['❄ '☕])

14:01 clojurebot: ?

14:02 justin_smith: clojurebot appears not to be utf8 clean

14:03 TimMc: ,('+' 0 0)

14:03 clojurebot: 0

14:04 tbaldridge: ,(get '+' 0 0)

14:04 clojurebot: 0

14:05 tbaldridge: justin_smith: function calls to symbols get translated to get ^^

14:05 justin_smith: ,('♟ '♞ '♛)

14:05 clojurebot: ?

14:05 justin_smith: just like keywords

14:06 kmicu: ,(apply (comp (partial (comp '+ '*' 'a''a) '+)) '(ha))

14:06 clojurebot: nil

14:06 tbaldridge: I really really want to write a variant of clojure.core that uses unicode symbols for everything. APL meets Lisp or something like that

14:06 maybe for april 1st next year

14:06 justin_smith: ,('a '{a 1 b 2})

14:06 clojurebot: 1

14:06 technomancy: tbaldridge: april 1 is less than 8 months away

14:06 justin_smith: nice

14:07 konr`: a chess game that uses chess unicode characters would be cool, too. (♞ :d3)

14:08 justin_smith: yes, that would be a nice little clojure based dsl

14:08 `fogus: tbaldridge: A unicode Clojure with ubiqiutous use of -> would be pretty frickin sweet.

14:09 tbaldridge: `fogus: that's kindof like bbloom's factjor

14:10 bbloom: i do not advocate unicode abuse :-)

14:10 justin_smith: basically you could just have a namespace with lots of lines that looks like (defmacro λ [bindings & body] `(fn ~bindings ~@body))

14:10 bbloom: despite years of trying, i still don't know my greek letters

14:10 hiredman: tbaldridge: have you seen pl?

14:10 gvickers: you have to know that one..

14:10 technomancy: justin_smith: nitpick: what is "domain-specific" about such a language?

14:11 justin_smith: chess?

14:11 that is a domain, no?

14:11 technomancy: oh, I thought you were talking to tbaldridge; nm

14:11 `fogus: bbloom: I don't know Greek letters either... but snowmen I know.

14:11 hiredman: feh, I don't think I have a way to load pl in to clojurebot's evaluator anymore

14:11 etehtsea: where lazy-seqs was moved from contrib?

14:11 justin_smith: if in emacs: c-x 8 <return> is your friend with unicode

14:11 bbloom: `fogus: clearly all the PL researchers should just perform all of their typing judgements with snowmen and bishops

14:11 justin_smith: also things like *lambda* tab-complete from beginning or end

14:11 tbaldridge: hiredman: I've seen it referenced, never used it

14:11 `fogus: The only problem is, what function does snowman get? I was thinking `persistent!` might be appropriate.

14:12 justin_smith: with 8

14:12 err

14:12 ☃ as thaw, the inverse

14:12 hyPiRion: justin_smith: you don't need to define λ as a macro to show it as λ in Clojure files

14:12 justin_smith: sure

14:12 hiredman: https://github.com/hiredman/odds-and-ends/blob/master/functional.clj#L114-130

14:12 justin_smith: that was a random example of uniclojure

14:13 though showing as unicode is probably more useful than requiring unicode input

14:13 TimMc: I'll just note here that Swearjure is uniclojure-compliant.

14:14 ro_st: loved that lightning talk :-)

14:14 actually really impressive how far along that got!

14:14 TimMc: ro_st: gfredericks' talk?

14:14 ro_st: yes, at CW '13

14:14 hyPiRion: TimMc: To some extent. λ isn't legal, although ☃ probably is.

14:14 TimMc: Hmm, true!

14:15 I guess we can't allow letters from any language.

14:16 hyPiRion: Not that it would help us much to allow them though.

14:17 TimMc: Disallowing ' and ! as being "letters" in the romanization of Xhosa and other "click languages" would be unfair, however.

14:17 konr`: you could also allow only roman numerals

14:18 TimMc: Eh, we don't need no stinkin' numerals.

14:18 hyPiRion: + * - and / is enough for me

14:19 patchwork: Will we ever free ourselves of the chains of ascii?

14:19 : (

14:20 technomancy: according to vernor vinge, no

14:21 TimMc: For code? No.

14:21 patchwork: Ha! even in the quick, they speak ascii

14:21 technomancy: 27th century technicians will wonder why dates are measured from the moon landing, and then realize it's actually a few months later

14:21 TimMc: (Well, I probably won't live long enough to be proven wrong, at least.)

14:22 konr`: There was a russian keyboard with leds on the keys which would make using unicode symbols viable

14:22 wink: the optimus?

14:22 konr`: yeah, that one!

14:23 TimMc: Í ðóñ'þ ßéé åháþ'ß åëóñg åíþh þhíß µéþhóð. °¥Ö

14:23 wink: us mechanical keyboard freaks would probably pass on it for some decent feeling :P

14:23 gvickers: $1500 dollar keyboard

14:23 patchwork: Seriously, and their processors will just be mind-boggling wrappers around an x86

14:23 callen: technomancy: hahahaha

14:24 hyPiRion: no wonder there won't be any singularity if this is true.

14:24 wink: technomancy: look, everytime I'm using the elevator in my building (it's been built in 1967) I have to think of Blaine the Mono from the dark tower lately. Like.. technology not touched for centuries or millenia that still works...

14:24 technomancy: callen: https://en.wikipedia.org/wiki/A_Deepness_in_the_Sky#Interstellar_culture

14:25 callen: technomancy: I read A Deepness in the Sky. Loved it.

14:26 bhauman: this all make me think of Bret victor's latest talk.

14:26 callen: I need a brain implant that filters out anything to do with Bret Victor.

14:30 dark_element: anybody here used this http://nakkaya.com/static.html

14:31 callen: dark_element: nah, I wrote my CMS mostly using the stack from Luminus. Looks neat though.

14:31 I wonder how quickly it compiles compared to Jekyll?

14:32 dark_element: callen, I can't get it working it yet.

14:32 callen, there is one more similar project https://github.com/liquidz/misaki

14:33 callen: I just use Varnish if it's truly static.

14:33 then I can write my code in the same way as usual for the CMS, but it gets cached to death :)

14:33 I might be weird though.

14:33 dark_element: do you just want to make a blog?

14:34 justin_smith: callen: give the whole thing a name like carbonite and you could probably convince other people to do it that way

14:34 wink: there's also http://algernon.github.io/madness/

14:34 callen: justin_smith: not_sure_if_serious.jpg

14:34 dark_element: callen, yup.

14:35 callen: dark_element: oh hum. Assuming the use of Clojure is a specific requirement, does it need to be an SSG?

14:35 SSGs can be really awkward at times.

14:36 dark_element: SSG?

14:36 callen: static site generators.

14:36 ucb: what's the best way of depending on a jar that may not be available in clojars nor maven central? i.e. the code is in github

14:37 technomancy: ucb: why is it not on clojars?

14:37 ucb: technomancy: it's not mine; it's a Java/.NET lib I want to wrap

14:37 dark_element: callen, i started with octopress today and later on went on trying out SSGs built using clojure.

14:37 ucb: I suppose I can upload a version to clojars under my username namespace

14:37 technomancy: ucb: you should open a bug report if it's not in a repository

14:37 ucb: technomancy: good point

14:38 wink: maven ALL the jars!

14:38 hyPiRion: more like deploy

14:38 zphds: Hey guys, I am coming from the world of Python and new to Clojure. Can someone take a look into this piece of code and tell me why it's writing an empty zip archive?

14:38 http://cljbin.com/paste/520926a8e4b0b4dec3dca30b

14:38 amalloy: ~map

14:38 clojurebot: map and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board

14:38 * technomancy guesses "map is lazy" before looking at it

14:39 amalloy: technomancy: good guess

14:39 hiredman: technomancy: we all did

14:39 technomancy: heh

14:39 amalloy: i actually guessed "for is lazy"

14:39 bbloom: zphds: what they are trying to say is that you're ignoring the return value of the functional "map" call, which, even if you weren't ignoring it, is problematic when wrapped up with side effects.

14:39 (doc doseq)

14:39 clojurebot: "([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."

14:40 bbloom: zphds: try that^^

14:40 justin_smith: quickest fix for the code is mapv for map, after that there is doall wrapped around map, then there is refactoring to a deseq

14:40 *doseq

14:40 that being the best option imho

14:40 hiredman: amalloy: for use by someone new to the language seems unlikely

14:40 functionform: why are the array set functions typed but not the get?

14:40 zphds: bbloom: is it more of a code-smell issue or does it have any other adverse effects?

14:41 bbloom: zphds: laziness & side effects just don't mix. if you need side effects, use an eager operation, such as doseq

14:41 it's an easy fix: (doseq [photo photos] …body of your map function here...)

14:41 zphds: bbloom: I am ashamed to admit that I didn't know that map was lazy

14:41 bbloom: zphds: never be ashamed while you're learning!

14:42 technomancy: everyone gets bitten by that early on =)

14:42 bbloom: yup

14:42 bhauman: hell yep

14:42 zphds: heh

14:42 :D

14:42 dnolen: zphds: and laziness burns even experienced Clojure users

14:42 bbloom: it's especially easy to get bitten by it since it's not fully lazy. it's actually "non-strict" meaning it's SOMETIMES lazy

14:42 where sometimes == always except in 30-ish item chunks

14:42 zphds: whoa

14:42 TimMc: &(take 4 (map println (range 60)))

14:42 lazybot: ⇒ (012345678910111213141516171819202122232425262728293031nil nil nil nil)

14:42 bbloom: and so when it *sometimes* happens eagerly, you can't tell it sometimes happens lazilly

14:43 zphds: is it also bad if I have side effects as part of my 'let'?

14:43 like what I did with mkdirs inside a let?

14:43 dnolen: bbloom: "sometimes" being range and vector

14:43 bbloom: zphds: if your code needs side effects, then let and do are the best places to put them

14:43 both of those forms let you explicitly sequence operations

14:43 technomancy: zphds: that's fine. it's best if you bind to _ for side-effects; makes it clear the return value isn't used.

14:44 zphds: bbloom: ah

14:44 bbloom: technomancy: unless your side effect has a return value :-P

14:44 technomancy: (assuming you mean the [] part of a let)

14:44 llasram: zphds: There's also `doto`, depending on what exactly you're doing

14:44 zphds: I kinda figured _ is for such things

14:44 ystael: related question: is there a tool I can use as a 'laziness monitor'? that is, to answer the question "I think this code might be less than maximally lazy somewhere, but where?"

14:44 bbloom: zphds: just by convention though. _ isn't special in any way

14:45 ystael: other than watching memory meters

14:45 zphds: llasram: yeah, I played around with doto initially, but that io/copy in the middle is ruining the sequence

14:45 bbloom: right, I kinda use that in my python code as well, to tell that this var is just there and won't be used anywhere else

14:46 ystael: I had trouble with OOM due to this during the ICFP contest this weekend until I remembered that mapcat is a little bit eager

14:46 dnolen: ystael: that's cool that you gave ICFP a shot, you didn't try integrating w/ external SMT solver? Sounds like Z3 was popular?

14:47 ystael: dnolen: no, i used the maximally stupid generate-and-test approach

14:48 which actually did surprisingly well

14:48 zphds: well doseq didn't help

14:49 it's something to with 'data' which is a byte array

14:49 dnolen: ystael: nice, yeah some folks tried core.logic, which is fun but I think a bad fit for the problem description out of the box - but writing a proper CLP(BV) extension to core.logic is probably a bit too much work given the time alloted :)

14:53 ystael: dnolen: wish i had learned how to use the reducers library ahead of time, i suffered most from lack of parallelism

14:53 (and poor time management, but that's to be expected with a baby in the house)

14:53 bbloom: dnolen: (acronym-expand-1 "BV")

14:54 dnolen: bbloom: BitVector

15:01 zphds: woohoo.. got it working

15:01 here is the working snippet

15:01 http://cljbin.com/paste/52092c79e4b0b4dec3dca30c

15:01 thanks guys!

15:02 bbloom: zphds: see also ##(doc with-open)

15:02 lazybot: ⇒ "Macro ([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."

15:03 zphds: bbloom: I attempted with-open, but the [o (output-stream path)] has to be the first pair?

15:03 justin_smith: zphds: also, hanging close braces only make the code harder to read for anyone familiar with a lisp family language

15:04 bbloom: move the .mkdirs outside of the let. defn's body is in an implicit do

15:04 zphds: bbloom: so I couldn't set things up for the with-open block in the order I wanted

15:04 bbloom: then let photos & fullpath

15:04 then with-open out and zout

15:04 then doseq & doto

15:04 zphds: ah

15:04 callen: zphds: props for abusing let already. Took me ages to figure out you could do that.

15:04 zphds: that's a neater idea

15:05 callen: haha

15:06 technomancy: zphds: usually closing an "outer" stream will close the inner one too

15:06 callen: MFW: my coworkers are more excited about Datomic than Clojure.

15:06 * callen brb crying tears of blood

15:07 zphds: technomancy: ah ok… that one flew right by me

15:07 wink: callen: #firstworldproblems :P

15:07 ro_st: good instinct. Datomic is -ing awesome.

15:07 callen: wink: we are in the tar pit of Python. It's awful.

15:07 wink: lol

15:07 callen: we can't even seem to reliably package our shit up for deployment.

15:07 ystael: callen: isn't that a snake pit

15:07 ToxicFrog: callen: could be worse. You could be in the tar pit of C++.

15:07 callen: ystael: python wasn't named after a snake.

15:07 ToxicFrog: Where the tar is actually made of razorblades.

15:07 wink: or C#

15:07 callen: ToxicFrog: I'd prefer that.

15:07 ToxicFrog: because then at least I'd get some fucking respect.

15:07 zphds: are there any online resources that details the conventions and good practices?

15:07 ystael: callen: yes, yes, i am aware of that. it was a pun of admittedly mediocre quality.

15:08 callen: "oh you're a C++ programmer? Let me give way then..."

15:08 ToxicFrog: wink: IME C# is honestly not that bad. I'd take it over C++ and Java, at least.

15:08 wink: zphds: https://github.com/bbatsov/clojure-style-guide for example

15:08 zphds: wink: cool

15:08 callen: that guide isn't wholly accurate or credible.

15:08 ToxicFrog: callen: yes, but what does respect get you when you pay for every day with your sanity and/or liver?

15:08 callen: please do not recommend batsov's guide as if it were authoritative.

15:08 wink: ToxicFrog: it's not such a bad language. but I still have no good experiences :P

15:08 ToxicFrog: ...I feel like there's a version of the Chemical Worker's Song that applies to C++ programming kicking around in my head somewhere.

15:09 wink: callen: "for example". but ok

15:09 zphds: see above. But I find it better than nothing at the start

15:09 ystael: ToxicFrog: isn't the best feature of C# called "F#" ?

15:10 TimMc: zphds: As far as indentation goes, just trust Emacs.

15:10 zphds: wink: cool…

15:10 wink: callen: well do you have better resources? :)

15:10 stuartsierra: zphds: http://dev.clojure.org/display/community/Library+Coding+Standards

15:10 zphds: TimMc: yep! with nrepl it just kicks ass

15:10 TimMc: nooooo

15:10 ToxicFrog: ystael: I haven't actually used F#

15:10 TimMc: stuartsierra: I hate that that page recommends map destructuring in args. ;_;

15:10 *restargs

15:10 ToxicFrog: I have high hopes for clojure-clr, though

15:11 wink: .oO( how to incite a peaceful channel in 3 easy steps. style guide, languages, editors )

15:11 zphds: wink: haha

15:11 and all it takes is a newbie to do that :)

15:11 TimMc: It's pretty hard to get this channel up in arms about editors, thankfully.

15:11 wink: zphds: your're just a catalyst :P

15:12 ro_st: wink: wait until you see what happens when someone mentions the CA

15:12 * ystael ducks

15:12 zphds: what's a CA :D

15:12 TimMc: haha

15:12 Fer`: yogthos: ping

15:12 * nDuff hides

15:12 wink: I'd say Certificate Authority, but apart from leiningen and clojars I can't imagine what he meant :P

15:12 yogthos: Fer`: howdy

15:12 * TimMc barricades himself in the panic room

15:13 wink: hint: ssl in java is painful

15:13 Fer`: yogthos: hello, in selmer is {% for x in foo.bar %} not supported?

15:13 TimMc: wink: Let's just pretend that's what CA refers to here. :-P

15:13 Yes, very good.

15:13 yogthos: Fer`: uhm should be...

15:13 zphds: oh

15:13 and going by the naming convention

15:13 Fer`: yogthos: maybe I have an error in my code I'll run more tests

15:14 zphds: I should be renaming make-archive into make-archive!

15:14 cespare: is that the same C and A as in CLA?

15:14 zphds: since I have seen that '!' usually means that there is a side effect lurking beneath

15:15 cespare: haha do you seriously have to mail this thing?

15:15 ro_st: no! shush!

15:16 don't say it!

15:16 yogthos: Fer`: so this definitely works (render " {% for x in foo.bar %} {{x}} {% endfor %}" {:foo {:bar (range 5)}})

15:17 callen: Fer`: post code please?

15:17 Fer`: Refheap.com

15:17 wink: as someone totally oblivious... was clabango too slow? or why selmer? (I take it it's newer?)

15:18 Fer`: yogthos: this doesnt seem to work (selmer.parser/render "{%for x in foo.0%} {{x.id}} {%endfor%}" {:foo [{:id "s"} {:id "a"}]})

15:18 TimMc: wink: s/editors/templating libraries/, actually

15:18 callen: I've explained this before, but Clabango was too slow and the owner wasn't interested in maintaining it.

15:18 wink: callen: thanks

15:18 callen: TimMc: there's peace in the land. Selmer exists.

15:21 yogthos: Fer`: that wouldn't no :)

15:21 Fer`: foo.0 is a map

15:22 Fer`: this is fine (selmer.parser/render "{%for x in foo%} {{x.id}} {%endfor%}" {:foo [{:id "s"} {:id "a"}]})

15:22 Fer`: this is also fine (selmer.parser/render "{{foo.0.id}}" {:foo [{:id "s"} {:id "a"}]})

15:23 wink: *sigh* wish I'd not used a now-nonmaintained static site generator

15:23 Fer`: oh im stupid i should have a nested vector

15:23 bhauman: publishing my next core.async post http://rigsomelight.com/2013/08/12/clojurescript-core-async-dots-game.html

15:24 yogthos: Fer`: no worries :)

15:25 bhauman: nice!

15:25 ro_st: 69

15:25 is that a high score, bhauman?

15:25 Fer`: yogthos: what about this: (render "{%for x in foo.0%} {{x.id}} {%endfor%}" {:foo [[{:id "s"} {:id "a"}]]})

15:25 i fear i'm being stupid again

15:25 ro_st: bhauman: i very quickly wanted diagonal matching :-)

15:25 bhauman: yogthos: thanks,

15:25 ro_st: the original doesn't have it and it makes the game to easy

15:26 the post is on HN now

15:26 ro_st: makes sense :-)

15:26 Jblaze: Hello, I am trying to dump a blob from a mssql to file I am able to query and get a resultset but cannot figure out how to right it to bytes any insight?

15:27 (write)

15:27 yogthos: Fer`: that might be a bug :)

15:28 Fer`: yogthos: aw :-( what do you recommend i should do. Flatten my vectors a bit?

15:28 ro_st: Jblaze: tried (spit "filename" (pr-str data)) ?

15:29 yogthos: you could do this (render "{%for x in foo%} {% for y in x %} {{y}} {%endfor%} {%endfor%}" {:foo [[{:id "s"} {:id "a"}]]})

15:29 it's a bit uglier :)

15:29 ro_st: bhauman: this looks great. i've added it to my CSP queue

15:29 bhauman: ro_st: thanks :)

15:29 ro_st: or is that to my CSP channel?

15:30 yogthos: Fer`: I'll take a look at supporting that though

15:31 Jblaze: yes it truncates

15:31 tbaldridge: bhauman: what is the reasoning behind using all the put! vs >! inside a go?. And why use only one channel for the render pipeline, instead of one between each step?

15:31 Jblaze: unfortunately

15:31 Fer`: yogthos: Looking forward to it ty

15:34 bhauman: tbaldridge: I am assuming you are talking about the get-drawing fund. I am just using go as a promise in this case

15:34 dnolen: bhauman: wow impressive post, no atoms!

15:35 bhauman: dnolen: thanks, i really appreciate that

15:35 hn votes appreciated ;)

15:35 bbloom: dnolen: hehe. is that the new purity test? replace all your atoms w/ loop/recur? (inc erlang)

15:36 (inc erlang)

15:36 lazybot: ⇒ 2

15:36 tbaldridge: erlang: "we don't have state...or actually we do, we just hide it inside closures where you can't get at it..."

15:37 callen: pretty much ^^

15:37 bbloom: so i've been thinking more about the "wither actors" thing

15:37 bhauman: tbaldridge: i am still trying to parse your render pipeline question. My answer is probably that I was just going for a straight forward implementation

15:37 bbloom: i agree that queues (and hence channels) are preferable

15:37 however, i don't think channels are more primitive, at with respect to concurrency instead of distribution

15:38 i feel like actors : lists :: channels : abstract data types

15:38 +1 of indirection = /2 headaches

15:39 at with => at least with

15:40 tbaldridge: bhauman: just a thought, you could keep the system almost exactly as you have it, but implement it as a dataflow graph, might be a bit easier to understand the code that way.

15:42 bhauman: tbaldridge: meaning use more channels to separate concerns?

15:43 tbaldridge: actually not picking up what you are getting at

15:44 ToBeReplaced: so... how long does it take before i should be able to post issues on jira?

15:45 tbaldridge: bhauman: I haven't spent a ton of time in the code, but things like select-chan seem a bit odd to me. We're going to read a message from the chan, check it with pred, then throw it out?

15:45 bhauman: Yep that

15:45 tbaldridge: IMO, that sounds like someone is putting something into a chan that doesn't belong there.

15:46 bhauman: tbaldridge: Yep that was used to bleed off events

15:47 tbaldridge: I think you could get rid of that with a combination of sliding buffers and/or more channels.

15:48 bhauman: tbaldridge: there is a state problem when someone completes a circuit. And I need to wait until they let go of the screen to consume the draw end event.

15:50 tbaldridge: I agree, I am going to revisit it, drawing is difficult and I used it to handle edge cases

15:50 dnolen: bhauman: typo, s/cheetsheet/cheatsheet

15:50 Cho0fool: callen is installing yesod(haskell web frame work) now http://www.qadate.com/images/haha-nelson.jpg

15:51 callen: I do that about once a month to check to see if cabal is still broken.

15:51 still broken, for any wondering.

15:51 Cho0fool: see you in a month!

15:53 Raynes: callen: They're working on it though.

15:53 The sandbox stuff.

15:53 The only problem with the sandbox stuff is that compiling Haskell takes forever.

15:53 callen: I was using cabal-dev and it still broke on the first build for a single package.

15:53 Raynes: Elixir compiles shit at the speed of sound cuz parallel.

15:54 ystael: Raynes: thank you for clojail! clojail.core/thunk-timeout was just what the doctor ordered yesterday

15:54 Raynes: You're welcome.

15:55 I wonder if thunk-timeout will work forever.

15:55 bhauman: dnolen: fixed

15:55 Raynes: They deprecated .stop ages ago, but haven't actually removed it. Do they ever remove things? Ever?

15:55 ystael: Raynes: well, for my use case, it only needed to work until 8 PM yesterday :D

15:56 glosoli: Are there some very popular commercial products written in Clojure ? Just got curious, not that I am judging the language by the products it powers

15:56 callen: glosoli: Hotelicopter, before they got bought out.

15:56 Weatherbill

15:56 dnolen: bhauman: really really fantastic post, read it more or less all the way through. Will give a more in depth review later.

15:56 callen: a rather large dating site network. a geneaology service.

15:57 bts-: flightcaster is clojure i think?

15:57 bhauman: dnolen: lookin

15:57 dnolen: forward to it

15:57 glosoli: thanks ! :)

15:58 pmonks: Weathertron (though ClojureScript on mobile)

16:02 H4ns: sorry for another beginner q: how can i construct a map from an array so that the keys are the values from the array and the values are the results of calling some function with the key as argument?

16:04 patchwork: H4ns: (into {} (map (fn [k] [k (f k)]) array))

16:05 Where `f` is your function

16:05 H4ns: patchwork: ah, so simple! thanks a bunch!

16:06 patchwork: Yep! clojure is beautiful

16:08 Raynes: (into {} (map (juxt identity f) array))

16:08 patchwork: ^

16:08 :

16:08 :3

16:08 yogthos: Fer`: so yeah that was a bug in parsing the keys, I got it fixed and will push out a new version tonight

16:08 ystael: everything's better with juxt

16:08 llasram: (inc Raynes)

16:08 Raynes: ~just

16:08 lazybot: ⇒ 34

16:08 clojurebot: excusez-moi

16:08 Raynes: ~juxt

16:08 clojurebot: juxt is the bestest option though if it doesn't weird you out

16:09 hyPiRion: (zipmap array (map f array)) ;; duh.

16:09 H4ns: it weirds me quite a bit

16:09 patchwork: juxt! I should have known if I wasn't using juxt there was something wrong

16:09 ToxicFrog: Yeah, zipmap was my first through

16:09 *thought

16:09 Raynes: hyPiRion: You're a bad person.

16:10 H4ns: woha, juxt.

16:10 thanks.

16:10 zphds: maybe another topic that can incite some fights in this channel, :), but what is the 'flask microframework' in the clojure world?

16:10 lib-noir + compojure?

16:11 glosoli: what are some best resources around cljs ?

16:11 yogthos: zphds: http://www.luminusweb.net/

16:11 piranha: what's fn*? :) Just saw it in (macroexpand '#(...))

16:11 zphds: yogthos: cool, let me take a look...

16:15 ztellman: piranha: it's one of Clojure's fundamental forms

16:15 hyPiRion: Raynes: I know.

16:15 Fer`: yogthos: kk

16:15 tcrawley: dnolen: you should pressure bhauman to come to the conj

16:15 ztellman: try macroexpanding (fn [[x y]]) to see how it differs from the normal fn

16:15 piranha: ah ok

16:16 ztellman: thanks! I see now :)

16:18 gtrak: piranha: if you're really curious: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L46

16:19 piranha: so it's actual function, unlike 'fn', which is a fancy wrapper around it

16:19 hehe, the same with other destructuring forms, like loop or let

16:19 cespare: ztellman: I don't get it.

16:19 (macroexpand '(fn [x] (+ x 1)))

16:19 (fn* ([x] (+ x 1)))

16:19 gtrak: it's the bottom level that the compiler deals with, after macroexpansion

16:20 piranha: cespare: (macroexpand '(fn [[x]] x))

16:20 tbaldridge: ,(clojure.walk/macroexpand-all '(fn [[x y]] (+ x y))

16:20 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

16:20 tbaldridge: ,(clojure.walk/macroexpand-all '(fn [[x y]] (+ x y)))

16:20 clojurebot: #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk>

16:20 piranha: gtrak: yes, I see. It was interesting to see (macroexpand '(let [[x] [1]] x))

16:21 gtrak: macroexpand is also part of the compiler

16:21 it's recursive, outer-first

16:21 piranha: sure :)

16:22 (fn* ([p__4116] (let* [vec__4117 p__4116 x (clojure.core/nth vec__4117 0 nil)] x))) - are there any optimizations performed further? I.e. dropping first part of let?

16:23 tbaldridge: there's no point, the JVM jit will remove the vec__4117 p__4116 part

16:24 piranha: I see

16:24 well this is fun stuff :)

16:24 bbloom: i really wish there was a symbolic representation of the jvm byte code & i could do the moral equiv of a macroexpand on it

16:25 piranha: too bad compiler is in java, it's a bit harder to read than clojure :-)

16:25 tbaldridge: bbloom: there is

16:25 bbloom: piranha: the clojurescript compiler is written in clojure. many important differences, but the structure is illuminating, none the less

16:25 hiredman: bbloom: well, you mean javap?

16:25 ztellman: bbloom: https://github.com/gtrak/no.disassemble

16:26 it's really, really useful in certain situations

16:26 bbloom: oh awesome

16:26 hiredman: no.diassemble seems kind of meh

16:26 bbloom: i wish it was in an sexpr form, but i guess i can settle on this

16:26 gtrak: it's pretty trivial, I'll be the first to admit :-)

16:26 hiredman: way too much, you can capture the bytecode without all that

16:26 ztellman: hiredman: it only gives you a pretty-printed version

16:26 which is all the Eclipse debugging library gives you, unfortunately

16:27 bbloom: still, cool stuff!

16:27 ztellman: I've toyed with trying to dig deeper, but it's been enough for every situation I've needed to know about the bytecode

16:27 hiredman: I have a replacement for eval somewhere that captures the bytes of any generated classes

16:27 piranha: bbloom: but there is a GSoC about doing actual clojure compiler in clojure, right?

16:27 hiredman: so you don't need an agent, etc

16:27 bbloom: piranha: yeah, i believe Bronsa is working on that. my understanding is that his plan is to 1-for-1 port the java & worry about making it more idiomatic later

16:27 so it's likely to be some pretty ugly clojure

16:28 gtrak: hiredman: yea, this was in lieu of modifying clojure itself, or the classloader code.

16:28 bbloom: maybe even uglier than the original java! :-P

16:28 piranha: :))

16:28 gtrak: it's really a brute-force approach

16:28 ztellman: I dunno, I just use it as a default plugin, and don't think about it

16:28 I'm wasting literally megabytes of memory, I know, but somehow I survive

16:28 bbloom: i haven't needed to tune perf down to that level yet, thankfully

16:28 gtrak: ztellman: I was worried about this, I guess it's not a problem in practice?

16:29 dnolen: bhauman: HN is so weird, your post got ringed

16:29 bbloom: dnolen: vote ring detection is a serious issue

16:29 hiredman: https://gist.github.com/6214648

16:29 futile: kill inheritance plz

16:29 bhauman: dnolen: yeah iot's down at 42 now

16:29 ztellman: bbloom: you discover some interesting things using it

16:29 futile: kill complexity plz

16:29 kill over-engineering plz

16:29 dnolen: bbloom: as in it doesn't make any damn sense

16:29 ztellman: for instance, the emitted bytecode for (if (< x y) …) and (if-not (> x y) …) are completely different

16:29 bbloom: i worked in an office with ~30 startups coming and going. the "PLEASE VOTE UP MY STORY" emails from newbie startup founders were basically a biweekly occurrence

16:29 ztellman: the former is much, much more efficient

16:30 bbloom: so posting your story to the same small group, like here in #clojure, a few times in a row is a surefire way to get a story killed

16:30 futile: kill the prevalent attitude of late that highly encourages and praises all these things plz

16:30 fin.

16:30 hiredman: ztellman: is the jitted asm any different?

16:31 bhauman: dnolen: are you sure it was ringed?

16:31 ztellman: hiredman: I'm pretty sure it would be, unless the JVM is much more clever than I realized

16:31 gtrak: hiredman: nice, only downside is you still have to eval stuff manually, that big a deal really.

16:31 dnolen: bhauman: I can't imagine it getting flagged, it was in the top 10 5 minutes ago.

16:31 gtrak: not that big a deal, really*

16:31 dnolen: bhauman: you rarely see drop offs like that w/o ringing

16:32 ztellman: hiredman: actually, no, I'm sure. The latter was way slower.

16:32 dnolen: bhauman: of course there could be secret group of Clojure hating flaggers?

16:32 ztellman: dnolen: or Clojure hating mods?

16:32 hiredman: ztellman: sure, and you are sure it was jitted in your tests?

16:33 ztellman: hiredman: I used criterium, I think that absolves me of those sorts of concerns

16:33 hiredman: I mean, I am not doubting, just curious

16:33 ztellman: but I wasn't looking at JIT debug prints or anything

16:33 hiredman: looking at the implementation of if-not it looks like it would be pretty bad

16:33 bhauman: dnolen: well it's still getting votes and climbing

16:34 bbloom: HN is a lost cause, i'm pretty sure pg has given up on it at this point

16:34 ztellman: hiredman: in the slow case, it was a function invocation and a boolean object comparison

16:34 hiredman: extra function call to not, not has it's own if, etc

16:34 ztellman: yes

16:34 bbloom: sshhh nobody tell the hacker community about ltu

16:34 piranha: bbloom: well it seems there is still nothing better at this point...

16:34 Bronsa: bbloom: i am actually making it clojure-ish as I write it :)

16:34 ztellman: and that's not something that would ever happen in Java, so they probably didn't optimize it

16:35 bhauman: dnolen: perhaps no comments in an hour is an valid algorithm

16:35 piranha: bbloom: ltu is less general

16:35 bbloom: piranha: of course.

16:35 ztellman: hiredman: though I think if-not could just invert the clauses, right?

16:35 no need to actually call 'not'

16:36 tbaldridge: ztellman: whats this gonna do then? (if-not (mypred? 1 2))

16:36 hiredman: ztellman: maybe, also as people don't depend on macro expansion ordering

16:36 as long as

16:36 ztellman: tbaldridge: there are no clauses in that, I'm confused

16:37 hiredman: (if-not (foo? 1 2) :a :b) => (if (foo? 1 2) :b :a)

16:37 tbaldridge: oh, nvm, I understand, just re-order the if/then

16:37 ztellman: exactly

16:37 bts-: and if there's no else clause, insert nil for the missing clause

16:38 ztellman: that would fix the unpredictable performance in the (if-not (< x y) …) case

16:38 but it's not clear if anyone but me cares

16:38 and I can manually reorder, I guess

16:40 hyPiRion: ztellman: well, it's essentially just changing `(if (not ~test) ~then ~else) to `(if ~test ~else ~then), isn't it?

16:41 (in the if-not macro)

16:41 ztellman: hyPiRion: sure, but I'm not hopeful w.r.t. the chances of a patch on if-not making it into Clojure proper

16:42 maybe someone with more juice could give it a shot

16:43 bbloom: hyPiRion: that's a broken macro

16:44 ugh wait no, nevermind

16:44 ztellman: haha, I was going to say, I don't see it

16:44 bbloom: sorry, javascript on the brain atm

16:47 TimMc: s/ on if-not// :-(

16:49 zerokarmaleft: bbloom: LtU is safely of such high caliber that I don't think scrubs would even bother commenting with pretense

16:49 TimMc: Although apparently the unsigned-bit-shift-right patch might be getting some love, since it is interfering with Clojure-in-Clojure data structures.

16:49 amalloy: ztellman: start by submitting a patch that turns 'not into an inlining macro that knows about how and, or, <, >=, and all those guys are related, so that it emits simplified forms. then the smaller patch to make if-not less silly will look more friendly

16:50 hiredman: start by turning if-not in to a macro that uses a SSA representation to examine the predicate...

16:51 bbloom: zerokarmaleft: i've been attempting to grok everything i see on LtU. it's taken me a few years, but i finally feel like anything that is over my head upon first glance is now at least approachable within an hour or two

16:52 ztellman: TimMc: https://github.com/ztellman/primitive-math problem solved

16:53 zerokarmaleft: bbloom: I have a bit more Benjamin Pierce to read on that score

16:53 ztellman: seriously though, the amount of grief I saved myself by just creating simple wrappers for static Java functions is immense

16:53 ystael: (inc ztellman) ;; starred, thank you!

16:53 lazybot: ⇒ 6

16:54 hiredman: it would be really nice if the compiler's set of intrinsics was extendable

16:55 ztellman: hiredman: with the escape hatch of just using java, why does it need to be?

16:55 bbloom: maybe there needs to be a java* primitive :-)

16:55 hiredman: or if numbers.java wasn't so gross, or the inlining and intrinsic stuff was more consistent

16:55 ztellman: bbloom: you've seen alan dipert's javastar library, right?

16:56 bbloom: lol of course that exists.

16:56 hiredman: ztellman: because I don't want to write java

16:56 bbloom: so extensible compilers is a bit of a hobby interest of mine

16:56 ztellman: bbloom: I think it beats out my local mutable variable hack for sheer hilarity

16:56 hiredman: I want a core.logic rules and data driven generation of numbers.java and intrinsics.java

16:57 bbloom: hiredman: have you seen tbaldridge's ssa+datalog stuff? fun things coming :-)

16:57 ztellman: hiredman: totally understandable, but sometimes it's easier to cut the gordian knot with https://github.com/ztellman/primitive-math/blob/master/src/primitive_math/Primitives.java than by throwing more code and abstractions at the problem

16:57 hiredman: bbloom: I've not

16:57 bbloom: tbaldridge: chime in here w/ a link for hiredman

16:57 hiredman: ztellman: sure

16:59 ztellman: and the end product of what I want would I think be similar, a bunch of static jvm methods, but machine generated ensuring consistency of what is inlined and what isn't, what has intrinsics and what doesn't etc

16:59 ztellman: hiredman: also a pony

16:59 hiredman: https://github.com/hiredman/Archimedes/blob/master/src/Archimedes/foo.clj

17:00 bbloom: ztellman: i don't think it's an impossible request

17:00 hiredman: actually, that is the old bad one

17:00 tbaldridge: hiredman: I haven't worked on it in some time (got sidetracked with core.async) but this is a simple type inferencer for SSA code https://github.com/halgari/mjolnir/blob/master/src/mjolnir/ssa_rules.clj

17:00 hiredman: https://github.com/hiredman/Archimedes/blob/master/src/Archimedes/bar.clj

17:00 ztellman: bbloom: definitely not impossible, but anything in that vein needs to either do an end run on the compiler, or we need to wait for CinC

17:01 hiredman: so it generates a bunch of method signatures right now

17:01 ztellman: either will take a while

17:01 tbaldridge: core.async trivia.... The SSA dispatch system is extensible. So you can do stupid crazy stuff like this with it: https://github.com/halgari/async-bench/blob/master/src/async_bench/core.clj#L108

17:01 bbloom: ztellman: oh yeah, CinC is the gating factor for additional compiler cleverness. i'm sure Bronsa will accept some help :-)

17:02 hiredman: Mjöllnir is a great word, I have my irssi setup to replace h a m m e r with Mjöllnir every time I type it

17:03 ztellman: don't get me wrong, I would love to see all this stuff, and I think we've made some great progress towards an extensible compiler in the last year

17:03 technomancy: I named my guitar that in high school

17:04 bbloom: tbaldridge: can you elaborate on what's going on there?

17:04 ztellman: but CinC was discussed at the first Conj, and it has yet to emerge as anything other than "a thing we could do, sometime"

17:04 TimMc: ztellman: Hmm, nice! (primitive-math)

17:04 bbloom: tbaldridge: you extended the SSA with a generators/yield operation?

17:05 ztellman: I'm interested in approaches that aren't gated on CinC that give comparable results, albeit with less elegance

17:05 tbaldridge: bbloom: right, there's nothing hard-coded in the ioc_macros.clj file for core.async. Everything is handed to the processors at macro expansion time. This means you can define yield/<!/>! etc.

17:05 hiredman: ztellman: I don't the changes I am thinking of to numbers.java would require CinC

17:05 bbloom: tbaldridge: awesome. i was trying to make some sense of ioc_macros & see how extensible it was. i was curious if i could use it to implement non-determinism

17:05 ztellman: hiredman: oh, maybe I was misunderstanding, you want to modify numbers.java itself?

17:06 bbloom: tbaldridge: looks like i could

17:06 tbaldridge: looks like this yield is as general as the one described in here: http://lambda-the-ultimate.org/node/4349

17:06 tbaldridge: bbloom: this is a simpler example, but done with an "identity" function. That is, it does a state-machine translation, but with no change in the resulting semantics: https://github.com/clojure/core.async/blob/1aff841e2d1f5cd7b35b2ea232d10187ce268888/src/test/clojure/clojure/core/async/ioc_macros_test.clj#L14

17:07 TimMc: ystael: Did you ever figure out why unchecked-add was giving you overflow exceptions?

17:07 tbaldridge: So most of the core.async code is tested against this "runner" macro. it really simplifies testing alot

17:07 TimMc: 'cause that was pretty freaky

17:07 bbloom: tbaldridge: that's awesome

17:07 ztellman: TimMc: yeah, I used it to make https://github.com/ztellman/immutable-bitset/blob/master/src/immutable_bitset.clj

17:07 hiredman: ztellman: generate a replacement numbers.java (and maybe intrinsics.java, and maybe generate jvm bytecode directly, no .java) using data describing numeric types, the operations on those types, and rules for what kind of operations are allowed on what types, and what return values are allowed for what types

17:07 bbloom: tbaldridge: i really like the idea of viewing computation effects as pausing a sub process & communicating with the parent process

17:08 TimMc: ztellman: Immutable bitset... a.k.a. BigInteger? :-D

17:08 bbloom: tbaldridge: fits my brain much better than the delimited continuations view of the world. shift/reset is just mind melting, even though i can generally understand them given enough time to work it out on paper

17:08 ztellman: TimMc: leaner in the sparse element case, and actually looks like a Clojure set

17:09 tbaldridge: bbloom: yeah, I'm interesting in exploring how this sort of thing could be used in more bizarre examples, for example, parsers. I wonder how many monads we can kill in the process :-P

17:09 TimMc: Hmm, cool.

17:09 ztellman: also has a transient variant, so you're not forced to clone the bit array each time

17:09 bbloom: tbaldridge: in theory, you can kill *all* the monads. i'm pretty sure that yield == delimited continuations == monads

17:09 * TimMc stars all of ztellman's repos

17:09 ztellman: haha

17:10 tbaldridge: bbloom: that's my theory as well, but I have no proof.

17:10 bbloom: tbaldridge: luckily, the PL community has proven it for you!

17:10 i just finished groking a pile of this stuff

17:11 ystael: bbloom: can you recommend a bibliography or reference list? or is it more "read LtU and chase links for a sufficiently long time" ?

17:11 TimMc: no, i think that was temporary repl gremlins, i never saw it again

17:11 bbloom: http://okmij.org/ftp/ is a great place to start

17:11 over the past 6 months or so, i've been basically trying to understand everything that guy has ever touched :-)

17:11 ystael: bbloom: oh. "To begin, become as smart as Oleg." Got it. :D

17:12 bbloom: ystael: start reading :-)

17:13 ztellman: on a non-Clojure note, is anyone reading the Hyperloop pdf?

17:13 bbloom: tbaldridge: so yeah, oleg & shan and spj and a few other folks have written about how a generalized version of yield (with both input and output) actually macro expresses single-level delimited continuations

17:13 tbaldridge: bbloom: nice! I'm going to read that paper then

17:13 bbloom: tbaldridge: multi-level delimited continuations & full continuations are basically GOTO, so that's a bad plan

17:14 tbaldridge: yeah, definitely read that. then there is one other one you need to read about "handlers"… let me find this for you

17:15 tbaldridge: http://math.andrej.com/2012/03/08/programming-with-algebraic-effects-and-handlers/

17:15 that's the one

17:15 it's in an ocaml-like language, which is much more pleasant to read than haskell IMO ;-)

17:16 anyway, the idea there is that instead of delimited continuations, you have "handlers" and then you run a piece of code inside a handled block

17:16 tbaldridge: (inc bbloom)

17:16 lazybot: ⇒ 12

17:16 bbloom: just like spinning off a sub process

17:16 the way you implement things like dynamic-wind (ie finally blocks) is you just run the sub process, then when the sub process is done, you do your cleanup code

17:16 the way you do things like dynamic bindings is you yield with a message "hey, give me the binding of X" and the parent process either responds or forwards the request up the chain

17:17 this pattern lets you create a process tree that can cleanly handle computational effects

17:17 and there is a really clean algebraic treatment of this approach as well

17:17 * bbloom dusts the monads off his hands

17:18 callen: bbloom: thinking of giving a talk on monads at my company. Should I explain them in terms of meteorites or burritos?

17:18 bbloom: i just wish we had macros with dynamic-extent :-( it would be so nice to have non-local transforms into SSA

17:19 ztellman: callen: monads are like a Lovecraftian horror...

17:19 tbaldridge: callen: I prefer to look at them as red-headed step-children

17:20 bbloom: tbaldridge: let me know once you've battled your way through those two papers. would love to hear your thoughts

17:20 tbaldridge: will do

17:20 callen: bbloom: you want dynamic extent?

17:20 * callen tap dances and gets ready to give his CL spiel

17:25 ystael: speaking of theoretical background, where is a good place to start for foundations behind core.async ? the CSP book ?

17:25 bbloom: tbaldridge: even without dynamic extent, it would be *bad ass* to build a pluggable effect system w/ the ioc macros. let me know how i can help if you decide to attempt that :-)

17:28 ystael: the golang community is a great source for the *practical* background

17:28 ystael: the theoretical background is yeah, the CSP stuff, plus SSA

17:28 cmatheson: ystael: i agree with bbloom, i've started going through the csp book but so far go code has been more helpful for writing core.async stuff

17:29 bbloom: there are also deep parallels to CPS (note the transposed P and S) and the various continuations work from the FP community

17:29 ystael: bbloom: (= (acronym-expand-1 "SSA") "static single assignment") ?

17:29 bbloom: true

17:29 csp = communicating sequential process; cps == continuation passing style

17:30 * ystael tries to remember where he put appel's compiler books

17:30 bbloom: although i'm no longer a believer in unencapsulated, reified continuations

17:30 ystael: bbloom: in the sense of Scheme "full call/cc" ?

17:31 bbloom: yeah

17:31 even in that second paper i linked, where they do reify delimited continuations as functions

17:31 they don't allow the continuations to escape (i think)

17:33 tbaldridge: you should totally open source a core.yield library too. i think people would totally dig that as well

17:35 ystael: bbloom: having trouble finding the precise reference for the "first paper" you mentioned above

17:35 (oleg, shan, spj)

17:36 bbloom: it's linked right on top of http://lambda-the-ultimate.org/node/4349

17:36 http://parametricity.net/dropbox/yield.subc.pdf

17:36 ystael: bbloom: cool, thank you!

17:37 bts-: bbloom: unencapsulated == undelimited?

17:38 bbloom: bts-: unencapsulated meaning you can edit or inspect them

17:38 (outside of debugging, i mean)

17:38 bts-: i see. thanks

18:17 hiredman: I did a little yield macro for a restartable json encoder I was thinking about

18:18 https://github.com/hiredman/json/blob/master/src/com/thelastcitadel/cps.clj

18:29 Fer```: read-string and edn/read-string seem really buggy with windows files

18:30 hiredman: 1. read-string doesn't have anything to do with files 2. you have a bad default encoding

18:31 Fer`: I have a config file i wrote on linux that gets parsed fine but when i open it in readme on windows and make a change read-string doesnt even return nil o.o

18:31 hiredman: sorry i do (read-string (slurp file))

18:32 well the file is originally encoded in utf-8 and then i open it with notepad

18:32 hiredman: 1. that is a gross way to files 2. have you checked the output of slurp?

18:32 3. what is returned?

18:33 Fer`: hiredman: the same file only with crlf. Also what would be better than that?

18:33 hiredman: slurp reads the entire thing in to memory as a string

18:33 Fer`: yeah it returns a string with crlf

18:33 and read-string silently blows up or something it doesnt return anything

18:34 hiredman: reading the entire config file in as a string in order to turn and around and hand ti the clojure reader via read-string is silly

18:34 Fer`: that isn't possible

18:34 Fer`: your repl must be broken, how are you running the code?

18:35 a bare clojure.repl? lein repl? slime? nrepl? counter clockwise?

18:36 Fer`: hiredman: nrepl: https://www.refheap.com/17541

18:36 hiredman: what nrepl client?

18:36 Fer`: mm how do i know that

18:36 hiredman: how do you start it?

18:37 Fer`: i do nrepl-jack-in on emacs

18:37 hiredman: what version of nrepl.el?

18:37 I guess it doesn't matter

18:38 are you using something like the latest?

18:38 where did you get your nrepl.el?

18:38 Fer`: it says 0.1.8

18:38 from emacs live

18:39 well anyway it's broken if i uberjar my program and do java -jar anyway. the configuration values get turned to nil after i make any change

18:39 hiredman: Fer`: they can't get "turned to nil"

18:40 Fer`: hiredman: but that's what happenning :-(

18:40 hiredman: Fer`: most likely you are trying to read a file that doesn't exist, you should be using resources from the classpath (clojure.java.io/resource etc)

18:40 Fer`: no the file is outside the jar

18:41 hiredman: Fer`: what happens if you java -cp the-uber-jar clojure.main

18:41 then try to slurp your file

18:44 Fer`: hiredman: it seems to slurp fine i guess, there are some weird characters where there should be accents (it's in spanish) but that's prolly because of the dumb windows console

18:46 read-string still fails though and it returns a ?

18:46 at least that's what the windows console tells me :'P

18:47 hiredman: Fer`: could be, or could be a dodgy windows encoding, which the jvm will use if you don't tell it to use something non-crazy

18:47 ~encoding

18:47 clojurebot: Cool story bro.

18:47 hiredman: ~google jvm file encoding

18:47 clojurebot: First, out of 75300 results is:

18:47 utf 8 - Setting the default Java character encoding? - Stack Overflow

18:47 http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding

18:47 upwardindex: I've read that parsing EDN on the client side is about 3 times slower than json, anyone has looked at how much faster EDN generation is on the server side compared to cheshire?

18:56 yogthos: Fer`: ok selmer 0.3.8 is up on clojars and should work as expected ;)

18:57 ztellman: upwardindex: I wouldn't assume it's faster

18:57 jackson, the library that cheshire uses, is heavily optimized

18:58 Fer`: yogthos: nice

19:01 well, making the file from scratch in notepad works but porting it from linux then modifying in notepad breaks everything. Why is programming so hard :-(

19:02 justin_smith: notepad bug?

19:02 Fer`: Uhm well i can't expect people to modify configuration files in windows with anything else

19:03 hiredman: notepad does ascii, so if you have weird characters in there editing the file in notepad will break it

19:03 Fer`: I guess i can try removing the non english characters

19:05 hiredman: is this better? (with-open [in (PushbackReader. (FileReader. path))] (edn/read in)) The other way seemed more succint :')

19:06 hiredman: yes, but you can use clojure.java.io/reader and clojure.java.io/file instead of FileReader

19:06 Fer`: ty for your time

19:13 hiredman: http://pythonforbiologists.com/index.php/29-common-beginner-python-errors-on-one-page/ this is great

19:14 technomancy: hiredman: you gonna make a clojure one?

19:15 justin_smith: [does it work in the repl but not in -main] -> [does your code use map or for?]

19:15 hiredman: "did you get an exception?" - yes -> "did you read it?" - no -> "which public school system failed you?"

19:15 justin_smith: hah

19:16 reading clojure stacktraces is a special kind of literacy, thanks to laziness in particular

19:16 technomancy: "Maybe we can still find something to talk about. Like how you let your family down."

19:16 http://achewood.com/index.php?date=09232002

19:21 ToxicFrog: Man, that flowchart is way too optimistic

19:22 [Do you get an error when you run the code]--yes-->[What type of error do you get]--don't know, didn't read it-->[Ok, so read it]--I already closed the terminal-->[Run the program again, then]--how?-->[I'm leaving now to drink heavily]

19:24 justin_smith: imagine if people tried to work that way in the real world "I tried to buy bread at the store it didn't work" "how didn't it work?" "I asked the guy for the kind of bread I wanted and he said something but didn't give me bread" "what did he say?" "I dunno"

19:25 ToxicFrog: I know

19:26 bja: pretty sure people I know actually do that

19:26 ToxicFrog: And yet, a depressing number of people - and not just people attempting to program - react to error messages by closing them instantly, without reading them

19:26 As if reading them would somehow CRASH THEIR BRAIN or something

19:26 bja: yes? That wasn't hyperbole on my part, that was drawn from years of watching people taking first-year CS

19:27 Unless you mean the bread

19:27 In which case I have no idea

19:27 bja: yeah, I've seen the first year cs thing, but I was talking about the generic non-computer stuff. in particular, with cars.

19:27 ToxicFrog: welp now I'm even more sad

19:29 futile: bruh

19:30 ToxicFrog: How does it work with cars?

19:36 johnmn3: hey, I'd like to use an nrepl with a file that I am accessing from the browser using a file:///... url, rather than served up from a server on localhost

19:37 I'm getting: Uncaught Error: URI file:/robots.txt is invalid for field ppu

19:37 bja: Mostly the same but dealing with indicator lights. I spent a non-trivial amount of time doing ECM testing for vehicles. It was part of my job to triage reports from suits driving prototypes. Getting some to tell you which indicator light was on was a hassle. Extracting any sort of report on what happened leading up to the indicator light never actually happened unless the person who found it was formerly an engineer.

19:41 Indicator lights are the world's easiest debug message. There are N different ones, and you should be able to communicate by asking them to point it out in a picture then finding out of it was solid or blinking.

19:42 johnmn3: "cross origin requests are only supported for HTTP."

19:43 bja: johnmn3: python -m SimpleHTTPServer 8080

19:43 johnmn3: a lot of browsers will section off interesting things from file:///

19:44 running a simple http server from the directory of your static html will help

19:45 johnmn3: bja: so how does one brepl to an app they are developing for the phone that is html5 based, but mostly offline? or even desktop-based web-apps? I guess I could fire up a server but it seems like a hastle

19:46 bja: johnmn3: I suppose that would depend a lot on how your phone's browser engine handles file:/// requests

19:47 johnmn3: it might be that something like webkit as a widget for android/iphone/whatever has relaxed rules on hitting, file:///

19:47 johnmn3: aye

19:50 noprompt: the number of stars frak has received over the past 24hrs is bit disturbing. is the problem it attempts to solve really that big of an issue for programmers?

19:51 nevertheless it's cool that people think it's interesting enought to star. :)

19:52 technomancy: more libraries should have a "Why?" section in the readme

19:52 * technomancy considers changing the lein default template

19:52 hyPiRion: noprompt: hey, don't complain. My most starred project is a hello world program.

19:53 noprompt: technomancy: i included a "Why?" section. although the answer is both snarky and truthful. :)

19:53 bja: johnmn3: https://groups.google.com/forum/#!topic/phonegap/meQSrujEsTo seems to indicate that XHR requests to file:/// are kosher on android's webview atleast

19:53 technomancy: noprompt: yeah, that's what I mean; you're setting a good example =)

19:53 noprompt: hyPiRion: no complaints here!

19:53 johnmn3: bja: you rock!

19:53 hyPiRion: good =)

19:54 bja: johnmn3: you might look at phonegap's java scaffolding for android to see how they initialize their webkit to be consistent

19:54 might be able to consult their scaffolding for iOS/etc too (or just use phonegap...)

19:55 noprompt: technomancy: my only hope is that if anyone plans to use it seriously, they ask themselves the same question.

19:55 johnmn3: bja: yea, using phonegap

19:56 bja: johnmn3: that makes me want to try to build a clang-based phonegap app now. thanks for killing my free time.

19:56 noprompt: i must say that guy guns deserves some credit. he's the one that actually verified whether the patterns frak was generating were really *that* much more efficient.

19:57 hyPiRion: you could turn your hello world project in to a repository for how to say hello in X language. then you could get some PRs!

19:57 :P

19:58 * johnmn3 just starred frak

19:59 hyPiRion: noprompt: hah, no. I'm actually happy with it just the way it is, stars doesn't really matter =)

19:59 noprompt: hyPiRion: i tend to agree. :)

20:00 if anything, i hope people get the battlestar reference. lol.

20:05 i love it when i edit a conflicting diff and delete the part i actually wanna keep. love it. <3

20:07 bja: noprompt: hope your editor has an undo tree

20:09 noprompt: bja: i did a git rebase -i (which i never do) had a conflict, editted, committed, then realized i fraked it up.

20:10 bja: iow, i can't fix it. i'm gonna have to rewrite the code from memory.

20:10 bja: maybe it mirrored somewhere and you hadn't pushed yet?

20:11 noprompt: bja: no, i did a git push -f right after. ha!

20:11 awalters: noprompt: if you once committed it, it's in the reflog

20:11 noprompt: fortunately it wasn't to master!

20:11 awalters: it's only if you haven't committed/stashed that you can really lose stuff

20:11 noprompt: awalters: oh rly?

20:12 awalters: http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html

20:12 it's always been something i need to read about when i need it...which thankfully is less and less

20:12 but it has saved my ass

20:12 noprompt: awalters: well, this is good information. thanks!

20:13 awalters: np. good luck!

20:15 noprompt: awalters: that's pretty neat. wow, you saved me some trouble.

20:15 awalters: great thing to know about in these situations. hopefully they don't come up often :-)

20:18 noprompt: indeed. this is the first time i've had this problem. i try to avoid using git rebase -i because i like to keep my commit history. this is probably another good reason to avoid it.

20:19 interesting. does this mean that git commit history is immutable?

20:19 tieTYT: i've taken this idea from stuart sierra I think in my JS code. Basically he says everything is a map. You pass in your world to a function and every function returns a world-type. This way a lot of your program can be written like this: (-> world a b c d e f) and you can rearrange everything without refactoring signatures

20:19 anyone know what I'm talking about? I'm hoping i didn't pervert the spirit of his suggestionm

20:19 bbloom: noprompt: modulo garbage collection

20:19 technomancy: noprompt: yes; basically only refs change in git

20:19 bbloom: git help gc

20:20 technomancy: which sounds awfully familiar

20:20 noprompt: bbloom: am i going to have to read a paper? :P

20:20 tieTYT: JS isn't purely functional and I basically use the same idea in my game. Most functions take a gameState object which is very similar to a Map

20:20 bbloom: technomancy: no idea what you're referring to. what could possibly be similar to immutabile+gc ?

20:20 noprompt: that's very cool.

20:20 bbloom: noprompt: nope :-)

20:21 technomancy: bbloom: if only programming languages had support for a kind of "references" which could point to different immutable things over time

20:21 * technomancy strokes his beard thoughtfully

20:22 bbloom: technomancy: yeah, and then just like we've got non tracking tags and tracking branches and various kinds of ways to talk about commits. what if we had different kinds of "references" that do different things when they point to different immutable things over time?

20:22 * bbloom strokes his beard thoughtfully with one hand while stroking technomancy's beard awkwardly with the other hand

20:23 technomancy: it's so crazy it just might work

20:23 noprompt: bbloom: did you go to college? someone was suggesting i should skip it and just read papers. can't remember if that was you.

20:23 bbloom: i went to college, but skipping it and just reading papers is a whole lot cheaper

20:23 noprompt: * dreads returning to college in a week.

20:23 bbloom: i dunno if i recommended that

20:24 my actual opinion is far more nuanced

20:24 but if your choice is college+debt, i recommend not-college+not-debt

20:24 noprompt: bbloom: i have something like 13 classes to complete before completing my bs, which amounts to about 20K. i'm debating whether the ROI is really going to be worth it since it's gonna take me 3 more years at the current rate.

20:25 ztellman: noprompt: 4 classes a year?

20:25 noprompt: ztellman: i work full time and don't want to get C's.

20:26 ztellman: but yeah, basically. maybe 5 if i can take a course during the summer.

20:26 cmatheson: noprompt: i was doing 1 class a semester by the end, you'll make it eventually

20:26 noprompt: i might be able to test out of something but i would still have to pay for the units i believe.

20:29 hiredman: noprompt: what do you think the return on the degree will be, if you are already working fulltime, do you expect a salary bump, or are you not working in your field already?

20:29 bbloom: i should also add that i studied comp sci for 4 years and learned more in 3 months at google than in 4 years at school

20:30 most undergraduate CS curriculums are a fucking joke

20:31 noprompt: hiredman: i'm not sure. mostly i've continued to go out of the fear not having the degree would hurt me somehow later in life.

20:32 ztellman: bbloom: what did you work on at google?

20:32 bbloom: translate.google.com

20:32 ztellman: ah, that'd be a good one

20:33 bbloom: was certainly jumping in the deep end

20:33 noprompt: hiredman: i do work fulltime as a programmer, but i make peanuts. i figure if i have a degree and a good OS profile i'd be able to land a much better job with better pay. it seems however a good OS profile can get your pretty far though so i've been debating the degree.

20:33 ztellman: I got stuck doing GWT frontend development, got out pretty quickly

20:33 bbloom: ouch.

20:33 hiredman: noprompt: yeah, that is an understandable concern

20:33 noprompt: bbloom: you are right about the undergrad CS courses being a joke.

20:33 bbloom: mine was more like "oh, hey. you don't know *anything* about machine learning or distributed systems? you've got a < 4 month internship to make one of the world's largest NLP systems faster. GO."

20:34 learned fast.

20:34 ztellman: ha, yeah

20:34 hiredman: not understandable in the sense that I've seen that happen or something, but understandable in the sense that it is something I worry about sometimes :)

20:34 ztellman: My paperwork got lost after I got an offer, basically I just got put in a team in the SF office that had a slot

20:34 no allocations, no nothing

20:35 bbloom: ztellman: i dunno about now, but in 2007, google's HR department was a black hole

20:35 technomancy: the most important thing I learned in my CS classes was how to configure wifi and stuff on linux so I could actually use my laptop to learn things while in my classes

20:35 bbloom: technomancy: why was that always so difficult?

20:35 ztellman: bbloom: they actually let most of them go ~2008, and had an 18 month hiring freeze

20:35 bbloom: there was some insane mac address entry form thinggie that didn't take normally formatted mac addresses

20:35 ztellman: I came in right at the end of that, everyone was a new hire

20:35 noprompt: hiredman: one thing that i do have at my job which makes up for the pay is the creative freedom i have. it's given me the opportunity to spend most of the year programming in clojure.

20:35 bbloom: ztellman: yes, i know about that hiring freeze. it's why i wound up working on xbox

20:35 that's when i graduated

20:36 ztellman: it was a total mess, my recruiter got fired right after my offer, which is how I got lost

20:36 unbeknownst to me, since I was taking a month off between jobs

20:36 not a great initial experience

20:36 technomancy: bbloom: this is back when hardware on Linux was actually hard

20:36 bbloom: i got this phone call telling me they wanted to make me an offer but couldn't make me an offer. i was like "yeah, ok, whatever" as i was holding the phone to my ear with my shoulder & signing the xbox offer

20:36 technomancy: c. 2003

20:36 bja: intro to digital systems (logic gates, debugging, misc number systems) was an important class for me because it really forced me into a more structured way of debugging systems

20:37 cespare: for a different perspective, I feel that college was completely worth it for me. Although I worked really hard to get undergrad + masters in 4 years, to maximize my value.

20:37 I found it easy to land a really good job right out of school (with the help of a professor I worked with a lot) and paid off all debts in < 2 years.

20:37 bbloom: technomancy: that's probably the OTHER time i learned a lot about CS during my college years: we had this ipaq linux devices in the lab & the wifi was so damn flaky that we couldn't actually do any of the research the group normally did (which was shit) so i fixed the wifi kernel module

20:37 technomancy: barely knew what a kernel was, much less how to write a kernel model when i started

20:38 technomancy: haha; nice

20:38 hyPiRion: "paid off all debts in < 2 years" -> Whoaa, where did you work you say?

20:38 bbloom: my coworkers loved me, but apparently i didn't get enough research done

20:38 nevermind the 100X productivity boost to everybody else

20:38 ultimately quit when i was sick of having to go fight for my late pay checks

20:38 cespare: hyPiRion: haha, i didn't

20:38 noprompt: what really pisses me off about the CS program at CSUF is they won't offer the compilers course, even with a signed petition because they are scared the students will all drop.

20:38 cespare: hyPiRion: also my parents paid half of my undergrad, so maybe it would've been four years without help.

20:38 bbloom: noprompt: that's what really upsets me. it's a fucking business

20:39 cespare: noprompt: wtf, i think your problem is a half-assed CS program.

20:39 callen: Intentional symbol capture in a small family of macros all conforming to a known contract (aforementioned symbol) - kosher/not-kosher great idea/best idea?

20:40 bbloom: the engineering program at my school had a 50% first year drop out rate. the next year, they reworked it, & it had a 95% first year success rate (estimating numbers) meanwhile, the following year, the professors were all like "THESE KIDS DO NOT KNOW SHIT" and practically striked

20:40 noprompt: cespare: well there's not much i can do about it but get through it, i guess.

20:40 bbloom: so the school expanded it's easier offerings and make it much simpler to change majors, then made the engineering program marginally harder again lol

20:40 noprompt: bbloom: was the strike successful?

20:40 technomancy: bbloom: sturgeon's law for undergrads

20:41 cespare: bbloom: at my school the intro CS was in scheme and had a super high dropout rate, and that was considered a feature not a bug

20:41 jcsims: there are some key things I get from my CS education, but also very important things from my own studying and several internships

20:41 bbloom: noprompt: only in the sense that the school expanded it's liberal arts offerings & pushed really hard to retain paying students who left the engineering program, such that the engineering program could recover

20:41 callen: cespare: excellent. :)

20:41 bbloom: tuition diversification, i call it

20:42 noprompt: * should have remained a math major.

20:42 bbloom: cespare: i think that high drop out rates are a feature iff the kids who pass come out dramatically better for it

20:42 cespare: bbloom: yeah there could be many reasons.

20:42 bbloom: cespare: failing kids for the sake of failing kids is bad. i don't care if those kids work hard and learn something and then ALSO fail

20:43 bja: bbloom: I've never really seen a place that fails people for the thrill of doing it

20:43 bbloom: bja: i've seen a few teachers do it

20:43 hyPiRion: bja: You've never been to Europe

20:43 noprompt: bja: have you heard of test first? lol.

20:43 hyPiRion: "Oh, the exam was too easy? We should apply a normal distribution on it"

20:44 bbloom: bja: i had a professor who basically graded everyone on an absurd curve, such that by week 3 of the course, most kids dropped the class expecting to fail. he did this simply so that he'd have less homework to grade so he could focus on grant-seeking nonsense

20:44 bja: hyPiRion: most of my profs decided to just make exams extremely difficult to score well on

20:44 hyPiRion: "Oh, the exam was too hard, and over 50% failed? *shrug*"

20:44 bbloom: bja: he admitted this publicly after the last day to drop passed

20:44 ztellman: bbloom: don't the TAs do the grading, typically?

20:44 bja: (and hten making those classes mandatory for any engineering undergrad)

20:44 bbloom: ztellman: not if you're such a dick that nobody wants to be your TA

20:45 ztellman: ha, well

20:45 hyPiRion: (dec shitty professor)

20:45 lazybot: ⇒ -1

20:45 callen: (inc tenure)

20:45 lazybot: ⇒ 1

20:45 hyPiRion: bbloom: that sounds like a nightmare

20:45 bja: ah, I guess I had mostly sane profs for the few years I went to university

20:46 bbloom: hyPiRion: the full version of this story can only be told over beer and off the record :-)

20:47 hyPiRion: heh

20:48 noprompt: colleges also seem very interested in investing in rediculously over the top gyms and dorms while at the same time neglecting to focus on education.

20:48 bbloom: i'm pretty down on the state of education

20:48 don't depress me.

20:48 callen: noprompt: gyms can be shown to high school seniors and their parents.

20:49 noprompt: callen: this is true. a part of the marketing pitch for the resort they'll be sending their kids to.

20:49 bja: callen: so can dorm rooms. but spending money on a fancy gym was way more important than dry dorms

20:50 * callen shrug

20:51 noprompt: bbloom: aparently cursive is eventually going to be a thing of the past, joining the ranks of the arts and physical activity.

20:51 bbloom: because, you know, america needs an army of critical thinkers and art and physical activity, well, they play no role in that.

20:53 callen: physical activity is a good way to make your brain perform better.

20:53 speaking of, time to coffee up for today's hoist.

20:53 bbloom: noprompt: dude, hate to break it to you, but cursive went away in the early 90s

20:53 noprompt: callen: that was part of the point i was making.

20:54 bbloom: what? naw. i remember learning cursive in the early 90s.

20:54 bbloom: noprompt: cancelled it when i was in grade school

20:55 noprompt: bbloom: well it's news to me!

20:55 jodah: n00b Q: I'm hitting some "unable to resolve symbol: ", in two different situations, when attempting to load/reload a file. what causes this?

20:56 * noprompt is probably the only one in here that gives a shit about writing in cursive.

20:56 bbloom: yeah, fuck cursive :-)

20:56 patchwork: I don't remember the last time I wrote by hand at all

20:57 I had to write a check the other day, I almost forgot how to do my signature

20:57 bbloom: patchwork: that was me for a while, but i find it is *sometimes* useful to draw shapes WITH A PENCIL and label things & what not

20:57 patchwork: it was strangely alien

20:57 bbloom: i'm more of a notes-in-vim sorta guy

20:57 but it's just not the right tool for box and line diagrams

20:57 noprompt: patchwork: i find that solving problems on paper/whiteboard helps me find solutions to problems more efficiently than hacking on them.

20:58 bbloom: (inc whiteboard)

20:58 lazybot: ⇒ 1

20:58 patchwork: bbloom: Right! I make boxes and arrows with a pencil

20:58 just not words

20:58 callen: bbloom: I definitely had to learn cursive in the 90s.

20:58 I need an at-home whiteboard. I need an at-work whiteboard too for that matter.

20:58 Gerd dermmert.

20:59 technomancy: I've got a roll of butcher paper for my lap

20:59 lab

20:59 noprompt: that's it. i'm officially starting a campaign to bring back cursive. lazy ass kids these days. we need to restore america's education system! starting with cursive!

20:59 callen: technomancy: do you just slap the roller on the wall or something?

20:59 noprompt: i just discovered there's this stuff called idea paint which you can use on your walls to effectively turn it in to a giant dry/erase board.

21:00 callen: noprompt: I'm sure my landlord would love that.

21:00 noprompt: http://www.ideapaint.com/

21:00 ztellman: noprompt: it doesn't erase very well

21:00 jcsims: noprompt: I've seen blackboard paint as well

21:00 callen: most walls are probably too textured for it to erase well.

21:00 ztellman: I think it's more than that, ink adheres better than it does on an actual whiteboard

21:00 noprompt: callen: fuck your landlord. he'll change his mind once he's seen the added value.

21:01 ztellman: either way, lots of ghostly past ideas

21:01 noprompt: but i do have to admit ztellman is write, you really gotta wipe it down.

21:01 bbloom: ztellman: i actually found that the idea paint in my last office building was the *nicest* whiteboard in there

21:01 patchwork: ztellman: One half of basic I/O

21:01 bbloom: erased very well

21:01 i think there are several grades of quality of the stuff

21:02 noprompt: "write" was on purpose. i sware.

21:02 ztellman: I'm a write-only sort of guy

21:02 bbloom: very possible, I never procured the stuff, just used it where it was already up

21:07 noprompt: bbloom: that's good to know, i'll have to do some research before i use it at home. i've only used the stuff once and my experience was similar to ztellman's.

21:10 bbloom: could just be that the other whiteboards were double shitty

21:10 :-)

21:11 callen: Clojure web discussion: https://www.refheap.com/17547

21:21 technomancy: callen: I stick it up with thumbtacks

21:22 callen: technomancy: immutable whiteboard. I like it.

21:22 technomancy: callen: unfortunately no structural sharing =(

21:23 callen: butcher paper isn't a HAMT. Sorry.

21:25 technomancy: any opinions on intentional symbol capture as part of a contract?

21:47 noprompt: bbloom: thanks for giving me the idea to use a trie. it made my dreams come true. now i have to fix this shitty algorithm.

21:47 bbloom: i don't recall giving you that idea either, apparently my memory is going. but rock on data structures!

21:49 noprompt: bbloom: yeah, i'm pretty sure it was your idea to use a some kind of a trie. i've been kicking around the idea of using DAWG but i'm still learing about how to implement them.

21:49 bbloom: what operations are you preforming on this data structure?

21:50 `cbp: callen: hi

21:50 noprompt: bbloom: the whole idea behind frak is you give it a vector of strings and it gives you a regular expression for matching those strings.

21:51 bbloom: gotcha

21:52 noprompt: bbloom: i'm using a word trie which keeps track of which branches are terminal, etc. so when the pattern is compiled it knows which parts of the pattern are optional ie bar(?:n(?:aby))

21:52 the input there being ["bar" "barn" "barnaby"]

21:53 i was thinking that a DAWG might make it possible to keep the overall data structure thinner.

21:53 but going from a DAWG to a regex is probably more complicated. wit the trie it's pretty damn easy.

21:56 bbloom: have you used a DAWG before?

21:56 bbloom: nope

21:59 gfredericks: I add :profiles {:logic {:dependencies [[org.clojure/core.logic "0.8.3"]]}} to my project.clj

21:59 and then `lein with-profile logic repl` fails to start, not finding nrepl code

22:00 dnolen: ztellman: I finally understand your point about core.async and implementing take-while - I suppose take-while could return the "rest" of the input channel

22:01 ztellman: dnolen: yeah, but I don't know how useful that is

22:01 without some sort of peek or pushback behavior, it's probably not something you'd want to expose

22:03 dnolen: ztellman: I think take-while is pretty useful, you can simulate push back by implementing something like concat

22:04 ztellman: dnolen: if I'm understanding what you're suggesting, that creates a cascade of channels that grows by one each time you call take-while

22:04 unless you have some way to flatten it out when the prefixed message is consumed

22:05 dnolen: ztellman: that's a thought, but you are correct - I don't you want to use it all the time

22:05 ztellman: however reading over this http://rigsomelight.com/2013/08/12/clojurescript-core-async-dots-game.html

22:05 made me see the possible utility, or maybe there's some other way to eliminate the redudancy

22:06 in his blog post he has three cases where he want to consume up to a certain point - and the code is more or less the same

22:08 ztellman: yeah, I'm not sure what the right way to handle that is

22:08 dnolen: something to ponder ...

22:08 ztellman: there's probably still that issue that I opened way back when I was first looking through the code, but the conclusion at the end of that was that I didn't see an elegant way to add it in

22:09 you can do it in Lamina pretty easily, but the interaction with the queues is a lot more involved as a result

22:09 I'm not clear that's a good trade-off

22:11 dnolen: hmm I suppose it could be avoided with sentinel values

22:11 like it is everywhere else

22:12 ztellman: right, in Lamina you have (read-channel* :predicate f :on-false ::false)

22:12 dnolen: k

22:12 thanks

22:13 ztellman: but now that means that instead of returning a message from inside the thread-safe queue consumption, you're returning information about whether the message was consumed

22:42 mindbender1: is there an idiomatic way of nesting aget calls in cljs?

22:42 like get-in in clj

22:43 ambrosebs: mindbender1: isn't aget variadic?

22:43 technomancy: gfredericks: try `with-profile +logic` instead

22:44 you're replacing the :base profile from whence the nrepl dep coms

22:44 mindbender1: ambrosebs: I'm not sure about that

22:45 I'm getting wrng number of args

22:45 *wrong

22:45 ambrosebs: mindbender1: I think it should work.

22:45 mindbender1: code?

22:47 mindbender1: ambrosebs: yeah, it works. Thanks

22:47 gfredericks: technomancy: thanks

22:47 ambrosebs: ok

23:01 muhoo: that routing handler discussion is interesting. lol at whoemver wrote "g hold up" as a comment tho. and i like the idea of turnign refheap into pirate pad. but how do you contribute/edit it?

23:01 i'm tryign to edit the doc, and it ain't lettin me

23:07 oh well i forked it fwiw https://www.refheap.com/17551

23:14 bbloom: for all the awesomeness of core.async & the ioc macros…. i'm really sad i can't use it with HOF

23:18 noprompt: apparently the pattern i generated to match every word in /usr/share/dict/words is hoax. so says the internet.

23:21 tbaldridge: bbloom: HOF?

23:21 bbloom: higher order functions

23:21 sorry for the unnecessary acronym

23:21 Raynes: Don't ever apologize HOFmeister.

23:21 tbaldridge: bbloom: yeeeahhhh....I have some thoughts on those lines, nothing workable yet.

23:22 bbloom: although we're in the same boat as C#/F#/Haskell, it's just with being a dynamic language and all we can't hide it like Haskell does

23:23 bbloom: tbaldridge: wouldn't you need to do full defunctionalization?

23:23 tbaldridge: i've started attempting to implement the effect handlers idea in that second paper

23:25 noprompt: Raynes: HOFmeister. lol.

23:25 tbaldridge: bbloom: that'd be one way, like I said, nothing worth talking about yet. I just wish we could do stuff like (map <! chan-seq)

23:25 bbloom: tbaldridge: if you do that, then i'd need to (defmacro <3 [tbaldridge] ...)

23:25 tbaldridge: lol

23:25 bbloom: while i got you here

23:25 callen: `cbp: hi!

23:25 `cbp: http://www.reddit.com/r/Clojure/comments/1k8v72/a_discussion_a_couple_of_colleagues_and_i_had/

23:26 bbloom: tbaldridge: i'm curious if there is a way to hook non-terminal positions in the ioc macros

23:27 tbaldridge: bbloom: currently no. You'll notice that :Return is a special case. My plan was to allow for the override of any SSA instruction, but I can't figure out a way to justify it as a commit to core.async :-)

23:27 `cbp: callen: do we have any plans to support {% for x,y in foo %}?

23:28 right now it turns that into :x,y :-P

23:28 callen: `cbp: that's...a really good point.

23:28 yogthos: ahem ^^

23:28 yogthos: comma-based destructuring of for loop iterators?

23:28 tbaldridge: bbloom: the first incarnation of core.async had full blown generator support, but I yanked it out since it was considered "confusing" by the powers-that-be. So long-term I wonder if we couldn't yank the ioc stuff from core.async and put it into its own lib.

23:29 bbloom: tbaldridge: i'd be interested in that, but the further this thing gets pushed, the more it's gonna look like a full blown compiler :-P

23:29 here's my use case for hooking things:

23:29 * bbloom tries to get his words right, hold on

23:33 bbloom: ok so in that second paper, the one on algebraic effect handlers, they define a version of ocaml with two sub languages. one is the "expression" language and the other is the "computation" language. basically, expressions are inert and computations have operational semantics. in the concrete syntax, they inject "val" expressions into the computation language which wrap expressions and force evaluation. the "val" expression is treated as

23:33 a computational effect, just the same as an exception handler's catch block for example

23:33 the idea is that evaluation is a computational effect

23:33 but you can "intercept" evaluation and modify the result via a "val" handler

23:33 it's basically your hook into the monad (*cringe* that i said that)

23:33 so you can define `val x = [x]`

23:34 tbaldridge: bbloom: so you want to intercept individual function calls?

23:34 clojurebot: function is <Chouser> there is one class per fn, one instance of it per closure

23:34 bbloom: tbaldridge: i'm not precisely sure what points i want to hook

23:34 Phil_D: I'm having a hell of a time trying to develop with the REPL. I'm using Cheshire to encode JSON — and Monger to interface with my MongoDB database. I'm doing something *very* simple, such as encoding a query from Mongo to JSON:

23:34 (generate-string model/find-all-models)

23:34 This works totally fine in production when I set a Compojure route to spit the data out as JSON, but when I try to do the exact same thing in nRepl (proper namespace and all), I get:

23:34 "JsonGenerationException Cannot JSON encode object of class: class org.bson.types.ObjectId: 52099f9a0364ddb5b182ffa5 cheshire.generate/generate (generate.clj:147)"

23:34 I cannot get my head around why one works and the other doesn't. It's incredibly inconvenient because now I have no way of productively parsing the response with functions on the fly. What do I do?

23:34 bbloom: i guess i want to hook any expression which would be evaluated, yielding a value

23:34 so like (let [x (some thing here)] ...)

23:34 callen: `cbp: I'll email it.

23:35 er...github issue it.

23:35 `cbp: callen: okk

23:35 bbloom: i want execution to pause at (some thing here) and trigger something like a terminal

23:35 basically insert extra states for ever time an expression is evaluated

23:36 tbaldridge: bbloom: isn't that what pause does in the runner macro?

23:36 in that case it simply continues to the next block, but wouldn't that do it

23:36 bbloom: yeah, but the pause is explicit

23:36 i want to insert it explicitly at keep points

23:37 and pause would also apply a function to the value before sticking it back in to the state map

23:37 dnolen: Phil_D: do you have a classes directory lying around in your project directory?

23:37 tbaldridge: bbloom: would the (some thing here) be known at compile time?

23:38 bbloom: yes. they happen at particular points in the syntax of the primitives. hold on, let me find the precise description in this paper

23:39 Phil_D: dnolen: I have a 'models' directory that holds functions to insert documents to the database as well as query collections.

23:40 callen: `cbp: it's up. Good find!

23:41 bbloom: tbaldridge: eh. it'd be easier if you just read that paper. i know you'd be excited by it anyway, so i'm just gonna assume you'll read it

23:41 :-)

23:41 tbaldridge: bbloom: lol, yeah, I'll try to get to it soon

23:41 bbloom: tbaldridge no rush of course. i'm just dicking around

23:42 dnolen: Phil_D: I mean are you somehow loading the wrong classes? did you ever AOT? you may have a classes directory lying around then.

23:42 `cbp: callen: :-) I'm reading your chat

23:42 bbloom: tbaldridge: for now, i'm gonna do the explicit thing, like pause

23:43 dnolen: Phil_D: http://github.com/dakrone/cheshire/blob/master/src/cheshire/generate.clj#L147

23:43 Phil_D: it looks like you're passing in something cheshire cannot handle

23:45 Phil_D: dnolen: Yeah, it doesn't like the ObjectId. that Monger is adding to the map I'm trying to encode. The only thing is that Cheshire doesn't care about that in production. It just serializes the ObjectId. as a string. My application works fine, but the behavior somehow changes in the REPL that throws that error.

23:46 dnolen: Phil_D: I'd be wary about that conclusion "Chesire doesn't care"

23:46 Phil_D: there's probably something else going on.

23:46 `cbp: "What if context-free grammars were as easy to use as regular expressions?" And here I'm thinking that regular expressions are anything but :-/

23:46 dnolen: Phil_D: the fact that it works in production is likely a distraction, it should *never* work

23:48 Phil_D: dnolen: Hmmm. On the front-end I'm using ClojureScript with an AngularJS app that interfaces with the JSON — it's still "works". The calls are very straightforward. I can paste in a code bit to pastebin.

23:49 dnolen: Phil_D: I don't really have time to dig in, but based on the error you're passing in the wrong thing. Pass in the right thing at the REPL and it will work.

23:50 Phil_D: dnolen: Gotcha. It could be the way I'm interfacing with the REPL. I've had mixed results (I'm just beginning Clojure development).

23:52 callen: Phil_D: are you using Clang?

23:52 dnolen: Phil_D: As far as I can tell has nothing to do w/ your REPL setup at all :) your code that magically works in production is incorrect or you're doing something different and not realizing it.

23:53 callen: `cbp: the problem with regex is that they can be dense and the syntax isn't great. look at the markdown parser that was written with Instaparse.

23:53 `cbp: look at this: https://github.com/chameco/Hitman/blob/master/src/hitman/core.clj

23:53 ridiculously awesome.

23:54 dnolen: callen: damn

23:54 callen: dnolen: I'm considering writing an experimental validating lexer and parser for Selmer with Instaparse :)

23:55 `cbp: I considered instaparse for a split second for selmer before i did a simple state machine and then yogthos was all like nahhhh lets use mine

23:55 callen: I'm actually trying to make certain, in the meantime, that expressing the template lang in terms of a CFG is possible, if it isn't, I'll cut off the full parser part.

23:55 `cbp: sadly yogthos' was further along and you weren't online to consult on something. Sorry about that :(

23:56 `cbp: it's ok his is prolly faster/better anyway

23:56 Phil_D: dnolan: even if I'm using nRepl with Emacs? Like, I'm throwing entire buffers into the REPL for evaluation.

23:56 Apage43: I just got to use instaparse for a thing

23:56 was nice

23:56 callen: `cbp: proooobably. The current design of Selmer is essentially based on the actual DTL implementation, but 6x less code.

23:56 Apage43: went well eh?

23:56 Apage43: yep

23:57 thing works

23:57 callen: `cbp: Selmer is like ~1k LOC. DTL is ~6k

23:57 Apage43: end users get (relatively) useful errors when they do something wrong

23:58 callen: Apage43: oh really? Could you show me an example?

23:58 Apage43: error handling is actually our primary concern atm.

23:58 now that performance has been conquered (haha, perverse priorities :)

23:59 brehaut: callen: that hitman code is awesome

Logging service provided by n01se.net