2016-05-22
| 00:47 | etiago | any Clojure gurus around to lend me a hand with this? http://pastebin.com/Xq7HksiY why don't I get any output? |
| 00:47 | etiago | it's part of a larger thing, but I simplified it |
| 00:48 | etiago | I would just like to print the references to those functions in trigger-cb-vector |
| 00:51 | amalloy | for is lazy |
| 00:52 | tolstoy | etiago replace "for" with "doseq". |
| 00:54 | etiago | tolstoy: seriously? this whole thing was just because 'for' was not evaluating? |
| 00:55 | etiago | amalloy: tolstoy: so... lazy means it would only evaluate once I would try to use its return value, is that so? |
| 00:55 | tolstoy | As amalloy mentioned, `for` returns a lazy sequence, so it won't evaluate until something uses the values in it. |
| 00:55 | amalloy | etiago: yes |
| 00:55 | etiago | hah, yeah it works now :) |
| 00:55 | amalloy | in your -main you create a lazy sequence, and then throw it away |
| 00:56 | etiago | thanks tolstoy, amalloy! |
| 00:56 | etiago | yeah... I haven't got used to lazy evaluation yet, it didn't even cross my mind |
| 00:56 | etiago | <-- clojure beginner |
| 00:56 | tolstoy | Heh. It can be confusing when you type that into the REPL, because it'll work! |
| 00:57 | etiago | tolstoy: exactly! I was debugging it and it did work, and in my program it didn't |
| 00:57 | tolstoy | There's an implied print in there, which will then "realize" the lazy seq. read-eval-PRINT-loop. ;) |
| 00:58 | etiago | and it's one of those "false friends" because I come from a declarative language background where for just... iterates. but 'for' in Clojure is a bit of a different story |
| 00:58 | etiago | ha yeah :D |
| 01:07 | tolstoy | The other gotcha I've seen drive new folks crazy is (println "something") doesn't print the quotes. They think they have a string, but it's a symbol, or the opposite. |
| 01:08 | etiago | tolstoy: haven't ran into that before but thanks for the headsup :p |
| 01:29 | Gh0stInTheShell | Wait cljs evaluates fractions as floating point and clj evaluates them as ratios? |
| 01:31 | dysfun | yes. cljs only has floats |
| 01:31 | dysfun | (because js only has floats) |
| 01:32 | TEttinger | doubles? |
| 01:32 | dysfun | well, they are doubles |
| 01:32 | TEttinger | can you do 1/3 in CLJS? is the numeric tower different? |
| 01:32 | TEttinger | ,1/3 |
| 01:33 | clojurebot | 1/3 |
| 01:33 | dysfun | there are only doubles in cljs |
| 01:33 | dysfun | so that will come back approximately 0.33 |
| 01:33 | TEttinger | ouch |
| 01:33 | Gh0stInTheShell | ,(defn square_root_three [] (loop [lower 1 upper 2 depth 50] (let [n (/ (+ upper lower) 2)] (if (== depth 0) n (if (< (* n n) 3) (recur n upper (dec depth)) (recur lower n (dec depth))))))) |
| 01:33 | clojurebot | #'sandbox/square_root_three |
| 01:34 | Gh0stInTheShell | ,(square_root_three) |
| 01:34 | clojurebot | 3900231685776981/2251799813685248 |
| 01:34 | dysfun | cause with proper integers, we can build whatever binary structures we like |
| 01:34 | Gh0stInTheShell | ,(double (square_root_three)) |
| 01:34 | clojurebot | 1.732050807568877 |
| 01:34 | Gh0stInTheShell | ,(time (double (square_root_three))) |
| 01:34 | clojurebot | "Elapsed time: 5.619722 msecs"\n1.732050807568877 |
| 01:35 | Gh0stInTheShell | ,(time (square_root_three)) |
| 01:35 | clojurebot | "Elapsed time: 67.226463 msecs"\n3900231685776981/2251799813685248 |
| 01:35 | Gh0stInTheShell | ,(time (square_root_three)) |
| 01:35 | clojurebot | "Elapsed time: 6.271845 msecs"\n3900231685776981/2251799813685248 |
| 01:35 | TEttinger | ha what... |
| 01:35 | Gh0stInTheShell | lol |
| 01:35 | TEttinger | timing isn't the most precise thing with IRC and printing |
| 01:35 | Gh0stInTheShell | :) |
| 02:24 | idev | anyone here written a Frege => Clojure compiler? |
| 02:24 | idev | I want the type checking of Frege, but CLJS's ability to generate JS code. |
| 02:25 | dysfun | i doubt it exists |
| 02:25 | justin_smith | as far as I know the only frege compiler is the one that generates java code |
| 02:25 | dysfun | core.typed supports cljs |
| 02:25 | idev | core.typed is very weird to use in practice (and quite slow the last time I tried it) |
| 02:26 | dysfun | yes, but since what you want doesn't exist, i'm giving you alternatives :) |
| 02:26 | dysfun | however, if you just want to generate javascript from a typed language, there are options |
| 02:29 | tolstoy | elm? purescript? |
| 02:29 | dysfun | elm is fantastic for beginners |
| 02:30 | dysfun | and lots of exciting research coming out of it at the minute |
| 02:30 | dysfun | they have an entire project to improve their error messages |
| 02:30 | idev | purescript's compiler is too slow |
| 02:30 | idev | and its dependence on bower/node/whatever is a mess |
| 02:30 | idev | elm is sorta-kinda-weak FRP |
| 02:30 | dysfun | however if i wanted types to build javascript, i'd probably use haste or fay (both haskell) |
| 02:31 | idev | fay doesn't support type classes |
| 02:31 | dysfun | haste does |
| 02:31 | idev | haste I kinda like, quite a bit faster than ghcjs |
| 02:31 | dysfun | ghcjs tries to solve a bigger problem |
| 02:31 | dysfun | and because experience is king, i just can't use it yet |
| 02:31 | idev | but I'd relaly like server side to have power of jvm |
| 02:31 | idev | so I'm looking at clojure and frege |
| 02:32 | dysfun | then stop worrying about types |
| 02:32 | dysfun | clojure is the most integrated you are going to get on this |
| 02:32 | idev | I'm not smart enough to program without types. |
| 02:32 | dysfun | sure you are. if i can do it even though my brain doesn't wake up for several hours after i get out of bed, you can |
| 02:33 | ben_vulpes | dysfun: thoughts on typescript? |
| 02:33 | dysfun | ben_vulpes: not even interesting. |
| 02:33 | ben_vulpes | really! where does it fail? |
| 02:34 | dysfun | well for a start it takes in javascript++ and spits out javascript |
| 02:34 | dysfun | you have to like javascript to start with |
| 02:35 | tolstoy | If you're going to go types, go advanced types? |
| 02:35 | dysfun | yeah, there's no point otherwise |
| 02:36 | dysfun | i don't like type systems as a concept, but when they're there, i'll use them to enforce invariants |
| 02:36 | dysfun | most type systems just make you type a lot |
| 02:36 | tolstoy | haha |
| 02:37 | dysfun | everything is just a tool |
| 02:38 | tolstoy | My biggest problems in code is organization, general architecture. |
| 02:39 | tolstoy | If I learn enough to know I have the wrong approach, I'm not sure a sophisticated type system helps. |
| 02:39 | dysfun | interesting, that's not a problem i experience except when i'm doing leading edge stuff |
| 02:39 | tolstoy | Well, I mean, if I have a big problem, "types" isn't it. It's architecture. |
| 02:40 | tolstoy | Which is really a problem of Too Big. |
| 02:40 | dysfun | just do what everyone else does and make it postgres' problem |
| 02:41 | tolstoy | I don't have a lack of solutions, but better types doesn't ever seem to be one of them. |
| 02:42 | dysfun | 99 problems but lack of types aint one? |
| 02:42 | tolstoy | Yikes! Clojure Remote vids are not high def! |
| 02:42 | ben_vulpes | postgres doesn't do much for my ui complexity. |
| 02:42 | dysfun | sure it does, it means every page starts to look like a table |
| 02:43 | tolstoy | You all have seen that now ancient parody SQL on Rails? |
| 02:43 | dysfun | yup |
| 02:44 | tolstoy | Oh, good. It's still on Youtube. |
| 02:44 | tolstoy | Website's gone, though. Lots of fun. |
| 02:44 | dysfun | should've written it on top of access |
| 02:46 | ben_vulpes | there's also the accidentally self-parodic aquameta |
| 02:47 | tolstoy | Is it possible to put a library out these days without a Brett Victor style rationale? |
| 02:47 | dysfun | what's special about his rationales? |
| 02:51 | tolstoy | I don't know. They seem low-key in tone, but high-brow in implication. |
| 02:51 | tolstoy | http://blog.aquameta.com/2015/08/28/introducing-aquameta/ |
| 02:51 | tolstoy | "Software Development Complexity Bottlenecks Human Progress" -> therefore build a whole stack on Postgres. ben_vulpes is right. ;) |
| 02:52 | dysfun | wow, there's so much in that page that makes me not want to deploy it |
| 02:52 | tolstoy | "We believe that it is a social imperative, arguably one of the greatest demands of our time, to make software development more accessible to everyone." |
| 02:53 | dysfun | well i do agree about the social imperative, but i'm not convinced he's gone in the right direction |
| 02:53 | tolstoy | Having said that, here's my new UUID lib. ;) Eh. Just snarking for no good reason. |
| 02:53 | dysfun | i put in a rationale whenever it's not obvious why the user should give a fuck |
| 02:54 | tolstoy | I thought the light-table thing got caught up in the rhetoric a bit, then turned out to be an editor. |
| 02:54 | dysfun | have you mixed up some of the talk about eve? |
| 02:54 | dysfun | (which was frankly underwhelming) |
| 02:55 | tolstoy | Yeah, there's the rhetoric of it, and the reality. |
| 02:56 | dysfun | but i can't fault the spirit they set out with |
| 02:56 | tolstoy | LightTable had some of that. I remember thinking it was going to be a whole new way of interacting with Clojure, but.... |
| 02:56 | dysfun | heh, yes |
| 02:56 | dysfun | turns out that it's a very hard thing to do |
| 02:56 | dysfun | (yes, i've got projects on experimenting...) |
| 02:57 | tolstoy | I only complain about over-the-top rhetoric because I so want it to end up being true. |
| 02:57 | dysfun | yup. that's why my rationales include notes about when you may not want to use it |
| 02:57 | dysfun | realism. |
| 02:57 | tolstoy | Heh. Any thoughts on that Arachne thing? |
| 02:58 | dysfun | well i'm impressed he got it funded |
| 02:59 | dysfun | but you know, we already have many http servers, html generation libraries, jdbc interfaces |
| 03:00 | dysfun | i have written three libraries that make jdbc less painful |
| 03:00 | dysfun | for the amount of time he's going to have to give it attention, i'm expecting he'll settle for something activerecord-style |
| 03:00 | tolstoy | I'm kinda with yogthos' puzzlement: I just don't see what it adds. Yet another antidote as problematic as the poison it cures? |
| 03:01 | dysfun | yes, it's very confusing |
| 03:01 | dysfun | since the amount of time involved for all of that is not that much, it's insane to think he can replace the world |
| 03:01 | tolstoy | To me, every db-backed app is just a custom mini-language over JDBC. Just right for the job! |
| 03:02 | dysfun | well i'm trying to change that :) |
| 03:02 | tolstoy | datalog for rdbms? |
| 03:02 | dysfun | maybe one day |
| 03:02 | dysfun | i've tackled the toolchainy parts |
| 03:02 | dysfun | i'm currently procrastinating finishing my sql generation library |
| 03:03 | tolstoy | I remember sitting through the Pedestal talk and just being confused. |
| 03:03 | dysfun | (clojure data structures, pretty close to the language, designed for behind the scenes use) |
| 03:03 | tolstoy | Then react + cljs wrappers came along, and it as all clear (and superceded). |
| 03:03 | dysfun | yes, i still don't see the point of either pedestal or that other thing that claims to open up java apis as webservices easily |
| 03:05 | tolstoy | On the other hand, I really like Luke's quiescent, though Magnar's PR to update to the latest React has languished for a month. |
| 03:07 | tolstoy | Before it came along, I'd settled on a kind of "game loop" for CLJS UIs. Instead of React's render stuff, I just used dommy to do it the hard way. |
| 03:07 | tolstoy | It was more about organization for me. |
| 03:08 | dysfun | react + textboxes = disaster |
| 03:08 | tolstoy | One namespace for updating state. Doesn't matter how crappy it is, it's in that one place. Etc, etc. Here's another for updating the UI. |
| 03:08 | dysfun | also if you browse with a lot of tabs open, you can hear when you have react running |
| 03:08 | tolstoy | Heh. |
| 03:09 | dysfun | or ember. jesus that was slow |
| 03:10 | dysfun | i wonder if we could crowdfund an open source datomic-like |
| 03:10 | tolstoy | The most convincing argument I've heard for Full Stack Clojure web stuff is that it provides solutions for stuff you don't have time to master, like auth, security, etc. |
| 03:10 | tolstoy | Oh, that would be good. |
| 03:10 | dysfun | i could really use some paid work, but who wants to crowdfund someone they've never heard of? |
| 03:11 | insamniac | i'll do it! |
| 03:11 | tolstoy | If you can put together a prototype, then you might be surprised. |
| 03:11 | dysfun | heh |
| 03:11 | insamniac | i've got at least 10 bucks |
| 03:11 | dysfun | it's tempting |
| 03:11 | dysfun | i would really like the product to exist |
| 03:11 | dysfun | i think a lot of people would really like the product to exist |
| 03:12 | dysfun | and the lack of the existence of it is why a lot of people don't stick with clojure |
| 03:12 | tolstoy | Seems like if you know how to implement a persistent map, you're 1/2 the way there. The other 1/2 is datalog. |
| 03:12 | dysfun | which is mostly about learning datalog harder |
| 03:12 | dysfun | there are only three datalog implementations on clojure toolbox |
| 03:13 | tolstoy | Maybe doesn't even need to be datalog especially. |
| 03:13 | dysfun | datalog is pretty cool |
| 03:14 | dysfun | fuck it, gonna play about |
| 03:14 | tolstoy | demo could just show EAVT saved to a data store, a transactor and peer, and the kickstarter is for datalog and produtionizing. |
| 03:14 | tolstoy | That whole "datoms" thing would be good enough at first. ;) |
| 03:14 | dysfun | well i was thinking local peer for the demo |
| 03:16 | tolstoy | conceptual transactor, I guess. |
| 03:16 | dysfun | yes |
| 03:17 | tolstoy | Even storing EAVT in a four column SQL table is really interesting. |
| 03:17 | dysfun | yes, i thought about that too |
| 03:17 | tolstoy | Enlightening, might be a better word. |
| 03:17 | tolstoy | I realized why the queries return just entity ids. Once you get that set back, you can then resolve them. Makes a lot of sense (for simplifying queries). |
| 03:22 | dmiles | it'd be nice if something like KnowdgeWorks existed in Clojure |
| 03:23 | dysfun | what's that? |
| 03:24 | tolstoy | This? http://www.lispworks.com/products/knowledgeworks.html |
| 03:24 | dmiles | that yes |
| 03:24 | dmiles | that is actually a datalog env |
| 03:34 | tolstoy | LispWorks hobbyist edition 32bit $500. 64bit, $750. |
| 03:36 | dmiles | sadly that is part of why i feel i have to write my own version |
| 03:36 | dysfun | this is why i don't use lispworks |
| 03:36 | dysfun | and the smalltalks, some of the cool things are still spendy as well |
| 03:38 | tolstoy | IntellJ IDEA is $500 a year, so it's kinda inline with that. |
| 03:38 | dmiles | i brought KnowledgeWorks up since that is exactly what we want |
| 03:38 | tolstoy | Oh, wait, that's biz users. Individual is $150. |
| 03:38 | dmiles | the next ussue though.. is can you do an opensource project with it? |
| 03:38 | dysfun | and i wouldn't pay for IntelliJ either |
| 03:39 | tolstoy | Yeah, sorry. Just curious about all those prices. |
| 03:39 | dysfun | even if you can, would you? |
| 03:39 | dmiles | I mean Opensource that you and anyone you meet on the street can do code togehter in |
| 03:39 | dysfun | what's the point in opensourcing something built on something most people don't have? |
| 03:39 | dmiles | yup exactly |
| 03:39 | tolstoy | Ah, because LispWorks isn't just the IDE, it's the actual runtime, right? |
| 03:40 | dysfun | the licensing model is practically prehistoric |
| 03:40 | dmiles | Right my interest is the KnowlefgeWorkds rules system.. the stuff i want to work on opensourcewise is the rules peopel make |
| 03:40 | dmiles | and the bits of code the rules use |
| 03:41 | tolstoy | I suspect they're selling to a prehistoric market. |
| 03:41 | dysfun | probably, yes |
| 03:42 | tolstoy | dmiles: Sorry, yes, the rules stuff is interesting, but the Big Shiny is distracting. ;) |
| 03:43 | dmiles | one fun peice is i am cutting and pasting their docs into my systemsdocumation :P |
| 03:44 | dmiles | (and Cycorps documentation) |
| 03:44 | dmiles | but i am very annoyed i even have to do this phase of recreationg that their stuff |
| 03:45 | dmiles | well annoyed there is not that level of a datalog system out there already |
| 03:47 | dmiles | i am told that there isnt due to the lack of utility and value of it :P |
| 03:47 | dmiles | (hehe) |
| 03:48 | dmiles | or from the other side of that coin is those few companies that possess the power of such a software system hide it for dear life (refering to cycorp) |
| 07:01 | Kah0ona | I have a ref, with a boolean. I basically want stuff to happen once that boolean becomes true, and block/park otherwise. I'm new to core.async, which functions should i use here? |
| 07:01 | Kah0ona | futures? |
| 07:01 | Kah0ona | also; when said boolean changes to false again, it should stop 'stuff to happen' |
| 07:04 | Kah0ona | (I want to avoid any form of explicit busy-waiting if possible) |
| 07:05 | dysfun | sorry, you're trying to model this ref behaviour in core.async instead? |
| 07:41 | dimon_ | hi, could any take a look? https://gist.github.com/jjmornim/8bebc673d0094b747ffdc7151fba8325 |
| 07:43 | dysfun | i commented on it |
| 07:44 | dimon_ | dysfun: tnx, man |
| 07:44 | dysfun | np |
| 07:50 | dimon_ | dysfun: not working properly |
| 07:50 | dysfun | howso? |
| 07:50 | dysfun | oh i see |
| 07:51 | dysfun | fixed |
| 09:10 | gour | hello, i'm considering to learn racket and use it for desktop (gui) app. have no experience with either scheme or lisp, but wonder if someone if familiar with both, how does it compare with clojure, especially in regard to writing gui apps? i'm not very fond of java and java apps and did play with haskell in the past so like FP style in general. anyone? |
| 09:21 | shiranaihito | gour: well, with Clojure you could use Java's Swing for the GUI. With Racket.. is there anything comparable? |
| 09:22 | gour | shiranaihito: iirc, Racket has its own GUI which uses platform's native UI |
| 09:22 | shiranaihito | gour: so with OS X it would somehow use Cocoa? |
| 09:23 | shiranaihito | i have no clue, but it would be surprising if it would be just as "full-fledged" for writing Mac UIs as using Cocoa etc through Apple's own tools |
| 09:23 | gour | shiranaihito: here is the info: http://blog.racket-lang.org/2010/12/racket-version-5.html |
| 09:26 | shiranaihito | ok, but are there any examples of apps using that |
| 09:28 | gour | maybe this: http://docs.racket-lang.org/gui/Windowing_Functions.html#%28part._.System_.Menus%29 |
| 09:31 | shiranaihito | gour yeah, it looks kind of promising |
| 09:31 | shiranaihito | but i'm still not sure it's a better choice than clojure |
| 09:31 | shiranaihito | or.. let's say it's unclear that it would be :) |
| 09:32 | gour | shiranaihito: any pro/cons in reagard to racket vs clojure? |
| 09:32 | shiranaihito | no clue about racket, but at least clojure looks like a reasonably safe bet |
| 09:32 | gour | ok. |
| 09:33 | shiranaihito | it depends on your requirements / circumstances too ofc |
| 09:33 | gour | shiranaihito: let me explore web site etc. |
| 09:33 | shiranaihito | e.g. what exactly do you want to accomplish (and why :p) and would doing something else be a better use of your time anyway :P |
| 09:40 | gour | shiranaihito: well in the past i tried with haskell (like FP); but there was too much of monads...otoh, i'd like to have some fun when working on a hobby project, have more type-safe language which is still (relatively) syntactically clean unlike things like e.g. Rust :) |
| 09:40 | shiranaihito | :P |
| 09:41 | shiranaihito | if you're just exploring for fun and to learn a new language, i guess you can just go for it without worrying about the details too much :) |
| 09:42 | shiranaihito | on the other hand, it would be nice if the language you learn would be suitable for getting stuff done in the real world too, so that your new skills could be applied towards that end later on :) |
| 09:42 | shiranaihito | .. and in that respect, clojure is a safe bet again :) |
| 09:44 | gour | ok, i'll explore it a bit |
| 09:49 | dysfun | shiranaihito: Swing isn't going to have a native feeling ui |
| 09:49 | shiranaihito | dysfun true, but does he need one? |
| 09:50 | dysfun | who knows? |
| 09:50 | shiranaihito | for all we know, no one else will ever see his app |
| 09:50 | shiranaihito | yeah.. so if we don't know, then we don't know that not having a native feeling UI will ever be a problem either, and so it's not all that relevant? :) |
| 09:50 | dysfun | but to assume makes an ass out of u and me. oslt. |
| 09:50 | shiranaihito | well.. who assumed and what? :P |
| 09:51 | dysfun | i'm just saying it's good not to assume that it isn't important |
| 09:51 | shiranaihito | but it's good to assume it is? :P |
| 09:51 | dysfun | i didn't say that :p |
| 09:52 | shiranaihito | well it's an assumption either way and assumptions are bad mmmm'kay? :P |
| 09:52 | dysfun | but it is good to assume it's worth mentioning :) |
| 09:52 | shiranaihito | it can't be if assumptions are bad! :P |
| 09:52 | dysfun | everything is everything else. |
| 09:53 | shiranaihito | now we're veering into r/philosophy -territory :P |
| 09:53 | dysfun | the parentheses...manifold and fractal... |
| 09:54 | shiranaihito | so how do you feel about Redux and the related ecosystem btw? |
| 09:54 | dysfun | redux? |
| 09:54 | shiranaihito | oh.. you've been spared.. :D |
| 09:54 | shiranaihito | ok, nevermind :P |
| 09:54 | dysfun | i assume you're not talking of the only thing i know by that name |
| 09:54 | shiranaihito | (it's a "state management library" for javascript etc) |
| 09:54 | shiranaihito | oh? just messing with me or something? |
| 09:55 | dysfun | well i think we can safely assume i don't like it even without reading it |
| 09:55 | shiranaihito | well, you managed to confuse me with that mysterious comment.. care to elaborate? |
| 09:55 | dysfun | first comment: the only product i know called redux is an internal product at a company |
| 09:56 | shiranaihito | oh ok |
| 09:56 | shiranaihito | it's not that then :) |
| 09:56 | dysfun | anyway, i'll save reading it by assuming it's |
| 09:56 | shiranaihito | https://github.com/reactjs/redux |
| 09:56 | dysfun | as bad as any other javasscript thing |
| 09:56 | shiranaihito | this one gives you "predictable state" :) |
| 09:56 | shiranaihito | :P |
| 09:56 | dysfun | no it doesn't. it's clearly linked to react |
| 09:56 | shiranaihito | you're disappointed with javascript thingies? :p |
| 09:57 | shiranaihito | react is actually a good thing, btw |
| 09:57 | shiranaihito | redux i'm not sure about, but it's got some neat ideas in it |
| 09:57 | dysfun | i think we're going to agree to disagree on this to save time. |
| 09:58 | dysfun | it is a matter of taste, therefore we can both be right |
| 09:58 | shiranaihito | disagree on what? react being good? |
| 09:59 | dysfun | yes |
| 09:59 | shiranaihito | well, i don't think it's just a matter of opinion |
| 09:59 | shiranaihito | i'm not keen on a (lengthy) debate either, but it would be interesting to hear about your views on react |
| 09:59 | shiranaihito | like.. why is it bad? :P |
| 10:01 | jonaskoelker | I'm not intuiting the semantics of closures properly, see http://paste.debian.net/693856/ -- can someone explain or point me to a way of understanding what's happening? |
| 10:01 | jonaskoelker | (damn state) |
| 10:02 | justin_smith | jonaskoelker: why defn on line 4? |
| 10:02 | jonaskoelker | justin_smith: the real code involves mutually recursive functions (via post-delay on android). I'm not sure defn is necessary, but I would like to name my things |
| 10:03 | justin_smith | jonaskoelker: what's your question here? |
| 10:04 | jonaskoelker | "what's the minimal subset of the operational semantics of clojure which explains the difference in behavior?" |
| 10:04 | jonaskoelker | (... "between using defn and using fn") |
| 10:04 | justin_smith | jonaskoelker: oh, it doesn't work because you create foo twice - and the same foo is called by (f) or (g) |
| 10:05 | justin_smith | jonaskoelker: so this isn't about clojure, it's about the behavior of vars |
| 10:05 | justin_smith | defn returns a var, when you call a var, it's latest value is looked up and called |
| 10:05 | justin_smith | so it always calls the most recent foo |
| 10:05 | justin_smith | this difference has nothing to do with closures, it's just about what vars do |
| 10:06 | jonaskoelker | let me try and express that in my own words: counter has a scope, which the evaluation of (defn foo) mutates. On the second evaluation of (defn foo), the closure over the first atom becomes garbage. |
| 10:06 | justin_smith | if you did (def f @(counter)) (def g @(counter)) then you would see your expected behavior (but why use defn and create vars?) |
| 10:06 | justin_smith | jonaskoelker: no |
| 10:06 | justin_smith | vars are a mutable container, calling defn changes the contents |
| 10:06 | justin_smith | that's it |
| 10:07 | justin_smith | you aren't using the function directly, because you do not deref the var, so you always get the latest var contents |
| 10:07 | justin_smith | defn foo doesn't mutate register, it just mutates foo (and the new foo points to a different register) |
| 10:08 | jonaskoelker | so... is there an implicit global/per-function/... map of names to vars? |
| 10:08 | justin_smith | jonaskoelker: not implicit, explict |
| 10:08 | jonaskoelker | there's some context to that explanation which I probably don't (fully) know yet |
| 10:08 | justin_smith | jonaskoelker: vars are mutable globally accessible containers, that is their job |
| 10:09 | justin_smith | if you don't want that, don't call defn inside another defn |
| 10:10 | jonaskoelker | I see, if I (eval foo) before (def f ...) it doesn't name-error |
| 10:10 | jonaskoelker | that is... interesting |
| 10:10 | justin_smith | right, the compiler creates foo when you define counter |
| 10:10 | justin_smith | because vars are not for locals |
| 10:10 | jonaskoelker | so, what's the proper way to do named local functions? |
| 10:10 | justin_smith | jonaskoelker: let, or letfn |
| 10:11 | jonaskoelker | I see |
| 10:11 | justin_smith | letfn allows mutual recursion, so I am guessing that is the one you want |
| 10:12 | jonaskoelker | Is (defn bar ...) different from scheme's (define (bar ...))? |
| 10:12 | jonaskoelker | I guess so too :) |
| 10:12 | justin_smith | yes, it is, because define in scheme is capable of creating locals |
| 10:13 | justin_smith | defn is not |
| 10:13 | jonaskoelker | I'll try to (assoc brain (not-predictive sicp-examples clojure)) ;-) |
| 10:13 | justin_smith | heh |
| 10:14 | jonaskoelker | I'll probably prefer assoc!, but yeah :D |
| 10:15 | justin_smith | jonaskoelker: another thing that might help - after running your example, (= f g) returns true |
| 10:15 | justin_smith | (since they both point to the same var object - no two functions are ever equal in clojure) |
| 10:16 | jonaskoelker | that is unsurprising now that you mention it and I have though about it for 30 seconds ;) |
| 10:18 | jonaskoelker | btw, my question having been answered, about "so this isn't about clojure, it's about the behavior of vars" -- when & how would you use vars outside clojure? |
| 10:18 | jonaskoelker | I guess you *can* via Java interop, but... why? What benefits do they provide, and at what cost? |
| 10:18 | justin_smith | jonaskoelker: I meant not about closures but about vars |
| 10:19 | jonaskoelker | oh :) |
| 10:19 | jonaskoelker | eajy typo ;) |
| 10:19 | justin_smith | java interop is used for the same reason you would use c ffi in scheme - to access a huge ecosystem of existing libraries |
| 10:19 | justin_smith | so we don't need to make things from scratch |
| 10:20 | jonaskoelker | I get that. I meant using clojure vars from java (using java interop in the probably less used direction) |
| 10:20 | justin_smith | well, if you want to access clojure values from java, you are going to need to access them via vars (even the function that returns a vale is in a var before you call it) |
| 10:21 | justin_smith | *value |
| 10:23 | jonaskoelker | I see. So do namespaces have something like a Map<String, ClojureVar> baked into them? |
| 10:23 | jonaskoelker | (or just Var for short, I guess) |
| 10:23 | justin_smith | symbol/var yes |
| 10:23 | jonaskoelker | "symbol/var"? |
| 10:23 | justin_smith | not string to var, symbol to var |
| 10:23 | jonaskoelker | ah |
| 10:24 | jonaskoelker | Map<texty-thing, Var> ;) |
| 10:24 | justin_smith | ,(ns-interns *ns*) ; you can access the map |
| 10:24 | clojurebot | {} |
| 10:24 | justin_smith | ,(defn f []) |
| 10:24 | clojurebot | #'sandbox/f |
| 10:24 | justin_smith | ,(ns-interns *ns*) |
| 10:24 | clojurebot | {f #'sandbox/f} |
| 10:24 | jonaskoelker | ,(f) |
| 10:24 | clojurebot | nil |
| 10:25 | jonaskoelker | I got confused about , being unquasiquote(?) versus whitespace for a second :D |
| 10:25 | justin_smith | ahh, right |
| 10:25 | jonaskoelker | neatly, copy-pasting ",my-form-goes-here" to clojure --repl works as expected :) |
| 10:26 | justin_smith | ,,,,,,(+,,,,,1,,,,1,,,,),,,,, ; don't do this in real code |
| 10:26 | clojurebot | 2 |
| 10:26 | jonaskoelker | whaa-eee? :( |
| 10:26 | jonaskoelker | why would you *do* that? |
| 10:26 | jonaskoelker | :D |
| 10:26 | justin_smith | it's whitespace, that's all - just a very silly way to demonstrate that fact |
| 10:26 | jonaskoelker | I understand that much. |
| 10:27 | jonaskoelker | editor configuration: indent with tabs, spaces or commas? :D |
| 10:28 | jonaskoelker | now that I have your ear, what's the difference between strings, keywords and symbols (under the hood)? |
| 10:29 | justin_smith | keywords are self-evaluating, keywords and symbols are interned, keywords and symbols invoke get when used as a function |
| 10:29 | justin_smith | and symbols are resolvable |
| 10:29 | justin_smith | that's the major stuff at least |
| 10:29 | amalloy | symbols don't necessarily have pointer equality semantics, which is what's usually meant by interned |
| 10:30 | justin_smith | amalloy: oh! I thought they were interned in clojure like keywords are |
| 10:30 | amalloy | ,(identical? 'a 'a) |
| 10:30 | clojurebot | false |
| 10:30 | jonaskoelker | o.O |
| 10:30 | justin_smith | jonaskoelker: that just means they are equal, but not the same object in memory |
| 10:31 | amalloy | they can't be, because of metadata |
| 10:31 | justin_smith | ahh! of course, that makes sense now, thanks |
| 10:32 | jonaskoelker | ,(count (take-while identity (map identical? (iterate inc 0) (iterate inc 0)))) ; is that java.lang.Integer keeping the small ones identical, kinda' sorta' like what python does but in a different way? |
| 10:32 | clojurebot | 128 |
| 10:33 | justin_smith | jonaskoelker: iirc yes, the small ones are interned basically, the larger ones not - but amalloy is more likely to have the real dirt on that one than I |
| 10:33 | amalloy | i dunno about python, but yes |
| 10:33 | jonaskoelker | ISTR there being at *least* a java.lang.Integer.ZERO and .ONE, but I don't know about .ONE_HUNDRED_AND_TWENTY_SEVEN |
| 10:34 | justin_smith | jonaskoelker: this leads to a really weird stupid-jvm-trick where you can mutate 5 so it is equal to 4 |
| 10:34 | jonaskoelker | mutable ints are the best ints :p |
| 10:34 | justin_smith | and braek just about everything in the process, of course |
| 10:35 | jonaskoelker | introducing a whole new *class* of off-by-one errors |
| 10:35 | jonaskoelker | ;) |
| 10:36 | jonaskoelker | I like how in python, True and False are just bound names in the builtins namespace, so you can say "True, False = False, True" and all hell breaks loose. |
| 10:36 | jonaskoelker | but mutating objects is even more evil |
| 10:36 | justin_smith | jonaskoelker: there's a weird one in the jvm |
| 10:36 | justin_smith | ,(if (Boolean. "false") :yes :no) |
| 10:36 | clojurebot | :yes |
| 10:36 | jonaskoelker | wat |
| 10:37 | justin_smith | the answer here being, "never use the Boolean constructor" |
| 10:37 | jonaskoelker | ,(boolean (Boolean. "false")) |
| 10:37 | clojurebot | false |
| 10:37 | jonaskoelker | ,(boolean (Boolean. "False")) |
| 10:37 | clojurebot | false |
| 10:37 | jonaskoelker | WHAT?! |
| 10:37 | justin_smith | ,(= (Boolean, "false") (boolean (Boolean. "false"))) |
| 10:37 | clojurebot | #error {\n :cause "Expecting var, but Boolean is mapped to class java.lang.Boolean"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Expecting var, but Boolean is mapped to class java.lang.Boolean, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6875]}\n {:type java.lang.RuntimeException\n :message "Expe... |
| 10:37 | justin_smith | ,(= (Boolean. "false") (boolean (Boolean. "false"))) |
| 10:37 | clojurebot | true |
| 10:38 | justin_smith | none of it makes sense |
| 10:38 | jonaskoelker | ,(if (boolean (Boolean. "false")) :yes :no) |
| 10:38 | clojurebot | :no |
| 10:38 | jonaskoelker | :o |
| 10:38 | jonaskoelker | *!@^&# |
| 10:38 | justin_smith | jonaskoelker: so they are equal, but behave differently in an if check |
| 10:38 | jonaskoelker | @^#&$*!@$!!!!! |
| 10:39 | justin_smith | anyway, these things are actually refreshingly rare - but still totally daft |
| 10:39 | jonaskoelker | help, I lost my sanity. Have you seen it lately? |
| 10:39 | jonaskoelker | okay, two steps back. What is going on there? |
| 10:40 | jonaskoelker | ,(= Boolean/FALSE (Boolean. "false")) |
| 10:40 | clojurebot | true |
| 10:40 | jonaskoelker | ,(.equals Boolean/FALSE (Boolean. "false")) |
| 10:40 | clojurebot | true |
| 10:40 | justin_smith | jonaskoelker: boolean casts to an instance of Boolean, if only checks object identity, = checks value and not just object identity |
| 10:41 | jonaskoelker | so clojure-if is "if (val != null && val != Boolean.FALSE)" ? |
| 10:41 | justin_smith | wait - I can express that fir part more clearly - the function boolean casts to one of the two canonical Boolean instances, the ones that are checked by identity |
| 10:42 | justin_smith | jonaskoelker: yeah, that sounds about right - looking it up because now I am curious |
| 10:44 | jonaskoelker | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L2696 |
| 10:44 | justin_smith | jonaskoelker: well look at that, exactly what you suggested |
| 10:45 | jonaskoelker | yay, I has a intuition :) |
| 10:48 | jonaskoelker | so... (defn string2bool [s] (-> s Boolean. boolean)) and only ever use that? |
| 10:48 | jonaskoelker | ,(defn string2bool [s] (-> s Boolean. boolean)) |
| 10:48 | justin_smith | or maybe just never use the constructors |
| 10:48 | clojurebot | #'sandbox/string2bool |
| 10:48 | jonaskoelker | ,(if (string2bool "false") :f :t)) |
| 10:48 | clojurebot | :t |
| 10:48 | jonaskoelker | wat? |
| 10:49 | justin_smith | really one can usually get by with just using the literals, and if using a string you could usually use the reader |
| 10:49 | justin_smith | but I guess if you need to turn a string into a boolean, the above makes sense |
| 10:49 | jonaskoelker | if it's a string from the user (which they copy-pasted from the interwebs), I'd rather not invoke the reader |
| 10:49 | justin_smith | ,(clojure.edn/read-string "false") |
| 10:49 | clojurebot | false |
| 10:49 | jonaskoelker | ,(if (string2bool "false") :t :f)) |
| 10:49 | clojurebot | :f |
| 10:50 | justin_smith | jonaskoelker: that is what the clojure.edn ns is for |
| 10:50 | jonaskoelker | turns out I swapped the keywords I meant |
| 10:50 | jonaskoelker | interesting... I haven't looked at edn much, but my impression is that some thought went into it |
| 10:50 | jonaskoelker | like most clojure things :) |
| 10:51 | justin_smith | big picture, clojure.edn only allows constructors that are whitelisted (the defaults are without known side effects) and has no read-eval option to turn on |
| 10:53 | jonaskoelker | interesting. This sounds like one of those few places where I would sleep better at night if I had a type checker prove the absence of side effects, but meh... even haskell has a cheat function (unsafePerformIO), so... |
| 10:53 | justin_smith | jonaskoelker: well, it's only about constructing value objects - it's a specific set of them allowed |
| 10:53 | justin_smith | hash-maps, sets, vectors, etc. |
| 10:54 | justin_smith | we all hope none of those constructors have side effects, and so far we've not seen evidence of such bugs |
| 10:54 | jonaskoelker | yes, I understand, but even so... I like proofs. That means I can be dumb and still do smart things :D |
| 10:55 | justin_smith | I think the best evidence that those constructors are side effect free is that our clojure code works? But no proof, right. |
| 10:55 | jonaskoelker | agreed |
| 10:55 | jonaskoelker | by the way, is there any kind of library which will let me turn a value from a process calculus into something I can execute? |
| 10:56 | jonaskoelker | I'm contemplating modeling a UI in ccs and exploring the right-and-wrong-ness of my beliefs about the state transition graph. |
| 10:56 | justin_smith | well, in a very abstract way that's what core.async is doing (but probably not the literal way you mean) |
| 10:56 | justin_smith | but core.async is CSP - I don't know of CCP in clojure |
| 10:57 | jonaskoelker | potayto potarto, I hear Wadler says they're morally equivalent |
| 10:57 | justin_smith | in fact this is the first I have heard of CCP |
| 10:57 | justin_smith | hah, OK |
| 10:57 | jonaskoelker | ccp? you mean ccs? |
| 10:58 | justin_smith | oh, got all scrambled, sure |
| 10:58 | justin_smith | but ccp exists too! |
| 10:58 | justin_smith | http://www.sciencedirect.com/science/article/pii/S0304397504006942 hah |
| 10:59 | justin_smith | but while core.async implements CSP, it probably isn't the direct calculus tool you are looking for |
| 11:00 | jonaskoelker | yeah, summary/paraphrase of what I heard on the net: core.async is based on CSP, but doesn't eval csp expressions |
| 11:01 | jonaskoelker | though... maybe... just like you can eval an arbitrary expression, maybe I could have a small symbolic program with hooks and async-eval it. |
| 11:01 | jonaskoelker | and then put the heavy lifting in the hooks |
| 11:02 | jonaskoelker | it's funny, when I began uni studies in 2004, I was like "C is cool! Python is cool! formal models is bs, and I can manage state perfectly well", and now I'm leaning much more in the other direction |
| 11:03 | jonaskoelker | and I did a startup from right-after-uni (2012) to 2015-sep writing in python, so I was probably still going "python is cool" back then. |
| 11:03 | jonaskoelker | Well, I better go watch https://www.infoq.com/presentations/core-async-clojure :) |
| 11:04 | justin_smith | I think most of us end up needing to learn the hard way that state doesn't scale very nicely. |
| 11:04 | jonaskoelker | and also https://www.infoq.com/presentations/clojure-core-async |
| 11:05 | jonaskoelker | we also get dumberer as we age, so maybe the truth was less true for us when we were younger |
| 11:05 | jonaskoelker | oh, how I love confounds :-\ |
| 11:05 | jonaskoelker | damn you, confounds, for complecting truths! |
| 11:06 | jonaskoelker | or rather, damn you, world, for being so complected :) |
| 11:10 | jonaskoelker | I'm going to listen to Rich and cook food. Nice chatting with you, Justin, and thanks for the help :) |
| 11:16 | dysfun | justin_smith: holy crap i just saw your new twitter avatar. you have a beard now |
| 11:17 | dysfun | we can officially let you at the unix system |
| 11:17 | justin_smith | it's pretty long actually, I've had it for about 3/2 years |
| 11:27 | jonaskoelker | shit, I just shaved. Do I have to use windows now? :( |
| 11:27 | dysfun | haha |
| 11:27 | dysfun | justin_smith: you can use BeOS if you want |
| 11:28 | dysfun | OS/2? |
| 11:31 | engblom | OS/2 was really amazing for its time. You could format a floppy and still get stuff done while it happened. |
| 11:31 | engblom | All stuff from MS became really slow as soon as you were writing anything to a floppy |
| 11:31 | dysfun | beos too |
| 11:32 | engblom | Yep |
| 11:32 | dysfun | beos was quite shiny for the time and yet it was fast |
| 11:32 | engblom | Sadly neither of them managed to crush the monopoly of MS |
| 11:32 | engblom | I was also playing a bit with BeOS during those times |
| 11:34 | engblom | During that time, alternative OS had a big disadvantage: Lack of proper office suite |
| 11:34 | ridcully | os/2 hat the lotus stuff |
| 11:34 | ridcully | s/hat/had/ |
| 11:34 | engblom | Oh, yes they had Lotus |
| 11:35 | ridcully | ami word somethingsometing |
| 11:35 | engblom | But if you ask me, lotus was terrible |
| 11:37 | dysfun | yes it was awful |
| 11:37 | dysfun | really really awful |
| 11:38 | engblom | Hmm, apparently staroffice existed for OS/2. Too bad it was so little known during that time. |
| 11:39 | ben_vulpes | dysfun tolstoy dmiles: neat thread |
| 11:39 | engblom | It was 1998 I for the first time found staroffice. Then I already had begun playing with Linux |
| 11:41 | justin_smith | I've survived this far without needing an office suite, I've got high hopes this can continue. |
| 11:42 | ben_vulpes | drive is a miserable miserable miserable office replacement |
| 11:43 | ben_vulpes | i never thought that i'd actually miss capital-e excel |
| 11:43 | ben_vulpes | but holy fuck google spreadsheets a pos |
| 11:43 | dysfun | excel is actually pretty amazing |
| 11:43 | ben_vulpes | apple's numbers idem. |
| 11:43 | ben_vulpes | dysfun: it is almost as though the product owners actually watched power users driving the thing for inspiration! |
| 11:43 | dysfun | i can only assume noone who develops openoffice has used excel in a few years |
| 11:44 | engblom | justin_smith: It depends on your work. Much can be done in other ways. I have even made several issues of an magazin in LaTeX. Still for some stuff an office suite saves you a lot of time |
| 11:44 | ben_vulpes | engblom: like collaborating with normies? |
| 11:46 | engblom | ben_vulpes: For example. Yesterday I had to quickly write down a food recipe my wife will use today at a course. It would have taken far longer time in LaTeX. Or if you need to quickly calculate some stuff, a spreadsheet might get you to the result faster than other methods |
| 11:47 | ben_vulpes | so true |
| 11:48 | ben_vulpes | and it's so easy to do scenario planning in spreadsheets too |
| 11:48 | ben_vulpes | nightmare to maintain tho |
| 11:49 | engblom | I hate how spreadsheets are misused as databases. But they are great for quickly calculating stuff, like total price before talking with a customer |
| 11:49 | dysfun | what spreadsheets need is refactoring tools |
| 11:51 | engblom | When I was designing an ocarina 3D model, I quckly used a spreadsheet for calculating all frequencies and the inital hole sizes. |
| 11:52 | engblom | It would have been taking a lot of time to put together a program for the same task. |
| 11:54 | ben_vulpes | engblom: cadcam proggy should handle that. |
| 11:55 | ben_vulpes | but if we balk at the 750 for a corporate single user lispworks license, i shudder to think what the response would be to the 8k list price for inventor. |
| 11:55 | dysfun | bollocks to that |
| 11:55 | ben_vulpes | are there any neat tricks for working with maps with the same key names? |
| 11:56 | dysfun | what do you mean? |
| 11:56 | ben_vulpes | eg a user map and a topic map in my test ns (representing harness data) both have a "name" key |
| 11:56 | ben_vulpes | so destructuring clobbers. |
| 11:56 | dysfun | oh i see what you mean |
| 11:57 | justin_smith | ben_vulpes: you can destructure maps without using :keys |
| 11:57 | dysfun | you can move to using the map-form destructure instead of :keys |
| 11:57 | ben_vulpes | map form destructure |
| 11:57 | justin_smith | ,(let [{a :a {a' :a} :b} {:a 0 :b {:a 1}}] [a a']) |
| 11:57 | clojurebot | [0 1] |
| 11:58 | ben_vulpes | aha |
| 11:58 | justin_smith | it's like a mirror image |
| 11:58 | ben_vulpes | sure |
| 11:59 | justin_smith | it can be mixed with :keys too |
| 11:59 | ben_vulpes | i'm wondering if it wouldn't be more legible if i pulled keys out in place though |
| 11:59 | ben_vulpes | yo dysfun have you ever worked with the pro cadcam packages though? |
| 11:59 | justin_smith | ,(let [{a' :a {:keys [a]} :b} {:a 0 :b {:a 1}}] [a a']) |
| 11:59 | clojurebot | [1 0] |
| 11:59 | dysfun | no |
| 11:59 | dysfun | i have worked with a cheap one |
| 11:59 | ben_vulpes | they are *entirely* worth the cost. |
| 11:59 | dysfun | it was alright actually |
| 12:00 | ben_vulpes | which one? |
| 12:00 | dysfun | pro/desktop |
| 12:00 | ben_vulpes | and was *everything* parametricizeable? |
| 12:00 | dysfun | no, it was cheap and designed for studnets |
| 12:00 | ben_vulpes | > creo |
| 12:01 | ben_vulpes | yeah notgreat.winrar |
| 12:01 | ben_vulpes | i was spoiled as a child |
| 12:02 | ben_vulpes | cannot use not-perfect cadcam |
| 12:02 | ben_vulpes | if it takes more than 3 keystrokes to parameterize a thing and link it to another value at the same tree level as i'm working i'm inclined to throw the workstation out a window |
| 12:03 | ben_vulpes | if i want to tie it to a sketch in a dimension in another part i am willing to open the tree |
| 12:03 | ben_vulpes | but by god there better be a tree that goes all the way down to the feature level for every single part |
| 12:03 | ben_vulpes | accessible from the assembly view |
| 12:03 | ben_vulpes | or seriously gtfo |
| 12:03 | clojurebot | Huh? |
| 12:03 | dysfun | my laptop used to take 45s to get to a repl |
| 12:04 | jasonmason | huh |
| 12:04 | ben_vulpes | my laptops are on a ~2 year depreciation cycle |
| 12:06 | dysfun | mine were when i had money |
| 12:06 | justin_smith | this laptop is on year 4, still better specs than a new macbook pro |
| 12:06 | ben_vulpes | the depreciation cycle is to avoid giving the irs the impression that i have money |
| 12:06 | ben_vulpes | justin_smith: what do you hack on? |
| 12:07 | dysfun | this desktop i'm borrowing is 4 years old but it's fast as |
| 12:07 | dysfun | also i plugged an ssd into it |
| 12:07 | justin_smith | system76 bonobo, 32 gigs ram, 8 cores |
| 12:07 | dysfun | i have 16GB RAM, 4 hardware cores, 8 virtual cores |
| 12:07 | justin_smith | 256gb sd plus a 1tb hd |
| 12:08 | ben_vulpes | huh and it linuxes adequately? |
| 12:08 | dysfun | i'm actually running freebsd |
| 12:08 | justin_smith | ben_vulpes: system76 only ships with linux installed, that's their whole deal |
| 12:08 | ben_vulpes | > matte display |
| 12:08 | ben_vulpes | be still my heart |
| 12:08 | ben_vulpes | dysfun: was talking to justin_smith |
| 12:08 | dysfun | system76 laptops are just rebadged clevos with ubuntu installed and configured |
| 12:08 | justin_smith | yeah, I have the matte display too, it's awesome |
| 12:08 | jasonmason | dysfun wat, repl takes 45s to start on that machine? |
| 12:09 | dysfun | jasonmason: no, this is the desktop i am borrowing. my almost 3 year old macbook air takes that long |
| 12:09 | jasonmason | ah |
| 12:09 | ben_vulpes | justin_smith: how much neckbeard flak does it catch for binary crud? |
| 12:09 | dysfun | i have to hand it back soon and moving onto a core 2 duo with 8 gigs of ram |
| 12:09 | justin_smith | ben_vulpes: you're the first one to ask, but I guess I don't go around in neckbeard circles that much |
| 12:10 | dysfun | only one of the system76 laptops doesn't require nvidia binary drivers |
| 12:10 | justin_smith | ben_vulpes: but I have been drooling over the new purism machines |
| 12:10 | ben_vulpes | not like i give much of a shit, just curious |
| 12:10 | ben_vulpes | dysfun: and the towers? |
| 12:10 | dysfun | i have no idea |
| 12:11 | justin_smith | in fact a big reason for getting this machine was to have big graphics capabilities (lots of high res displays) with linux, without wanting to kill myself because it's all just set up for me. |
| 12:11 | dysfun | oh the first tower i clicked on (ratel pro) comes with option of intel graphics |
| 12:11 | ben_vulpes | dysfun: are those open? |
| 12:11 | justin_smith | yeah, they have laptops with intel too, I explicitly didn't want intel |
| 12:11 | ben_vulpes | justin_smith: why no intel? |
| 12:12 | dysfun | intel is about as open as it gets, which is to say they publish specs |
| 12:12 | justin_smith | bad / weak graphics |
| 12:12 | dysfun | how often do you actually use graphics that intel couldn't handle? |
| 12:12 | justin_smith | not often any more :P |
| 12:12 | dysfun | and that's why i go intel |
| 12:13 | justin_smith | but the intel boards don't let me run 4 monitors like this one does either |
| 12:13 | dysfun | 4 monitors? |
| 12:13 | justin_smith | but that might just be circumstantial and not a limitation of on-board intel per se |
| 12:13 | dysfun | one does me |
| 12:13 | justin_smith | yeah |
| 12:13 | dysfun | i would like it to have more resolution though, this is a cheap 1080p display |
| 12:13 | ben_vulpes | i could probably settle for two |
| 12:13 | justin_smith | or they didn't when I was shopping, or I didn't look hard enough |
| 12:14 | ben_vulpes | 1080p gross |
| 12:14 | ben_vulpes | so effectively a portable tower. |
| 12:14 | ben_vulpes | needs a monitor to be useful. |
| 12:14 | dysfun | when i am unpoor i am going to buy myself a nice new desktop and a nice 4k monitor |
| 12:15 | jasonmason | how well are high ppi displays supported under linux |
| 12:15 | ben_vulpes | i'd probably be happy with a meerkat |
| 12:16 | dysfun | i imagine they mostly just work provided you have acceptable graphics drivers |
| 12:17 | jasonmason | but "just works" being what? tiny letters, with same definition as on lower ppi monitors? |
| 12:18 | dysfun | more pixels in the same space. i think you're saying an equivalent |
| 12:19 | ben_vulpes | jasonmason: do you want it apple style? where it ships in "old and blind" mode? |
| 12:19 | ben_vulpes | scuse me i mean "large shiny and juicy" mode |
| 12:20 | xtreak | https://clojuredocs.org/clojure.core/cast#example-542692cdc026201cdc326ccd is throwing an error for me. What is the cast syntax? |
| 12:20 | xtreak | ,(cast Integer 1) |
| 12:20 | clojurebot | #error {\n :cause "Cannot cast java.lang.Long to java.lang.Integer"\n :via\n [{:type java.lang.ClassCastException\n :message "Cannot cast java.lang.Long to java.lang.Integer"\n :at [java.lang.Class cast "Class.java" 3176]}]\n :trace\n [[java.lang.Class cast "Class.java" 3176]\n [clojure.core$cast invokeStatic "core.clj" 351]\n [clojure.core$cast invoke "core.clj" 346]\n [sandbox$eval25 invo... |
| 12:21 | justin_smith | that makes sense, in clojure 1 is a Long not an Integer |
| 12:21 | justin_smith | for converting, use int |
| 12:21 | justin_smith | ,(int 1) |
| 12:21 | clojurebot | 1 |
| 12:22 | jasonmason | ben_vulpes yeah i much prefer that over font that is too small to be readable |
| 12:22 | justin_smith | xtreak: cast in clojure will mostly be for things like nil and when you are using weird APIs, I think |
| 12:22 | justin_smith | ,(cast Integer nil) |
| 12:22 | clojurebot | nil |
| 12:23 | xtreak | Thanks. The docs use the syntax for casting. Guess that example is a little confusing. |
| 12:23 | justin_smith | xtreak: also cast doesn't change the type of the input - it just throws an exception if it's the wrong typ |
| 12:24 | justin_smith | ,(cast Number 1) ; since Long is a subclass of Number |
| 12:24 | clojurebot | 1 |
| 12:24 | justin_smith | ,(type (cast Number 1)) |
| 12:24 | clojurebot | java.lang.Long |
| 12:25 | justin_smith | xtreak: definitely a documentation bug in that example |
| 12:26 | xtreak | Thanks. was trying out the same in the repl :) will raise a pull request. Can I copy over your comments too? |
| 12:26 | justin_smith | sure! though we can skip the whole nil / weird APIs one I think, that's not actually what it's about at all |
| 12:28 | Morgawr | how would I test if a parameter is an atom, in clojurescript? |
| 12:28 | Morgawr | In clojure you can do (instance? clojure.lang.Atom my-param) |
| 12:28 | Morgawr | doesn't seem to work in Clojurescript though |
| 12:29 | dysfun | well for a start it's called cljs.core.Atom |
| 12:29 | dysfun | in cljs |
| 12:29 | Morgawr | ah, that might be it, then |
| 12:29 | dysfun | but iirc that won't help you |
| 12:29 | dysfun | try it |
| 12:29 | Morgawr | dysfun: seems to have worked, thanks! :) |
| 12:30 | dysfun | cool :) |
| 16:00 | jonaskoelker | Hi all. I'm trying to build an android project with lein droid doall, and get "No such var: u/update-vals" right after "Compiling cider.nrepl". Does anyone have an idea what's going on? |
| 16:00 | jonaskoelker | That's with "compiling:(cider/nrepl/middleware/util/meta.clj:64:8)" which says "u/update-vals" at l64 c8 but also [cider.nrepl.middleware.util.misc :as u] in the (ns ...) block |
| 16:01 | Gh0stInTheShell | jonaskoelker: I don't know, but I'd like to know what you find out. :) |
| 16:01 | Gh0stInTheShell | I'm just getting ready to start trying to use lein droid |
| 16:02 | jonaskoelker | I copied a thing from the net with some :aot-exclude-ns, including cider.nrepl; what's up with that? |
| 16:03 | jonaskoelker | if I add #"cider.nrepl.middleware\..+" and #"cider.inlined-deps\..+" to the excludes I copied, things compile fine, but then emacs gets angry when I cider-connect |
| 16:03 | jonaskoelker | saying very hurtful things, like "WARNING: CIDER requires nREPL 0.2.12 (or newer) to work properly" and "WARNING: CIDER's version (0.13.0-snapshot) does not match cider-nrepl's version (nil). Things will break!" |
| 16:04 | jonaskoelker | which makes me a sad panda |
| 16:04 | Gh0stInTheShell | lol |
| 16:10 | justin_smith | jonaskoelker: in general, the clojure side deps and the elisp lib must agree, but until some very recent versions, you have to make them match by hand |
| 16:12 | justin_smith | jonaskoelker: CIDER's good and bad points are the same thing: it prioritizes features over stability - when I was using it every in-place update would break my install and I had to do a clean slate to make it work again (including gettign rid of any elc files) because the abi lacked backward compatibility |
| 16:52 | jonaskoelker | so... do I just $ rm ~/.emacs.d/elpa/cider-*/*.elc? |
| 16:52 | justin_smith | and make sure the versions match, that should do it |
| 16:53 | justin_smith | the lein plugin and elisp versions, that is |
| 17:02 | jonaskoelker | are 0.13.0-SNAPSHOT and 0.13.0-snapshot different? |
| 17:04 | jonaskoelker | oh well, the lower case version doesn't resolve when I build. I still get nil as the cider-nrepl version |
| 17:04 | jonaskoelker | but I put cider.nrepl in my :aot-exclude-ns -- when I don't, I get compile errors |
| 17:05 | jonaskoelker | Exception in thread "main" java.lang.RuntimeException: No such var: u/update-vals, compiling:(cider/nrepl/middleware/util/meta.clj:64:8) |
| 17:05 | justin_smith | jonaskoelker: the lower case is a typo |
| 17:05 | jonaskoelker | oh, I already said that |
| 17:05 | jonaskoelker | in the 'WARNING: [...] bit', yes? |
| 17:05 | justin_smith | you shouldn't have cider in normal deps, it should be a dev-only thing (which is implicitly no-aot) |
| 17:05 | justin_smith | yeah, typo in the warning |
| 17:06 | jonaskoelker | but nrepl should be in deps? |
| 17:20 | jonaskoelker | In *nrepl-messages localhost* (:9999 fwd to :9999 on my phone) I see this: http://paste.debian.net/694803/ |
| 17:21 | jonaskoelker | so apparently, it would appear that maybe I'm running nrepl 0.2.10 on my phone? |
| 17:51 | justin_smith | jonaskoelker: I said normal deps - eg. cider stuff (and most of the time even nrepl itself) should be specified for the :dev or :repl profile only, and ideally it's added in your personal profiles.clj so that your collaborators don't have to live with your dev tooling decisions |
| 17:52 | justin_smith | and things in :dev or :repl are not aot compiled for lein run or lein uberjar |
| 17:58 | jonaskoelker | profiles @ http://paste.debian.net/694839/ and project @ http://paste.debian.net/694840/ -- do they look right? |
| 18:00 | justin_smith | I would typically put things like piggieback and tools.nrepl and cider-nrepl in :dev or :repl, not :user - I forget whether :user ends up in aot, but :dev should be ignored during aot |
| 18:03 | jonaskoelker | done. I'm building with 'lein droid doall', which doesn't include :user |
| 18:03 | justin_smith | oh, OK |
| 18:04 | jonaskoelker | other than that, it looks good? |
| 18:04 | justin_smith | yeah, looks fine |
| 18:05 | jonaskoelker | do you have an idea why I see >> version-string "0.2.10" << in my nrepl traffic? |
| 18:06 | jonaskoelker | I'm thinking _something_ is putting a bad version of nrepl on my phone, but what? |
| 18:06 | jonaskoelker | I even removed 0.2.10 from ~/.m2/..., but I still get 0.2.10 |
| 18:06 | justin_smith | you could look at `lein deps :tree' and check out the version conflicts |
| 18:06 | justin_smith | removing or adding to m2 directly will never effect your deps when using lein |
| 18:06 | justin_smith | if lein doesn't find the version it thinks you need, it will download it |
| 18:07 | justin_smith | (or simply fail and say the version doesn't exist if that doesn't work) |
| 18:07 | jonaskoelker | http://paste.debian.net/694851/ |
| 18:07 | jonaskoelker | 0.2.10 didn't come back, so I infer that lein didn't re-download it |
| 18:08 | justin_smith | jonaskoelker: lein doesn't check m2 to decide what to use |
| 18:08 | jonaskoelker | right, put it puts its downloads there, yes? |
| 18:08 | justin_smith | something might have fixed your issue, but I promise deleting the file did not do it |
| 18:08 | justin_smith | right, it does |
| 18:08 | justin_smith | I guess I misunderstood your point there |
| 18:09 | jonaskoelker | depends, it wasn't clear (I think) from "I even removed .." but perhaps from later on :) |
| 18:09 | jonaskoelker | err, my issue isn't fixed |
| 18:11 | jonaskoelker | do you know how to trace which nrepl goes into the shipped blob (of .apk flavor)? |
| 18:11 | justin_smith | there's lein deps :tree to see how lein picked each dep to use |
| 18:11 | justin_smith | and another version for plugin deps (I forget how that one works) |
| 18:13 | jonaskoelker | oh this is fun, I just did a "lein clean;lein droid doall" and now I get different errors :( |
| 18:13 | justin_smith | ugh, caching sucks |
| 18:14 | jonaskoelker | lein deps :plugin-tree is the one you mean, I take it |
| 18:14 | justin_smith | that's the one |
| 18:18 | jonaskoelker | Now I face "Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)" |
| 18:18 | jonaskoelker | do you happen to know the fixing spell on the top of your head? |
| 18:19 | justin_smith | I don't know the android stack stuff, sorry to say |
| 18:19 | justin_smith | but "cafebabe" sounds like a placeholder that didn't get properly filled in (I would use "deadbeef") |
| 18:19 | jonaskoelker | I think it's plain old java stuff; "cafebabe" is the magic number (see file(1)) for .class |
| 18:20 | justin_smith | I know what magic numbers are |
| 18:20 | jonaskoelker | *thumbs up* |
| 18:20 | justin_smith | I am saying, if I was picking a placeholder... I would pick something like that |
| 18:20 | justin_smith | but really, I don't know that error, sorry |
| 18:21 | jonaskoelker | what I'm saying is: I'm fairly confident that cafebabe isn't a poison pattern, it's the right value |
| 18:22 | justin_smith | oh, cafebabe is the standard for class files, hah |
| 18:22 | justin_smith | never mind then. |
| 18:26 | justin_smith | jonaskoelker: perhaps you pulled in compiled stuff that is incompatible with your java runtime version? |
| 18:28 | jonaskoelker | yeees. It appears cider is java 1.7+ and I was building for java 1.6 |
| 18:29 | justin_smith | I'd guess more likely the android stuff rather than cider? but yeah sounds right |
| 18:29 | jonaskoelker | when I remove the cider :plugin it all works, except of course for cider-connect :\ |
| 18:30 | jonaskoelker | Oh well, time for some experimentation with flipping switches and stuff :) |
| 18:34 | jonaskoelker | doing ":plugins [#_[cider/cider-nrepl "0.13.0-SNAPSHOT"]]" in :android-user seems to have done the trick |
| 18:34 | jonaskoelker | in that it builds and runs and I can connect to the repl |
| 18:34 | jonaskoelker | but still, version-string "0.2.10" and ugly warnings |
| 18:35 | justin_smith | ahh, so it's a fundamental incompatibility between the android and cider stuff |
| 18:36 | jonaskoelker | I'm not sure. It looks to me like a wrong version of a dependency gets pulled out of nowhere and baked into my .apk |
| 18:37 | justin_smith | jonaskoelker: could be bad packaging, a dep that ships with some of its deps built in |
| 18:37 | justin_smith | and thus forcing a bad version on you |
| 18:37 | jonaskoelker | can I grep through that somehow, somewhere? |
| 18:38 | justin_smith | jonaskoelker: you could maybe look at where the dep is in your classpath, at runtime |
| 18:38 | jonaskoelker | $ find ~/.m2 -name jar -exec jar xvf '{}' | grep nrepl |
| 18:38 | jonaskoelker | ^_^ |
| 18:38 | justin_smith | jonaskoelker: if it's the problem I am describing, it would be a class file or jar baked into a jar you are using |
| 18:38 | justin_smith | jonaskoelker: so if you looked for the classpath where that dep came in, you would see which jar it was in... |
| 18:39 | jonaskoelker | my understanding of .apk is that it's everything bundled up. I don't think I have an nrepl on my phone separate from the one I push |
| 18:39 | justin_smith | right, you want to bundle all your things |
| 18:39 | justin_smith | what I am saying is that a lib that is badly packaged can force you to use a bad version by bundling a dep |
| 18:39 | jonaskoelker | I understand that... |
| 18:40 | justin_smith | OK |
| 18:40 | jonaskoelker | here's a snippet from my "DEBUG=1 lein droid doall" output http://paste.debian.net/694914/ |
| 18:40 | jonaskoelker | it seems to point at nrepl 0.2.12 |
| 18:40 | jonaskoelker | but I should probably walk down dependecies |
| 18:41 | justin_smith | jonaskoelker: you can also get the path where a dep is found at runtime in the repl - I'm looking it up now |
| 18:42 | justin_smith | ,(.getResource clojure.lang.Atom "") ; do this with a class that ships with nrepl |
| 18:42 | clojurebot | nil |
| 18:43 | justin_smith | well in a repl you would get the actual resource |
| 18:43 | justin_smith | must be a security thing on clojurebot |
| 18:46 | justin_smith | jonaskoelker: user=> (.getResource (class clojure.tools.nrepl.server/start-server) "") |
| 18:46 | justin_smith | jonaskoelker: #object[java.net.URL 0x51edba41 "jar:file:/media/justin/806084F16084EEEA/m2/repository/org/clojure/tools.nrepl/0.2.10/tools.nrepl-0.2.10.jar!/clojure/tools/nrepl/"] |
| 18:47 | calligraffiti | t |
| 18:47 | calligraffiti | t |
| 18:48 | jonaskoelker | justin_smith: (.getResource (class clojure.tools.nrepl.server/start-server) "") => nil |
| 18:48 | justin_smith | curiouser and curiouser |
| 18:49 | justin_smith | jonaskoelker: I assume if you check eg. clojure.core/+ instead, you see the path to the clojure jar it loaded |
| 18:49 | jonaskoelker | still nil |
| 18:50 | TEttinger | oh resources may be weirdly different in APKs |
| 18:50 | justin_smith | TEttinger: fascinating |
| 18:51 | TEttinger | heh. I know that on Java, some "special" handling is needed for filesystem differences between android and desktop Java |
| 18:51 | ealfonso | if my dependencies i project.clj change, how do I 'fresh' those in the cider repl? |
| 18:51 | justin_smith | oh, right |
| 18:51 | ealfonso | s/fresh/refresh |
| 18:52 | justin_smith | ealfonso: as I remember it there is a command to pull in new deps, but nothing that will change a dep version or remove a dep |
| 18:52 | TEttinger | APKs, like JARs, don't allow you to write to their contents, but I think APKs have a different way of loading resources... hopefully a better one than the classloader package-relative-sometimes crap on desktop |
| 18:52 | justin_smith | but I also don't remember the command name / shortcut |
| 18:53 | ealfonso | justin_smith right now i'm killing and re-starting the repl, which is annoying |
| 18:55 | jonaskoelker | ealfonso: cider has a ,refresh thing, but that may be a cider-only thing |
| 18:55 | jonaskoelker | otherwise I have heard (vaguely) about https://github.com/clojure/tools.namespace |
| 18:56 | justin_smith | jonaskoelker: tools.namespace cannot pull in new classpath deps |
| 18:56 | jonaskoelker | oh *derp* |
| 18:56 | justin_smith | pomegranate can, or the more friendly pallet/alembic wrapper to it |
| 18:56 | justin_smith | but those don't come with cider iirc - cider has its own deal that loads classes |
| 18:57 | justin_smith | pomegranate will actually go and download a new dep then load it |
| 18:59 | jonaskoelker | I have all the classes that went into my apk in ./debug/classes/org/clojure/tools/nrepl, might that help? |
| 19:01 | jonaskoelker | hey wait! |
| 19:02 | jonaskoelker | nrepl.clj constructs version-string by getting a resource, (when-let [in (.getResourceAsStream (class connect) "/clojure/tools/nrepl/version.txt")] ... |
| 19:02 | jonaskoelker | version.txt is 0.2.12 -- but maybe getting the resource goes ookie |
| 19:02 | justin_smith | jonaskoelker: oh wow - so it is eerily related to my attempt to help failing in that way |
| 19:03 | justin_smith | fun coincidence |
| 19:03 | justin_smith | sounds like a bug for tools.nrepl? |
| 19:06 | jonaskoelker | could be |
| 19:12 | jonaskoelker | can I point lein to a hand-rolled tools.nrepl jar? |
| 19:13 | jonaskoelker | I might hard-wire the resource value into stuff just for funzies |
| 19:13 | justin_smith | jonaskoelker: absolutely - clone the repo, change the version string in project.clj, run lein install |
| 19:13 | justin_smith | well after making your other source changes of course :) |
| 19:15 | jonaskoelker | that sounds way too clean :D I was thinking about editing the *jar* file :D |
| 19:28 | jonaskoelker | would have been too easy, wouldn't it :\ |
| 19:28 | jonaskoelker | I still get "0.2.10" |
| 23:36 | tolstoy | Speaking of Excel, worked with a finance guy to said he HAD to use windows because Excel + Basic was the killer app he couldn't do without: and no basic on the Mac version of Excel. |
| 23:36 | tolstoy | On the other hand, some people use it to create tables and use a calculator to plug in the right values. ;) |
| 23:51 | TEttinger | tolstoy: ? |
| 23:51 | tolstoy | Referring to a conversation 12 hours ago. ;) |
| 23:52 | tolstoy | Made me realize that Excel is the IDE / Shell "for the rest of us". |