#clojure logs

2016-02-07

00:16mercwithamouthso i compulsively bought ANSI Common Lisp...noticing that it was written by Paul Graham and his name pops up a lot. Is there much to gain in reading about/learning other dialects of lisp to further growth in clojure?
00:16mercwithamouthi assume in general it's just good to read/learn as much as possible from different 'smart guys' and add it to your toolbox.
02:10oraclehi
02:11oracleI am using https://github.com/semperos/clj-webdriver, and there is a taxi api, but I can't find the file of taxi.clj. Do you know whether to find it ?
08:13SomelauwInside a macro I'm trying to get the name of a function to be printed. Let's say I write (def f +). Now I want to turn f into '+'.
08:14Somelauw(name f) doesn't work because f is not clojure.lang.Named
08:16Somelauw`(name ~f) comes closest so far
08:33kwladykahow parameter should look in function like (fn [foo bar] ... ) to know it is a map, vector or list? Especially map? Any common rules?
08:39qsyskwladyka: parameters can be of any type, it's your decision
08:52Somelauwkwladyka: mostly just m for m, v for vector, coll for collection I think
08:54mmeixhelpful: https://github.com/bbatsov/clojure-style-guide#naming
08:55mmeix"Follow clojure.core's example for idiomatic names..." etc
09:04kwladykaqsys yes but for example i want my parameter to be map, it is my decision. But how to say about that in name of parameter?
09:05kwladykai am looking some common solution
09:06mmeixkwladyka you can hint by naming the parameter m
09:06qsyskwladyka: see mmeix: https://github.com/bbatsov/clojure-style-guide#naming
09:06mmeixkwladyka or use an understandable docstring for your function (which is a good idead anyway)
09:08qsysI hardly every hint the type in the name
09:08qsysit's too much of a hassle when the 'type' changes
09:09mmeixI think if a function has to many parameters, so it becomes unclear which does what, i would be better to split into more functions and compose
09:10kwladykahmm so maybe i should do (fn [m-foo] ... )
09:10qsysespecially when it's a concrete type, like map, vector, ... no need to hint on the type on them
09:11mmeixI haven't seen anything like m-foo ...
09:11qsysknowing whether it's sequential or countable or ..., might(!) be interesting
09:11qsysnever saw something like m-foo either
09:11kwladykaif not m-now what is your proposition?
09:11kwladyka*m-foo
09:12mmeixwhat is the content of your "foo" parameter?
09:12mmeix(not the type)
09:12kwladykafor example values for database to insert
09:12kwladykaso it can be m-values
09:13mmeixI would just use "values" then
09:14mmeixyou could write into the docstring: "... expects a map <values> ..."
09:14mmeixif you need guarantees, then you would check for the type, or use something like Schema
09:15mmeixI guess
09:15kwladykajust i am thinking about some standards in architecture and i am doing some experiments
09:17mmeix"There are only two hard things in Computer Science: cache invalidation and naming things." :-)
09:17j-pb_and off by one errors
09:17kwladykammeix ;)
09:17mmeixThere's a variation I just found:
09:18mmeix"There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery"
09:18mmeix:-)
09:18mmeixbut clojure helps with that ...
09:18kwladykathe biggest problem is always state... remember it and do something things depend on this
09:19mmeixthere are good solutions for this (one and only one source of truth, Om, Re-frame)
09:20mmeix(if in web app)
09:20kwladykaeven in Om you have state. At that moment i am using Rum in work and i am not very happy with that, because of some limitations but maybe i am doing this wrong.
09:21mmeixof course there is state, but in a immjtable world it's relatively easy to think and plan with it, I find
09:21mmeiximmutable*
09:39dysfunhrm, is there a clojurescript analogue of find-var ?
09:45kwladykadysfun i don't think so
09:56mmeixkwladyka wouldn't https://github.com/plumatic/schema help with your plannings?
09:57kwladykammeix no it makes me feel like OOP :)
09:57mmeixok
09:57kwladykai am just doing experiments in architecture and compare some things
09:57mmeixunderstood
10:01SomelauwInside a macro I'm trying to get the name of a function to be printed. Let's say I write (def f +). Now I want to turn f into '+'. How to do this?
10:59benjyz1in Clojurescript i request JSON from a server
10:59benjyz1its delivered as {"time" 1454860967241}
10:59benjyz1server delivers proper JSON, but I can't parse the data ?
11:00justin_smithbenjyz1: is that the actual string?
11:00justin_smithbecause that's valid edn, but not valid json
11:00benjyz1I'm testing with a tool, which says its valid json
11:00justin_smithanyway, if the string is valid json, use js/JSON.parse
11:01benjyz1a chrome extension tool
11:02benjyz1ok, trying. I'm working with catacumba on the backend... github.com/funcool/catacumba
11:05frafrafraciao
11:05frafrafra!list
11:08mmeixI worked through the Om Next Tutorial, but I'm not sure about the advantages over re-frame - could it be, that Om Next has it's biggest strength for large and complex apps? Thinking in re-frame seems to be just more straightforward ...
11:09mmeix(ah, should have posted this in clojurescript ...)
11:09justin_smithmmeix: I think the main benefit with om next is the data query model
11:09mmeixthis I understood
11:09mmeixbut there is very much complexity upfront, I find
11:10justin_smithis managing your data manually and using re-frame simpler?
11:10mmeixtime will tell, I guess
11:11mmeixright now, backend just delivers simple datasets, main work is in the client
11:11mmeixok, maybe I should dive deeper into Datalog etc.
11:14mmeixthanks for thoughts
11:18mmeixbut I cannot tell how much Parinfer did for a better coding experience for me :-)
11:55benjyz1hmmm. js/JSON.parse should work?
11:55benjyz1I'm getting back a persistent arraymap, although its an array. weird
11:56justin_smithbenjyz1: why are you getting a cljs type at all?
11:57benjyz1you'right, that's my mistkae. I'm using ajax.core
12:04python476hi, I'm reading cljs github wiki, looking for documentation about the (vanilla?) dom interface (object like js/console, js/document, (.-xxx ) form) and am a bit lazy, can anyone link me to a page ?
12:05justin_smithpython476: it's the js dom interface. You use it with interop syntax, but it's just the dom.
12:05justin_smithpython476: best docs are the mozdev ones
12:06justin_smithpython476: unless it's the interop syntax itself you are asking about - Obj.prop becomes (.-prop obj) Obj.method(x) becomes (.method Obj x)
12:06python476justin_smith: the interop syntax is probably what I need
12:07python476and how many objects are prefixed with js/ ?
12:07python476anything in the global scope is the js ns ?
12:07justin_smithalso the -> macro helps a lot here - o.prop1.prop2 becomes (-> o .-prop1 .-prop2) o.method(x).prop becomes (-> o (.method x) .-prop)
12:08justin_smithpython476: js/window is usually the global scope
12:08justin_smithbut yeah, there's js/JSON etc.
12:08python476yeah, I have to glue -> usage in my fingers, I often think about it 1min too late
12:09python476thanks justin
12:09justin_smithnp
12:09python476just knowing the 'syntax interop' term helps me finding articles from google
12:09justin_smithgreat
12:16python476justin_smith: powdertoy gift https://www.youtube.com/watch?v=h4eHgnLFk9k
12:35terakilobytefriend piqued my interest in clojure. Still trying to get used to lisp syntax but not finding it ridiculous? Plan on using Clojure for the Brave and True and Web Development with Clojure as my two main resources
12:35terakilobyteany other good ones I should know about?
12:35python476there's no `flip` function in clojure ?
12:36justin_smithpython476: there's one in eg. flatland/useful and it is easy to write
12:36terakilobytesorry, didn't mean to put a ? after my syntax statement
12:36python476yeah I guess it's so easy
12:37dysfun#(foo %2 %)
12:37dysfunalmost as short as 'flip'
12:37python476yeah good point
12:38justin_smith(fn [f] #(apply f (shuffly %&)))
12:38dysfunyou also won't need curry/uncurry because of destructuring
12:40mmasticPaul Graham wrote that the codebase for Viaweb was 20%-25% macros. Can anyone resonate with something like that? or maybe such a high percentage doesn't come up anymore these days for some reason?
12:40dysfunit's rare for that much of a clojure codebase to be macros
12:41dysfunpg was using common lisp which is a different animal
12:41python476mmastic: CL was a bit less regular than more recent lisps and had less abstractions maybe ? leading to more macro-fu than needed today
12:41python476(less regular or more complex... don't wanna sound firey)
12:41dysfunif you listen to CL fans speak, they'd say it was more regular
12:42dysfunbut it's a very verbose language compared to scheme or clojure, and there is definitely more need
12:42dysfunbut then again CL is a language where reader macros are commonplace :)
12:42mmasticOh I see. I was a bit surprised because I found myself not really resorting to macros, pretty much at all :P (even when abstracting). So that's normal, I suppose, yeah?
12:42python476the side of lisps that scared me the most is the sub-cons-cell values
12:43python476a symbol could have many bindings somehow
12:43justin_smithpython476: like our metadata!
12:43justin_smithprobably the first metadata system in programming history actually
12:44python476good point but it's mentally separated as metadata, not first class programming idiom
12:44justin_smithpython476: yes, the concept has matured
12:44justin_smiththey were in the early days, where it was tempting to use it for *everything*
12:44python476unless you'd specify function arguments through metadata
12:44dysfunclojure is quite refined feeling compared to ma
12:45dysfunmost* lisps
12:45python476one fact I miss from old lisps is .. lack of literals
12:45dysfunyou mean that edn supports e.g. sets?
12:45kwladykahow to convert using clojure.jdbc uuid string like "d263381c-9a90-4494-8759-c56f6f56a7f0" to uuid in postrges during select? I get Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
12:45python476I'm not at the edn point in my clojure experience
12:46python476[] and {} aren't making me feel happy visually or mentall
12:46python476y
12:46dysfunedn is the syntax clojure uses
12:46dysfuni quite like [] and {} as it happens
12:46dysfunand i don't think i'm alone
12:46python476I like my parens in whole bags :D
12:47dysfunwell common lisp and scheme are that-a-way
12:47python476it's backed by a sane principle, which I lauded when Hickey talked about it
12:47python476but .. I can't explain I like (vector ... ) and all ((... ((( ))))( ( )))
12:48dysfunwell clojure has been designed to minimise need for parens, so it's not surprising you don't like it
12:48dysfunpersonally i like my code with minimal parens
12:48python476heh, my parens-avoidance reflex is to run sml
12:49dysfunsimilarly i have c++
12:49python476that's for code with maximal ;
12:50dysfunyeah, it's quite a different language
12:50python476indeed
12:50python476and changing a lot since c++11
12:50dysfunbut i can switch between clojure and c++ pretty seamlessly these days
12:50dysfunoh yeah, c++ before 11 was a clusterfuck
12:50python476horizontal gene transfer is hot from fp to mainstream
12:50dysfunc++14 is bordering on 'nice' and c++17 if they actually deliver it all will be ace
12:51python476some c++ guys aren't fond of it.. I don't understand
12:51dysfunsomenoe built a clojure-like transducers library for modern c++, which made me laugh
12:51python476you get small, readable, typed and native ..what's not to like
12:51kwladykai solve my problem... just add #uuid before...
12:51python476laugh ? the steal factor or the quality?
12:52dysfunwell it seems an odd language to steal bits for c++ from
12:53python476transducers are such a nice pattern though
12:53python476I wonder what's the next step .. full deforestation and partial evaluation ~_ ?
12:54dysfundif this free wifi weren't so shit i'd share the link
12:54dysfunah got it http://vitiy.info/cpp14-how-to-implement-transducers/
12:56python476odd, (macroexpand '(<macro> ...)) yields (<macro> ...) ~_~
12:56python476but with `(when ...)` I get the expanded expr
12:56python476(defmacro wait! [b] `(do (js/alert) ~b))
12:56python476did I noobed ?
12:57python476oops, bodiless
12:59python476the c++ transducers reminds me of my early java days trying to bend the syntax to not program in java ~_~
13:58justin_smithbut transducers are not a syntax, they are an algorithmic building block, which c++ lacked
13:59justin_smithperhaps they didn't need because they just use mutable data anyway
14:05python476justin_smith: yes, but c++ idioms still aren't really tailored to functional programming and that makes for a bit of a twisted source to look at
14:06python476I believe that somehow c/c++ made people do all this in their head and flatten it a large scopes with nested loops
14:06python476a lot of c code appear to me as lazy list programming projected onto a register machine mindset
14:06python476maybe I'm trying to retrofit a functional hammer ..
14:07python476I investigated zippers yesterday, is it commonly used ?
14:08justin_smithpython476: not sure, I bet searching clojure.zip on http://crossclj.info would be informative
14:08BronsaI wouldn't say zippers are commonly used
14:12justin_smithOK, I wonder which is used less, refs or zippers
14:12justin_smithI guess there are refs in core, dunno if that skews results
14:24python476thanks both of you
14:25python476these clojure websites (conj.io, crossclj) etc are pretty nice, are they listed in a central place ?
14:26python476oh /r/clojure has many
14:26justin_smithpython476: those two, github, and clojars, are what I use. There's probably more, I'd like to see that link too.
14:26justin_smithoh (checks)
14:26mmeixthe cheat sheet!
14:26mmeixhttp://clojure.org/api/cheatsheet
14:27justin_smithyeah, conj.io is a fork of that
14:27justin_smithr/clojure does have a good set of links
14:28SomelauwWhat is the best way to write out complex formulae without infix notation?
14:28python476it's just that I remember urls more than title (conj.io rather than grimoire)
14:29justin_smithSomelauw: probably not using clojure... - is the issue the likelihood of making mistakes in translating to prefix, or that you just don't think it looks as nice?
14:30justin_smithSomelauw: oh sorry, misread - I typically do it inside-out based on the implicit parens
14:30mmeixor maybe threading macros -> and ->> ? (or do I misunderstand...)
14:30justin_smithso I translate tightest bindings first (explicit function call, exponentiation), then move out
14:30Somelauwjustin_smith: In python it looks like this def solve(a, b):
14:30Somelauw (a.T @ a).I @ (a.T @ b)
14:31SomelauwIn clojure like this (defn solve [a b]
14:31Somelauw (mmul (inverse (mmul (transpose a) a))
14:31Somelauw (mmul (transpose a) b)))
14:31python476nods
14:32justin_smithSomelauw: there's box infix and postfix (of methods) to translate there, yeah
14:33mercwithamouthwould i get anything out of reading ANSI Common Lisp that would help with clojure(lisp in general?)
14:33mercwithamouthi'm aware that common lisp isn't strictly functional...but i'd think there would be something good to take away just from the author
14:35arkhSomelauw: (-> (transpose a) (mmul) (inverse) (mmul))
14:35python476obj.meth == (meth obj)
14:35mmeixarkh that's what I meant ...
14:36justin_smithmissed mmul's second arg both times
14:36justin_smithbut that's the general idea, yeah
14:37justin_smithSomelauw: another issue, I don't know about python, but in clojure if you have (transpose a) in two places in the same function, a is transposed twice, and you might want to use a let block for optimization
14:37SomelauwIf I haven't made any mistakes it becomes (-> (a transpose (mmul a) inverse) (-> a transpose (mmul b)))
14:38justin_smithsome extra parens
14:38justin_smith(-> a transpose ...)
14:38justin_smithwhat you have there is a noop (-> f) is just f
14:39justin_smithunless you wanted (-> (-> a transpose ....) ...)
14:39Somelauwjustin_smith: not completely sure, but I think in python tranpose is O(1) because it can just change the view of the array
14:40justin_smithSomelauw: oh, it's not something that uses CPU? makes sense I guess
14:40justin_smithSomelauw: if its O(1) with a low constant, go for it
14:40mercwithamouthwould i get anything out of reading ANSI Common Lisp that would help with clojure(lisp in general?)
14:41justin_smithmercwithamouth: according to the people who wrote ansi common lisp, ansi common lisp is the only "lisp in general"
14:41justin_smithI don't recall there being much about immutable / functional programming, but I could be forgetting
14:43mercwithamouthjustin_smith: yeah common list doesn't really deal with immutability or fp(though you could...to a degree) clojure would most likely be my go to language but lately i've been picking up books related to scheme and CL as well just to see
14:43mercwithamouthif i can even just pick up a few good ideas from it then cool....it was only $8
14:44Somelauwjustin_smith: just tested it and mutating a-t in python, mutates a too
14:44justin_smithSomelauw: cool
14:44Somelauwand threading does make the syntax look a bit nicer
14:46spuzI'm trying to solve a clojure exercise that asks for a value with the mutable field 'name'. What is the best way to implement this?
14:46spuzas far as I can tell, all clojure objects are immutable
14:47justin_smithspuz: probably wants deftype with a volatile-mutable or something field
14:47justin_smith,(doc deftypes)
14:47python476spuz: is it a public clojure website exercise ?
14:47clojurebotTitim gan éirí ort.
14:47justin_smith,(doc deftype)
14:47clojurebot"([name [& fields] & opts+specs]); (deftype name [fields*] options* specs*) Options are expressed as sequential keywords and arguments (in any order). Supported options: :load-ns - if true, importing the record class will cause the namespace in which the record was defined to be loaded. Defaults to false. Each spec consists of a protocol or interface name followed by zero or more method bodies: pr...
14:48spuzyeah it's this one: http://exercism.io/exercises/clojure/robot-name/readme
14:48spuzsee in the test where it calls a function 'reset-name' which it seems it expects to mutate the input argument
14:48justin_smithspuz: anyway, full doc string for deftype describes how to make mutable fields
14:49spuzjustin_smith, thanks, I saw deftype just wasn't sure it was the best way as it warns "Note well that mutable fields are extremely difficult to use correctly"
14:49spuzand "They are for experts only"
14:49justin_smithspuz: now that I look again - they provide tests but no source right?
14:50spuzjustin_smith, correct
14:50justin_smithspuz: if so, you don't need to use a mutable field on a deftype, you could just use an atom or ref or agent, and functions that manipulate that. It would probably have a hash-map in it
14:50justin_smith,(def h (atom {:name "joe"}))
14:50clojurebot#'sandbox/h
14:51justin_smith,(swap! h assoc :name "bill")
14:51clojurebot{:name "bill"}
14:51justin_smith,@h
14:51clojurebot{:name "bill"}
14:51spuzah yeah atoms...
14:51spuzthanks
14:51justin_smiththat should be enough to pass their test
14:51spuzhow do you decide whether to use atoms or deftypes?
14:51justin_smithspuz: do I need methods on an object because the lib I use wants to call methods and mutate values
14:52justin_smithif yes, deftype might be a good idea, if no, just use a container with a hash-map
14:52spuzright so deftype is a bit more like "I need to build a class"
14:52rhg135If the deftype will never be shared it's safe
14:52justin_smithacross threads? sure
14:53rhg135But now we have volatile for that
14:53python476 spuz: nice set of exercices !
14:53rhg135So just if you need a named type
14:56spuzpython476, yeah they are nice. you can see everyone else's solution to a problem after you've submitted yours and comment on/receive comments from others
14:56spuzand so far they are pretty much just the right level of stupidly simple for me to be able to progress with them
14:56python476lots of languages too, Ocaml, even elisp :)
14:57mmeixI learned much at 4clojure.com
14:57python476spuz: indeed, they're mostly no stress, good to enjoy and stay zen
14:57mmeixstarts easy, gets really hard gradually
14:57python476I don't remember how much of 4clojure I did
15:21python476ha, this cheatsheet has a bit of js interop in it http://cljs.info/cheatsheet/
15:22mmeixah, that's additional value ... bookmarked!
15:22python476found here : http://swannodette.github.io/2015/12/23/year-in-review/
15:22python476it's from the author of parinfer
15:22python476(which is still as cute as when it first popped)
15:24justin_smithmove blocks semantically - we might as well describe the letter to print on the screen instead of the bits representing its pixels
15:24virmundihello. I’m having a hard time idomatically invoking a function on a deftype. The deftype implements a protocol named CRUD. CRUD has a function of (read-by-example [this conn example]). Whenever I try to invoke via (read-by-example instance conn example). This fails with CompilerException java.lang.RuntimeException: Unable to resolve symbol: read-by-example in this context,
15:24virmundicompiling:(/private/var/folders/st/sgtzb_8n213254gzfwtn6t9h0000gn/T/form-init6058469801129634139.clj:1:1)
15:25virmundiIf I append a period to read-by-example, it works fine.
15:56yuunghey, clojure/lein noob here: i'd like to make a new directory and file in my src/namespace directory. how do i require that file in my src/namespace/core.clj?
15:57justin_smithyuung: you can use the :require clause of the ns macro
15:57yuungfor example, i'd have src/namespace/new_dir/new_file.clj, and i'd like to use that file in core.clj
15:58justin_smith(ns namespace.core (:require [namespace.new-dir.new-file :as whatever] ...)
15:58justin_smith)
15:58yuungjustin_smith i see, i'll try that! thanks
15:59yuungjustin_smith, could I accomplish the same with a use statement?
15:59benjyz1hi. Datomic has its own query language. what is it called again?
15:59justin_smithyuung: this also means taht namespace/new_dir/new_file.clj starts with (ns namespace.new-dir.new-file)
15:59hfaafbDatalog!
15:59justin_smithyuung: yeah, but we usually prefer to utilize require instead of use
16:00yuungjustin_smith, i see i see
16:00benjyz1oh.. didn't know the language was around since 1977 https://en.wikipedia.org/wiki/Datalog
16:00benjyz1this is the same one, right?
16:01justin_smithbenjyz1: it's a variant, yeah - most things in the clojure world come from a long time ago, but sometimes they are obscure
16:02benjyz1just found somebody implement an in-memory databse for the browser which can speak datalog
16:02justin_smithom next does that
16:02justin_smithalso the datomic db uses datalog
16:03qsysdatascript
16:03qsyshttps://github.com/tonsky/datascript
16:03benjyz1yes, I was referring to datascript. does om next use datascript?
16:04justin_smithbenjyz1: I don't think so, but it uses pull notation derived from datalog to bind data to widgets
16:04benjyz1AFAIK nobody has really done a kind of clojure/clojurescript framework which operates on data only
16:04qsysdunno if om next implements it, or so...
16:05benjyz1yes, that's a great idea. I've worked with Meteor which is pure JS.. pretty terrible
16:05qsysI'm using rum, which can do om-like things
16:05qsysand more
16:05benjyz1but they have the idea of the same language on client/server. that's very useful
16:05qsysunopiniated when it comes to storing state
16:05benjyz1instead of sending HTML around, one sends data and the client renders
16:06benjyz1didn't know rum..
16:06qsyssame author of datascript, pretty basic - much more basic than om
16:07benjyz1qsys: interesting, thx.
16:07qsysthis means: more work for you... (but more flexibility)
16:09yuungjustin_smith if i wanted to load that new file into the repl, what should I do? `(require '[namespace.new_dir.new_file :as new])` returns nil, but (new) throws an error
16:09yuungjustin_smith unable to resolve symbol error*
16:09justin_smithyuung: (new/foo) where foo is something defined in that ns
16:10yuungjustin_smith ahhhh i see
16:10yuungjustin_smith thanks a lot
16:10justin_smiththere's other tools in the repl too
16:10justin_smith(dir foo)
16:10justin_smith(ns-publics foo) to get at the actual data
16:11yuungjustin_smith, ah, nice
16:11justin_smith(ns-refers 'foo) and (ns-interns 'foo) to get its full scope (and it's (ns-publics 'foo))
16:13yuungjustin_smith, if i wanted to create a new namespace within a directory, and have each of the files in that directory start with (ns namespace.new-dir), would that be possible?
16:13justin_smithyuung: no, the ns has to match the file name
16:13yuungjustin_smith ah okay
16:13justin_smithfor require to work at least
16:13justin_smiththere's also load-file
16:14justin_smithbut best to use require and have a compatible layout unless you have a good reason to do something weird like load-file
16:15yuungjustin_smith gotcha
16:15yuungjustin_smith thanks! you've helped a bunch.
16:15justin_smithnp
16:16benjyz1justin_smith: have you been doing LISP before clojure?
16:17benjyz1(if I may ask ;)
16:17justin_smithbenjyz1: yeah, I did some common lisp, and some scheme. ocaml too which is very relevant because ml uses immutable data
16:17justin_smiththis was all hobby level only
16:17benjyz1I remember very distinctly I wanted to learn LISP
16:17justin_smithclojure was my first/only professional lisp
16:17benjyz1and read Paul Graham's essays
16:17justin_smithbenjyz1: I read them too, yes
16:18justin_smithand some of his books are good too :)
16:18benjyz1but it seemed so obsure, and I knew nobody he knew the lagnuage
16:19benjyz12 years ago I decide I have to bite the bullet, or otherwise I'll just programming forever ^^
16:19benjyz1*hate
16:20benjyz1I wonder why it took so long for a LISP to break through. I've never heard of anyone using CL in an enterprise e.g.
16:20justin_smithbenjyz1: libraries and tooling - having such easy access to all of java is huge
16:20TEttingerNASA, yeah, but not much enterprise use until Clojure
16:21justin_smithI mean most java stuff is easier to use in clojure than it is in java
16:21TEttingerthat's what I always say too :)
16:21mgaare benjyz1: perhaps the most prominent example was ITA
16:21TEttingermgaare: are they still in business?
16:21mgaareTEttinger: acquired by Google
16:21justin_smithbenjyz1: even just pragmatically, you can swap out one java library for a clojure library in a java ecosystem, and the enterprise are all using java
16:21TEttingerI don't know the name
16:21TEttingerdeepmind people?
16:22mgaareTheir stuff powers google's flight search now, I believe
16:22clojurebotexcusez-moi
16:22benjyz1Tettinger: deepmind uses Lua
16:22justin_smithbenjyz1: by comparison sneaking common lisp into an app is much harder (unless you are doing microservices I guess)
16:22mgaareTEttinger: ITA was also (still is? not sure) the backing engine for Orbitz
16:23benjyz1justin_smith: I'm trying to solve some quite hard problems and Clojure is really the only option
16:23TEttingers/Orbitz/everyone
16:23TEttingerused by travel companies such as Bing Travel, Cape Air, CheapTickets, Kayak.com, and Orbitz, and by airlines such as Alitalia, American, ANA, United Airlines, US Airways, and Virgin Atlantic.
16:23benjyz1but it took a while to get there. I've been trying to use ZeroMQ as a kind of distributed system thing
16:24TEttingerbenjyz1: woah really?
16:24mgaareI thought ZeroMQ was for IPC, not so good for distributed?
16:24TEttingerthe lua thing surprises me
16:25mgaare(other than that sub-class of "distributed" that runs on a single machine)
16:25justin_smithmgaare: "Carries messages across inproc, IPC, TCP, TIPC, multicast."
16:26benjyz1mgaare: I honestly don't know what's good for ^^ it promises a lot of performance for default use-cases. highly optimized, but from language perspective not sound
16:26benjyz1its used by stock exchanges to distribute data e.g.
16:26TEttingerGoogle's competitor Facebook has also been working on their own Go-playing system darkforest, based on combining machine learning and tree search.[18][14] Although a strong player against other computer Go programs, as of early 2016, it had not yet defeated a professional human player.[19]
16:27benjyz1Tettinger: https://github.com/kuz/DeepMind-Atari-Deep-Q-Learner/blob/master/dqn/NeuralQLearner.lua
16:27TEttingerthat's kinda sad
16:27mgaareOk, I must have been thinking of some specific use case I read
16:27TEttingeroh cool
16:27justin_smithbenjyz1: what does "from a language perspective not sound" mean? there are versions written in java and c# and c++, bindings for python, java, php, ruby, c, c++, c#, Erlang, Perl...
16:28TEttingerahhh it uses Torch benjyz1
16:28amalloyIME it usually means "i personally don't like it"
16:28TEttingerTorch7 is a big thing now I guess, I knew it had GPU-based neural network stuff
16:28benjyz1justin_smith: what I mean is this.... it enforces really a C/C++ programming model
16:29justin_smithoh, so regardless of language from which it's used, it's an imperative api?
16:29benjyz1and impossible to change things under the hood. you get a big binary which you can't change
16:29benjyz1I guess the idea you have these messaging patterns and then connect different components
16:30justin_smithbenjyz1: callback based, or?
16:30benjyz1but clojure/async is much more powerful
16:30benjyz1Request-Reply, Publish-Subscribe, Router-Dealer
16:31benjyz1and each use-case is optimized
16:31benjyz1its really weird. e.g. it hides IP addresses from user-space
16:31benjyz1so basically only for internal networks not internet.. anyway, I'm glad I moved away from it
16:34benjyz1what I found also that actors and scheme were related. ZeroMQ is an attempt at doing actors
16:35justin_smithbenjyz1: as in actors were notably implemented in scheme?
16:36benjyz1"Gerald Sussman and Guy Steele then took an interest in Actors and published a paper on their Scheme interpreter in which they concluded "we discovered that the 'actors' and the lambda expressions were identical in implementation."
16:36benjyz1https://en.wikipedia.org/wiki/History_of_the_Actor_model#Scheme
16:36Bronsampc
16:37justin_smithbenjyz1: man, the late '70s was a time when "we discovered x are equivalent to foo" for all foo was published
16:37justin_smithwait sorry, lambdas for all x err... nevermind
16:37benjyz1lol. to young for that. these days its like all computer science before 1990 is forgotten
16:38benjyz1so Javascript rocks!!?!
16:38benjyz1which is a language written in 10 days
16:38justin_smithbenjyz1: smart kids read papers from before they were born, even in CS
16:38justin_smithlate '70s was when I was born
16:39justin_smithI still have things to learn from papers of that era
16:39python476I'd like to grasp continuation and cont-based backtracking
16:40benjyz1I think what you say applies a lot to 1900-1930 too
16:40benjyz1Russell, Frege, Whitehead
16:40justin_smithbenjyz1: oh, absolutely
16:40benjyz1not strictly computer science though.
16:41justin_smitheven Norbert Wiener, Claude Shannon...
16:59DynamicMetaFlowWhat would be some good papers to read from that era?
17:04benjyz1I recently read some works of Shannon
17:05benjyz1A mathematical theory of communication.
17:05benjyz1Turing on computable numbers
17:05benjyz1very worth reading original papers IMO
17:10justin_smithDynamicMetaFlow: there's a list on github "papers we love", https://github.com/papers-we-love/papers-we-love
17:12justin_smithDynamicMetaFlow: but I agree, some of those original papers from the early history are great
17:12justin_smithshannon's mathematical theory of communication being just an example
18:40python476I think I'ma use clojure repl to live test Java code ~_~
18:45python476it's already proving useful
18:45justin_smithpython476: yeah, clojure is a great lib for using java
18:46python476it's a Java 'only' MOOC
18:46python476clojure java interop comes to mind in a clojure project
18:47python476but now I just clicked
18:48python476doesn't make my code less buggy though <o/
18:56Somelauwhmm, why is there no transient 'update!' like there is 'assoc!'?
19:02DynamicMetaFlowThank you
19:04justin_smithSomelauw: because nested transients aren't really a usable thing
19:04justin_smithoh, but update not update-in...
19:05Somelauwyep, I was surprised update! is missing
19:15justin_smithSomelauw: given the source of update, update! should be easy to write
19:19SomelauwI just saw the source. I used to hope update would avoid the double key-lookup.
19:20justin_smith,(defn update! [m k f &args] (assoc! m k (apply f (get m k) args)))
19:20clojurebot#error {\n :cause "Unable to resolve symbol: args in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: args in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: args in this co...
19:21justin_smith,(defn update! [m k f & args] (assoc! m k (apply f (get m k) args)))
19:21clojurebot#'sandbox/update!
19:21justin_smith,(-> {} transient (update! :a assoc :b :c) persistent!)
19:21clojurebot{:a {:b :c}}
19:22Somelauw(persistent! (update! :a (fnil inc 0) (transient {})))
19:22Somelauw,(persistent! (update! :a (fnil inc 0) (transient {})))
19:22clojurebot#error {\n :cause "clojure.lang.Keyword cannot be cast to clojure.lang.ITransientAssociative"\n :via\n [{:type java.lang.ClassCastException\n :message "clojure.lang.Keyword cannot be cast to clojure.lang.ITransientAssociative"\n :at [clojure.core$assoc_BANG_ invokeStatic "core.clj" 3259]}]\n :trace\n [[clojure.core$assoc_BANG_ invokeStatic "core.clj" 3259]\n [clojure.core$assoc_BANG_ invoke "...
19:22justin_smithSomelauw: missing the main arg
19:23justin_smithor wait, just in the wrong order
19:23Somelauw,(persistent! (update! (transient {}) :a (fnil inc 0)))
19:23clojurebot{:a 1}
19:26Somelauw,(persistent! (update! (transient {}) :a fnil inc 0))
19:26clojurebot{:a #object[clojure.core$fnil$fn__5727 0x4e893b51 "clojure.core$fnil$fn__5727@4e893b51"]}
19:28justin_smithSomelauw: (fnil nil inc 0) ; this defines a function
19:30Somelauw I see. It looked so tempting.
19:31python476is there a (doto-n <init> <f> ... <h>) that returns the result of (h <init'>) ?
19:32python476I need a blend of doto and ->
19:33justin_smith(-> init (doto f ...) h)
19:33python476I must have messed something up, I tried this earlier :)
19:55lode-moonerLet's say I'm working on a copyrighted closed-source project with leiningen. What am I supposed to put in my project.clj file under :license?
19:57justin_smithlode-mooner: you can leave the key out, or specify "Copyright Me 2016 all rights reserved"
19:57justin_smithno automatic license
21:55slesterhi there! lein repl is choking when I have :main set... any idea what I'm doing wrong? "Could not locate main__init.class or main.clj on classpath."
21:55justin_smithslester: well, what's your :main setting?
21:56slesterlein run, however, does work. lein repl works when I comment out the :main
21:56slesterjustin_smith, it's boring, `:main amiss.core/main`
21:56justin_smithslester: it should point at a namespace, not a function
21:57justin_smithslester: I assume lein run is working because there are top level side effects in amis.core
21:57slesteroh, is that new or did I mis-copypasta from somewhere
21:57slesterit's not actually calling main ever in core.clj
21:57slesterso I should call the main function myself?
21:57slesterin core.clj?
22:01justin_smithslester: you specify :main amis.core and then lein run will call amis.core/-main
22:01justin_smithsounds like maybe you just have top level side effects in amis.core?
22:04slesterjustin_smith, ah, I actually didn't have the - in front of main. Thanks, all fixed up :)
22:05justin_smithslester: yeah, it's picky about that
22:06slesterbut yeah, if you put amiss.core/main into :main, lein will happily run it, but repl chokes (which makes sense now)
22:47tolstoyHuh. Using Electron seems neat. Build for OSX and you get a .app file with everything you need.
22:47tolstoyFor windows, you get a directory with lots of stuff and an exe which isn't stand-alone.
22:51lockdown.app are directories
22:55tolstoyYes. Handy. I was hoping that somehow all the "node.dll" stuff would be bundled into a single exe file. Yes. Ignorant of windows.
22:57tolstoyI suppose the assumtion is that you'd never install just an EXE. It's always an installer.
23:26slesteris there a more idiomatic way of doing (update-in state [:player 2] #(partial apply conj) '(1 2))?
23:29justin_smith(update-in state [:player 2] conj 1 2)
23:32slesterjustin_smith, the thing coming in is a list, that was just an example :(
23:33justin_smithslester: my thing does what yours does
23:33justin_smithoh you mean the '(1 2) is the form you get?
23:33slesteryeah
23:33justin_smith(update-in state [:player 2] into l)
23:34justin_smithinto is basically an optimized apply conj
23:34slesterjustin_smith, yesss, thanks
23:49tolstoyInteresting. Using CLJS with Electron to build a tiny cross platform network diagnostics tool. Works well.
23:50tolstoyBUT, when I run it on windows, it works the first time, when all tests (socket connects, basically) timeout any subsequent time.
23:50tolstoyIf I copy the same bits over the top of the old bits and start it up, it works again.
23:51tolstoySometimes just re-starting it makes it work. Maybe something's not "resetting" on Windows. Oy.
23:51tolstoyRegardless, using CLJS with Electron is a pleasure. ;)
23:52justin_smithtolstoy: perhaps it's about some child process that isn't exiting properly - on a *nix child processes are reaped but not on win
23:53tolstoyjustin_smith: Even using node? Yeah, it's weird.
23:53tolstoyMaybe it's these VMs I downloaded from MS for IE/Edge testing.
23:53justin_smithtolstoy: I'm just talking about the OS level behavior, that's a big win/nix difference
23:54justin_smiththe other big ones being you need something else other than pipes (and there could be a bug there) and file locking is implicit
23:54tolstoySurely node and Electron aren't that janky....
23:55justin_smithon nix you can use an unlinked file, it's perfectly legit to use until the last program that has a handle to it exits. You can also remove a file some app is using, and the app will keep using it.
23:55justin_smithtolstoy: just citing known differences, I clearly have nowhere near enough info to identify the real problem
23:55tolstoyI hear you.
23:56tolstoyCould be the way I'm invoking it, too.
23:56tolstoyI've got a directory filled with DLLs, resources (the JS code), and an EXE. I click on the EXE and presume it's loading in the DLLs as necessary.
23:56justin_smithtolstoy: I am not surprised to hear of any dev-centric tooling being totally bizarre on windows, since relatively few devs use windows any more
23:57justin_smithcompared to the recent past
23:57tolstoyjustin_smith: Supposedly this is the same thing Atom is using. But who knows.