#clojure logs

2016-05-18

00:45Gh0stInTheShellif I want to write generalized code for the JVM and then later I want it to work with Clojurescript, is that reasonable
00:45Gh0stInTheShell?
00:46Gh0stInTheShellwhat about, like, the java math libs? I can't call those, right?
00:46dysfuncorrect
00:46Gh0stInTheShellso how do I round numbers?
00:46matt_dGh0stInTheShell: yup, cant call java libs using clojurescript
00:46dysfunbut you can use feature expressions to provide alternate implementations for clojure and cljs
00:46Gh0stInTheShelldysfun: okay will check that out, thank you
00:46dysfuni do it a lot in my modules because i use native java string functions
00:47dysfun#?(:clj ... :cljs ...)
00:47dysfunwhere ... is one form
00:47dysfun#?@(:clj [...] :cljs [...]) for slicing
00:47Gh0stInTheShellgotcha
00:47dysfunsplicing*
00:47Gh0stInTheShellyou guys think of almost everything :)
00:48dysfunhttps://github.com/irresponsible/oolong/blob/cljs/src/irresponsible/oolong/util.cljc
00:48dysfunwe try :)
00:49dysfunalthough we stole those from common lisp
00:49Gh0stInTheShell:)
00:49dysfunyou use .cljc files if you need feature expressions
00:49Gh0stInTheShell'You guys' goes all the way back to Gosper or Greenblatt or whatever ;)
00:49dysfunthey can become clojure or clojurescript or whatever else we support next
00:50dysfunyou can also have a .clj file and a .cljs file with the same module name
00:50engblomI wish you would also have been "stealing" native compilatation (not compilation for jvm, javascript, .net)
00:50dysfunthat's one of my side projects
00:50dysfunbut i might just jump to lfe instead
00:51dysfuni do find it a bit annoying at times that clojure chose the jvm, but it's meant good things for clojure
00:54Gh0stInTheShellis clojure more performant on Dalvik/ART than JVM?
00:54engblomdysfun: I am in particular interrested in programming control system with tiny computers like rpi. Native compilation would be great for this kind of platform, especially as it would probably mean easier to use kernel sys-calls for faster IO.
00:54dysfunGh0stInTheShell: there are...issues with android and clojure
00:55engblomdysfun: Or interfacing native libraries
00:55dysfunengblom: i'm use lfe for a raspi project
00:55dysfunyes, native libraries are where i have problems with clojure too
00:55dysfunbecause JNI = no thanks, hope someone else did it already
00:55Gh0stInTheShelldysfun: But I keep watching talks about writing games for android with clojure? Is it all a bad idea?
00:55dysfunno, but it will make your app slower to start up
00:56dysfunwould you rather write it all in java? ;)
00:56Gh0stInTheShelldysfun: :)
00:57dysfunhonestly most people deploying to phones are using cljs
00:58Gh0stInTheShelldysfun: Using cljs on top of Apache Cordova?
00:59Gh0stInTheShellor similar?
01:01dysfunpretty much
01:01dysfunyou gain support for other platforms for free
01:02dysfunthere's an up-to-date webkit component for cordova
01:04dysfunmy app problem is worse, i have a lot of code to be shared across all platforms, so i wrapped it up into a c++ library
01:04dysfunc++ turns out to be the only sane way to do this
01:04dysfunthen native guis
01:05Gh0stInTheShell:(
01:06dysfunwhen i was looking at clojure native compilation, i thought it would be fun to use native interop syntax for c++ classes
01:07Gh0stInTheShellcause c++ is just like sane java :)
01:07dysfunexactly like it, obvs :)
01:07Gh0stInTheShellHow hard could it be? :P
01:07dysfunwell i doubt it will surprise you terribly much to hear it can be very hard
01:07Gh0stInTheShellnot surprised ;)
01:07justin_smithdepends how you feel about memory leaks maybe?
01:08dysfunjustin_smith: i use the jvm, it *is* a memory leak
01:08Gh0stInTheShellIn 1999 I felt, much like the rest of the industry, that C++ was the only sane way to do anything....
01:08dysfunin the modern days there are still areas where c++ is the least insane choice
01:09dysfuni still write quite a lot of c++
01:09dysfunmostly because i can't afford to pay someone else to :p
01:09justin_smithI got a PR accepted on csound (a c project) over the weekend
01:09justin_smithnot going to pretend it was a complex contribution...
01:09dysfuni contributed to some post-quantum crypto written in C the other week
01:09dysfunthat's a challenge
01:10dysfuncrypto puts loads of extra constraints in play
01:10Gh0stInTheShellThere's still problems where I like the memory model in c and c++ better than JS or Java or clj. it lends well to things like fast manipulations of memory etc
01:11dysfun'manipulation of memory'. the antithesis of clojure
01:12dysfuni don't like the js machine because most browsers don't support proper ints yet
01:14Gh0stInTheShell(inc dysfun)
01:14Gh0stInTheShellI agree
01:14dysfuni don't like the JVM at the part i have to write JNI, to the degree that i never do it
01:15dysfunlook at how non-jvm langs handle this, it tends to be a simple interface you can drive easily from C
01:15Gh0stInTheShelland then you just write bindings in your fave langs etc
01:15Gh0stInTheShellBut they're not on the JVM :)
01:16dysfunyeah, which means i can't use clojure. shame, but them's the breaks
01:16dysfunand so i've concluded java is absolutely fine for long running server processes and very little else
01:17Gh0stInTheShellbut there's cljs :)
01:17Gh0stInTheShellwith the crappy ints
01:17dysfunand deploy node to production? are you kidding me?
01:18Gh0stInTheShellwith unstable web workers so it's truly multithreaded
01:18Gh0stInTheShell:)
01:18dysfunwebworkers suck
01:18Gh0stInTheShelloui
01:18dysfunyou have to load a separate script file into them
01:18dysfunthey really really do not want to be a general purpose mechanism
01:18Gh0stInTheShelland their context is all stupid and stuff
01:18Gh0stInTheShellyeah I know
01:24Gh0stInTheShellI'll just take this languague designed to be massively parallel and run it in this one little lightning fast thread....
01:25Gh0stInTheShells/languague/language
01:26Gh0stInTheShelldysfun: So do you mean it's a bad idea to deploy node to production, or just clojurescript running on node?
01:26dysfunpersonally i don't trust node at all
01:27Gh0stInTheShelloh okay
01:27dysfunand i'm not mad fond of javascript, even behind a clojurey wrapper
01:27Gh0stInTheShellbut plenty of people are running it in production...
01:27Gh0stInTheShellI'm sure you have good reasons for your distrust :)
01:28dysfunah, the politics argument: you voted for him
01:28dysfunhow wrong can a majority be? well...
01:28Gh0stInTheShellI'm not arguing :)
01:28Gh0stInTheShelljust trying to learn some things
01:29dysfunalso heard as "if it's good enough for the bbc"
01:29Gh0stInTheShellgothcha
01:29dysfunthere are many people who do deploy node to production, but i'm more risk averse
01:29Gh0stInTheShellgotcha
01:32Gh0stInTheShellso what to deploy? ;)
01:32dysfunat the minute i have a clojure site running aleph deployed behind nginx
01:32Gh0stInTheShellI fear just running java on my system to write code for android and clojure
01:32Gh0stInTheShellLike I just dropped the security soap
01:33dysfunit's just a vm, it isn't going to eat your firstborn
01:33Gh0stInTheShellI hate it
01:33Gh0stInTheShell:)
01:33dysfuni hate the startup time
01:33Gh0stInTheShellthere's that
01:33dysfunor i did when it was 45s on my last machine
01:33dysfunbut i've since stolen a friend's machine
01:33Gh0stInTheShellnodejs will find those prime numbers before clojure is done loading
01:33Gh0stInTheShell:)
01:34dysfunbut there you go, i already said it's only good for long running processes
01:34Gh0stInTheShellI know. SO what to deploy?
01:34Gh0stInTheShell:)
01:34dysfunfor your app?
01:34Gh0stInTheShellNo I mean, you told us what you wouldn't deploy?
01:35Gh0stInTheShellI was just curious if you had any banner for a path to success or anything.
01:35dysfuni deploy clojure!
01:35Gh0stInTheShellI don't have a particular app I'm talking about. I realize that's really pertinent.
01:35Gh0stInTheShelldysfun: Okay cool
01:35dysfunokay, well i believe in the unix philosophy, right tool for the job
01:36dysfunan awful lot of what i do is long-lived server processes. clojure is ace for that
01:36Gh0stInTheShellright I realized that as I was asking
01:36Gh0stInTheShellyou answered my question
01:37dysfunif you have another usecase in mind, i can make recommendations for the specific
01:37dysfunbut otherwise, i use whatever tools seem least likely to make me throw my keyboard against a wall
01:37dysfunand if clojure fits, that's likely to be clojure
01:38Gh0stInTheShellNah man, just curious. I'm excited about using clojurescript with nodejs and excited about clojure on the JVM and still use old scool OOP to make money.
01:39Gh0stInTheShellI realize lisp is older school, but it goes back to that C++ is the only sane way to build native business applications blah blah, and then "PHP has a C++ like object model now!" and crap like that
01:39dysfunyeah, NASA was under pressure to move to C++ for the mission they sent out in lisp
01:39dysfungood job they sent it out in lisp, they needed a repl to debug a C component
01:39dysfunone with a formal proof, no less!
01:41Gh0stInTheShellSo I know Javascript, I know Lisp, I know C/C++/PHP/Perl/Java/SQL/NoSQL and I'm just trying to draw Clojure and cljs into my tiny personal grand theory of things :)
01:41dysfungood
01:41dysfunwhile you're at it, look at lisp flavoured erlang and haskell too
01:42Gh0stInTheShellHad to learn a small amount of haskell to fix the window manager :)
01:42dysfuni find it's easier to use than to bother with all the type theory
01:42Gh0stInTheShellI'm supposed to learn ELixir for work
01:43Gh0stInTheShellbut that's not lisp flavored erlang is it?
01:43dysfunheh, i've gone LFE instead of elixir
01:43dysfunno, but it's on the erlang vm
01:43Gh0stInTheShellyep
01:43dysfunit's got a very different view of concurrency. it's worthwhile knowing both
01:47Gh0stInTheShellMy brain is only so large. :)
01:47Gh0stInTheShelland I'm lazy and impatient
01:47dysfunme too. that's why i loved perl
01:48Gh0stInTheShellI still use it as a sysadmin tool, which it is great for
01:48Gh0stInTheShell:)
01:48dysfuni rarely write any any more
01:48Gh0stInTheShellI use it with -e from the command line
01:49dysfunAt the minute i've been ignoring my work and doing LFE
01:49dysfunwork is mostly clojure at the minute
01:49Gh0stInTheShellI used to write webservers with it, and then with it and Catalyst, but that was utter nonsense :)
01:49dysfunhaha, i was never a Catalyst fan either
01:49dysfunthe modern era of perl web frameworks is pretty cool, but i just don't care enough about perl anymore
01:49Gh0stInTheShellthe stuff without catalyst was worse, clojure is like a sane boat in a rough sea of BS for me :)
01:50dysfunand it feels like perl6 will end up killing off perl5 and complete its transition to 'legacy'
01:50Gh0stInTheShellI was so excited about perl 6 in 2008!
01:50Gh0stInTheShelllmao
01:50dysfuni was never
01:50dysfunthey didn't learn first time round
01:50dysfunjesus
01:50Gh0stInTheShellI mean they kept saying it would come out
01:50Gh0stInTheShellwell they killed perl
01:50clojurebotIt's greek to me.
01:50Gh0stInTheShell:)
01:51Gh0stInTheShellsorry let's talk about greek :)
01:51dysfunyeah, quite a few of my perly friends have a lot to say about perl6 that isn't positive
01:51dysfunand i was a bit dismayed to see someone i used to have a great deal of respect for slag off clojure and say perl6 was better
01:52dysfun(cause, y'know, clojure is something i know a lot about)
01:53dysfunmaybe he caught the same thing larry did that turned him into an embarrassment on stage
01:53Gh0stInTheShellPeople are ignorant :)
01:54dysfunoftentimes you just expect better of people than cheap FUD
01:57Gh0stInTheShellI fear the JVM. I loathe it. I have to have five versions of java installed on my GNU linux system to build different versions of Android.
01:57dysfunthen clojure is not the right tool for you
01:57Gh0stInTheShellit might be irrational, my fear and hate. But I can't get away from it and am it's prisoner.
01:57Gh0stInTheShellLike those RMS users in cahins
01:57Gh0stInTheShell:)
01:57dysfuni think it is irrational
01:57dysfunclojure is a wonderful tool
01:58dysfuni'd use it to build an android app
01:58Gh0stInTheShellI just want to learn clojure
01:58dysfunbecause java? are you fucking kidding me?
01:58Gh0stInTheShellI'll put up with the JVM, like I do for android builds
01:58dysfunthe jvm is one of the reasons clojure is *fast*
01:59dysfunhotspot is an amazing optimising compiler, for free in every JVM
01:59dysfunwell, not *every* JDK, but that's beside the point
02:02Gh0stInTheShelldysfun: well cool, I appreciate you taking the time to talk to me about this
02:02Gh0stInTheShellI continue to be excited about CS in general in the face of great adversity. ;)
02:03dysfunhaha, that's called 'learning', it's good for you
02:04Gh0stInTheShell:)
02:05namrahm is a .edn file treaded as .clj file?
02:05dysfunno
02:05dysfunit won't be loaded with (require) either
02:05namrabut i'm getting a runtime exception
02:05dysfunpastebin?
02:05clojurebotpastebin how about refheap? https://www.refheap.com/
02:06namrahave a edn file in resource-paths and when i do a 'lein run' it complains that a symbol cant be resolved in that context
02:06dysfunwhat are you using to read the edn file?
02:06namraload-file
02:07dysfunyeah, wrong tool
02:07namraconfusing
02:07namrait worked as expected within the repl
02:07dysfunokay, well edn is a subset of clojure syntax
02:07namrayep
02:07dysfunhttps://github.com/clojure/tools.reader this is the tool we use to read edn
02:07dysfunclojure.tools.reader.edn
02:08namrathanks alot
02:09dysfunnp
02:09namrabut still confusing ^^
02:10dysfuntotally fair :)
02:18namra:(
02:20ben_vulpesisn't refheap deprecated?
02:20ben_vulpesdysfun: so i'm tentatively looking for a gui stack
02:20ben_vulpesand yes elm is covered in warts
02:20dysfuni'm shocked
02:21ben_vulpeshey look i only bit it off because i'm looking to learn 3/4 ui paradigms in the next 2 quarters
02:21ben_vulpesi have no illusions about the misery of software development
02:21ben_vulpesanyways
02:21dysfunhave you done the clojurescript single source of truth one?
02:22ben_vulpes"one atom to rule all state in my spa"?
02:22dysfunyeah
02:22ben_vulpesdoesn't sit too well with me
02:22dimon_hey, in luminus I don't want the config files and others statics such as html, css, js and images to be embedded in the output jar. How can I achieve that?
02:22dysfuni think it's a lovely idea but terrible in practice
02:22ben_vulpeswhy tho uh
02:22ben_vulpeswell types mostly
02:22ben_vulpescomposability also
02:22dysfundimon_: remove them from resources, put them in another directory
02:23dimon_ok, tnx.
02:23dysfunchange any references to using them as a resource to pick them up from the directory
02:23dysfun(such as ring middleware that luminus uses to serve files...)
02:23dimon_but will luminus be able to find them?
02:23dimon_I see
02:23dysfuni expect you will now have to change middleware and learn about how middleware work
02:24ben_vulpesyeah why do you *need* that, dimon_ ?
02:24dysfunbecause he's deployed before and he knows the value of having things where you can modify them
02:25ben_vulpestwiddle css, redeploy, what
02:25dysfunhah. one of my clients wants things modifying willy-nilly and having the site splayed with template errors for a few seconds isn't a problem
02:25ben_vulpesyeah no fuck that
02:26dysfunsrsly though, correct answer for that situation
02:26ben_vulpeslet the human speak for themselves
02:26ben_vulpesi too have deployed static files behind nginx
02:26ben_vulpeswhen resource constraints demanded it
02:27dysfunyeah, it's a light traffic site, so i just let aleph serve them :)
02:27ben_vulpesi have only seen one stack so miserably designed that the payoff for moving off the paas was less than two years
02:27dimon_I'm new to dealing with SQL in clojure, what library do you recommend for simple blog? korma or anything else?
02:27ben_vulpes"designed" is not even what it was
02:27ben_vulpesdimon_: jdbc
02:27dysfundimon_: they all come with various tradeoffs
02:27dysfunfirst question: do you want to write SQL?
02:27ben_vulpesjust write the sql
02:28ben_vulpesyou'll end up doing it anyways
02:28dysfunben_vulpes: that's exactly what the clojure library i've been learning another language to avoid finishing deals with
02:28Gh0stInTheShelllol
02:28dimon_I can write it, no problem
02:28ben_vulpes*parser error*
02:29ben_vulpessecond pass ate it
02:29Gh0stInTheShellmake sure you escape user input porperly ;)
02:29Gh0stInTheShellproperly even
02:29dysfunokay, if you don't mind writing sql, i'd recommend https://github.com/irresponsible/utrecht and https://github.com/mpg-project/mpg
02:29ben_vulpesdimon_: if it's really a simple blog, consider datomic
02:29dysfundisclaimer: i hack on both of them
02:30ben_vulpesnifty, dysfun
02:30ben_vulpesthe latter'd be my hibernate equivalent?
02:30dysfunnot really
02:31dimon_why would I use which isn't popular with a couple of * at github?
02:31ben_vulpes> mpg/patch
02:31dysfunit will 'just work' for vectors though
02:31dimon_**library
02:31ben_vulpesthat is some stateful shit unless i misread?
02:31dysfunusers will come when i stop slacking on my marketing
02:31ben_vulpesyeah and to my transactolator too
02:31dysfunthese are brand new, and i can assure you they are very high quality and not going anywhere
02:32ben_vulpesmpg looks neat
02:33dysfunmpg was very painful to write
02:33dimon_how about HugSQL ?
02:33ben_vulpeshas a cute name
02:33ben_vulpesprobably going to cut off your fingers
02:34TEttingeryakuzaSQL
02:34dysfunwell for one, it puts sql in different files, which is just asking for bitrot
02:34ben_vulpes> irresponsible clojure guild
02:34ben_vulpeswho do i have to kill as an initiation rite for this club
02:34dysfundepends who i'm not liking this week :p
02:34ben_vulpesi once wrote a datomic transactor provisioning clojure app that poked at aws from the java api
02:35ben_vulpesis that irresponsible enough?
02:35ben_vulpesmy aws bill is absurd
02:35dysfunno, it's just ironic naming
02:35dysfunit amused me, i give them away for free
02:37ben_vulpesdysfun: anyways on an ancient topic, do you have any gui toolchain recommendations?
02:37dysfunin terms of expanding your knowledge of gui paradigms?
02:37dysfunwhat have you done already?
02:38Gh0stInTheShellWHy are there all of these empty repos in https://github.com/irresponsible
02:38ben_vulpesno, for use in slamming out robust client apps.
02:38Gh0stInTheShell;)
02:38dysfunGh0stInTheShell: because i'm too ashamed of the code to push it just yet
02:38ben_vulpessomething i can get comfortable and fast with within six months
02:39dysfunQt
02:39dysfunthere's really no other game in town
02:39ben_vulpesthe "learn gui paradigms" project is separate from but related to "build personal GUI-shitting toolchain"
02:39dysfunif you're doing desktop anyway
02:39ben_vulpesblee
02:39ben_vulpeswhat if mobile is a constraint
02:40dysfunpick whichever javascript framework pisses you off the least
02:40ben_vulpeswhat if i drip feed you constraints annoyingly
02:40Gh0stInTheShellThen jquery-ui
02:40Gh0stInTheShellduh
02:40Gh0stInTheShell:)
02:40ben_vulpesGh0stInTheShell: hate speech!
02:40Gh0stInTheShelldo what dysfun says, not offense intended :)
02:41ben_vulpesno i kid
02:42dysfunand actually just build the damn thing as a website
02:42ben_vulpesmyeah
02:42ben_vulpesthat juicy native feel tho
02:42Gh0stInTheShelland use apache cordova to make it a native app
02:42dysfunjquery-ui
02:42dysfunyou can have native feel on a website
02:42ben_vulpesfor real?
02:43Gh0stInTheShellben_vulpes: It can have that juicy native feel you can even have native code for each family of device
02:43Gh0stInTheShellAnd at the heart of it all you can just run some javascript to present mobile friendly froms and controls
02:43ben_vulpes> for each family of device
02:43ben_vulpesyeah about that
02:44Gh0stInTheShellYou know, like blackbeery, ios, etc retch
02:44dysfunyou will still need tweaks
02:44ben_vulpesfuck tweaks, shit shouldn't be that complex
02:44dysfunblackberry's most common form factor isn't iphone-proportioned
02:45Gh0stInTheShellI mean, you want that native feel?
02:45ben_vulpeswell, "you"
02:45dysfunyeah, if everyone is using a shit device, why lower yourself to its level?
02:45Gh0stInTheShellOr do you want drones to quickly eneter data into forms on their phones and send it back to the mothership for assessment?
02:45dysfunand, y'know, outside of the valley, everyone is
02:45ben_vulpeshey if you've got 300k i'll write swift, sure why not
02:46ben_vulpesdysfun: outside of the mobile device earners with disposable income you mean
02:46ben_vulpesusers
02:46dysfunif they're your demographic, go for them
02:47dysfunthey're one for one of my projects, so obviously we take a different approach
02:47ben_vulpesright tool etc, ofc
02:48dysfuni'm feeling like i might actually finish my sql generation library today
02:48Gh0stInTheShellI have had great success making android apps with HTML5 and javascript. Had no real issues, made nice apps. I have written android apps natively in java and found it to be extremly technical, work intensive, and time consuming. All apps were dleivered and functioned as promised for clients...
02:49dysfunyeah, if you can get away with it, build a mobile html app
02:49ben_vulpes"these people on irc said to use whatever js framework i wanted to, boss!"
02:50Gh0stInTheShellThe HTML5 and Javascript apps were eventually able to work on iOS, and could have worked on Blackberry or WIndows Mobile had I desired and done a little bit more work.
02:50dysfun"so i picked a thing you've never heard of because it had a hipster name"
02:50ben_vulpesehueaaehuaehaueahu
02:50TEttingerscriptr.io
02:50Gh0stInTheShelllol
02:50ben_vulpesalllll i wannnnt is for it to handle some fucking amount of complexity for me
02:50ben_vulpesfor the love of fuck
02:51Gh0stInTheShellI mean you've heard of jquery-ui and jquery-mobile, right?
02:51ben_vulpesget
02:51ben_vulpesthe
02:51ben_vulpesfuck
02:51ben_vulpesout
02:51ben_vulpesi suppose i should add that to the list
02:51dysfunactually, if i want to get something out, i use jquery
02:51ben_vulpesif i'm serious about guiquest
02:52Gh0stInTheShellguiquest!
02:52ben_vulpesit's like gentoo quest
02:52ben_vulpesbut profitable
02:52ben_vulpesmaybe
02:52Gh0stInTheShellI support you in your quest Sir Ben_vulpes
02:53ben_vulpesyes
02:53ben_vulpesthese roaches
02:53ben_vulpessix concrete walls
02:53Gh0stInTheShelllol all my quests are profitable maybe as well
02:53ben_vulpesit is a kingdom
02:53ben_vulpesand they my cattle
02:53Gh0stInTheShellhindsight is alway 20 20
02:53ben_vulpeshonestly i'd rather be doing ito calculus at a bank
02:53Gh0stInTheShellI kill my roaches but don't eat them
02:53Gh0stInTheShellwasteful
02:54Gh0stInTheShellwe have cats like cowboys have cattle but I don't eat those either
02:54ben_vulpesi have never understood the point of hosting cats
02:55ben_vulpeseven children and wives are more rewarding
02:55Gh0stInTheShellhosting, lol
02:55Gh0stInTheShelllike they're a windows vm or something
02:55Gh0stInTheShelllmao
02:55ben_vulpeswell, parasites.
02:55ben_vulpesgenerally speaking.
02:55Gh0stInTheShellcats are sweet and sleep in a big pile with you
02:55ben_vulpeschildren wives and dogs as well
02:55Gh0stInTheShelllol
02:55ben_vulpeswith no toxoplasmosis even
02:56ben_vulpesif you'll forgive a crude, crude joke meant only to lambast cats
02:56Gh0stInTheShellthat stuff makes me strong and introduce random seeds into my thinking, in the form of harmless cysts in my brain!
02:56ben_vulpesoh god
02:56ben_vulpestriggered
02:56ben_vulpesso this jquery ui thing
02:56Gh0stInTheShelllmao
02:57Gh0stInTheShellyes jquery ui
02:57ben_vulpescan i get type safety with it?
02:57Gh0stInTheShelllmao
02:57ben_vulpesIT PREDATES MY INTEREST IN TECHNOLOGY
02:57ben_vulpespoor kid grew up on macs, never stood a chance
02:57ben_vulpesfunny how the world changed
02:57dysfunif you want type safety, you may want to consider the haskell solutions
02:58dysfunbut don't expect to actually release anything
02:58ben_vulpeswhy not?
02:58Gh0stInTheShelllmao
02:58dysfunyou'd have to actually learn it to understand
02:58dysfunsuffice to say you can never quite forget you run in the browser, on javascript
02:58ben_vulpesthat is a dark dark perspective on the world dysfun
02:59dysfunah well
02:59ben_vulpesyeah one of the first things i did in elm was blow up its float representation
02:59TEttingerNaN?
02:59dysfunelm isn't really haskell. try haste or fay
02:59TEttingerFREEEEEGE
02:59ben_vulpesnah TEttinger there was some < comparison and i put in val.00000000000000001 and it failed
02:59dysfunelm is also a much more practical tool than either :)
02:59Gh0stInTheShellWhat kind of mobile app needs type safety? Are you sure the drones aren't entering data into forms and sending it back to the mothership for analysis?
03:00ben_vulpesGh0stInTheShell: i want type safety in writing the thing
03:00dysfunyeah, definitely need type safety for that "which celebrity murderer are you?" quiz
03:00Gh0stInTheShelloh man
03:00TEttingermurderer who is a celebrity? or murderer of a celebrity?
03:01Gh0stInTheShellwell I'm in the wrong channel to argue against type saftey, so have at it
03:01dysfunTEttinger: i really hadn't thought that far ahead, but i was thinking the former
03:01TEttingeror figurative murderer of the state of celebrity?
03:01ben_vulpesi don't think y'all grok how truly small my brain is, or how truly and perversely lazy i am
03:02dysfunno, my morning brain really really doesn't go that far
03:02TEttingerheh
03:02dysfunwe are out of tea and the coffee tastes horrible
03:02TEttingerhookah simulator lite for android
03:03dysfunhaha. i was in an amsterdam coffeeshop and someone showed me his vape and how he could get live stats on his iphone while he was vaping
03:03TEttingercoffee simulator for iOS
03:03dysfunwhat's that? loud sounds?
03:04dysfunflashing the display to bright white
03:07TEttingerit's a picture of a cup of coffee. you tilt the phone to drink it, making it hard to see the screen. when you untilt the screen, the cup is empty and there's the blood-curdling scream of "MY CROTCH! IT BURNS!"
03:08dysfunhaha
03:08dysfunyou're doing coffee wrong
03:08TEttingerthe rest of the app is in paid installments as you go through physical therapy to regain sensation in your virtual body
03:09Gh0stInTheShellIs it type safe?
03:09dysfunLOL
03:09TEttingerI uh don't drink coffee anymore. I used to a lot, aeropress is wonderful. but caffeine pills are easier on my stomach, by a lot
03:10dysfuni hear ya, but i find caffeine pills too strong
03:10Gh0stInTheShellben_vulpes: If you want badass 3d stuff for video games on mobile you can use Unity and Lua and pay for it like a chump but some of the smartest people I know really like Lua so there's that. :)
03:11Gh0stInTheShellI dunno if Lua is typesafe, lazily tried to learn it for like 45 minutes once
03:11dysfunit's not
03:11Gh0stInTheShellBut you can use it to write a large scale sapce combat game
03:12Gh0stInTheShell:)
03:12TEttingerUnity uses C# anyway
03:12TEttingerold version, maybe updating
03:12dysfunif you want types, you have to pick C++, Java or Haskell in practice, basically
03:12dysfunoh yeah, C#
03:14Gh0stInTheShellThere you go. Use Unity and C# to make some forms for drones to send data back to the mothership.
03:14Gh0stInTheShellWhat could be simpler?
03:15Gh0stInTheShellSO can I use jquery-ui with cljs?
03:15Gh0stInTheShellI can, right
03:15Gh0stInTheShelland any other js library I fell like
03:16Gh0stInTheShells/fell/feel
03:16Gh0stInTheShellsorry for my atrocious typing
03:17dysfunsure. might take some figuring out though
03:17dysfunbut you can use all of javascript
03:23Gh0stInTheShellI'm going to try to make cljs work with https://jquerymobile.com/
03:23dysfuni just heard a fantastic bit of bob martin "hundreds of dollars for a terabyte of memory"
03:23Gh0stInTheShellI kept saying jquery ui but I meant that
03:24Gh0stInTheShellallwinner 64 bit SoC is $5, right now :)
03:24dysfunwhat's that useful for?
03:24Gh0stInTheShelllol
03:25dysfun(asking, not taking the piss)
03:25Gh0stInTheShellI dunno, a $15 server appliance running linux, or a tablet, or a phone, or a little computer for a poor baby in africa that costs $45
03:25Gh0stInTheShelllol
03:25Gh0stInTheShelljust saw your taking the piss
03:25Gh0stInTheShelllmao
03:26dysfunhow much grunt do they have?
03:27Gh0stInTheShellas much as node or webkit will give them?
03:27Gh0stInTheShellI dunno
03:27dysfunlol, i mean how powerful are they?
03:28Gh0stInTheShelllooking
03:30Gh0stInTheShellhttp://www.allwinnertech.com/en/clq/processora/6053.html
03:30Gh0stInTheShell4 cortex A53s
03:30Gh0stInTheShellBuilt in video GPU etc
03:31dysfunhrm i can't find the clockspeeds
03:31Gh0stInTheShellanyway, you could picture a parallel board with 100 of those on it also, sexy for parallel and functional immutables blah blah
03:31Gh0stInTheShelldysfun: me neither
03:32dysfunyup, i've been seriously considering a huge number of simpler cores
03:33dysfunbut there comes a point when you just do it on FPGA
03:33dysfunor GPU
03:33Gh0stInTheShellYeah I have played with OpenCL and stuff like that
03:34Gh0stInTheShellIf only it was lisp :)
03:34dysfunheh
03:37Gh0stInTheShellSo if I can run JDK 8 for ARM I can run Clojure against that, too, right?
03:38dysfunyes, but the openjdk builds for raspi are slw
03:38dysfunyou have to compile your own at the minute or use azul's
03:38Gh0stInTheShellbut do you think they'll be faster on A64? ;)
03:39dysfundoubt it. too new an architecture for them to really do a good job taking advantage of it
03:39Gh0stInTheShelloh well
03:42Gh0stInTheShellThe JDK is slow on my 8-core AMD workstation with 64 GB of ram. :)
03:42dysfunit should only be slow to start up
03:42dysfunbut to get some of the benefits it has to run for a while
03:42Gh0stInTheShellyes, I know long running server processes
03:42Gh0stInTheShell:)
03:43Gh0stInTheShelljust let that repl finish cooking....
03:47TEttingerazul is nice for making the zulu builds. are the arm ones free like the desktop/server ones?
03:48dysfuni don't honestly know
03:59Gh0stInTheShellso if I use (long-array seq) to make an array, that array is a mutable Java array and not thread safe right?
04:00dysfuncorrect. don't use it across multiple threads concurrently
04:01Gh0stInTheShelldysfun: thank you
04:01dysfunyw
05:26dimon_should I import "db" or what?
05:26dimon_in my luminus project in the file home.clj I call a function "db/get-all-articles" and get an error "No such namespace: db"
05:26dimon_last time I tried, I got other kinds of errors because I'm a newbie
05:27dimon_the function get-all-articles should be defined in "db" because I've defined it in the *.sql
05:27dimon_so how can I properly import "db"?
05:29dysfun(:require [app.db :as db])
05:30dimon_tnx
05:35dimon_I have another error. My code at home.clj
05:35dimon_(:require [my_app.db :as db])
05:36dimon_and the error:
05:36dimon_java.lang.ClassNotFoundException: my_app.db.core,
05:36dimon_I've tried (:require [my_app.db.core :as db]) but also got a similar error
05:39dimon_helllloooo
05:40dysfunmy-app
05:40dysfunmy_app should be the filename, my-app should be the module name
05:41dysfunbeing rude doesn't help your question get answered any faster
05:42dimon_my-app is just an example, the real name is without "-"
05:43dysfunand it's in the right place, ie my-app/db.clj ?
05:44dimon_no, it's in src/clj/my-app/db/core.clj -- where it's created by default by Luminus
05:44dysfunokay, that's the right place for the require form you have there
05:45dysfuncan you pastebin the full error please?
05:45dimon_oh, sorry, it's already working. by itself. although last time I did reload it.
06:18dimon_hey, when I go to the url articles/15 in my Luminus app
06:18dimon_I have an error Parameter Mismatch: :id parameter data not found.
06:18dimon_although everything has been setup correctly I think
06:18dysfunwhat's the route?
06:18dimon_ (GET "/articles/:id" [id] (article-show-page id))
06:19dysfunodd
06:31dimon_another error
06:31dimon_ERROR: operator does not exist: integer = character varying Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 32
06:31dysfunso typecast it
06:31dysfunval :: type
06:31dimon_for this
06:31dimon_(defn article-show-page [id]
06:32dimon_ (layout/render "show.html"
06:32dimon_ {:title "123", :article (db/get-single-article {:id id})}))
06:32dysfunpastebin!
06:35dimon_this is not working
06:35dimon_ {:title "123", :article (db/get-single-article {:id id})}))
06:35dimon_but this
06:35dimon_ {:title "123", :article (db/get-single-article {:id 123})}))
06:35dimon_is
06:35dimon_any idea?
06:36dysfunif that is not working, then the variable isn't getting passed
06:36dysfuncorrectly
06:37dysfunoh. you're trying to query an integer column and you've got a string which is part of the url
06:37dysfunyou need Integer/parseInt
06:37dimon_let me try
06:58shiranai_dysfun: so Java is only good for "long-running (server?) processes" and nothing else? :P i'd be curious to hear more about that :)
06:58dysfunpersonal opinion
06:59dysfunif you simply must write in java for other devices, you can build a compact profile jvm
07:00dysfunand if it's not constraints of the hardware maybe you have a usecase where the usual exclusion factors don't apply
07:02shiranai_well, i was just thinking there are bound to be lots of things you can do just fine with Java even on a home computer
07:03dysfunwell sure, if the startup time isn't going to annoy your users too much
07:03dysfunbut have you ever tried to build a gui application in java?
07:03dysfunit's not fun
07:04shiranai_yeah i've done something with Swing.. but nothing (really) serious
07:04shiranai_i imagine it would get painful
07:05shiranai_though as you discussed earlier, maybe there is no painless GUI toolkit for any language anyway :)
07:07dysfunindeed
07:07dysfunbut i'm not convinced swing is ever the answer
07:07dysfunyou can make it work, but everyone who uses your software will complain about it
07:11shiranai_:)
07:11shiranai_those ungrateful bastards, the users.. :)
07:15dysfunthe user is king
07:15dysfundoesn't matter what things should be like, only what they are like
07:15dysfunoh bollocks, where's my torx screwdriver?
07:15shiranai_dysfun: i guess IDEA uses Swing, by the way.. or do you know if it's something else? i've never felt like complaining about the way it looks though
07:15dysfunalmost certainly swing
07:16shiranai_yeah, and it looks native to me at least
07:17shiranai_anyway, i think it's kind of lame to complain about an app not looking native if it's a good app and works well etc..
07:25ilevdIs it normal to force garbage collector after big processing?
07:30shiranai_"normal"?
07:30shiranai_i guess you might want to do it if it helps? :) that should be "normal" :)
07:38engblomdysfun: Regarding the discussion we had earlier about about raspi programming, I actually made a gpio library for raspi. It is using the /sys folder for accessing gpio and works on rasbian out of the box as rasbian got udev rules giving normal users access to /sys/class/gpio/*
07:39engblomAs it is using file operations, it is quite a bit slower compared to using a C library... but for most cases fast enough.
07:40engblomI was considering to use something as JNI for making a faster version, but now I am actually looking at alternative lispy languages for this kind of tasks.
08:25stainengblom: which JDK do you use on the Raspberry pi?
08:25stainhav eyou tried the ARM optimized edition from Oracle?
08:25stainyou would need to change some endian thingie
08:25engblomstain: I am using the oracle one. With openjdk, I do not even get to REPL as it will time out before it comes there
08:25stainI know..
08:26stainbecause it has no JIT
08:26engblomYep
08:26stainhow about the Android Dalvik? Can that work with Clojure?
08:27engblomThat I do not know.
08:27engblomMy library is fast enough to max out several of those cheap $1 stepper motor on rpi2, so it works for most cases
08:28stain:)
08:30engblomhttps://github.com/engblom/gpio <--- my library. Some part of it, especially the wait-for-input function is a bit uggly formated, but it do work
10:13sdegutisHi. I'm about to use (frequencies) in production for the first time. Is it best practice to cache that data into the database instead?
10:16Bronsasdegutis: that question doesn't make any sense, as usual
10:17sdegutisBronsa: Oh, hello again. I haven't heard from you since the last time you chose to complain about something I've said, a few months ago I think. How have you been since then?
10:18sdegutisOh wow, I just used fnil again. justin_smith was right all along.
10:18Bronsait never ceases to amaze how however sporadically I join this channel nowadays there's always a completely nonsensical stream of messages from you
10:18sdegutisBut this time it was (fnil - 0) in a comp-chain used within juxt within sort-by.
10:19sdegutisBronsa: Actually it's just a really unlikely coincidence. For the most part I make perfect sense. The only times I ever don't, you happen to fricken be here and whine about it.
10:21BronsaI must be really unlucky then. I can't remember ever witnessing what you say happens regularly
10:23sdegutiswelp.
10:24sdegutisBronsa: last week or this week or something I suggested :chop within :require like [foo.bar.quux :chop foo] as an alternative to [foo.bar.quux :as bar.quux]
10:25sdegutisbut justin was like "I wouldn't use that cuz then I can't grep for bar.quux inside my :require block"
10:25sdegutiswhich I can see getting confusing so yeah
10:45hodappIf I need a 'map' solely for its side effects over some collection, and I have no need for the resultant list, what's the idiomatic way to do that?
10:45lumadoseq
10:46hodappah, thanks
10:49Bronsaor run! if you want to keep the shape of map
10:49Bronsa(run! println (range 10)) vs (doseq [el (range 10)] (println el))
10:50hodapp'run!' will distract me less because I'll quit trying to read 'doseq' as Dos Eq(uis) and think of the beer commercials
11:05sdegutis,(time (->> (repeat 100000000 2) (apply +)))
11:05clojureboteval service is offline
11:05sdegutis,(time (->> (repeat 100000000 2) (reduce +)))
11:05clojureboteval service is offline
11:05bacon1989anyone here ever use the library specter?
11:05sdegutisI rest my case.
11:08sdegutisLocally, (apply +) takes 6518 msec, (reduce +) takes 1233 msec.
11:08sdegutisRemember, always use reduce +
11:09bacon1989is that because apply has to determine if it needs to fold or add the next value in the sequence?
11:10bacon1989where as reduce can have a pre-loaded level of arities to handle any extra seqs
11:10MJB47i think its mostly because reduce is optimised with this sort of thing
11:10MJB47even having its own data collection it uses internally
11:10bacon1989ah
11:10sdegutisI don't think reduce + does anything special.
11:10dysfun(apply str ...) is the exception
11:10sdegutisI think apply + just has to deal with a really really long coll.
11:11sdegutisOh right, it's because of how range is lazy, and reduce takes things in chunks.
11:11MJB47in general reduce is the fastest way of looping in core
11:11will_smapply will expand the seq and pass it to +, reduce will pas them 2 at a time
11:11sdegutisSo (apply +) has to take the entire 2-million-element array at once.
11:11MJB47i believe if you did the same test again with doseq vs reduce, reduce would still win
11:11sdegutisBut (reduce +) takes chunks of only 32 elements at a time, and reduces them, and goes onto the next chunk, until it's done.
11:13sdegutis,(->> (range 40) (map #(pr %)) first)
11:13clojurebot012345678910111213141516171819202122232425262728293031
11:15sdegutisdysfun is right, apply str is probably one of the only exceptions
11:15dysfunyou sound surprised
11:17justin_smithsdegutis: apply + does not need to consume the entire array at once
11:17justin_smithwill_sm: apply is not eager
11:18justin_smith,(apply (partial take 2) (repeat (range)))
11:18clojureboteval service is offline
11:18justin_smithergh.
11:19shiranai_any americans here? is this even real: https://www.youtube.com/watch?v=-4S0gHlKiho&amp;t=63 ?
11:20Bronsashiranai_: don't think this is the forum for this conversation
11:21shiranai_Bronsa well, i was kind of expecting a reaction like that :) yeah, you're right that this forum isn't *meant* for "random stuff", but that doesn't mean random stuff should never be brought up
11:21shiranai_but i'm curious about what americans think about that video
11:22justin_smithlook like typical seattle college kids to me, but really not on topic here so lets drop it
11:23justin_smithshiranai_: it's not just off the topic, but controversial in a way that isn't really useful or helpful here
11:23shiranai_do you think the way the people in the video answer the questions represents a problem?
11:23justin_smithshiranai_: stop
11:23shiranai_:P
11:23Bronsais #clojure-offtopic still a thing?
11:23Bronsadoesn't look like it
11:24shiranai_it's also interesting how highly intelligent people can't handle intellectual inquiry into things that actually matter in the real world, but alright, i'll stop
11:24bacon1989shiranai_: I found it interesting. I have a friend who's like that
11:24Bronsashiranai_: there's a place for discussing that, and a place for not discussing that. This is a place to discuss clojure.
11:24bacon1989very up in the air about being 'accused' of a certain gender
11:25shiranai_bacon1989 oh? that's interesting, but it seems we're not allowed to talk about it here :)
11:25bacon1989well, let's look at clojure, it's dynamically typed
11:25bacon1989our classification of data isn't very strict
11:25justin_smithshiranai_: there are plenty of channels on IRC for people who want to discuss that topic, this isn't one of them, I'd like to think people can be friendly and helpful to each other here regardless of our opinions on those issues
11:26shiranai_sure, i for one have no intention of being unfriendly
11:28hodappTV show designed to make people look stupid shows clips of people who appear to look stupid. Story at 11.
11:29hodappDealing with this object-oriented code already brings me enough real stupidity that we don't much need a TV show that manufactures additional stupidity.
11:31sdegutisHow hard would it be to create a new clojurebot?
11:33Bronsathe existing one works just fine
11:36sdegutis,(prn "okay Bronsa")
11:36clojurebot"okay Bronsa"\n
11:36sdegutissweet
11:36sdegutisbak online
11:36Bronsafor the nth time, stop needlessly mentioning me
11:37sdegutisBronsa: you've got to be kidding me
11:37sdegutisBronsa: you're going on permanent ignore
11:37sdegutisI'm done dealing with your unreasonable shit.
11:38hodapp...
11:38sdegutisBronsa: the next time someone replies to you 3 minutes later after you replied to them, you may want to rethink asking them to not "needlessly" mention you
12:06bmukI'm trying out compojure, but I still want a -main function. What can I do to pass my app-routes to run-jetty?
12:09dysfuni think you just answered your own question
12:17sdegutisWhat namespace alias convention do you use, if any?
12:18dysfunsingle letter
12:19justin_smithwould a superscript or subscript namespace alias count as half a letter?
12:20justin_smith,(require '[clojure.string :as ™])
12:20clojurebotnil
12:20justin_smithtwo letters, or half a letter - who knows?
12:36phillordwhen will clojure allow circular namespaces? when? when? when?
12:37dysfunnever probably
12:38phillordI know, and every day my monolithic namespace gets bigger and bigger
12:38phillordjust wanted to sahre
12:38phillordshare
12:41bmukdysfun: it's that easy? haha
12:41dysfunbmuk: pretty muc
12:42bmukI just saw that the compojure lein template only has support for lein ring (as opposed to a standalone jar)
12:42dysfunyes. you do not need to use lein ring's building stuff
12:42dysfunyou can use it during dev and not deploy with it if you want
12:44bmukI'm trying to make it as painless as possible for people on my team to build/test this stuff so I'm probably just going to use docker
12:44bmukwhich could run ring server-headless I suppose
12:44dysfunfor testing, you should probably just run it from lein
12:45dysfununless you mean automated testing
12:46bmukI do mean automated testing, but with docker they wouldn't have to have lein (or even java) installed, just docker build and docker run
12:48dysfunwith automated testing, it's expected that you will have your tools installed
12:48bmuktrue
12:48bmukI haven't gotten that far yet. I'm looking into Jenkins
12:49dysfunif it's open source, just use travis
12:50bmukIt isn't. It may be in the future, not sure yet
12:50hodappeven if it's closed-source, you may be able to pay to use Travis
12:50hodappand in my experience, Travis was far easier to screw with than Hudson & Jenkins
12:51dysfuni used to administer jenkins. very powerful, very annoying
12:51dysfuntravis is easy, but you pay real money for it
12:52bmukyeah $129/month for just 2 concurrent jobs is steep
12:53dysfunthis is why i just open source my commercial code
12:53dysfunyou get all sorts of cool stuff for free
12:54bmukThat's definitely true. It's something we've talked about
12:54dysfunand if you're in a competitive closed industry, it's a massive commercial advantage
12:57bmukI can see how it would be an advantage for clients who are programmers, but I'm not sure clients who aren't would know what that means
12:58bmukIf you don't mind me asking, what is/are your product(s)
12:58dysfunvaporware, obviously
12:58bmukhaha
13:02hodappI love working on vaporware
13:03hodappsometimes people will throw so much money at you to help them make vaporware
13:10sdegutisdysfun: I used to use single-letters but then they get ambiguous, e.g. s could be symbol or string. So I don't use them for aliases or variables anymore.
13:11dysfunso because a few overlap (s is a very good letter for overlaps), you don't use it anywhere?
13:11sdegutisdysfun: it's happened too much
13:11justin_smithclearly "first letter of name" is not the right hash function
13:11sdegutisdysfun: We used them for about 2 years before we replaced all of them with a longer convention this March.
13:12sdegutisat first the convention included symbols, like myapp.view.foo :as foo#, myapp.presenter.foo :as foo$, myapp.model.foo :as foo*, myapp.service.foo :as foo!
13:13dysfunhungarian notation
13:13sdegutisBut that wasn't as useful as I'd hoped, so I replaced them with myapp.view.foo :as foo.view, myapp.model.foo :as foo.model, etc
13:13sdegutisBut that's still inconvenient to use, because I keep typing model.foo/ waiting for autocompletion, when it's actually foo.model
13:13sdegutisSo lately I'm thinking of just doing myapp.model.foo :as model.foo
13:17sdegutisAnd thought it'd be prudent to see what conventions y'all use.
13:17dysfunbrief ones
13:18sdegutisdysfun: what do you do when you have overlap, e.g. myapp.model.user and myapp.view.user and myapp.routes.user and myapp.presenter.user ?
13:21dysfunwhatever works
13:21dysfunlike user-m (odel) vs user-v (iew)
13:22dysfunthe point is that it doesn't matter as long as a user can reasonably guess
13:22sdegutisok
13:22justin_smith,(require '[clojure.string :as the.namespace.that.has.stuff.for.working.with.strings.that.comes.from.clojure])
13:22clojurebotnil
13:23tolstoyMaybe just try out names in functions such that the functions are clear, then backport that to the require declaration?
13:23sdegutisjustin_smith: that's not a very practical nor predictable convention
13:23sdegutisThanks. Vased on everyone here's feedback, I think the right way for our app is myapp.model.user :as model.user
13:24justin_smithsdegutis: one could even say it is unconventional
13:24sdegutisFortunately these things can be changed pretty quickly, in the span of like 30 minutes with a call to `sed` and a little proofreading.
13:24jonathanj,(do (require '[clojure.string :as ™]) (™/lower-case "OKAY"))
13:24clojurebot"okay"
13:24jonathanjhaha
13:24justin_smithjonathanj: I like how that looks like a fraction
13:24jonathanji didn't actually know unicode names were allowed
13:25jonathanjtime to rename all my stuff to emoji
13:25dysfunshh, noone tell sdegutis that coding standards doesn't mean bikeshedding
13:26sdegutisdysfun: yeah I got that that was your opinion of this conversation from your last comment, which is why I just replied to you with "ok" and left it at that, but thanks for being condescendingly explicit
13:26jonathanjwouldn't it be better to use something like mu and mv as names?
13:26dysfunyou're welcome. leave the money on the dresser on your way out
13:26jonathanji mean, having to type model.user/X instead of myapp.model.user/X seems like a pretty minor improvement
13:27sdegutisjonathanj: sometimes you have multiple models that begin with the same letter
13:27jonathanjthen i guess user-m and user-v are good suggestions
13:27tolstoyIf the models (whatever that is) have a lot of similar functions, a protocol would work?
13:28sdegutisyep that's why I'm going with model.user and view.user
13:28sdegutistolstoy: hmm
13:28sdegutistolstoy: interesting idea, will ponder on it
13:29tolstoysdegutis I've been working with transforming incoming data into "records" and then having a "persist" protocol, and a "query" protocol, etc.
13:29tolstoyIf incoming message satisfies "persist" then proceed, etc, etc.
13:29sdegutisah right I remember you mentining that tolstoy
13:29tolstoySometimes a message implements multiple of these things. (Also "validate" protocol.)
13:30tolstoysdegutis Yeah. It still hasn't seem like a super bad idea. ;)
13:30sdegutisHmm. Our model namespaces don't actually share any functions.
13:30sdegutisI guess it's a good thing, it means we're not really repeating ourselves, and we have well structured and partitioned functionality.
13:30justin_smithtolstoy: works pretty well for clojure.core - that's how almost everything in clojure.core works (or functions built on that pattern of usage)
13:31tolstoyYeah. The idea is that an incoming packet from a web socket just needs to do a few things: save some data, query some data, be validated, send a notification, so why not just have four functions?
13:31tolstoyBUT, then I use extend-protocol for a lot of defrecords. It doesn't remove all that code, but it does (maybe) factor it a tiny bit more cleanly.
13:32sdegutistolstoy: during the past few years I've been developing a practice which currently is: avoid implementing helper functions or protocols until I'm 150% sure that I won't regret it in 12 months
13:32sdegutis(or macros, etc)
13:32tolstoysdegutis The result is I just (require [my.protocol :as proto] ...) and don't need all those namespaces.
13:33tolstoysdegutis Yeah, I've never really _needed_ those things, but how do I know that unless I try and fail? I feel like protocols are super useful, but not obviously so (for app devs, not lib devs).
13:33hiredmanif you extend protocol, and then don't require the code that does the extending, and just require the protocol, you are asking for a problem
13:34tolstoyI do a lot of (m/map->SaveUserProfile some-data-from-socket) and at least once nice thing: when it prints, I can see exactly what it wsa supposed to be.
13:34tolstoyhiredman Yes. I've encountered that.
13:35sdegutistolstoy: hmm interesting
13:36tolstoyWhat I don't do is (defrecord ...) and then extend all the protocols in the same file/declaration as that defrecord.
13:38tolstoyI can have a "validatable.clj" namespace and keep all that logic (and helper functions) together. But as hiredman noted, you have to (:require app.persitable app.validatable) etc somewhere, or those impls won't get noticed.
13:38tolstoyDownside: When you create a new entity, you sorta have to know what to do in several different files.
13:40justin_smithtolstoy: cross-cutting concerns are hard - the relationships in real code are often more like a DAG than a tree
13:40justin_smithat least we can usually avoid full fledged multi-graphs...
13:41tolstoyYeah. I organize by function, rather than type: all the validate functions, all the persist functions, all the query functions, etc. So, I'm not sure there's a "model" in any traditional sense.
13:42anandamideI just started with clojure today, and im getting some "weird" behavoir
13:42tolstoys/functions/implementations/ (for each type) but it seems like functions. ;)
13:42justin_smithtolstoy: well, one can model operations and transforms rather than objects and state, this is FP after all :)
13:42justin_smithanandamide: do tell
13:43anandamideI have this function that is over multiple lines, and unless I remove the linebreaks before pasting it into the repl, it doesnt evaluate it correctly, cutting it in half
13:43anandamideone sec, ill make a paste of the error message
13:43hiredmangiven the recomendation to not extend protocols unless you own the type or the protocol, the logical places for protocol extending are the file where the protocol or the type is defined
13:43justin_smithanandamide: yeah, if you can show how the input goes in too that would be good
13:43tolstoyjustin_smith Yeah. That's why I'm wondering of sdegutis namespace naming conventions are pointing up the need for a foundational shift in his code base (admittedly probably not worth it).
13:44justin_smithsdegutis: you should learn category theory
13:44tolstoyhiredman Notes.
13:44tolstoyhiredman I mean, noted.
13:44sdegutisjustin_smith: y4?
13:45justin_smithsdegutis: to internalize structures as operations between domains rather than recipes for punching state in containers
13:45justin_smithit's often simpler (but of course not always)
13:45anandamidehttp://pastebin.com/TAGggTQp
13:46sdegutistolstoy: So far the only two things I could see doing are implementing (description some-model) and (element some-model), but even then, the description and (hiccup) element are highly dependent on the context, e.g. we have one element-generating view-function for orders as the user sees them in order history, and one for orders as admins see them (with much more detail and admin links)
13:46justin_smithanandamide: it's iterate not itereate
13:46justin_smiththat's all
13:46anandamidesorry, i fixed that later
13:47sdegutistolstoy: For the most part, I've only found lego-style helper functions to be helpful, i.e. ones which are used within business-logic functions, rather than ones which become/replace business-logic functions
13:47anandamideI did notice that, but when pasting that specific function with the correct spelling and with line breaks it still doesnt work
13:47justin_smithanandamide: the repl doesn't care about newlines and accepts them anywhere it accepts whitespace
13:47justin_smithanandamide: feel free to share the new error
13:48tolstoysdegutis In my model, I convert the request to a type (defrecord), and the "query" protocol to fit the needs, so it might be (query [type user database-ref]) or something like that.
13:48sdegutistolstoy: hmm, by request do you mean http request?
13:48tolstoysdegutis If the user isn't not available with the incoming request, then AdminOrders vs UserOrders, or something.
13:49sdegutistolstoy: ah, i remember this now, your model is tied to an edn-based http interpreter (called via clojurescript), right?
13:49tolstoysdegutis Yeah. Just as an example. I'm using records as just convenient data containers, not as a "Model" for real word Entities or anything.
13:50tolstoysdegutis Yeah. Click something on the UI, then [:save/stuff {:foo "bar" :baz "quux"}] is sent to the server. A case statement takes that first keyword and applies an appropriate record to it. Then (proto/validate! new-record) and so on.
13:51tolstoyIf it were rest/stype http posts, the route itself would indicate which record to apply to the data. Then a single "process!" function is enough to handled _any_ item that flows in.
13:52sdegutistolstoy: your conventions make more sense to me now that i know the context better
13:52jonathanjtolstoy: that's an interesting idea
13:52sdegutistolstoy: do you use datomic on the backend of this?
13:53jonathanjtolstoy: i've been using protocol like i might have used a class in Java or Python but breaking them down into smaller individual things seems doable
13:53tolstoyI have dozens of types which are convenient to the data that comes in, NOT as a representation of Biz Objects. There's no user record. There's a "saveuser" or "update-password" or "expire-user" or whatever.
13:54tolstoysdegutis Yes. Datomic. IMutatable implements (mutate! [this datomic] ....) and IQueryable for (query [this datomic]).
13:54sdegutistolstoy: haha, IMutable is mutable
13:54sdegutistolstoy: do you expose any of the actual shape/structure of your datomic schema to your front-end?
13:55jonathanjshould've named it I'mMutable
13:55tolstoyjonathanj Yeah, I'm using it more as an organization strategy, kind of. Or like algebraic types, kinda.
13:55jonathanjtolstoy: yeah, i like it
13:56tolstoysdegutis: Well, say, when a user logs in, I send a [:user/auth {:token "aklaslda"}] and the IQueryable (or IFindable) then returns with a blob of useful data that's a cobbled together pull-api thing.
13:57tolstoysdegutis But I gave up, a long time ago, modeling entities in my database. The "database" is the model. Ask it questions, get arbitrary results back out.
13:58tolstoyNeed a page with some user data, some orders the user has seen, and a peach? Just run the query and shove it back out. No need to model Users Orders and Peaches in the code other than as temporary value objects.
13:58sdegutistolstoy: my only concern is that may be a security risk, to expose some of the shape/schema of your database to the front-end
13:59sdegutistolstoy: but I do agree with your philosophy, since datomic entities are our official first-class model, and we merely have helper functions to assist in examining/manipulating entities
13:59tolstoysdegutis Well, db/ids don't make it through. foo/bar becomes bar. I guess I'm not sure what you mean.
14:00sdegutistolstoy: the attributes themselves, if the user may know anything about them, i.e. their name or cardinality or type, then the user may find a security hole
14:00tolstoysdegutis Oh, they make it back to the client as regular maps. No schema attributes.
14:00sdegutise.g. if the user knows that :user/email is of :db.cardinality/one and :db.type/string and unique/value, then they may find a security hole or something
14:00sdegutisok
14:01tolstoySomething like, {:id "asads" :name "Some User" :orders [...] :peach {:id "asdas" :status "tasty"}}.
14:02tolstoyI try to keep in mind that I'm writing a custom app, not a general API or library or massive netflix style endpoint. ;)
14:03tolstoyThe end result of all of this is that my server-side API is down to a large case statement that transforms the edn/json into a clojure record, and a single 10 line "process!" function.
14:04tolstoyBTW, technique works great in ClojureScript, too.
14:05tolstoyClick a button, put (FindUserOrders. user-id) on a channel, implement Sendable and/ or Mutatable to update the state atom, or send a socket message, etc.
14:12sdegutisNetflix has an endpoint?
14:13sdegutisman I wouldn't be surprised if charmin.com had a rest api these days
14:13tolstoyOh, I don't know. Whatever serves all their clients.
14:13sdegutis:P
14:14tolstoyThey ended up implementing a query API rather than REST, so they could keep up, if you follow some of David Nolen's vids.
14:28sdegutisi have not, sorry
14:30sdegutisVideos and conference talks are hard for me to learn anything from due to them always taking way too long to get to the point. Text is much easier to skim/grep/read.
14:31tolstoyI watch them just to get a feel, or to (hopefully) load up the lateral thinking potential.
14:31tolstoyI'm never going to do anything with automata, but sometimes a sentence in the talk will spark an idea. That kind of thing.
14:32dysfunflatmap flatmap flatmap boom?
14:40tolstoyThe Anxiety of Influence
15:00sdegutisIs it possible to completely destroy a var?
15:00sdegutisNot merely unset it.
15:00dysfunwhat effect would that have beyond unsetting it?
15:01sdegutisdysfun: destroying it
15:01dysfunyou mean calling its finaliser?
15:01sdegutisAh, ns-unmap
15:01dysfunoh, unmapping it
15:01sdegutisdysfun: mainly to clear up clutter in an ns
15:01sdegutisdysfun: yeah, unmap it from the ns
15:16machinewarhow can I download/require a third-party package in leinengen repl?
15:17machinewarI know how to do it with dependencies in a file, but can I do it somehow from within a repl session in user namespace
15:21bmukif I have a named parameter in a route (say (GET "/message/:id" ...)), how can I access both the request and the id? would it just be [request, id]?
15:21thachmaihello
15:21thachmaido you know an efficient way to make sure that the vector doesn't grow beyond a certain size?
15:23thachmaiI could do a combination of count and subvec but it feels rather heavy
15:23hiredmanuh
15:23hiredmandefinitely not subvec
15:23hiredmanjust don't add things
15:24thachmaiI do want to add things. But if the vector is too large I want to keep only the last n elements
15:24hiredmanyou want a ring buffer, not a vector
15:24thachmaioh cool, thanks
15:25hiredmanyou can build one from a vector, a vector a number indicating where to write, and and you increment the write position and mod it to the size you want
15:26hiredmanor, you could just use a queue
15:30bmukI want to have a route with a parameter, but I still need to access the JSON in the request body
15:39thachmaibmuk, what's stopping you from accessing the :body?
15:43bmukthachmai: all my other routes look like this: (POST "/login" req (let [username (get-in req [:body :username])]...
15:44bmukif I have to replace req with the route parameter, what do I call get-in with?
15:45dysfun:params :name
15:53bmukdysfun: so you're saying keep it like this - (POST "/message" req .. and just do (get-in request [:params :id])?
15:53bmukwouldn't that have to be sent as https://foo.com/message?id=1234
15:54dysfun(POST "/message/:id" req ... (get-in req [:params :id]))
15:54dysfunPOST is just a very clever macro around ring maps and functions
15:55bmukah ok. So the macro behaves differently if instead of req I say [id]?
15:56bmukand without ":id" being in the route :params would refer to a query string
15:56dysfunif you pass it a vector, it treats it specially
15:56dysfunotherwise you are just binding to the request map
15:56dysfunso you can e.g. {:keys [params] :as req}
15:58bmukahh. I feel like I'm repeating myself a lot in this routing - several routes are identical except the name of the route and the function I call to get the body. Is there any way I can write that once?
15:59dysfunyou can make the bodies call simple functions that handle the entire request
15:59dysfunliterally just treating the routes as a mapping from route to function
16:00dysfunand then you can refactor those functions as normal when you see repeating patterns
16:01bmukthat makes sense
16:01dysfunas a general case, getting things where you can see them helps
16:01bmukso (POST "/login" req (login-user req))?
16:01bmukwhat do you mean by that?
16:02dysfunthat macro is doing a lot of things
16:02dysfunwhen you can more clearly see what's going on, things become easier to refactor
16:03bmukpush more of the logic into a function I control
16:03dysfunyeah
16:04amalloyor just (POST "/login" req login-user)
16:11bmukif I'm going to be making requests and decoding responses to json, is clj-http-lite + cheshire, or just clj-http the better option (in regards to speed)?
16:12dysfunno idea. figure out if you have a performance problem first through profiling and benchmark if necessary
16:14bmukTrue
16:14bmukSo the easiest way would be to use clj-http's built in decoding and if it's not fast enough try cheshire?
16:15dysfunif you look, you'll probably find it uses cheshire
16:15dysfunmost clojure libs do
16:15bmukIt does, just checked
16:15bmukoptionally, anyway
16:33hiredmanclj-http-lite is unlikely to be faster
16:34hiredmanclj-http-lite exists entirely to depend on just classes that ship with the jvm, if you don't care about that, don't use it
17:54amoedoes anyone have some pattern to deal with the situation where a REST API needs to make a link to some resource. The absolute URL can only be resolved by knowing some details from the "Host" header. So the full http request (or at least the looked-up URL prefix) needs to be passed through many functions as a parameter even though the prefix is really peripheral to the purpose of many of the functions.
18:11alex-weejlooking for something like python / perl ‘or’ which returns the first none-nil argument lazily evaluating
18:11alex-weejdoes this exist in the core?
18:12alex-weej(or foo bar) where bar is only evaluated if foo is nil
18:12danlarkinthat's how it works
18:12danlarkinexcept s/nil/falsy/
18:13alex-weejit returns true or false though
18:13danlarkinno it doesn't
18:13alex-weejbuh, i must have been doing it wrong :/
18:14alex-weejhah yes, sorry, ignore me
18:14alex-weejdefinitely too late to be hacking ;)
18:14alex-weejthanks
19:08dimon_I have this (def users [{:name "James" :age 26} {:name "John" :age 43}]). How can I change all its values of "name" using the functions map and assoc? I can't figure out how I'd use "assoc" in particular. By changing "name" I mean adding a string "_change" to its "name" value.
19:08justin_smithdimon_: something like (map #(update % :name str "_change") ...) should do it
19:09justin_smithdimon_: or is it required that you use assoc?
19:09justin_smith,(map #(update % :name str "_change) [{:name "James" :age 26} {:name "John" :age 43}])
19:09dimon_justin_smith: thx, that's it.
19:09clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
19:09justin_smith,(map #(update % :name str "_change") [{:name "James" :age 26} {:name "John" :age 43}])
19:09clojurebot({:name "James_change", :age 26} {:name "John_change", :age 43})
19:59dimon_I'm trying to change the format of a date which I display on a page in Luminum application:
19:59dimon_(defn home-page
20:00dimon_;........
20:00dimon_ :articles (map #(update % :inserted_at (.format (java.text.SimpleDateFormat. "MM/dd/yyyy"))) (db/get-all-articles))
20:00dimon_an error is No matching field found: format for class java.text.SimpleDateFormat
20:00dimon_what am I doing wrong?
20:00justin_smithdimon_: is format a static method?
20:01amalloyyou're calling format on a formatter but no date
20:01dimon_.
20:01dimon_how should I call it properly?
20:02justin_smithdimon_: you need an anonymous function wrapping the (.format ...) call that inserts the passed in inserted-at value
20:03justin_smithand you'll need the (fn [x] ...) style syntax because #() does not nest
20:04dimon_justin_smith: could you show me?
20:05TEttinger(map #(update % :inserted_at (fn [date] (.format (java.text.SimpleDateFormat. "MM/dd/yyyy") date)))
20:05justin_smith,(map #(update % :inserted-at (fn [d] (.format (java.text.SimpleDateFormat. "MM/dd/yyyy") d))) [{:inserted-at (java.util.Date. 0)} {:inserted-at (java.util.Date. 666666666)}])
20:06clojurebot({:inserted-at "01/01/1970"} {:inserted-at "01/08/1970"})
20:06justin_smith~666666666 is aproximately 1 week.
20:06clojurebotc'est bon!
20:07dimon_justin_smith: tnx, I'll check it out.
20:12justin_smithTEttinger: hah https://gist.github.com/noisesmith/4ffc657ff89ad3b9903f7e7b6dd159e6
20:13tolstoyRight around midnight, 1970: bad times!
20:27TEttingerjustin_smith: there's almost no significant stuff on those dates
20:27TEttinger1991 – The Visegrád Agreement, establishing cooperation to move toward free-market systems, is signed by the leaders of Czechoslovakia, Hungary and Poland.
20:29TEttingersteve macmanaman and the keyboard player for slipknot were born on one of those dates https://en.wikipedia.org/wiki/Steve_McManaman https://en.wikipedia.org/wiki/Craig_Jones_(musician)
20:33justin_smithhaha
20:33justin_smith(dec numerology)
20:41TEttingerjustin_smith: these fibonacci numbers are certainly off by a few milliseconds, but https://gist.github.com/pastebot/123af012b0a9f9a2255453161750a7c1
20:42justin_smithcool, we have a fibonacci date coming up then
20:43TEttinger1546105899666
20:43justin_smithbut that would be easier to read with pprint :P
20:43TEttingerinteresting last 3 digits
20:43TEttingerpprint had a weird issue on my lazybot
20:43TEttingerit couldn't read the file separator property
20:43TEttingererr
20:43TEttingerline separator
21:42machinewaris there a core function to swap values in a vector? i.e. I have [
21:42machinewar[1 2 3] and want it to be swapped w/ ["a" "b" "c"]
21:42justin_smithmachinewar: assoc
21:42justin_smithore replace
21:42justin_smithmachinewar: do you want to replace by value or by position?
21:43machinewarjustin_smith: value
21:43amalloywhat does "swapped with" mean
21:43amalloylike, what are your two inputs, and what is your desired output
21:43justin_smith,(replace {1 "a" 2 "b" 3 "c"} [1 2 3])
21:43clojurebot["a" "b" "c"]
21:44justin_smith,(replace {1 "a" 2 "b" 3 "c"} [1 2 3 4])
21:44clojurebot["a" "b" "c" 4]
21:44machinewari.e something like input [1 "b" 2 "c"] {1 "a" 2 "b"} output -> ["a" "b" "c"]
21:44machinewarmeaning swap 1 w/ a 2 w/ b
21:45justin_smithmachinewar: so close to what replace does as shown above?
21:45machinewarjustin_smith: correct!
21:45machinewarah thanks that works1
21:49machinewarman clojure is awesome
21:50machinewardefinitely in a honeymoon phase, but its perfect use case for what I'm working on
22:29sdegutisIf you ever want to add a delimiter in a file and you have Cider running, paste in (symbol (apply str (repeat 80 ";"))) and press C-c C-w after it
22:29sdegutisOr just hold the ; key for a while and let go when the line is long enough, if you're not like me and don't care if it's exactly 80 or not
22:33jeayesdegutis: 80I;<ESC>
22:34sdegutisjeaye: pfft, you and your vim wizardry
22:34amalloyM-8 M-0 ;
22:34sdegutisamalloy: pfft, you and your pure-emacs sorcery
22:35jeayeamalloy: Appears to be a tie
22:35amalloyin terms of what? number of keys?
22:35jeayeKey presses, both 5, assuming we use i instead of I since yours doesn't go to the beginning of the line
22:35sdegutismine has the most typing so it wins
22:36amalloyimo emacs wins, because you don't have to release meta between 8 and 0
22:36amalloyso you only press meta once
22:36sdegutisMv 8 0 M^ ;
22:36amalloybut of course emacs and vim both win for just being editors where it's easy to do custom things
22:36sdegutisimo cider wins cuz it uses the most convoluted method possible
22:36sdegutisincluding requiring a full jvm to be running
22:37jeayeamalloy: Agreed.
22:37amalloyi can just imagine the eclipse bugzilla page
22:37amalloywhere someone asks for the next version to include the "insert a character 80 times" feature
22:38sdegutisamalloy: also, that explains why sometimes when using I'm emacs I accidentally press the wrong things and suddenly there's a lot of extra letters in there than I meant
22:38amalloysdegutis: you can use C-h l to see what crazy thing you accidentally typed
22:38sdegutiswhoa
22:38sdegutisinsanity.
22:58tolstoyHuh. I've used C-u 78 - to get a line.