#clojure logs

2015-06-21

00:00zapho53I have a function with a let binding followed by 2 function calls which add something to a database. Whichever way round I switch them only the last one executes.
00:01amalloyzapho53: they are both returning a lazy sequence, which you forget to force any elements from
00:01zapho53Both functions have a YeSQL <! return value.
00:02zapho53amalloy: Then why does 1 execute?
00:02amalloybecause you return it, and whoever is above you in the call hierarchy happens to force it
00:03zapho53amalloy: How do I get both to execute?
00:03amalloyi mean there are other possible explanations and i don't know what this yesql thing is, but this is by far the most likely cause for the scenario you are describing, absent any code snippets to the contrary
00:04amalloyzapho53: try wrapping them both in (doall ...) to prove or disprove my supposition
00:04zapho53amalloy: Tried that once but maybe I screwed it up. Will try again.
00:05amalloyif that isn't the answer you will have to link to some actual code, or find someone who knows what yesql is
00:05pranavrcHi. I'm having a little trouble with the syntax for unquote-splicing inside a macro. I've pasted the details here: http://pastie.org/10251103 Can someone suggest what might be wrong?
00:06zapho53amalloy: doall results in this error: clojure.lang.LazySeq cannot be cast to java.lang.Number
00:07amalloyzapho53: then we have fixed the problem you asked about, and advanced to some other error
00:07zapho53amalloy: Which is weird because both functions will execute the desired result if put last in the order.
00:08amalloypranavrc: ` is shorthand for writing the tedious (list 'let ...) stuff you are doing by hand. you don't want to use both in most contexts
00:09amalloyyou could either write `(let [~'time (now)] foo bar baz), possibly with some more quoting depending on what foo/bar/baz actually are, or (list `let ['time `(now)] `foo `bar `baz), possibly with less quoting that again depends on what foo/bar/baz are
00:14pranavrcamalloy, I can't use `foo `bar `baz there as is, because the ~@(list foo bar baz) component I've included is actually a different function call that returns a list. I just used a different function for brevity.
00:15amalloyokay, so it's `(let [~'time (now)] ~@(whatever))
00:16pranavrcamalloy, in which case I still get the illegalstateexception error for unbound unquote
00:16amalloyno you don't. you can't get that exception from the code i pasted, unless (whatever) by itself also throws that exception
00:17amalloyin which case, fix whatever
00:26pranavrcamalloy, alright, thanks!
00:26amalloypranavrc: i suspect the reason whatever throws is you are trying to unquote stuff inside it, like @(whatever ~foo)
00:27amalloywhich is not what you want. you have already unquoted the whole expression
00:27pranavrcamalloy, yeah, that was the problem.
02:47Thebreakerwww.VALBOT.COM provides domain valuations. Reporting globally on Site Traffic, Pagerank, Malware, WHOIS data, SEO & even Social Media presence.
03:25kwladykaHow clojure is developing during all this years? What can we estimate about job and projects in Clojure?
04:11ttt_fffhow does one implement tuples in clojure?
04:11expezby using a vector
04:18TEttinger(inc expez)
04:18lazybotโ‡’ 1
04:19TEttingeryep, vectors already allow whatever for types, so you have the main advantage of tuples in a statically typed language right there already. and they're a single value, so that's the other use
04:31rs0also destructuring
04:49mskoudHi there!
05:01kaffeeboehnchenGood morning. :) I have this macro: https://paste.xinu.at/dabljg/clojure When I call it I get a null pointer. test-auth is working with the data I am calling the macro with if I call it on its own. What am I doing wrong?
05:03Chousuke_is authed-header actual clojure code?
05:03kaffeeboehnchenYes.
05:03Chousuke_how does the macro invocation look?
05:03kaffeeboehnchenit is a map looking like that: {:status 123 :body "hi"}
05:04kaffeeboehnchen(handle-request test-request other-fun)
05:04Chousuke_your macro is passing the symbol 'test-request to test-auth
05:04kaffeeboehnchenmy goal is to call other-fun when authed-header does not have a specific status and give other-fun the same request.
05:05kaffeeboehnchenah, ok
05:05Chousuke_why does this need to be a macro? :/
05:05kaffeeboehnchenI have no clue to do it otherwise.
05:05kaffeeboehnchenIf there is a better way please tell me.
05:06kaffeeboehnchenother-fun will not always be other-fun by the way
05:06kaffeeboehnchenthe function which should be called will change
05:06Chousuke_can't you just (if (check-status authed-header) blah (other-fun authed-header))?
05:07amalloythe easiest way to make this macro be a function is to change the defmacro to defn. it would be closer to working that way
05:07Chousuke_you can pass functions as arguments to other functions
05:07kaffeeboehnchenBut doesn't it get evaluated the moment I pass it?
05:07Chousuke_evaluated?
05:08Chousuke_if you pass it in a variable, why does that matter?
05:08kaffeeboehnchenIt only should be executed if authed-header has the status 202
05:08Chousuke_it won't be executed.
05:08Chousuke_it's just a function
05:08kaffeeboehnchenok
05:09Chousuke_I'm still not sure if I understand your problem correctly
05:09kaffeeboehnchenLater I wanna call (handle-request request this-fun), (handle-request request that-fun), (handle-request request other-fun).
05:10Chousuke_yeah, that's just fine
05:10kaffeeboehnchenOk. Thank you very much!
05:10Chousuke_I mean, if you do eg. (list + -), that won't actually call the + - functions
05:10Chousuke_you just get a list that contains them
05:10kaffeeboehnchenaaaaahh
05:46ambrosebswhat's the current stance on Java 7 support in core/contrib?
05:47ambrosebsgoing away soon?
06:17TEttingerambrosebs: I wasn't aware core/contrib was still around, tbh
06:18ambrosebscore+contrib
06:18TEttingerbut unless clojure is specifically moving from 6 compat to 8 compat, I kinda wonder why they would do that
06:19TEttinger(did clojure stop supporting JDK6 and thus android?)
06:19ambrosebsgood question
06:19kwladykaCan i discuss with somebody about Ring architecture? My goal is learn about architecture on this project.
06:22kwladykafirst of all what determine to separate catalogs core/devel/jetty-adapter/servlet as root direcotries, not as src/* directories?
06:27kwladykaas i understand ring respository has 4 projects 1 one, why not 4 separater ring repository?
06:34JickelsenI've included react-with-addons (from CDN) but (aget js/React "addons") returns nil. Any ideas?
06:49kwladykaok, next step... i understand magic happens because of lein-sub library
06:55crocketclojure repl uses 600MB of RAM from the beginning.
06:55crocketHow do I tame its memory usage?
07:03kwladykaso next... ring project use lein-sub and has :sub in profile.clj for subprojects, but this subprojects doesn't have main function or something like this. Also if i understand then run as casdace one by one, not paraller or... exatly opposite to cascade, because i am not sure how to interpratate "Should you need recursive behavior, consider Leiningen aliases or lein-cascade." and if not main functions inside... what exatly is running?
07:06kwladykacrocket, what do you mean clojure repl? "lein repl"? for me 1 136K memory
07:07crocketyes
07:07crocketlein repl
07:07crocketIt uses 620MB of RAM inside cider repl which is essentially lein repl.
07:08kwladykacrocket, "lein repl" for me on windows get only 1 136k memory
07:09kwladykamaybe you interpret used memory by process in bad way if you running repl inside another application
07:09crocketI?
07:09crocketnot me
07:09clojurebotI will never forgive that
07:10kwladykammm?
07:13crocketLook at http://imagebin.ca/v/25zcAKgAPHTq
07:14crocketlein repl ends up using 1GB
07:14crocketkwladyka, ^^
07:15kwladykacrocket, i relogin to IRC, i guess i miss something
07:19TEttingerkwladyka: crocket meant http://imagebin.ca/v/25zcAKgAPHTq
07:20TEttingerlein repl uses more or less RAM based on the project you're in, IIRC
07:20TEttingersince it does load the whole project to make it available, IIRC
07:23kwladykamy mistake, but still i have 200 MB or 250MB, I forgot :)
07:42crocketTEttinger, It is a very minimal leiningen project.
07:42crocketIt only has 3 functions.
07:43ambrosebshow can I tell lein to never compile/test a file in my test path
07:43TEttingerthen... just curious, how much free RAM do you have on your machine?
07:43TEttingerit's possible Java's gobbling up more than it currently needs in anticipation for later usage
07:44crocketTEttinger, 8GB of RAM and 13.5GB of swap.
07:44TEttingeris it swapping now?
07:44crocketno
07:44crocketThe system currently uses 2.5GB of RAM in total.
07:45crocketAnd, swapping doesn't necessarily lead to HDD access as far as I know.
07:45crocketHowever, swapping is not desirable.
07:45TEttingeroh that could be why then, you have enough free that java thinks it can take a whole lot, I guess
07:45TEttingerI know modern browsers do this
07:45crocketIt could be -Xms option.
07:46crocket-Xms 512M could cause this.
07:46TEttingeruh yes
07:46TEttingerthat would make it always start with 512 MB used, do you want to know if it's used by lein?
07:47crocketThe command lines don't specify -Xms or -Xmx.
07:47crocketI don't like this.
07:47crocketPython wouldn't consume this much.
07:49crockethexchat consumes 23.5MB of RAM.
07:49crocketDoes anyone plan to port clojure to python 3?
07:49crocketIt wouldn't make sense for performance reasons, though.
07:49TEttingerhuh, interesting. https://github.com/technomancy/leiningen/blob/master/bin/lein#L156-L158
07:49TEttingercrocket:
07:50TEttinger$google pixie lang
07:50lazybot[pixie-lang/pixie ยท GitHub] https://github.com/pixie-lang/pixie
07:50TEttingerit's very close to clojure, implemented in RPython (what PyPy uses) but not meant to call Python code yet
07:50TEttingerstartup is one of its reasons to exist
07:50kwladykacrocket, i found solution like that about memory "You can set :jvm-opts in the user profile if you're using Leiningen 2. Otherwise set JVM_OPTS as an environment variable." Did you try that?
07:51crocketkwladyka, no
07:51crocketI didn't know about it.
07:51TEttingeryeah, I'd check if something else set your JVM_OPTS env var
07:52crocketI use leiningen 2.5.1 on openjdk 1.8.0_45.
07:52crocketNothing sets JVM_OPTS in the user shell.
07:52TEttingerhm
07:52TEttingerJAVA_OPTS can also do it
07:53TEttinger(older java used that, lein treats it as an alias)
07:53kwladykahttps://groups.google.com/forum/#!topic/clojure/h3M-LSlE4dw Larry Travis answer - maybe it is solution for you
07:53crocketI expect pixie to be different from clojure.
07:53TEttingeryes, no libs for one :)
07:53crocketNo clojar
07:54TEttingerbut it's very very close in terms of language features. it's also at an early state, (they were doing a major refactor last I checked a few months ago, to try to change how lazy seqs worked or something)
07:57crocketOk, I specified :jvm-opts in ~/.lein/profiles.clj
07:57crocketWhy did they name it pixie?
07:57crocketIf they wanted it to be a clojure implementation on python, they would have named it accordingly.
07:58TEttingerI'm working on a clojure-like lisp as well, but using Perl 6's toolchain instead of PyPy. I'm encountering a rare problem in that the tools I am using to implement a new language, already have way more features than my language is going to even plan to have
07:58TEttingerit isn't directly clojure, and they planned to diverge in new features
07:58TEttinger(they have transducers in from the start, for example)
07:59TEttinger^ last 2 lines re: pixie
07:59crocketI expect clojure to be faster than the perl reincarnation and pixie.
07:59crocketpython VM is not fast enough.
07:59TEttingeryes. except for startup and memory usage
08:00crocketpixie would suit command line programs and GUI programs.
08:00crocketBecause of startup time and memory usage.
08:00TEttingerjava and the JVM have atrocious startup time compared to scripting language VMs. thankfully, the perl thing I'm using can produce JVM bytecode or a scripty VM's bytecode (MoarVM)
08:01crocketWill anyone fix clojure's slow startup time?
08:01TEttingerthere are some ways you can mitigate it
08:01crocketJVM itself is not slow to launch.
08:01TEttingerstarting with the --server JVM will always slow down launch relative to --client
08:02TEttingerbut --server does way more opts as your program runs
08:02crocketI heard http://clojure-android.info/skummet/ aims to reduce startup time.
08:02TEttingerthere's a mix in JDK 7 and newer, you can pass the args... let me find em
08:02crocketskummet
08:04TEttinger-server -XX:+TieredCompilation
08:04TEttingerthe second arg is only available for server JVMs, and it gives it -client JVM like startup behavior
08:04TEttingerit SHOULD be the default on -server
08:05crocketIt seems leiningen ignores ~/.lein/profiles.clj outside leiningen projects.
08:05TEttingerlow-end machines, particularly 32-bit windows machines, don't always have -server available as an option
08:06crocketIt seems lein repl is beyond hope.
08:07crocketIt is greedy of RAM.
08:08TEttingerwere you passing an -Xmx option?
08:08crocketyes
08:08crocket-Xmx512m
08:08crocketAnd, it uses 350MB.
08:09TEttingerwell that's not disobeying the -Xmx, but it is still a fair amount...
08:09crocketWhy does leiningen ignore ~/.lein/profiles.clj outside leiningen projects?
08:10TEttingerI don't know if it does, actually -- I think the profile may affect your project when it runs, not the lein program itself
08:10TEttingerbut I have no idea
08:11crocketI mean lein repl
08:11crocketWhy does 'lein repl' ignore ~/.lein/profiles.clj outside leiningen projects?
08:15TEttingeroh!
08:15TEttingerThe :base profile provides dependencies necessary for basic repl functionality, adds dev-resources to the :resources-path, and sets defaults for :jvm-opts, :checkout-deps-share and :test-selectors. It is part of Leiningen itself; you shouldn't need to change it.
08:17crocketTEttinger, What is the clojure-like language that targets perl 6?
08:17crocketDoes it compile to perl 6?
08:18TEttingeruhhh I'm making it and I don't know perl 6, don't expect much yet :)
08:18TEttingerhttps://github.com/technomancy/leiningen/blob/9c5192e6520fb96aa625313a468e0143001f54ca/leiningen-core/src/leiningen/core/project.clj#L467-L470
08:18TEttingerthat link is the default set of JVM opts that :base adds
08:18crocketIt seems Rakudo Perl targets MoarVM and JVM.
08:18TEttingeryes
08:18TEttingerthat's what I will too
08:18crocketWhut
08:19crocketTEttinger, How are you desining your clojure-like language?
08:19crocketWhat does it target?
08:19TEttingerI'm writing it with NQP, which is Not Quite Perl, a subset of Perl 6 meant for making compilers
08:19TEttinger(perl 6 is really really big in terms of feature scope)
08:20TEttinger(NQP is a smaller subset that they can bootstrap)
08:21TEttingeranything that uses NQP to make a compiler outputs a "QAST", which is effectively the same as a clojure ast in my case after it's been fully macroexpanded (no compile time logic)
08:21TEttingerJVM and Moar backends take a QAST and compile it to a native jar or exe, respectively, I think
08:21crocketIs there any clojure implementation suitable for command line programs?
08:21crocketor any lisp
08:22TEttingerI'd say pixie is about as close to clojure and command line as you'd get
08:22crocketpixie dust
08:22TEttingerother things get more scheme-like or common lisp like
08:23TEttingerSBCL has worse compile times than clojure, from what I hear, but produces very good optimizations
08:23TEttinger(not sure about repl in there)
08:23crocket"Pixie implements its own virtual machine. It does not run on the JVM, CLR or Python VM."
08:23TEttingeryep
08:23crocketAnd, it's written in python.
08:23TEttingerPyPy's RPython is a toolchain for making VMs
08:24TEttingerwell, the bootstrapper is in RPython and even that isn't all of Python
08:24crocketIs scheme decent for command line programs?
08:24wasamasayes
08:24crocketWhat about common lisp?
08:24TEttingerthere are many schemes though
08:24wasamasacommon lisp sucks for that purpose
08:24wasamasanot a single open-source implementation has tree shaking
08:25TEttingerracket is a good bridge between Clojure features and Scheme-ness
08:25wasamasaand therefore cannot produce binaries comparable with what you'll otherwise find there
08:25crocket???
08:25lazybotcrocket: Yes, 100% for sure.
08:25TEttingerthere's actually a racket lib that adds clojure data structures, immutable and all, to racket
08:25crocketI don't know tree shaking.
08:25TEttingerRacket is a scheme
08:25crocketIs Racket a functional programming language?
08:25wasamasanope
08:25TEttinger?
08:26crocketIs there a functional lisp dialect suitable for command line?
08:26TEttingerracket has immutable and mutable data structures like clojure
08:26wasamasait's a good deal closer than CL though
08:26wasamasacrocket: stop treating "functional" as a binary value
08:27wasamasacrocket: makes about as much sense as doing the same for OO
08:28crocketjavascript sucks.
08:28TEttingerracket doesn't support the same type of concurrency stuff as clojure. I don't think any other lisps do as well as clojure in that arena
08:28crocketpixie is close?
08:28crocketpixie has STM and CSP.
08:28TEttingerdo you mean CPS?
08:29wasamasacrocket: I also suggest you to just start writing code instead of spending all day asking #clojure about theoretical things
08:29TEttingerI like talking though!
08:29TEttingerit means my brain hurts less from perl stuff!
08:29expezI deployed a version that I don't want to promote to a proper release to clojars, when I try to deploy agai I get ReasonPhrase: Forbidden. What gives?
08:30wasamasacrocket: you may learn valuable things along the way such as that there is no perfect programming language
08:30wasamasacrocket: or that one programming language is better suited for a certain task than another
08:30TEttingerclojure is very very good for server apps
08:30wasamasacrocket: or that people writing code usually learn other languages as well
08:31crocketClojureScript on node.js could be made decent on command line.
08:35crocketTEttinger, Do you have other recommendations for command line than pixie?
08:35crocketpixie doesn't even have a tutorial yet.
08:37TEttingertry lots of lisps. racket has a heavy focus on being useful for whatever people want to adapt it for, since it's primary unique feature is the ability to make new language modes that are still valid racket (one has algol syntax)
08:37TEttingerracket also has a better documentation generator than, uh, everything
08:38TEttinger(it's a tool called Scribble and it really produces very good docs)
08:38crocketWhut
08:39crocketDoes clojure target python vm?
08:39TEttingernot that I know of, it potentially could
08:39TEttingerbetter would be LLVM, like many other languages are starting to try
08:41crockethttps://github.com/halgari/clojure-py/ not useable
08:41crocketonly 7 commits
08:41TEttingeras far as I can tell, LLVM has a number of advantages that explain why Apple is investing so heavily in it, and one is the quality of debugging and compilation speed that they get with Clang, the C/C++ compiler targeting LLVM, relative to GCC
08:41crocketLLVM sounds complex.
08:41TEttingerit is. it does have a lot of stuff under its banner
08:42wasamasacrocket: will you promise me to go quiet if I hand you a lispy language with a tutorial that's capable of producing executables and starting up quickly?
08:42TEttingerhehe
08:43wasamasanot to mention an alive community and sufficient amount of libraries
08:44crocketThat sounds magical
08:44wasamasait's not if you relax your criteria a bit
08:44wasamasahttp://call-cc.org/
08:44crocketActually, I was overwhelmed by lisp dialects....
08:44crocketRacket, chicken scheme, et al...
08:44wasamasaI'm using it for writing my CLI utilities and some simplistic web applications
08:45crocketI surmise chicken scheme is a decent language.
08:45wasamasait's no clojure, but eh, I'm fine with scheme
08:47crocketI'd be happier if there is a clojure implementation that starts up fast because that means one less language to learn.
08:47wasamasalol
08:48crocketI could probably try ClojureScript on node.js
08:48wasamasajust give up on it, as a good developer learning languages is a necessity
08:48wasamasawell, clojurescript's tooling sucks
08:48crocketDoes it have leiningen?
08:48wasamasayou'll have to start with a clojure project first, then add clojurescript as dependency
08:48wasamasathen write some lines to make leiningen compile javascript
08:49crocketwasamasa, It seems chicken scheme implements R5RS. Does R6RS improve on R5RS in any aspect?
08:49wasamasacrocket: R6RS is very different from R5RS
08:50wasamasacrocket: R7RS is an attempt to actually improve R5RS and splitting the language into a small and large version
08:50wasamasacrocket: and chicken supports a good amount of the small version of R7RS
08:52crocketIt seems committee has dominated scheme.
08:53crocketI have a selection disorder.
08:57crocketwasamasa, Does chicken scheme compile to native binaries directly?
08:57kwladykawasamasa, did you use lein-sub?
08:57wasamasakwladyka: nope
08:57Bahmanwasamasa: Count me in :-D
08:58wasamasaBahman: and I thought I was just seeing things
08:58kwladykawasamasa, ok. I am just looking somebody who can explain me https://github.com/ring-clojure/ring architecture :)
08:59wasamasakwladyka: not sure how a leiningen plugin comes into play there
08:59Bahmancrocket: One of the strengths of Chicken (and Racket) are native binaries.
08:59wasamasaBahman: didn't racket switch to having a VM?
08:59Bahmanwasamasa: Yes...but the binary contains the slimmed down VM for easy redistribution.
08:59BahmanPretty neat.
09:00kwladykawasamasa, do you have any idea why author of code choose to have all this projects inside one repository then separate them?
09:00wasamasawell, ok
09:00wasamasakwladyka: I suggest asking them
09:00kwladyka;)
09:01kwladykait can be a solution :)
09:01kwladykaand maybe the esiest in this case
10:02crocketIs it ok to write a GUI program in clojure with a JavaFX binding?
11:19whodidthishttps://www.refheap.com/104291 any way i could make core.match work in tests? ๐Ÿ˜ฟ
11:25crocketWill clojure be fixed with regard to nil?
11:26mmeixWhat should be fixed?
11:26crocketnil
11:26crocketNil causes errors
11:27mmeixexample?
11:27mmeix,(doc fnil)
11:27crocket(if ({:a nil :b 1} :a) "ok" "no")
11:27clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
11:27crocket,(if ({:a nil :b 1} :a) "ok" "no")
11:27clojurebot"no"
11:28crocketIt leads to logical bugs.
11:28crocket,(if (contains? {:a nil :b 1} :a) "ok" "no")
11:28clojurebot"ok"
11:29crocketSince nil is everywhere, it is difficult to find the origin of nil.
11:29whodidthismaybe core.typed will help you out
11:30crocketnil should have been an interop feature.
11:31mmeix ,(if ({:a nil :b 1} :a) "ok" "no")
11:31clojurebot"no"
11:31mmeixis perfectly ok, because nil is falsey
11:32mmeix"Both nil and false are treated as "false" and everything else is treated as true."
11:32mmeixhttp://blog.jayfields.com/2011/02/clojure-truthy-and-falsey.html
11:32crocketSomehow, it leads to bugs.
11:32crocketnil leaks into collections.
11:32crocketconditionals return false because nil leaked into collections somehow in a large codebase.
11:33mmeixI guess, nil will not declared truey ...
11:34Bronsacrocket: no, it will never be "fixed". it's not considered a bug or misfeature
11:34mmeixmaybe this helps:
11:34mmeixhttp://blog.jayfields.com/2011/01/clojure-fnil.html
11:34crocketnil shouldn't have been part of the core in the first place.
11:34Bronsathat's your opinion
11:34crocketRich Hickey was forced to use nil due to JVM.
11:35Bronsado you have any evidence to back that claim or is it just you assuming things?
11:35crocketNil is a mistake in programming languages.
11:35crocketNil, Null, ...
11:35Bronsacool. you seem to have made up your mind. have fun trying to convince the core team I guess
11:36crocketmmeix, I think fnil is a band aid at best.
11:37mmeixhm ...
11:38mmeixI'm a beginner, but the concept of only nil and false being falsey seemed very plausible to me
11:38mmeixinstead of say 0 being false, for example
11:38mmeixetc.
11:38crocketmmeix, My point is that I feel much better without nil in the core.
11:39crocketNil is better served as a java interop feature.
11:39mmeixthis is not going to happen, it would break nearly everything
11:39crocketI know
11:39mmeixAFAIK
11:40mmeixwhat is wrong with your example (if ({:a nil :b 1} :a) "ok" "no")?
11:40mmeixdon't see the point
11:40crocketIf a programmer assumes a map doesn't have nil, it is a problem.
11:42mmeixSomething other: trying "boot" for he first time, and doing some silly error somewhere - could someone have a quick look at: https://www.refheap.com/104324
11:44mmeix,(contains? {:a nil :b 1} :a)
11:44clojurebottrue
11:44mmeixif that matters
11:47mmeixwhat should (first {}) return? false?
11:47mmeix,(first {})
11:47clojurebotnil
11:59crocketWhy does clojure not have an option type?
12:23hellofunkis the idea behind an option type to simply differentiate between "no value is there" vs "a value is there, but the value is nothing" ?
12:30noidicrocket, http://clojure.github.io/core.typed/#clojure.core.typed/Option
12:32crocketThanks
12:32mmeixad hoc: is core.typed preferable to prismatic/schema ?
12:32crocketI have my eyes on pixie which is similar to clojure and loads fast.
12:33crocketpixie would be great for embedded devices and command line programs.
12:34whodidthismaybe you can start a core.typed for pixie
12:34justin_smithmmeix: schema is about runtime assertions, typed is about proving things at compile time
12:35mmeixah, ok ... thanks
12:39clojerI'm finding the more I work with Clojure the more I don't want to work with anything else. Can't decide whether that's a good or a bad thing :)
12:42clojerS-expressions just make it so easy to extract parts of a function and test in the repl by throwing some values at them.
12:48hellofunkclojer: welcome to lisp!
12:49wasamasathey want to know from me what I've learned at work
12:49wasamasaand it's been mostly clojure and clojurescript
12:50JickelsenAsked this before but it was probably at a bad time of day :) I've included react-with-addons (from CDN) but (aget js/React "addons") returns nil. Any ideas?
13:12kwladykaWhat are you using to database migrations?
13:15sdegutisAre there any decent OCR libraries for Clojure?
13:25clojerWhy does seq destructuring of a map change the original? For example:
13:25clojer(let [m { 365 [{:a 1 :b 2} {:a 4 :b 6}] 366 [{:a 11 :b 22} {:a 44 :b 66}]}] (for [[id [mps] :as orig] m] orig))
13:25clojerProduces: ([365 [{:b 2, :a 1} {:b 6, :a 4}]] [366 [{:b 2, :a 1} {:b 6, :a 4}]])
13:26clojerThe original map has not been retained as a map.
13:26justin_smithclojer: a hash-map is made of entry objects
13:26TEttingerbecause for isn't changing the original?
13:26TEttingerfor returns a new seq
13:26justin_smithfor cannot return a hash-map
13:27justin_smithyou can make a hash-map out of the entries there though
13:27TEttinger,(let [m { 365 [{:a 1 :b 2} {:a 4 :b 6}] 366 [{:a 11 :b 22} {:a 44 :b 66}]}] (into {} (for [[id [mps] :as orig] m] orig)))
13:27clojurebot{365 [{:a 1, :b 2} {:a 4, :b 6}], 366 [{:a 11, :b 22} {:a 44, :b 66}]}
13:28clojerI naively thought :as orig did exactly that, ie. saved the original, not transformed it.
13:29whodidthisorig there is a single key value pair
13:30justin_smithclojer: :as is a convenience for capturing bindings, but there is no binding in for that will capture the entirety of the original collection
15:11whodidthishow do i make a string from a list of strings in emacs lisp
15:11Bronsawhodidthis: what does this have to do with clojure?
15:13whodidthisok, whats kind of like (apply str '("abc" "def")) but in emacs lisp
15:14TimMchaha
15:14whodidthismost of us not originated from the great land of lisp :(
15:15whodidthiss/most/some
15:18wasamasa(mapconcat #'identity '("foo" "bar") "")
15:18wasamasanext time, ask on #emacs
15:20wasamasayou can alternatively do it like you'd do in any other lisp, but I bet there's some stupid reason for not doing so, like it's version of apply and funcall being braindead
15:20wasamasayup: "If a subr takes more than 8 arguments without using MANY or UNEVALLED, we need to extend this function to support it. Until this is done, there is no way to call the function."
15:27TimMc...emacs lisp can't apply when the fn doesn't specifically support it?
15:31wasamasathat's in the sources of funcall
15:31wasamasaso, I dunno how to interpret this, maybe it's a limitation at the C level
15:32wasamasaexperimentation at elisp level doesn't suggest there's anything wrong
15:36whodidthisapparently there was a new function called string-join, i was a bit dum for trying to find something apply-like in elisp
15:42wasamasait's using the same thing I suggested
15:42wasamasaand is relatively recent
16:34kwladykaIs any common rules for returning errors in Clojure from functions? For example validation error like "email is to valid".
16:46kwladykaWhy you will choose Pedestal instead of Ring?
16:48tcrayford____kwladyka: for the former question: typically I'd use a value like a map or something in that case, exceptions in others
16:49kwladykatcrayford____, yes.... i can't get used to i don't need some class for that...
16:50kwladykaDo you have any experience Validateur vs Bouncer?
16:50tcrayford____nope. I use mississippi and it's worked fine for me
18:01zakwilsonI'm looking for an IMAP client library. All I've found so far is clojure-mail, a very gmail-specific wrapper around JavaMail. Is there something more general I should look at, or should I just use a Java library?
18:03bbloomzakwilson: in general, you should prefer java libraries over clojure wrappers of java libraries.... unless the clojure wrapper is particularly good
18:03bbloomclojure is designed to make it easy to call jvm code w/o a wrapper. so the wrapper needs to provide some substantial benefit to justify itself
18:05bbloomand "saves you from typing a dot character" is not substantial benefit
18:07zakwilsonNo, but converting from Java's representation of an email message to a Clojure map and dealing with what look to be a few thorny issues with JavaMail like clojure-mail does might be.
18:12bbloomzakwilson: a quick look at the library suggests to me it's probably not worth wrapping
18:13bbloomor at least not worth wrapping in a general way: write the adaptor functions you need, reference clojure-mail if you need to for how to do some things
18:13bbloomcut out all the stuff you don't need/want
18:14bbloomor fork it and make the changes you need to be less gmail-specific
18:16zakwilsonbbloom: I was leaning toward forking it, as that doesn't look terribly hard. I was hoping for there to be a Right Thing I could use though, and it doesn't look like there is.
18:18bbloomzakwilson: i was telling you what (many in) the community will tell you is "the right thing": just call the jvm libs & write functions to make it nicer as you need them
18:18bbloomthe extra indirection only adds bulk and complexity
18:21jonathanjis there a better way of expressing: (into {} (for [[k v]] (some-func {:x k} v))) ?
18:23bbloomjonathanj: not sure what you're trying to express, since your `for is malformed
18:23jonathanjit is?
18:24bbloom,(for [[k v]] anything)
18:24clojurebot#error {\n :cause "for requires an even number of forms in binding vector in sandbox:"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.IllegalArgumentException: for requires an even number of forms in binding vector in sandbox:, compiling:(NO_SOURCE_FILE:0:0)"\n :at [clojure.lang.Compiler macroexpand1 "Compiler.java" 6644]}\n {:type java.lang.IllegalArgumentExce...
18:25jonathanj(for [[k v] some-map] ...) then
18:25bbloomjonathanj: you need an expression for [k v] to iterate over
18:25bbloomso you're trying to apply a function to each key in a map and then get a new map with the same values?
18:26jonathanjuh, i don't think that's what that code does
18:26jonathanji want to apply a function to each value in a map, with access to the key, and have it result in a new map
18:27bbloom(reduce (fn [m [k v]] (assoc m k (f k v))) {} m)
18:29bbloomor just (into {} (map f m))
18:34jonathanjbbloom: yeah, i guess into map makes more sense than into for, thank you
18:36whomphow can i get a list of all the values of a hashmap? like the keys fn, but for values instead
18:37whompoh... vals... seems reasonable
19:17jonathanjis there a less repetitive way of writing: (cond (map? value) ... (vector? value) ...)?
19:18bbloomjonathanj: what repetition are you attempting to eliminate?
19:18justin_smithjonathanj: for one thing, a multimethod can replace a cond over types
19:19jonathanjbbloom: repeating `value`
19:20jonathanjjustin_smith: true, but it's quite a small task
19:22bbloomjonathanj: you can 1) just deal w/ it, as it's not the problematic kind of repetition (spreading knowledge to multiple places) or 2) choose a smaller variable name or 3) probably can use condp
19:22bbloom(doc condp)
19:22clojurebot"([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must be a unary fu
19:23bacon1989bbloom: it was something I was going to suggest, but I think that would just lengthen his code
19:23bacon1989IPersistentMap doesn't seem shorter to me ;)
19:26bbloom,(let [value "foo"] (condp (fn [f _] (f value)) nil keyword? 1 symbol? 2 string? 3 number? 4))
19:26clojurebot3
19:27bbloomyou can write a macro for that, or a custom macro built on cond
19:27bbloomor, really, just don't worry about that superficial repetition
19:29bbloom,(defmacro condv [v & clauses] `(let [v# ~v] (condp (fn [f# _#] (f# v#)) nil ~@clauses)))
19:29clojurebot#'sandbox/condv
19:29bbloom,(condv "foo" keyword? 1 symbol? 2 string? 3 number? 4)
19:29clojurebot3
19:29bbloom,(condv 567 keyword? 1 symbol? 2 string? 3 number? 4)
19:29clojurebot4
19:29bbloom,(condv 'there-you-go keyword? 1 symbol? 2 string? 3 number? 4)
19:29clojurebot2
19:30jonathanj,(condp #(%1 %2) {} map? :map :else :unknown)
19:30clojurebot:map
19:30bbloomer duh, yeah, that works better than mine closing over value
19:30bbloomgo with that
19:30jonathanjis there another way of writing #(%1 %2)?
19:31bbloomno
19:31amalloyinfinitely many ways, but none of them very good
19:31bbloomyeah that
19:32bbloom,(defn call [f & args] (apply f args))
19:32clojurebot#'sandbox/call
19:32bbloom,(condp call {} map? :map :else :unknown)
19:32clojurebot:map
19:33jonathanj(comp eval list) is what i came up with
19:33jonathanjbut okay, i'll just use the macro
19:33justin_smitheval for that is like using a chainsaw to do your nails
19:35amalloy(inc justin_smith)
19:35amalloylazybot pls
19:35clojurebotCool story bro.
19:35jonathanji generally assume that using anything like "eval" or "exec" in any language is like that :P
20:05bacon1989will there every come a day where clojure is written entirely in C, and has an FFI that works with C libraries fairly well
20:06bacon1989not that i'm asking for it, I think it would be cool
20:06bacon1989I would just love to see commandline tools written in clojure
20:07bacon1989skummet definitely helps, but it's a crutch to the main problem
20:07bbloombacon1989: https://github.com/pixie-lang/pixie
20:08bacon1989oh yeah, I think that's awesome
20:09bacon1989but that's in 'pre-alpha'
20:09bacon1989in time though
20:11bacon1989i'm liking the direction of pixie actually
20:11bacon1989maybe I just need to be patient
20:12bacon1989'clojure inspired lisp'
22:19jjttjj1is there a way built into incanter to get a dataset from a sequence of maps keyed by the colnames?
22:21jjttjj1found it, to-dataset works
23:18keramidama