2015-06-21
| 00:00 | zapho53 | I 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:01 | amalloy | zapho53: they are both returning a lazy sequence, which you forget to force any elements from |
| 00:01 | zapho53 | Both functions have a YeSQL <! return value. |
| 00:02 | zapho53 | amalloy: Then why does 1 execute? |
| 00:02 | amalloy | because you return it, and whoever is above you in the call hierarchy happens to force it |
| 00:03 | zapho53 | amalloy: How do I get both to execute? |
| 00:03 | amalloy | i 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:04 | amalloy | zapho53: try wrapping them both in (doall ...) to prove or disprove my supposition |
| 00:04 | zapho53 | amalloy: Tried that once but maybe I screwed it up. Will try again. |
| 00:05 | amalloy | if that isn't the answer you will have to link to some actual code, or find someone who knows what yesql is |
| 00:05 | pranavrc | Hi. 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:06 | zapho53 | amalloy: doall results in this error: clojure.lang.LazySeq cannot be cast to java.lang.Number |
| 00:07 | amalloy | zapho53: then we have fixed the problem you asked about, and advanced to some other error |
| 00:07 | zapho53 | amalloy: Which is weird because both functions will execute the desired result if put last in the order. |
| 00:08 | amalloy | pranavrc: ` 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:09 | amalloy | you 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:14 | pranavrc | amalloy, 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:15 | amalloy | okay, so it's `(let [~'time (now)] ~@(whatever)) |
| 00:16 | pranavrc | amalloy, in which case I still get the illegalstateexception error for unbound unquote |
| 00:16 | amalloy | no you don't. you can't get that exception from the code i pasted, unless (whatever) by itself also throws that exception |
| 00:17 | amalloy | in which case, fix whatever |
| 00:26 | pranavrc | amalloy, alright, thanks! |
| 00:26 | amalloy | pranavrc: i suspect the reason whatever throws is you are trying to unquote stuff inside it, like @(whatever ~foo) |
| 00:27 | amalloy | which is not what you want. you have already unquoted the whole expression |
| 00:27 | pranavrc | amalloy, yeah, that was the problem. |
| 02:47 | Thebreaker | www.VALBOT.COM provides domain valuations. Reporting globally on Site Traffic, Pagerank, Malware, WHOIS data, SEO & even Social Media presence. |
| 03:25 | kwladyka | How clojure is developing during all this years? What can we estimate about job and projects in Clojure? |
| 04:11 | ttt_fff | how does one implement tuples in clojure? |
| 04:11 | expez | by using a vector |
| 04:18 | TEttinger | (inc expez) |
| 04:18 | lazybot | โ 1 |
| 04:19 | TEttinger | yep, 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:31 | rs0 | also destructuring |
| 04:49 | mskoud | Hi there! |
| 05:01 | kaffeeboehnchen | Good 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:03 | Chousuke_ | is authed-header actual clojure code? |
| 05:03 | kaffeeboehnchen | Yes. |
| 05:03 | Chousuke_ | how does the macro invocation look? |
| 05:03 | kaffeeboehnchen | it is a map looking like that: {:status 123 :body "hi"} |
| 05:04 | kaffeeboehnchen | (handle-request test-request other-fun) |
| 05:04 | Chousuke_ | your macro is passing the symbol 'test-request to test-auth |
| 05:04 | kaffeeboehnchen | my goal is to call other-fun when authed-header does not have a specific status and give other-fun the same request. |
| 05:05 | kaffeeboehnchen | ah, ok |
| 05:05 | Chousuke_ | why does this need to be a macro? :/ |
| 05:05 | kaffeeboehnchen | I have no clue to do it otherwise. |
| 05:05 | kaffeeboehnchen | If there is a better way please tell me. |
| 05:06 | kaffeeboehnchen | other-fun will not always be other-fun by the way |
| 05:06 | kaffeeboehnchen | the function which should be called will change |
| 05:06 | Chousuke_ | can't you just (if (check-status authed-header) blah (other-fun authed-header))? |
| 05:07 | amalloy | the 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:07 | Chousuke_ | you can pass functions as arguments to other functions |
| 05:07 | kaffeeboehnchen | But doesn't it get evaluated the moment I pass it? |
| 05:07 | Chousuke_ | evaluated? |
| 05:08 | Chousuke_ | if you pass it in a variable, why does that matter? |
| 05:08 | kaffeeboehnchen | It only should be executed if authed-header has the status 202 |
| 05:08 | Chousuke_ | it won't be executed. |
| 05:08 | Chousuke_ | it's just a function |
| 05:08 | kaffeeboehnchen | ok |
| 05:09 | Chousuke_ | I'm still not sure if I understand your problem correctly |
| 05:09 | kaffeeboehnchen | Later I wanna call (handle-request request this-fun), (handle-request request that-fun), (handle-request request other-fun). |
| 05:10 | Chousuke_ | yeah, that's just fine |
| 05:10 | kaffeeboehnchen | Ok. Thank you very much! |
| 05:10 | Chousuke_ | I mean, if you do eg. (list + -), that won't actually call the + - functions |
| 05:10 | Chousuke_ | you just get a list that contains them |
| 05:10 | kaffeeboehnchen | aaaaahh |
| 05:46 | ambrosebs | what's the current stance on Java 7 support in core/contrib? |
| 05:47 | ambrosebs | going away soon? |
| 06:17 | TEttinger | ambrosebs: I wasn't aware core/contrib was still around, tbh |
| 06:18 | ambrosebs | core+contrib |
| 06:18 | TEttinger | but unless clojure is specifically moving from 6 compat to 8 compat, I kinda wonder why they would do that |
| 06:19 | TEttinger | (did clojure stop supporting JDK6 and thus android?) |
| 06:19 | ambrosebs | good question |
| 06:19 | kwladyka | Can i discuss with somebody about Ring architecture? My goal is learn about architecture on this project. |
| 06:22 | kwladyka | first of all what determine to separate catalogs core/devel/jetty-adapter/servlet as root direcotries, not as src/* directories? |
| 06:27 | kwladyka | as i understand ring respository has 4 projects 1 one, why not 4 separater ring repository? |
| 06:34 | Jickelsen | I've included react-with-addons (from CDN) but (aget js/React "addons") returns nil. Any ideas? |
| 06:49 | kwladyka | ok, next step... i understand magic happens because of lein-sub library |
| 06:55 | crocket | clojure repl uses 600MB of RAM from the beginning. |
| 06:55 | crocket | How do I tame its memory usage? |
| 07:03 | kwladyka | so 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:06 | kwladyka | crocket, what do you mean clojure repl? "lein repl"? for me 1 136K memory |
| 07:07 | crocket | yes |
| 07:07 | crocket | lein repl |
| 07:07 | crocket | It uses 620MB of RAM inside cider repl which is essentially lein repl. |
| 07:08 | kwladyka | crocket, "lein repl" for me on windows get only 1 136k memory |
| 07:09 | kwladyka | maybe you interpret used memory by process in bad way if you running repl inside another application |
| 07:09 | crocket | I? |
| 07:09 | crocket | not me |
| 07:09 | clojurebot | I will never forgive that |
| 07:10 | kwladyka | mmm? |
| 07:13 | crocket | Look at http://imagebin.ca/v/25zcAKgAPHTq |
| 07:14 | crocket | lein repl ends up using 1GB |
| 07:14 | crocket | kwladyka, ^^ |
| 07:15 | kwladyka | crocket, i relogin to IRC, i guess i miss something |
| 07:19 | TEttinger | kwladyka: crocket meant http://imagebin.ca/v/25zcAKgAPHTq |
| 07:20 | TEttinger | lein repl uses more or less RAM based on the project you're in, IIRC |
| 07:20 | TEttinger | since it does load the whole project to make it available, IIRC |
| 07:23 | kwladyka | my mistake, but still i have 200 MB or 250MB, I forgot :) |
| 07:42 | crocket | TEttinger, It is a very minimal leiningen project. |
| 07:42 | crocket | It only has 3 functions. |
| 07:43 | ambrosebs | how can I tell lein to never compile/test a file in my test path |
| 07:43 | TEttinger | then... just curious, how much free RAM do you have on your machine? |
| 07:43 | TEttinger | it's possible Java's gobbling up more than it currently needs in anticipation for later usage |
| 07:44 | crocket | TEttinger, 8GB of RAM and 13.5GB of swap. |
| 07:44 | TEttinger | is it swapping now? |
| 07:44 | crocket | no |
| 07:44 | crocket | The system currently uses 2.5GB of RAM in total. |
| 07:45 | crocket | And, swapping doesn't necessarily lead to HDD access as far as I know. |
| 07:45 | crocket | However, swapping is not desirable. |
| 07:45 | TEttinger | oh that could be why then, you have enough free that java thinks it can take a whole lot, I guess |
| 07:45 | TEttinger | I know modern browsers do this |
| 07:45 | crocket | It could be -Xms option. |
| 07:46 | crocket | -Xms 512M could cause this. |
| 07:46 | TEttinger | uh yes |
| 07:46 | TEttinger | that would make it always start with 512 MB used, do you want to know if it's used by lein? |
| 07:47 | crocket | The command lines don't specify -Xms or -Xmx. |
| 07:47 | crocket | I don't like this. |
| 07:47 | crocket | Python wouldn't consume this much. |
| 07:49 | crocket | hexchat consumes 23.5MB of RAM. |
| 07:49 | crocket | Does anyone plan to port clojure to python 3? |
| 07:49 | crocket | It wouldn't make sense for performance reasons, though. |
| 07:49 | TEttinger | huh, interesting. https://github.com/technomancy/leiningen/blob/master/bin/lein#L156-L158 |
| 07:49 | TEttinger | crocket: |
| 07:50 | TEttinger | $google pixie lang |
| 07:50 | lazybot | [pixie-lang/pixie ยท GitHub] https://github.com/pixie-lang/pixie |
| 07:50 | TEttinger | it's very close to clojure, implemented in RPython (what PyPy uses) but not meant to call Python code yet |
| 07:50 | TEttinger | startup is one of its reasons to exist |
| 07:50 | kwladyka | crocket, 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:51 | crocket | kwladyka, no |
| 07:51 | crocket | I didn't know about it. |
| 07:51 | TEttinger | yeah, I'd check if something else set your JVM_OPTS env var |
| 07:52 | crocket | I use leiningen 2.5.1 on openjdk 1.8.0_45. |
| 07:52 | crocket | Nothing sets JVM_OPTS in the user shell. |
| 07:52 | TEttinger | hm |
| 07:52 | TEttinger | JAVA_OPTS can also do it |
| 07:53 | TEttinger | (older java used that, lein treats it as an alias) |
| 07:53 | kwladyka | https://groups.google.com/forum/#!topic/clojure/h3M-LSlE4dw Larry Travis answer - maybe it is solution for you |
| 07:53 | crocket | I expect pixie to be different from clojure. |
| 07:53 | TEttinger | yes, no libs for one :) |
| 07:53 | crocket | No clojar |
| 07:54 | TEttinger | but 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:57 | crocket | Ok, I specified :jvm-opts in ~/.lein/profiles.clj |
| 07:57 | crocket | Why did they name it pixie? |
| 07:57 | crocket | If they wanted it to be a clojure implementation on python, they would have named it accordingly. |
| 07:58 | TEttinger | I'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:58 | TEttinger | it isn't directly clojure, and they planned to diverge in new features |
| 07:58 | TEttinger | (they have transducers in from the start, for example) |
| 07:59 | TEttinger | ^ last 2 lines re: pixie |
| 07:59 | crocket | I expect clojure to be faster than the perl reincarnation and pixie. |
| 07:59 | crocket | python VM is not fast enough. |
| 07:59 | TEttinger | yes. except for startup and memory usage |
| 08:00 | crocket | pixie would suit command line programs and GUI programs. |
| 08:00 | crocket | Because of startup time and memory usage. |
| 08:00 | TEttinger | java 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:01 | crocket | Will anyone fix clojure's slow startup time? |
| 08:01 | TEttinger | there are some ways you can mitigate it |
| 08:01 | crocket | JVM itself is not slow to launch. |
| 08:01 | TEttinger | starting with the --server JVM will always slow down launch relative to --client |
| 08:02 | TEttinger | but --server does way more opts as your program runs |
| 08:02 | crocket | I heard http://clojure-android.info/skummet/ aims to reduce startup time. |
| 08:02 | TEttinger | there's a mix in JDK 7 and newer, you can pass the args... let me find em |
| 08:02 | crocket | skummet |
| 08:04 | TEttinger | -server -XX:+TieredCompilation |
| 08:04 | TEttinger | the second arg is only available for server JVMs, and it gives it -client JVM like startup behavior |
| 08:04 | TEttinger | it SHOULD be the default on -server |
| 08:05 | crocket | It seems leiningen ignores ~/.lein/profiles.clj outside leiningen projects. |
| 08:05 | TEttinger | low-end machines, particularly 32-bit windows machines, don't always have -server available as an option |
| 08:06 | crocket | It seems lein repl is beyond hope. |
| 08:07 | crocket | It is greedy of RAM. |
| 08:08 | TEttinger | were you passing an -Xmx option? |
| 08:08 | crocket | yes |
| 08:08 | crocket | -Xmx512m |
| 08:08 | crocket | And, it uses 350MB. |
| 08:09 | TEttinger | well that's not disobeying the -Xmx, but it is still a fair amount... |
| 08:09 | crocket | Why does leiningen ignore ~/.lein/profiles.clj outside leiningen projects? |
| 08:10 | TEttinger | I don't know if it does, actually -- I think the profile may affect your project when it runs, not the lein program itself |
| 08:10 | TEttinger | but I have no idea |
| 08:11 | crocket | I mean lein repl |
| 08:11 | crocket | Why does 'lein repl' ignore ~/.lein/profiles.clj outside leiningen projects? |
| 08:15 | TEttinger | oh! |
| 08:15 | TEttinger | The :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:17 | crocket | TEttinger, What is the clojure-like language that targets perl 6? |
| 08:17 | crocket | Does it compile to perl 6? |
| 08:18 | TEttinger | uhhh I'm making it and I don't know perl 6, don't expect much yet :) |
| 08:18 | TEttinger | https://github.com/technomancy/leiningen/blob/9c5192e6520fb96aa625313a468e0143001f54ca/leiningen-core/src/leiningen/core/project.clj#L467-L470 |
| 08:18 | TEttinger | that link is the default set of JVM opts that :base adds |
| 08:18 | crocket | It seems Rakudo Perl targets MoarVM and JVM. |
| 08:18 | TEttinger | yes |
| 08:18 | TEttinger | that's what I will too |
| 08:18 | crocket | Whut |
| 08:19 | crocket | TEttinger, How are you desining your clojure-like language? |
| 08:19 | crocket | What does it target? |
| 08:19 | TEttinger | I'm writing it with NQP, which is Not Quite Perl, a subset of Perl 6 meant for making compilers |
| 08:19 | TEttinger | (perl 6 is really really big in terms of feature scope) |
| 08:20 | TEttinger | (NQP is a smaller subset that they can bootstrap) |
| 08:21 | TEttinger | anything 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:21 | TEttinger | JVM and Moar backends take a QAST and compile it to a native jar or exe, respectively, I think |
| 08:21 | crocket | Is there any clojure implementation suitable for command line programs? |
| 08:21 | crocket | or any lisp |
| 08:22 | TEttinger | I'd say pixie is about as close to clojure and command line as you'd get |
| 08:22 | crocket | pixie dust |
| 08:22 | TEttinger | other things get more scheme-like or common lisp like |
| 08:23 | TEttinger | SBCL has worse compile times than clojure, from what I hear, but produces very good optimizations |
| 08:23 | TEttinger | (not sure about repl in there) |
| 08:23 | crocket | "Pixie implements its own virtual machine. It does not run on the JVM, CLR or Python VM." |
| 08:23 | TEttinger | yep |
| 08:23 | crocket | And, it's written in python. |
| 08:23 | TEttinger | PyPy's RPython is a toolchain for making VMs |
| 08:24 | TEttinger | well, the bootstrapper is in RPython and even that isn't all of Python |
| 08:24 | crocket | Is scheme decent for command line programs? |
| 08:24 | wasamasa | yes |
| 08:24 | crocket | What about common lisp? |
| 08:24 | TEttinger | there are many schemes though |
| 08:24 | wasamasa | common lisp sucks for that purpose |
| 08:24 | wasamasa | not a single open-source implementation has tree shaking |
| 08:25 | TEttinger | racket is a good bridge between Clojure features and Scheme-ness |
| 08:25 | wasamasa | and therefore cannot produce binaries comparable with what you'll otherwise find there |
| 08:25 | crocket | ??? |
| 08:25 | lazybot | crocket: Yes, 100% for sure. |
| 08:25 | TEttinger | there's actually a racket lib that adds clojure data structures, immutable and all, to racket |
| 08:25 | crocket | I don't know tree shaking. |
| 08:25 | TEttinger | Racket is a scheme |
| 08:25 | crocket | Is Racket a functional programming language? |
| 08:25 | wasamasa | nope |
| 08:25 | TEttinger | ? |
| 08:26 | crocket | Is there a functional lisp dialect suitable for command line? |
| 08:26 | TEttinger | racket has immutable and mutable data structures like clojure |
| 08:26 | wasamasa | it's a good deal closer than CL though |
| 08:26 | wasamasa | crocket: stop treating "functional" as a binary value |
| 08:27 | wasamasa | crocket: makes about as much sense as doing the same for OO |
| 08:28 | crocket | javascript sucks. |
| 08:28 | TEttinger | racket 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:28 | crocket | pixie is close? |
| 08:28 | crocket | pixie has STM and CSP. |
| 08:28 | TEttinger | do you mean CPS? |
| 08:29 | wasamasa | crocket: I also suggest you to just start writing code instead of spending all day asking #clojure about theoretical things |
| 08:29 | TEttinger | I like talking though! |
| 08:29 | TEttinger | it means my brain hurts less from perl stuff! |
| 08:29 | expez | I 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:30 | wasamasa | crocket: you may learn valuable things along the way such as that there is no perfect programming language |
| 08:30 | wasamasa | crocket: or that one programming language is better suited for a certain task than another |
| 08:30 | TEttinger | clojure is very very good for server apps |
| 08:30 | wasamasa | crocket: or that people writing code usually learn other languages as well |
| 08:31 | crocket | ClojureScript on node.js could be made decent on command line. |
| 08:35 | crocket | TEttinger, Do you have other recommendations for command line than pixie? |
| 08:35 | crocket | pixie doesn't even have a tutorial yet. |
| 08:37 | TEttinger | try 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:37 | TEttinger | racket also has a better documentation generator than, uh, everything |
| 08:38 | TEttinger | (it's a tool called Scribble and it really produces very good docs) |
| 08:38 | crocket | Whut |
| 08:39 | crocket | Does clojure target python vm? |
| 08:39 | TEttinger | not that I know of, it potentially could |
| 08:39 | TEttinger | better would be LLVM, like many other languages are starting to try |
| 08:41 | crocket | https://github.com/halgari/clojure-py/ not useable |
| 08:41 | crocket | only 7 commits |
| 08:41 | TEttinger | as 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:41 | crocket | LLVM sounds complex. |
| 08:41 | TEttinger | it is. it does have a lot of stuff under its banner |
| 08:42 | wasamasa | crocket: 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:42 | TEttinger | hehe |
| 08:43 | wasamasa | not to mention an alive community and sufficient amount of libraries |
| 08:44 | crocket | That sounds magical |
| 08:44 | wasamasa | it's not if you relax your criteria a bit |
| 08:44 | wasamasa | http://call-cc.org/ |
| 08:44 | crocket | Actually, I was overwhelmed by lisp dialects.... |
| 08:44 | crocket | Racket, chicken scheme, et al... |
| 08:44 | wasamasa | I'm using it for writing my CLI utilities and some simplistic web applications |
| 08:45 | crocket | I surmise chicken scheme is a decent language. |
| 08:45 | wasamasa | it's no clojure, but eh, I'm fine with scheme |
| 08:47 | crocket | I'd be happier if there is a clojure implementation that starts up fast because that means one less language to learn. |
| 08:47 | wasamasa | lol |
| 08:48 | crocket | I could probably try ClojureScript on node.js |
| 08:48 | wasamasa | just give up on it, as a good developer learning languages is a necessity |
| 08:48 | wasamasa | well, clojurescript's tooling sucks |
| 08:48 | crocket | Does it have leiningen? |
| 08:48 | wasamasa | you'll have to start with a clojure project first, then add clojurescript as dependency |
| 08:48 | wasamasa | then write some lines to make leiningen compile javascript |
| 08:49 | crocket | wasamasa, It seems chicken scheme implements R5RS. Does R6RS improve on R5RS in any aspect? |
| 08:49 | wasamasa | crocket: R6RS is very different from R5RS |
| 08:50 | wasamasa | crocket: R7RS is an attempt to actually improve R5RS and splitting the language into a small and large version |
| 08:50 | wasamasa | crocket: and chicken supports a good amount of the small version of R7RS |
| 08:52 | crocket | It seems committee has dominated scheme. |
| 08:53 | crocket | I have a selection disorder. |
| 08:57 | crocket | wasamasa, Does chicken scheme compile to native binaries directly? |
| 08:57 | kwladyka | wasamasa, did you use lein-sub? |
| 08:57 | wasamasa | kwladyka: nope |
| 08:57 | Bahman | wasamasa: Count me in :-D |
| 08:58 | wasamasa | Bahman: and I thought I was just seeing things |
| 08:58 | kwladyka | wasamasa, ok. I am just looking somebody who can explain me https://github.com/ring-clojure/ring architecture :) |
| 08:59 | wasamasa | kwladyka: not sure how a leiningen plugin comes into play there |
| 08:59 | Bahman | crocket: One of the strengths of Chicken (and Racket) are native binaries. |
| 08:59 | wasamasa | Bahman: didn't racket switch to having a VM? |
| 08:59 | Bahman | wasamasa: Yes...but the binary contains the slimmed down VM for easy redistribution. |
| 08:59 | Bahman | Pretty neat. |
| 09:00 | kwladyka | wasamasa, do you have any idea why author of code choose to have all this projects inside one repository then separate them? |
| 09:00 | wasamasa | well, ok |
| 09:00 | wasamasa | kwladyka: I suggest asking them |
| 09:00 | kwladyka | ;) |
| 09:01 | kwladyka | it can be a solution :) |
| 09:01 | kwladyka | and maybe the esiest in this case |
| 10:02 | crocket | Is it ok to write a GUI program in clojure with a JavaFX binding? |
| 11:19 | whodidthis | https://www.refheap.com/104291 any way i could make core.match work in tests? ๐ฟ |
| 11:25 | crocket | Will clojure be fixed with regard to nil? |
| 11:26 | mmeix | What should be fixed? |
| 11:26 | crocket | nil |
| 11:26 | crocket | Nil causes errors |
| 11:27 | mmeix | example? |
| 11:27 | mmeix | ,(doc fnil) |
| 11:27 | crocket | (if ({:a nil :b 1} :a) "ok" "no") |
| 11:27 | clojurebot | "([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:27 | crocket | ,(if ({:a nil :b 1} :a) "ok" "no") |
| 11:27 | clojurebot | "no" |
| 11:28 | crocket | It leads to logical bugs. |
| 11:28 | crocket | ,(if (contains? {:a nil :b 1} :a) "ok" "no") |
| 11:28 | clojurebot | "ok" |
| 11:29 | crocket | Since nil is everywhere, it is difficult to find the origin of nil. |
| 11:29 | whodidthis | maybe core.typed will help you out |
| 11:30 | crocket | nil should have been an interop feature. |
| 11:31 | mmeix | ,(if ({:a nil :b 1} :a) "ok" "no") |
| 11:31 | clojurebot | "no" |
| 11:31 | mmeix | is perfectly ok, because nil is falsey |
| 11:32 | mmeix | "Both nil and false are treated as "false" and everything else is treated as true." |
| 11:32 | mmeix | http://blog.jayfields.com/2011/02/clojure-truthy-and-falsey.html |
| 11:32 | crocket | Somehow, it leads to bugs. |
| 11:32 | crocket | nil leaks into collections. |
| 11:32 | crocket | conditionals return false because nil leaked into collections somehow in a large codebase. |
| 11:33 | mmeix | I guess, nil will not declared truey ... |
| 11:34 | Bronsa | crocket: no, it will never be "fixed". it's not considered a bug or misfeature |
| 11:34 | mmeix | maybe this helps: |
| 11:34 | mmeix | http://blog.jayfields.com/2011/01/clojure-fnil.html |
| 11:34 | crocket | nil shouldn't have been part of the core in the first place. |
| 11:34 | Bronsa | that's your opinion |
| 11:34 | crocket | Rich Hickey was forced to use nil due to JVM. |
| 11:35 | Bronsa | do you have any evidence to back that claim or is it just you assuming things? |
| 11:35 | crocket | Nil is a mistake in programming languages. |
| 11:35 | crocket | Nil, Null, ... |
| 11:35 | Bronsa | cool. you seem to have made up your mind. have fun trying to convince the core team I guess |
| 11:36 | crocket | mmeix, I think fnil is a band aid at best. |
| 11:37 | mmeix | hm ... |
| 11:38 | mmeix | I'm a beginner, but the concept of only nil and false being falsey seemed very plausible to me |
| 11:38 | mmeix | instead of say 0 being false, for example |
| 11:38 | mmeix | etc. |
| 11:38 | crocket | mmeix, My point is that I feel much better without nil in the core. |
| 11:39 | crocket | Nil is better served as a java interop feature. |
| 11:39 | mmeix | this is not going to happen, it would break nearly everything |
| 11:39 | crocket | I know |
| 11:39 | mmeix | AFAIK |
| 11:40 | mmeix | what is wrong with your example (if ({:a nil :b 1} :a) "ok" "no")? |
| 11:40 | mmeix | don't see the point |
| 11:40 | crocket | If a programmer assumes a map doesn't have nil, it is a problem. |
| 11:42 | mmeix | Something 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:44 | mmeix | ,(contains? {:a nil :b 1} :a) |
| 11:44 | clojurebot | true |
| 11:44 | mmeix | if that matters |
| 11:47 | mmeix | what should (first {}) return? false? |
| 11:47 | mmeix | ,(first {}) |
| 11:47 | clojurebot | nil |
| 11:59 | crocket | Why does clojure not have an option type? |
| 12:23 | hellofunk | is 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:30 | noidi | crocket, http://clojure.github.io/core.typed/#clojure.core.typed/Option |
| 12:32 | crocket | Thanks |
| 12:32 | mmeix | ad hoc: is core.typed preferable to prismatic/schema ? |
| 12:32 | crocket | I have my eyes on pixie which is similar to clojure and loads fast. |
| 12:33 | crocket | pixie would be great for embedded devices and command line programs. |
| 12:34 | whodidthis | maybe you can start a core.typed for pixie |
| 12:34 | justin_smith | mmeix: schema is about runtime assertions, typed is about proving things at compile time |
| 12:35 | mmeix | ah, ok ... thanks |
| 12:39 | clojer | I'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:42 | clojer | S-expressions just make it so easy to extract parts of a function and test in the repl by throwing some values at them. |
| 12:48 | hellofunk | clojer: welcome to lisp! |
| 12:49 | wasamasa | they want to know from me what I've learned at work |
| 12:49 | wasamasa | and it's been mostly clojure and clojurescript |
| 12:50 | Jickelsen | Asked 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:12 | kwladyka | What are you using to database migrations? |
| 13:15 | sdegutis | Are there any decent OCR libraries for Clojure? |
| 13:25 | clojer | Why does seq destructuring of a map change the original? For example: |
| 13:25 | clojer | (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:25 | clojer | Produces: ([365 [{:b 2, :a 1} {:b 6, :a 4}]] [366 [{:b 2, :a 1} {:b 6, :a 4}]]) |
| 13:26 | clojer | The original map has not been retained as a map. |
| 13:26 | justin_smith | clojer: a hash-map is made of entry objects |
| 13:26 | TEttinger | because for isn't changing the original? |
| 13:26 | TEttinger | for returns a new seq |
| 13:26 | justin_smith | for cannot return a hash-map |
| 13:27 | justin_smith | you can make a hash-map out of the entries there though |
| 13:27 | TEttinger | ,(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:27 | clojurebot | {365 [{:a 1, :b 2} {:a 4, :b 6}], 366 [{:a 11, :b 22} {:a 44, :b 66}]} |
| 13:28 | clojer | I naively thought :as orig did exactly that, ie. saved the original, not transformed it. |
| 13:29 | whodidthis | orig there is a single key value pair |
| 13:30 | justin_smith | clojer: :as is a convenience for capturing bindings, but there is no binding in for that will capture the entirety of the original collection |
| 15:11 | whodidthis | how do i make a string from a list of strings in emacs lisp |
| 15:11 | Bronsa | whodidthis: what does this have to do with clojure? |
| 15:13 | whodidthis | ok, whats kind of like (apply str '("abc" "def")) but in emacs lisp |
| 15:14 | TimMc | haha |
| 15:14 | whodidthis | most of us not originated from the great land of lisp :( |
| 15:15 | whodidthis | s/most/some |
| 15:18 | wasamasa | (mapconcat #'identity '("foo" "bar") "") |
| 15:18 | wasamasa | next time, ask on #emacs |
| 15:20 | wasamasa | you 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:20 | wasamasa | yup: "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:27 | TimMc | ...emacs lisp can't apply when the fn doesn't specifically support it? |
| 15:31 | wasamasa | that's in the sources of funcall |
| 15:31 | wasamasa | so, I dunno how to interpret this, maybe it's a limitation at the C level |
| 15:32 | wasamasa | experimentation at elisp level doesn't suggest there's anything wrong |
| 15:36 | whodidthis | apparently there was a new function called string-join, i was a bit dum for trying to find something apply-like in elisp |
| 15:42 | wasamasa | it's using the same thing I suggested |
| 15:42 | wasamasa | and is relatively recent |
| 16:34 | kwladyka | Is any common rules for returning errors in Clojure from functions? For example validation error like "email is to valid". |
| 16:46 | kwladyka | Why you will choose Pedestal instead of Ring? |
| 16:48 | tcrayford____ | kwladyka: for the former question: typically I'd use a value like a map or something in that case, exceptions in others |
| 16:49 | kwladyka | tcrayford____, yes.... i can't get used to i don't need some class for that... |
| 16:50 | kwladyka | Do you have any experience Validateur vs Bouncer? |
| 16:50 | tcrayford____ | nope. I use mississippi and it's worked fine for me |
| 18:01 | zakwilson | I'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:03 | bbloom | zakwilson: in general, you should prefer java libraries over clojure wrappers of java libraries.... unless the clojure wrapper is particularly good |
| 18:03 | bbloom | clojure 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:05 | bbloom | and "saves you from typing a dot character" is not substantial benefit |
| 18:07 | zakwilson | No, 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:12 | bbloom | zakwilson: a quick look at the library suggests to me it's probably not worth wrapping |
| 18:13 | bbloom | or 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:13 | bbloom | cut out all the stuff you don't need/want |
| 18:14 | bbloom | or fork it and make the changes you need to be less gmail-specific |
| 18:16 | zakwilson | bbloom: 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:18 | bbloom | zakwilson: 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:18 | bbloom | the extra indirection only adds bulk and complexity |
| 18:21 | jonathanj | is there a better way of expressing: (into {} (for [[k v]] (some-func {:x k} v))) ? |
| 18:23 | bbloom | jonathanj: not sure what you're trying to express, since your `for is malformed |
| 18:23 | jonathanj | it is? |
| 18:24 | bbloom | ,(for [[k v]] anything) |
| 18:24 | clojurebot | #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:25 | jonathanj | (for [[k v] some-map] ...) then |
| 18:25 | bbloom | jonathanj: you need an expression for [k v] to iterate over |
| 18:25 | bbloom | so you're trying to apply a function to each key in a map and then get a new map with the same values? |
| 18:26 | jonathanj | uh, i don't think that's what that code does |
| 18:26 | jonathanj | i 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:27 | bbloom | (reduce (fn [m [k v]] (assoc m k (f k v))) {} m) |
| 18:29 | bbloom | or just (into {} (map f m)) |
| 18:34 | jonathanj | bbloom: yeah, i guess into map makes more sense than into for, thank you |
| 18:36 | whomp | how can i get a list of all the values of a hashmap? like the keys fn, but for values instead |
| 18:37 | whomp | oh... vals... seems reasonable |
| 19:17 | jonathanj | is there a less repetitive way of writing: (cond (map? value) ... (vector? value) ...)? |
| 19:18 | bbloom | jonathanj: what repetition are you attempting to eliminate? |
| 19:18 | justin_smith | jonathanj: for one thing, a multimethod can replace a cond over types |
| 19:19 | jonathanj | bbloom: repeating `value` |
| 19:20 | jonathanj | justin_smith: true, but it's quite a small task |
| 19:22 | bbloom | jonathanj: 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:22 | bbloom | (doc condp) |
| 19:22 | clojurebot | "([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:23 | bacon1989 | bbloom: it was something I was going to suggest, but I think that would just lengthen his code |
| 19:23 | bacon1989 | IPersistentMap doesn't seem shorter to me ;) |
| 19:26 | bbloom | ,(let [value "foo"] (condp (fn [f _] (f value)) nil keyword? 1 symbol? 2 string? 3 number? 4)) |
| 19:26 | clojurebot | 3 |
| 19:27 | bbloom | you can write a macro for that, or a custom macro built on cond |
| 19:27 | bbloom | or, really, just don't worry about that superficial repetition |
| 19:29 | bbloom | ,(defmacro condv [v & clauses] `(let [v# ~v] (condp (fn [f# _#] (f# v#)) nil ~@clauses))) |
| 19:29 | clojurebot | #'sandbox/condv |
| 19:29 | bbloom | ,(condv "foo" keyword? 1 symbol? 2 string? 3 number? 4) |
| 19:29 | clojurebot | 3 |
| 19:29 | bbloom | ,(condv 567 keyword? 1 symbol? 2 string? 3 number? 4) |
| 19:29 | clojurebot | 4 |
| 19:29 | bbloom | ,(condv 'there-you-go keyword? 1 symbol? 2 string? 3 number? 4) |
| 19:29 | clojurebot | 2 |
| 19:30 | jonathanj | ,(condp #(%1 %2) {} map? :map :else :unknown) |
| 19:30 | clojurebot | :map |
| 19:30 | bbloom | er duh, yeah, that works better than mine closing over value |
| 19:30 | bbloom | go with that |
| 19:30 | jonathanj | is there another way of writing #(%1 %2)? |
| 19:31 | bbloom | no |
| 19:31 | amalloy | infinitely many ways, but none of them very good |
| 19:31 | bbloom | yeah that |
| 19:32 | bbloom | ,(defn call [f & args] (apply f args)) |
| 19:32 | clojurebot | #'sandbox/call |
| 19:32 | bbloom | ,(condp call {} map? :map :else :unknown) |
| 19:32 | clojurebot | :map |
| 19:33 | jonathanj | (comp eval list) is what i came up with |
| 19:33 | jonathanj | but okay, i'll just use the macro |
| 19:33 | justin_smith | eval for that is like using a chainsaw to do your nails |
| 19:35 | amalloy | (inc justin_smith) |
| 19:35 | amalloy | lazybot pls |
| 19:35 | clojurebot | Cool story bro. |
| 19:35 | jonathanj | i generally assume that using anything like "eval" or "exec" in any language is like that :P |
| 20:05 | bacon1989 | will there every come a day where clojure is written entirely in C, and has an FFI that works with C libraries fairly well |
| 20:06 | bacon1989 | not that i'm asking for it, I think it would be cool |
| 20:06 | bacon1989 | I would just love to see commandline tools written in clojure |
| 20:07 | bacon1989 | skummet definitely helps, but it's a crutch to the main problem |
| 20:07 | bbloom | bacon1989: https://github.com/pixie-lang/pixie |
| 20:08 | bacon1989 | oh yeah, I think that's awesome |
| 20:09 | bacon1989 | but that's in 'pre-alpha' |
| 20:09 | bacon1989 | in time though |
| 20:11 | bacon1989 | i'm liking the direction of pixie actually |
| 20:11 | bacon1989 | maybe I just need to be patient |
| 20:12 | bacon1989 | 'clojure inspired lisp' |
| 22:19 | jjttjj1 | is there a way built into incanter to get a dataset from a sequence of maps keyed by the colnames? |
| 22:21 | jjttjj1 | found it, to-dataset works |
| 23:18 | keramida | ma |