2016-04-02
| 00:07 | deepakprasanna | How can I create a lazy sequence containing all the combinations of 0, 1 and 2? |
| 00:07 | deepakprasanna | Like this |
| 00:07 | deepakprasanna | (0 1 2 00 10 20 01 11 21 02 12 22 000 100 200 010 110 210 020 120 220 001 101 201 011 111 211 021 121 221 002 102 202 012 112 212 022 122 222 0000 1000 2000 |
| 00:07 | deepakprasanna | ..... |
| 00:07 | Z3nnY | in wich language ? |
| 00:07 | Z3nnY | and for wht |
| 00:43 | troydm | is it faster to conj! each element of vector or list performance wise into transient vector? |
| 00:45 | troydm | also is there a macro that will expand (into! trans [a b c]) into (conj! ((conj! (conj! trans a) b) c) ? |
| 01:28 | backnforth | Hi |
| 01:28 | backnforth | How do I use the repl to run a project? |
| 01:31 | backnforth | i thought it was simply to use the command "lein repl" inside a projects directory |
| 01:35 | TEttinger | backnforth: to run an application from source you can use lein run, which needs a -main fn defined and specified in project.clj |
| 01:36 | TEttinger | lein repl lets you interactively run fns |
| 01:36 | backnforth | I've used lein repl before to act as lein run but removing the main fn from the project.clj |
| 01:36 | backnforth | i just cant remember how lol |
| 01:37 | TEttinger | I mean, at the repl you can call (-main) |
| 01:37 | TEttinger | it's just a fn (Clojure catchphrase) |
| 01:37 | backnforth | "run -main" ? |
| 01:37 | TEttinger | hm? |
| 01:37 | backnforth | how so? |
| 01:37 | TEttinger | no, I mean if you have a repl running, you can run main since it's a normal fn |
| 01:37 | TEttinger | have you used the repl before? |
| 01:37 | backnforth | very little |
| 01:38 | backnforth | i understand that its great for fn functions |
| 01:38 | backnforth | but i dont know how to call a projects function with it |
| 01:39 | backnforth | I know I would have to start off with the command "lein repl" |
| 01:39 | TEttinger | do you mean at the command line, before you get into the repl? |
| 01:39 | backnforth | and thats while im inside the projects directory |
| 01:39 | backnforth | but i dont know what command to use in the repl |
| 01:39 | TEttinger | oh, the repl is all clojure code |
| 01:40 | TEttinger | there aren't special commands, really. |
| 01:40 | TEttinger | try this in the repl |
| 01:40 | TEttinger | (println "Hello!") |
| 01:40 | TEttinger | should print the string you gave it and also print nil at the end, where nil is just what println returns |
| 01:42 | backnforth | TEttinger, yes i understand that |
| 01:42 | backnforth | i love that about the repl |
| 01:42 | TEttinger | since -main is a fn, if the repl loaded the same ns as the ns main is in, you can just type (-main) to call it with no args. if you aren't in the same ns, you can use or require the ns that has -main |
| 01:42 | backnforth | ,(require ns.core) |
| 01:42 | backnforth | like that? |
| 01:42 | clojurebot | #error {\n :cause "ns.core"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.ClassNotFoundException: ns.core, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.ClassNotFoundException\n :message "ns.core"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClass... |
| 01:42 | TEttinger | require allows you to add :reload at the end of the args, too |
| 01:43 | TEttinger | heh, clojurebot doesn't have your code, but almost |
| 01:44 | TEttinger | (require '[ns.core]) is how I think it expects it, but there's also (require '[ns.core :reload]) for when you changed the code and want to update the code in the running repl |
| 01:44 | TEttinger | I might have the syntax wrong |
| 01:44 | TEttinger | justin_smith! |
| 01:45 | backnforth | (require 'ns.core) worked for me :D |
| 01:45 | backnforth | this is excellent |
| 01:45 | backnforth | Thank you TEttinger |
| 01:46 | TEttinger | woo, glad it works! |
| 01:46 | backnforth | i feel "repl"ed |
| 01:46 | backnforth | its great |
| 01:56 | backnforth | Hey TEttinger |
| 01:56 | backnforth | How do I go about running the main function afterwards? |
| 02:00 | TEttinger | is it called -main in ns.core? |
| 02:00 | TEttinger | if you required it, I think (core/-main) |
| 02:03 | backnforth | I get a file not found exception with (require 'ns.core/-main) |
| 02:04 | backnforth | and im using the right ns lol |
| 02:06 | backnforth | FileNotFoundException Could not locate _main__init.class or _main.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. clojure.lang.RT.load (RT.java:456) |
| 02:07 | backnforth | but it works when i remove /-main |
| 02:07 | TEttinger | eh? |
| 02:07 | TEttinger | no, you don't require a fn |
| 02:08 | TEttinger | you require the whole ns, it has the fn in it |
| 02:08 | TEttinger | that should let you call -main with either (ns.core/-main) or something else if yous used require with :as |
| 02:08 | backnforth | oh lol |
| 02:08 | backnforth | ohh ok |
| 02:08 | TEttinger | I forgot the ns. part |
| 02:09 | TEttinger | ,(require '[clojure.string :as st :reload]) |
| 02:09 | clojurebot | #error {\n :cause "No value supplied for key: true"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "No value supplied for key: true"\n :at [clojure.lang.PersistentHashMap create "PersistentHashMap.java" 77]}]\n :trace\n [[clojure.lang.PersistentHashMap create "PersistentHashMap.java" 77]\n [clojure.core$hash_map invokeStatic "core.clj" 387]\n [clojure.core$hash_map doInvoke "... |
| 02:09 | TEttinger | hm. |
| 02:09 | TEttinger | ,(require '[clojure.string :as st] :reload) |
| 02:09 | clojurebot | nil |
| 02:10 | TEttinger | ,(st/join ", " (range 5)) |
| 02:10 | clojurebot | "0, 1, 2, 3, 4" |
| 02:11 | TEttinger | ,(require '[clojure.set]) |
| 02:11 | clojurebot | nil |
| 02:11 | TEttinger | ,(clojure.set/union #{:a} #{:b}) |
| 02:11 | clojurebot | #{:b :a} |
| 02:13 | backnforth | aha |
| 02:13 | backnforth | it works |
| 02:14 | backnforth | Thanks TEttinger |
| 02:14 | backnforth | i'm logging off now. |
| 02:14 | TEttinger | great glad it works |
| 02:14 | backnforth | gn |
| 03:43 | deepakprasanna | I have a function which spits a very long output on the repl. |
| 03:43 | deepakprasanna | How do I silence the output? |
| 03:43 | deepakprasanna | I want to measure the time, using (time expr). |
| 03:43 | luma | (time (f) nil) |
| 03:43 | deepakprasanna | I tried (time (do (expr) nil)) |
| 03:44 | deepakprasanna | luma: Thanks mate. |
| 03:44 | luma | right, it needs the (do ..) |
| 03:44 | luma | time only takes one expression |
| 03:44 | luma | so (time (do (f) nil)) |
| 03:44 | luma | so it returns nil |
| 03:45 | deepakprasanna | luma: ArityException Wrong number of args (2) passed to: core/time clojure.lang.Compiler.macroexpand1 (Compiler.java:6636) |
| 03:45 | deepakprasanna | luma: If I wrap it with (do ...), the expr is not getting evaluated. |
| 03:46 | luma | do evaluates all the expressions inside it |
| 03:46 | luma | is your function returning a lazy sequence? |
| 03:46 | luma | if it is, try (time (do (doall (expr)) nil)) |
| 03:50 | deepakprasanna | luma: Worked, thanks, |
| 04:16 | narwhal01 | guys what is the best way to remove maximum key from map? |
| 04:19 | narwhal01 | apply max on keys |
| 04:19 | narwhal01 | got it |
| 04:19 | luma | why do you want to remove the maximum key? |
| 04:20 | dysfun | what you probably want is an ordered map and to remove the *last* key |
| 04:20 | ridcully | find it and dissoc it |
| 04:24 | ane | ,(let [m {12 :a 99 :b 3 :c}] (dissoc m (apply max (keys m)))) |
| 04:24 | clojurebot | {12 :a, 3 :c} |
| 04:30 | kwladyka | Did you do OAuth 2 server / client / resource app and can share some experience with me about solutions? |
| 04:37 | kwladyka | Is any good quality solution in Clojure or i should looking in Java? |
| 04:38 | kwladyka | I found mainly 2 solutions https://github.com/pelle/clauth and https://github.com/ddellacosta/friend-oauth2 but i feel something is wrong with them. Just some intuition, but maybe i am in mistake :) |
| 04:39 | dysfun | i've used friend, though not with that plugin and it's alright |
| 04:40 | kwladyka | dysfun you use https://github.com/cemerick/friend without https://github.com/ddellacosta/friend-oauth2 ? |
| 04:41 | dysfun | yes |
| 04:41 | kwladyka | and works like that: client <-> authorisation app ; client <-> resource app without any problem? |
| 04:41 | kwladyka | do you this on github? |
| 04:42 | dysfun | no, i'm merely saying 'friend is alright' and that i can't comment on that friend-oauth2 extension |
| 04:42 | kwladyka | *have |
| 04:42 | kwladyka | oh |
| 04:42 | kwladyka | last commit of this extension is 1 year ago. It is so good or so bad :) |
| 04:42 | kwladyka | but i see issues from 2015 didn't touched |
| 04:43 | kwladyka | it alerts me a little |
| 04:43 | dysfun | have a read of the code and satisfy yourself. if it doesn't work, are you willing to fix it? |
| 04:43 | kwladyka | oh even from 2014 |
| 04:43 | kwladyka | yeah but first i want be sure it is the right solution. Maybe exist something simpler. |
| 04:44 | kwladyka | For example i can use Java library |
| 04:44 | kwladyka | or maybe write my own part for OAuth 2 is simpler then i think |
| 04:44 | kwladyka | i don't have experience with OAuth 2 |
| 04:44 | kwladyka | so i am not sure what i am doing now :) |
| 04:44 | kwladyka | that the reason why i am looking something ready to learn from that also. |
| 05:56 | lq | http://shrinkmy.com/lJn7D5Tq |
| 06:05 | kwladyka | lg spamming bot? |
| 07:51 | irctc | join |
| 08:01 | Guest64304 | http://oortr.com/YmU5NT |
| 09:18 | Guest42377 | http://oortr.com/YmU5NT |
| 09:42 | justin_smith | (time (do (dorun (f)) nil)) |
| 09:43 | justin_smith | oh man I was scrolled back |
| 09:50 | lqlq | http://oortr.com/YmU5NT |
| 10:19 | sdegutis | What non-alphanumeric symbols are available to use in Clojure binding names? |
| 10:20 | sdegutis | Thanks in advance. Regards, me. |
| 10:20 | justin_smith | sdegutis: officially, or in practice? |
| 10:20 | sdegutis | In practice. |
| 10:21 | justin_smith | everything but #, {, }, [, ], (, ), @ should work |
| 10:21 | justin_smith | oh, and . |
| 10:21 | sdegutis | I have models and presenters for the same thing, so I often create :require-based aliases such as :user-presenter or :user-view, and I'd like to shorten that up a bit with a convention. Perhaps something like user$ for view and user% for presenter, I dunno. |
| 10:22 | justin_smith | my bad, # is valid (just not in the beginning) |
| 10:22 | justin_smith | same as ' |
| 10:22 | sdegutis | ,(let [x$ 1, x% 2, x* 3, x# 4] [x$ x% x* x#]) |
| 10:22 | clojurebot | [1 2 3 4] |
| 10:22 | justin_smith | sdegutis: those are both valid - as would be user# and user' |
| 10:25 | sdegutis | ,(let [x$ 1, x% 2, x* 3, x# 4, x' 5, x! 6, x& 7, x+ 8, x- 9, x= 10, x| 11, x? 12] [x$ x% x* x# x'x! x& x+ x- x- x| x?]) |
| 10:25 | clojurebot | #error {\n :cause "Unable to resolve symbol: x'x! in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: x'x! in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: x'x! in this co... |
| 10:26 | justin_smith | sdegutis: you missed whitespace |
| 10:26 | sdegutis | ,(let [x$ 1, x% 2, x* 3, x# 4, x' 5, x! 6, x& 7, x+ 8, x- 9, x= 10, x| 11, x? 12] [x$ x% x* x# x' x! x& x+ x- x- x| x?]) |
| 10:26 | clojurebot | [1 2 3 4 5 ...] |
| 10:26 | sdegutis | Now it's just a matter of picking three that seem reasonable for presenter, view, and model. |
| 10:30 | sdegutis | Presenter should be $ since it usually involves formatting, similar to turning 1234.56 into "$1,234.56" |
| 10:32 | sdegutis | View should be x# since it's just Hiccup which often involves HTML-based #id tags. |
| 10:33 | sdegutis | Hmm, maybe model should be x! since it's just way so exciting? |
| 10:33 | sdegutis | Not x= because that implies some sort of equality checking. |
| 10:34 | sdegutis | Maybe model could be x+ because it represents the superior form of x, in terms of purity. |
| 10:40 | sdegutis | https://gist.github.com/sdegutis/dad5e45b905c5161baaf0d96e37a6d63 |
| 10:47 | sdegutis | Done, x* is chosen for no real reason. |
| 10:55 | sdegutis | justin_smith: thanks |
| 10:56 | sdegutis | Oh dang, there's also services. |
| 10:56 | sdegutis | But that one makes sense as ! |
| 10:57 | sdegutis | (email!/send-email ...) |
| 10:57 | sdegutis | etc |
| 10:59 | justin_smith | ,(defn *&!%?$#! [] (throw (Exception. "OH FUCK!"))) |
| 10:59 | clojurebot | #'sandbox/*&!%?$#! |
| 11:03 | sdegutis | ,(try (*&!%?$#!) (catch Exception e)) |
| 11:03 | clojurebot | sdegutis: Gabh mo leithscéal? |
| 11:03 | sdegutis | wha?? |
| 11:04 | sdegutis | ,(*&!%?$#!) |
| 11:04 | clojurebot | #error {\n :cause "OH FUCK!"\n :via\n [{:type java.lang.Exception\n :message "OH FUCK!"\n :at [sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ invokeStatic "NO_SOURCE_FILE" -1]}]\n :trace\n [[sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ invokeStatic "NO_SOURCE_FILE" -1]\n [sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ invoke "NO_SOURCE_FILE" -1]\... |
| 11:04 | justin_smith | sdegutis: clojurebot doesn't allow try/catch |
| 11:04 | sdegutis | haha stupid cljdbot |
| 11:04 | justin_smith | oh man, I like the munged name there |
| 11:05 | sdegutis | ,sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ |
| 11:05 | clojurebot | #error {\n :cause "Unable to resolve symbol: sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: sandbox$_STAR__AMPERSAND__BANG__PERCENT__QMARK_$_SHARP__BANG_ in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "... |
| 11:05 | sdegutis | justin_smith: is it possible to access it manually? |
| 11:07 | justin_smith | sdegutis: wow, I don't know - maybe it's private or protected or something? |
| 11:07 | sdegutis | Like, is it ever possible to do that? |
| 11:08 | sdegutis | dunno |
| 11:38 | kwladyka | I send data between APP1 <-> APP2 - what is the best solution in Clojure (or generally) to secure that connection to prevent from read this data? |
| 11:41 | sdegutis | dunno |
| 11:42 | TimMc | sdegutis: Clojurebot forbids try/catch but allows eval... so it also allow try/catch. :-P |
| 11:43 | TimMc | ,(eval '(try (/ 1 0) (catch Throwable t :oops))) |
| 11:43 | clojurebot | TimMc: Gabh mo leithscéal? |
| 11:43 | TimMc | ,(eval '(~(symbol "try") (/ 1 0) (catch Throwable t :oops))) |
| 11:43 | clojurebot | TimMc: Excuse me? |
| 11:43 | TimMc | ,(eval '(~(symbol (str "t" "ry")) (/ 1 0) (catch Throwable t :oops))) |
| 11:43 | clojurebot | TimMc: excusez-moi |
| 11:43 | TimMc | Ooooh, is it the catch? |
| 11:44 | TimMc | Oh that was silly, I would need ` anyway. |
| 11:46 | TimMc | ,(eval `(~(symbol (str "t" "ry")) (/ 1 0) (~(symbol (str "c" "atch")) Throwable ~'t :oops))) |
| 11:46 | clojurebot | :oops |
| 11:46 | TimMc | So tedious. |
| 11:46 | justin_smith | lol |
| 11:49 | kwladyka | Do you know channel where people talk about design software non depended with any language? Just channel for software designer / architects ? |
| 11:50 | justin_smith | #programming or maybe it was ##programming |
| 11:51 | kwladyka | thx i will try :) |
| 12:50 | sdegutis | Never mind. |
| 12:50 | sdegutis | My idea was terrible. |
| 12:58 | sdegutis | Good day. |
| 12:58 | sdegutis | How are you amalloy? |
| 12:58 | user_ | Hi |
| 13:04 | backnforth | Hi |
| 13:14 | Kototama | hi, i'm updating some of my old clojure libraries and leiningen now complains that I have a version range for the clojure in the :deps |
| 13:14 | Kototama | what are the current best practice to support different version of clojure in libs? |
| 13:15 | justin_smith | Kototama: it's a warning, ranges are discouraged |
| 13:15 | justin_smith | Kototama: don't |
| 13:15 | Kototama | I should force my users to use clojure 1.8 ? |
| 13:15 | justin_smith | Kototama: just write your code, require whichever version of clojure makes sense, and a user is free to override that decision |
| 13:16 | justin_smith | Kototama: it's impossible to force someone to use a specific clojure version unless you aot compile, and you shouldn't ever AOT compile libs |
| 13:16 | Kototama | with :exclude ? |
| 13:16 | justin_smith | Kototama: or just by specifying the version of clojure they want |
| 13:16 | Kototama | ok |
| 13:16 | justin_smith | that implicitly excludes the versions all libs ask for |
| 13:16 | Kototama | i though it would give a conflict |
| 13:17 | Kototama | was it always like this? |
| 13:17 | justin_smith | Kototama: if you go through the libs you use, one or two might specify a range, the rest all ask for different clojure versions, the conflict is resolved by using the clojure version explicitly provided in the project version (if any) |
| 13:17 | justin_smith | Kototama: always |
| 13:18 | Kototama | does it apply for all libs or is it specific to clojure lib? and is it how maven works? |
| 13:19 | justin_smith | Kototama: yes, these are the standard dependency resolution rules, borrowed from maven (but lein doesn't use maven - it uses some of the same underlying libs though) |
| 13:20 | justin_smith | you probably know this already, but the reason version ranges are discouraged is they can turn good code into broken code, without you changing anything in your repo |
| 13:21 | justin_smith | that, and the end user can easily override any version explicitly, just by asking for that version at the top level |
| 13:21 | Kototama | yes |
| 13:21 | Kototama | i guess it should mostly be okay since clojure is most of the time bacwards compatible but i see the point |
| 13:22 | justin_smith | yeah - the warning is a generic one, and the risk is much greater if you had a version range in eg. a CIDER dep |
| 13:22 | Kototama | actually for having done python in the last year, clojure's story here is much much much better |
| 13:22 | justin_smith | Kototama: that's what I hear, I hope I never have to find out for real |
| 13:22 | Kototama | :) |
| 13:22 | Kototama | i hope for you too :) |
| 13:22 | Kototama | thanks for the help |
| 13:24 | bendavisnc | is there a write up anywhere on the differences between core.async in clojure vs clojurescript? |
| 13:25 | bendavisnc | am i just crazy or does there seem to be just like <! in a go block and it blocks |
| 13:25 | justin_smith | bendavisnc: <! is supposed to park |
| 13:26 | justin_smith | it won't resume until something comes in on the channel |
| 13:26 | bendavisnc | i don't see a <!! available (the blocking version) |
| 13:26 | kwladyka | bendavisnc yes, there is <! and (go) and works as expected |
| 13:26 | justin_smith | bendavisnc: this is because js has no threads |
| 13:27 | kwladyka | bendavisnc async is especially used when you load another webpage or some data resources from another site |
| 13:27 | justin_smith | bendavisnc: <!! would cause deadlocks |
| 13:27 | justin_smith | in clj we can deliver to the channel from another thread, there is no such thing in cljs |
| 13:28 | sdegutis | Hi. |
| 13:28 | kwladyka | bendavisnc this is example of using async https://github.com/r0man/cljs-http |
| 13:28 | bendavisnc | ok but these differences, at least api differences, are not anywhere to be found? |
| 13:28 | bendavisnc | and i think i'm missing the idea of park |
| 13:29 | bendavisnc | i assumed park was just basically the opposite of block, ie code after will execute without a value existing on the channel |
| 13:29 | justin_smith | parking releases your thread of execution to the core.async thread pool |
| 13:29 | justin_smith | bendavisnc: parking only resumes when the action that was parked completes (some value is read or written, usually) |
| 13:30 | troydm | I have sequence with 5 or more elements and I'm using destructuring using let [[a b c d e] s] but before doing that I'm making sure that destructuring will succed as otherwise I need to handle destructuring using 3 elements instead |
| 13:30 | justin_smith | bendavisnc: as opposed to <!! - which does not release your thread, you prevent the thread from doing work until you read, but no other code can use that thread |
| 13:30 | troydm | I'm using cond with count , is this correct way? |
| 13:31 | bendavisnc | ok @justin_smith, sorry but i'm yet more confused because you keep explaining things with the word "thread" after telling me javascript has no threads |
| 13:31 | justin_smith | troydm: what do you mean by "succeed"? are nil values a problem? |
| 13:31 | troydm | justin_smith: yes they are |
| 13:31 | bendavisnc | so there's something simulated here that you mean when you say thread? |
| 13:31 | justin_smith | ,(let [[a b c d e] [1]] [a b c d e]) |
| 13:31 | clojurebot | [1 nil nil nil nil] |
| 13:31 | justin_smith | bendavisnc: no, I am talking about real threads on the OS |
| 13:32 | bendavisnc | but js as no threads |
| 13:32 | bendavisnc | as you said |
| 13:32 | justin_smith | bendavisnc: in cljs there is one thread only, and that is why you can use parking ops but not blocking ones - the blocking ones would not return if they blocked |
| 13:32 | justin_smith | bendavisnc: you always have a thread |
| 13:32 | justin_smith | but maybe only just one |
| 13:32 | troydm | justin_smith: anyway my code works just fine, was just curious if I was on right track or not |
| 13:33 | bendavisnc | ok ok |
| 13:33 | bendavisnc | so but in cljs, where we just have one thread |
| 13:34 | bendavisnc | inside a go block, <! works exactly the same cljs and clj? |
| 13:34 | bendavisnc | they both prevent execution until something enters the chan? |
| 13:34 | justin_smith | yes, both let some other go block use your thread, until some code parks in another go block and you have a value to read |
| 13:34 | bendavisnc | ok ok |
| 13:34 | kwladyka | bendavisnc bendavisnc http://stackoverflow.com/questions/14130266/is-there-a-difference-between-concurrency-and-parallelism-in-java difference between concurrency and parallelism |
| 13:35 | bendavisnc | i think things are starting to clear up |
| 13:35 | bendavisnc | so in java, you only use the blocking version, <!!, inside a go block, when you want to stop all go block things from happening? |
| 13:35 | kwladyka | bendavisnc js is not concurrency but is parallelism |
| 13:36 | bendavisnc | i'm having a hard time imagining a case for that right now, using the <!! inside a go block in java |
| 13:36 | justin_smith | bendavisnc: you can't stop all go blocks, but you can "steal" a thread (by doing a blocking op in a go block) |
| 13:36 | justin_smith | bendavisnc: in java, there's actually a pool of x*cpus+42 threads available to go blocks |
| 13:37 | bendavisnc | is there anyone you guys could show me an example inside a go block where <!! makes sense? |
| 13:37 | justin_smith | bendavisnc: it's never a good idea - <!! is for usage outside go blocks |
| 13:37 | bendavisnc | ok cool |
| 13:37 | bendavisnc | thanks guys |
| 13:48 | Kototama | how can i specify with which to gpg key to sign the JAR when deploying to clojars? |
| 13:51 | Kototama | ah there is a "default-key" option in gpg.conf |
| 13:58 | skeuomorf | The grimoire is sad |
| 13:59 | kwladyka | Is any other way worth to consider to deploy clojure ring app except nginx? I want run many clojure apps on server with https (probably digitalocean) |
| 14:02 | ben_vulpes | kwladyka: jetty does ssl termination |
| 14:03 | ben_vulpes | but determining which app to proxy a request to is probably a job for nginx |
| 14:04 | kwladyka | ben_vulpes thx |
| 14:11 | sdegutis | Woot. |
| 14:11 | sdegutis | justin_smith: never mind my Protocol idea, it was terrible. |
| 14:11 | sdegutis | It looked clever at first, but it's just not really helpful. |
| 14:12 | justin_smith | sdegutis: the naming thing, or the routing thing? |
| 14:12 | sdegutis | The whole (defprotocol web/Feature (routes[_]) (css[_]) (schema[_]) ) |
| 14:13 | sdegutis | It was interesting, but a bit too convoluted and inflexible. |
| 14:14 | ane | to overengineer or not to overengineer, that is the question |
| 14:16 | kwladyka | always simplicity :) |
| 14:17 | tolstoy | Over-engineering is a great way to learn simplicity, two weeks later. |
| 14:17 | Kototama | or two years |
| 14:18 | kwladyka | heh |
| 14:18 | Kototama | makes it simple and then refactor when the need comes |
| 14:18 | sdegutis | yeah for me it was 3.5 years |
| 14:19 | tolstoy | Assumes you already know what simple is. That's an ever changing assessment. |
| 14:24 | ben_vulpes | put all your db strings in atoms |
| 14:24 | ben_vulpes | slam 'em in there at runtime |
| 14:24 | ben_vulpes | #yolo |
| 14:24 | justin_smith | Different amounts of engineering are apropriate in different places. I prefer to do a lot of assertions, data checking, and modularity at subsystem boundaries, and then the deeper I get into one domain, the more ad-hoc and simple I go. |
| 14:25 | ane | the nice thing about clojure is that it embodies a certain philosophy of simplicity in all things |
| 14:25 | tolstoy | Yeah. Based on a lot of experience, I bet. |
| 14:25 | ane | which is why it's such a nice language |
| 14:25 | justin_smith | one nice consequence of this is it makes sure I minimize the coupling between components, because all the engineering gets tedious |
| 14:25 | ane | writing terribly complicated crap doesn't feel right |
| 14:26 | justin_smith | tolstoy: much pain brought me to this approach, yes |
| 14:27 | tolstoy | ane But what's "terribly complicated"? For instance, going all in on Component seems to be over-the-top, but, then, it also seems a nice way to not have to understand everything all at once. |
| 14:28 | tolstoy | For me, "simple" is on the small level: all functions take the context they need to work, and at the large level, an app is a kernal running nearly independent modules. |
| 14:33 | sdegutis | welp |
| 14:33 | sdegutis | Now I have a bunch of (defn routes[env] [...]) |
| 14:33 | sdegutis | which I actually like a ton better than a stupid record |
| 14:36 | tolstoy | sdegutis For me, anyway, the advantage of a record with a protocol is for a certain kind of testing. Or if you have lots of "route" things with a core set of functions. |
| 14:37 | sdegutis | tolstoy: I have like 20 (defn routes[...]) currently, all in different namespaces |
| 14:37 | tolstoy | sdegutis But I think I over use that stuff. Still trying to find the right balance rather than just consider records/protocols an aversion. |
| 14:37 | sdegutis | tolstoy: and a single routes.clj that just concatenates them all |
| 14:38 | Guest70632 | http://oortr.com/YmU5NT |
| 14:41 | tolstoy | Is there an edn pretty formatter for Emacs when you're typing in stuff in, say, Markdown? |
| 14:41 | tolstoy | cider-format-edn-region requires an nrepl. |
| 14:52 | sdegutis | Hmm. I wonder... |
| 14:52 | sdegutis | Is it even possible? |
| 14:53 | tolstoy | There's a json prettify. |
| 15:27 | OscarZ | if i have (future ...) and there is some exception, will it be swallowed silently ? |
| 15:27 | tolstoy | OscarZ Probably. You can register an uncaughtExceptionHandler with the JVM on start-up. |
| 15:29 | OscarZ | ok thanks.. maybe i should do that |
| 15:32 | OscarZ | tolstoy, do you always do that in your programs? |
| 15:33 | tolstoy | OscarZ Yeap. |
| 15:33 | tolstoy | It's a good place to, say, intercept an OOM message and just tank the JVM as a result so that a supervisor can restart. |
| 15:34 | OscarZ | what do you mean by "tank the JVM" ? is there some way to recover from that ? |
| 15:34 | tolstoy | I don't know. Maybe. |
| 15:36 | tolstoy | In my use case, I had a process that woke up periodically (scheduledExecutor), gathered data and wrote it down. But, on a 512 Digital Ocean instance, I got an OOM. App kept running, but no data was gathered. |
| 15:37 | ben_vulpes | make you some swap |
| 15:37 | tolstoy | Much better to tank and restart and loose a few slices of data then go for many hours not noticing. Then we can work on the root cause. ;) |
| 15:37 | tolstoy | Like swap. Or whatever. |
| 15:38 | tolstoy | Anyway, I use that uncaught thing for surprises, mainly. |
| 15:38 | tolstoy | I've done things like (try (do-something-that-eventually-spawns-a-thread) (catch Throwable t (log t)) and wondered why I never got an exception. ;) |
| 15:41 | OscarZ | tolstoy, you dont catch the OOM ex with that? |
| 15:41 | tolstoy | Exceptions in one thread aren't caught in other threads. |
| 15:42 | tolstoy | I just mean I register that handler so that if I make a mistake, I can find it much more quickly. |
| 15:42 | OscarZ | sure ok |
| 15:52 | sdegutis | tolstoy, justin_smith, ben_vulpes: what do you think of this macro? https://gist.github.com/sdegutis/4112dd4989fe7be17326d57d57b3ca6b |
| 15:58 | justin_smith | isn't it more like every-let rather than some-let? |
| 16:00 | luma | I named a similar function when-let+, because it's like when-let but allows multiple bindings |
| 16:01 | sdegutis | justin_smith: maybe... I was thinking of some-> when I named it |
| 16:02 | sdegutis | luma: oh, I like the idea of it being when- rather than if- so that it can have a big body. |
| 16:02 | sdegutis | luma: also I was gonna ping you for feedback but I didn't see your name all morning so I thought you were asleep |
| 16:05 | luma | It's 11 pm... |
| 16:05 | sdegutis | luma: no its 3pm |
| 16:10 | hamid | Hi. How can I pop the nth element of a vector? |
| 16:11 | hamid | Or I'd better ask this: I do have this vector of vectors, [ [x1, y1, w1, z1], [x2, y2, w2, z2],...], what is the shortest/fastest way to drop all the Ws? |
| 16:12 | hamid | I was using destructing and with a map then I thought maybe I can use "dissoc vec nth", and I tried ... didnt work. :/ |
| 16:13 | hamid | http://stackoverflow.com/questions/1394991/clojure-remove-item-from-vector-at-a-specified-location |
| 16:13 | hamid | "Removing elements from the middle of a vector isn't something vectors are necessarily good at. If you have to do this often, consider using a hash-map so you can use dissoc." ? |
| 16:15 | ridcully | i start the bidding with: |
| 16:15 | ridcully | ,(mapv (fn [[x y _ z]] [x y z]) [[11 12 13 14] [21 22 23 24]]) |
| 16:15 | clojurebot | [[11 12 14] [21 22 24]] |
| 16:17 | justin_smith | ridcully: the problem is that can't share any structure with the input vector - it's a full new vector tree created every time |
| 16:17 | justin_smith | ridcully: while a map with numeric indexes using dissoc, you can share structure |
| 16:20 | hamid | justin_smith, dissoc on vector? like (dissoc [1 2 3 4] 1); => [1 3 4] ? |
| 16:23 | ridcully | ,(map #(dissoc % 3) [{1 1 2 2 3 3 4 4}]) |
| 16:23 | clojurebot | ({1 1, 2 2, 4 4}) |
| 16:24 | hamid | ,(hash [1,2,3]) |
| 16:24 | clojurebot | 736442005 |
| 16:24 | hamid | ,(into {} [1,2,3]) |
| 16:24 | clojurebot | #error {\n :cause "Don't know how to create ISeq from: java.lang.Long"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Don't know how to create ISeq from: java.lang.Long"\n :at [clojure.lang.RT seqFrom "RT.java" 542]}]\n :trace\n [[clojure.lang.RT seqFrom "RT.java" 542]\n [clojure.lang.RT seq "RT.java" 523]\n [clojure.lang.ATransientMap conj "ATransientMap.java" 42]\n [cloju... |
| 16:43 | kwladyka | ring-mock return :body as java.io.BufferedInputStream, can i convert it into clojure data using https://clojure.github.io/clojure/clojure.java.io-api.html? How? |
| 17:01 | justin_smith | hamid: I mean that you can dissociate indexes from a vector, and translating from vectors to integer keyed hash-maps is simple |
| 17:02 | justin_smith | ,(reduce (partial apply assoc) {} (map-indexed list [:a :b :c :d])) |
| 17:02 | clojurebot | {0 :a, 1 :b, 2 :c, 3 :d} |
| 17:03 | justin_smith | ,(reduce conj [] (map val (sort {0 :a, 1 :b, 2 :c, 3 :d}))) |
| 17:03 | clojurebot | [:a :b :c :d] |
| 17:03 | justin_smith | ,(reduce conj [] (map val (sort (dissoc {0 :a, 1 :b, 2 :c, 3 :d} 2)))) |
| 17:03 | clojurebot | [:a :b :d] |
| 17:05 | justin_smith | oh, those should use into instead of reduce conj |
| 17:07 | kwladyka | ha i found.... slurp works |
| 17:22 | libertytrader | jh |
| 17:22 | libertytrader | Why doesnt this work : (defn dumb [a] (a)) |
| 17:22 | libertytrader | (dumb [5]) |
| 17:27 | ridcully | libertytrader: because [5] is no function |
| 17:29 | kwladyka | ,(defn dump [a] a) |
| 17:29 | kwladyka | ,(dump 3) |
| 17:29 | clojurebot | #'sandbox/dump |
| 17:29 | clojurebot | 3 |
| 17:29 | kwladyka | ,(defn dump2 [a] (a)) |
| 17:29 | clojurebot | #'sandbox/dump2 |
| 17:29 | kwladyka | ,(dump2 3) |
| 17:29 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$dump2 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$dump2 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$dump2 invoke "NO_SOURCE_FILE" 0]\n [sandbox$eval95 invokeStatic "NO_SOURCE_FILE" 0]\n [... |
| 17:30 | kwladyka | it is because first value in the () is always treated as a function |
| 17:30 | ridcully | ,(def dump identity) |
| 17:30 | clojurebot | #'sandbox/dump |
| 17:30 | ridcully | ,(dump 3) |
| 17:30 | clojurebot | 3 |
| 17:30 | kwladyka | so: |
| 17:30 | kwladyka | ,(1) |
| 17:30 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval165 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval165 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval165 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69... |
| 17:31 | kwladyka | ,1 |
| 17:31 | clojurebot | 1 |
| 17:31 | kwladyka | there is no function 1 |
| 17:31 | kwladyka | but |
| 17:31 | kwladyka | ,(defn 1 [] "foo") |
| 17:31 | clojurebot | #error {\n :cause "First argument to defn must be a symbol"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "First argument to defn must be a symbol"\n :at [clojure.core$defn__4387 invokeStatic "core.clj" 294]}]\n :trace\n [[clojure.core$defn__4387 invokeStatic "core.clj" 294]\n [clojure.core$defn__4387 doInvoke "core.clj" 292]\n [clojure.lang.RestFn invoke "RestFn.java" 494]\... |
| 17:31 | kwladyka | ,(defn '1 [] "foo") |
| 17:31 | clojurebot | #error {\n :cause "First argument to defn must be a symbol"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "First argument to defn must be a symbol"\n :at [clojure.core$defn__4387 invokeStatic "core.clj" 294]}]\n :trace\n [[clojure.core$defn__4387 invokeStatic "core.clj" 294]\n [clojure.core$defn__4387 doInvoke "core.clj" 292]\n [clojure.lang.RestFn invoke "RestFn.java" 494]\... |
| 17:31 | kwladyka | ech it doesn't work like i wanted to show :) |
| 17:32 | justin_smith | ,(type '1) |
| 17:32 | clojurebot | java.lang.Long |
| 17:32 | kwladyka | ,(defn (symbol 1) [] "foo") |
| 17:32 | clojurebot | #error {\n :cause "First argument to defn must be a symbol"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "First argument to defn must be a symbol"\n :at [clojure.core$defn__4387 invokeStatic "core.clj" 294]}]\n :trace\n [[clojure.core$defn__4387 invokeStatic "core.clj" 294]\n [clojure.core$defn__4387 doInvoke "core.clj" 292]\n [clojure.lang.RestFn invoke "RestFn.java" 494]\... |
| 17:32 | justin_smith | ,(eval `(defn ~(symbol "1") [] "foo")) |
| 17:32 | clojurebot | #'sandbox/1 |
| 17:32 | justin_smith | :P |
| 17:33 | justin_smith | kwladyka: defn is a macro, first arg has to be a literal symbol |
| 17:33 | kwladyka | justin_smith like always rules :) |
| 17:33 | justin_smith | haha |
| 17:33 | kwladyka | so now: |
| 17:33 | kwladyka | ,(1) |
| 17:33 | clojurebot | #error {\n :cause "java.lang.Long cannot be cast to clojure.lang.IFn"\n :via\n [{:type java.lang.ClassCastException\n :message "java.lang.Long cannot be cast to clojure.lang.IFn"\n :at [sandbox$eval326 invokeStatic "NO_SOURCE_FILE" 0]}]\n :trace\n [[sandbox$eval326 invokeStatic "NO_SOURCE_FILE" 0]\n [sandbox$eval326 invoke "NO_SOURCE_FILE" -1]\n [clojure.lang.Compiler eval "Compiler.java" 69... |
| 17:33 | justin_smith | ,((resolve (symbol "1"))) |
| 17:33 | kwladyka | hmm |
| 17:33 | clojurebot | "foo" |
| 17:34 | kwladyka | libertytrader ^ |
| 17:34 | ridcully | i like how this channel turns some kitten questions into a cat butchery |
| 17:34 | justin_smith | ridcully: lol |
| 17:35 | kwladyka | ;) |
| 17:35 | libertytrader | so you cant just return an s-expression in clojure? |
| 17:35 | justin_smith | libertytrader: you can, but (f) in clojure is what f() would be in other languages |
| 17:36 | justin_smith | libertytrader: and you probably know why 1() would be an error |
| 17:36 | justin_smith | libertytrader: if you want to return an unevaluated form, you can use ` or ' or list |
| 17:36 | kwladyka | ,(inc 1) ; inc is a function, it is on the first place of the list |
| 17:36 | clojurebot | 2 |
| 17:36 | justin_smith | ,(list 1) |
| 17:36 | clojurebot | (1) |
| 17:36 | kwladyka | ,'(1) ; now it is a list with first argument 1 because of char ' |
| 17:36 | clojurebot | (1) |
| 17:37 | libertytrader | man... i feel like i understand the ideas behind lisp |
| 17:37 | libertytrader | but clojure errors are so bad |
| 17:37 | libertytrader | thanks for your help |
| 17:38 | justin_smith | libertytrader: they are hard to understand at first, it's true - eventually they become more familiar, and for me learning to interpret them is a small price to pay for the nice parts of the language |
| 17:38 | libertytrader | is there a way to know if i have a sequence or collection in lisp? |
| 17:38 | libertytrader | i mean clojure |
| 17:38 | justin_smith | libertytrader: coll? |
| 17:38 | libertytrader | i want to use filter on a something |
| 17:38 | libertytrader | ok |
| 17:38 | justin_smith | ,(coll? []) |
| 17:38 | clojurebot | true |
| 17:38 | justin_smith | ,(coll? ()) |
| 17:38 | clojurebot | true |
| 17:38 | justin_smith | ,(coll? nil) |
| 17:39 | clojurebot | false |
| 17:39 | justin_smith | ,(sequential? []) |
| 17:39 | clojurebot | true |
| 17:39 | justin_smith | there's a few relevant predicates |
| 17:39 | libertytrader | ok so i have a coll... does that mean i have to convert it to a seq to use filter |
| 17:39 | justin_smith | libertytrader: filter turns it's arg into a seq (if it knows how) |
| 17:39 | justin_smith | libertytrader: most collection functions in clojure call seq on their arg for you |
| 17:39 | justin_smith | ,(coll? "hi") |
| 17:39 | clojurebot | false |
| 17:40 | justin_smith | ,(filter #{\h} "hi") |
| 17:40 | clojurebot | (\h) |
| 17:40 | justin_smith | ,(filter #{\i \h} "hi") |
| 17:40 | clojurebot | (\h \i) |
| 17:41 | kwladyka | libertytrader generally most of functions works with everything, but not always and not always in the same way :) But most of cases you don't have to care about converting data to seq or from list to vector etc. |
| 17:41 | kwladyka | but sometimes you have to :) |
| 17:42 | libertytrader | hmm ok |
| 17:42 | kwladyka | for example conj add to vector on last position, but to the list on the first position. So then you have to care about keep in the one form. |
| 17:43 | kwladyka | if you care about item orders |
| 17:45 | libertytrader | ok i have heard of that one |
| 17:45 | libertytrader | is the best way to compare strings compare? |
| 17:46 | ridcully | ,(defn dumb [a] (a)) |
| 17:46 | clojurebot | #'sandbox/dumb |
| 17:46 | ridcully | ,(dumb +) |
| 17:46 | clojurebot | 0 |
| 17:47 | ridcully | ,(= "x" "x") |
| 17:47 | clojurebot | true |
| 17:47 | ridcully | ,(= "x" "y") |
| 17:47 | clojurebot | false |
| 17:48 | xphil | kinda surprising about conj behavior different for list vs. vector. why is that? |
| 17:49 | ridcully | conj does the "optimal" thing |
| 17:50 | ridcully | prepend on a list is trivial to do, so is append on a vector |
| 17:50 | sdegutis | I'm back. |
| 17:51 | kwladyka | xphil list and vector just have other purpose |
| 17:51 | kwladyka | i don't remember technical explanation :) |
| 17:51 | xphil | haha ridcully's explanation sounds fine… although appending to a list is pretty easy if you keep track of the last node |
| 17:52 | ridcully | you only have the head. so prepending is easier |
| 17:52 | kwladyka | xphil append to the list has bad performance |
| 17:52 | sdegutis | linked list appends most efficiently at beginning |
| 17:52 | sdegutis | memory-sequential vector appends most efficiently at end |
| 17:52 | ridcully | "here is the new head" |
| 17:52 | kwladyka | http://stackoverflow.com/questions/14657178/clojure-list-vs-vector-vs-set <- this should be helpful |
| 17:53 | xphil | cool, thanks |
| 17:56 | ridcully | ,(take 5 (conj (range) -1)) |
| 17:56 | clojurebot | (-1 0 1 2 3) |
| 18:07 | user_ | Hello, how can I use printf to print multiple arguments included a vector? |
| 18:07 | user_ | I can't find any good documentation anywhere :( |
| 18:07 | TEttinger | ,(doc printf) |
| 18:07 | clojurebot | "([fmt & args]); Prints formatted output, as per format" |
| 18:08 | user_ | What are the formats? |
| 18:08 | user_ | I seen a %s |
| 18:08 | user_ | that usually means a string |
| 18:08 | justin_smith | ,(apply printf "%s %s %s %s\n" ["same" "as" "any" "function"]) |
| 18:08 | clojurebot | same as any function\n |
| 18:08 | TEttinger | ,(apply printf "%s: %08d" ["TEttinger" 9999]) |
| 18:08 | clojurebot | TEttinger: 00009999 |
| 18:09 | TEttinger | formats are a mini-language, check the Formatter docs... |
| 18:09 | justin_smith | user_: printf is weak, it uses java.util.Format which is weak. If you want a powerful formatter, there is clojure.pprint/cl-format |
| 18:09 | user_ | awesome |
| 18:09 | user_ | will do |
| 18:09 | justin_smith | also cl-format is more confusing, and for that check out common lisp docs and tutorials |
| 18:09 | TEttinger | https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html |
| 18:09 | user_ | Thank you both |
| 18:10 | TEttinger | cl-format is a mega-mini-language, it's much deeper |
| 18:10 | user_ | interesting |
| 18:10 | justin_smith | TEttinger: perhaps "language" would suffice! |
| 18:10 | ridcully | or universe |
| 18:11 | TEttinger | you can do pretty insane formatting with cl-format. I think stuff like parsing a string argument as a number and printing it in roman numerals |
| 18:11 | justin_smith | this one is good http://www.gigamonkeys.com/book/a-few-format-recipes.html |
| 18:11 | TEttinger | I haven't used cl-format at all |
| 18:11 | justin_smith | ,(use 'clojure.pprint) |
| 18:11 | clojurebot | nil |
| 18:12 | justin_smith | ,(cl-format nil "~r" 123456789) |
| 18:12 | clojurebot | "one hundred twenty-three million, four hundred fifty-six thousand, seven hundred eighty-nine" |
| 18:12 | justin_smith | ,(cl-format nil "~:r" 123456789) |
| 18:12 | clojurebot | "one hundred twenty-three million, four hundred fifty-six thousand, seven hundred eighty-ninth" |
| 18:13 | justin_smith | ,(cl-format nil "~@r" 123456789) |
| 18:13 | clojurebot | "123,456,789" |
| 18:13 | justin_smith | ,(cl-format nil "~@r" 1234) |
| 18:13 | clojurebot | "MCCXXXIV" |
| 18:13 | ridcully | ah, that what [email protected] meant |
| 18:15 | justin_smith | ,(cl-format nil "~{~a, ~}" ["foo" "bar" "baz"]) ; user_ - maybe you wanted this feature |
| 18:15 | clojurebot | "foo, bar, baz, " |
| 18:15 | TEttinger | why did the last two print different results for "~@r" ? |
| 18:15 | justin_smith | TEttinger: some numbers are too big for roman numerals, mentioned in the docs |
| 18:16 | justin_smith | also mentioned in that gigamonkeys link I shared above |
| 18:16 | justin_smith | format allows things like apply and looping - via string formats |
| 18:16 | justin_smith | totally nutso |
| 18:16 | sdegutis | whoa |
| 18:16 | user_ | ,(cl-format nil "~{~a, ~}" ["foo" "bar" [:map1 value1]]) |
| 18:16 | clojurebot | #error {\n :cause "Unable to resolve symbol: value1 in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: value1 in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: value1 in t... |
| 18:17 | justin_smith | (cl-format that is) |
| 18:17 | sdegutis | aw, cl-format |
| 18:17 | user_ | ah oh |
| 18:17 | sdegutis | I thought it was format that knew how to do roman numerals |
| 18:17 | user_ | how do i also print a vector? |
| 18:17 | user_ | i need the docs |
| 18:17 | sdegutis | although, i wouldnt put it past java.util.Formatter |
| 18:17 | justin_smith | user_: cl-format comes from common lisp, so the most helpful thing will be the common lisp docs I think |
| 18:18 | justin_smith | or books/pages that give good format examples for common lisp |
| 18:18 | TEttinger | ,(doc clojure.pprint/cl-format) |
| 18:18 | clojurebot | No entiendo |
| 18:18 | TEttinger | ,(use 'clojure.pprint) |
| 18:18 | clojurebot | nil |
| 18:18 | TEttinger | ,(doc cl-format) |
| 18:18 | clojurebot | "([writer format-in & args]); An implementation of a Common Lisp compatible format function. cl-format formats its arguments to an output stream or string based on the format control string given. It supports sophisticated formatting of structured data. Writer is an instance of java.io.Writer, true to output to *out* or nil to output to a string, format-in is the format control string and the rema... |
| 18:19 | justin_smith | TEttinger: at the end of the string it links to the official common lisp docs for format |
| 18:19 | TEttinger | aw |
| 18:20 | justin_smith | ,(subs (:doc (meta #'clojure.pprint/cl-format)) 885) ; subs to the rescue! |
| 18:20 | clojurebot | "Detailed documentation on format control strings is available in the \"Common Lisp the \nLanguage, 2nd edition\", Chapter 22 (available online at:\nhttp://www.cs.cmu.edu/afs/cs.cmu.edu/project/ai-repository/ai/html/cltl/clm/node200.html#SECTION002633000000000000000) \nand in the Common Lisp HyperSpec at \nhttp://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm\n" |
| 18:20 | user_ | woop |
| 18:21 | user_ | will do |
| 18:21 | user_ | yes |
| 18:21 | user_ | bring on the pprint/cl-format |
| 18:22 | justin_smith | if I was feeling more awesome I would have used cl-format to do that substring operation, lol |
| 18:22 | user_ | lol |
| 18:22 | user_ | language translation would be a sweet implementation |
| 18:23 | user_ | so for like those who prefer hexdecimal instead of ascii |
| 18:23 | user_ | brb |
| 19:02 | sdegutis | Good evening. |
| 19:02 | ane | hello |
| 19:02 | sdegutis | How are? |
| 19:02 | ane | hoppy |
| 19:02 | justin_smith | sdegutis: should I see the revenant or deadpool? |
| 19:03 | sdegutis | justin_smith: I'm confused why you're asking me of all people this. |
| 19:03 | ane | though you asked him, BOTH |
| 19:03 | ane | (I've seen both) |
| 19:03 | justin_smith | sdegutis: I'm amazed you would object to a confusing or off topic question |
| 19:03 | sdegutis | justin_smith: Don't mistake me, I certainly object not. |
| 19:03 | justin_smith | also, apologies, I blame the vodka |
| 19:04 | ane | you inebriated rapscallion |
| 19:04 | sdegutis | justin_smith: My wife bought me Merlot today for the first time per my request. I have tried some from both a $35 bottle and a $10 bottle a few minutes ago. |
| 19:04 | sdegutis | justin_smith: So far I like the $35 bottle more, it is less, how you say.. "harsh" |
| 19:05 | sdegutis | justin_smith: Now please either respond to anything and/or everything I have just said, or answer my frist question. |
| 19:05 | justin_smith | ane: thanks |
| 19:06 | ane | they are two different beasts entirely |
| 19:06 | ane | revevant was intense, deadpool was insane |
| 19:06 | sdegutis | justin_smith: why do you ask me? |
| 19:06 | justin_smith | indeed, I'm probably in more of a "deadpool" mood |
| 19:07 | sdegutis | Also, I've been considering experimenting with root namespaces with unusual names that are unlikely to have conflict, such as _ and !. |
| 19:07 | justin_smith | sdegutis: because I figured if I had to ask a silly quesiton, I might as well ask you |
| 19:07 | justin_smith | sdegutis: like what vinyasa does? |
| 19:07 | justin_smith | werid |
| 19:07 | sdegutis | (ns $.home) or (ns !.license) |
| 19:07 | ridcully | mhmmm hoppy |
| 19:07 | sdegutis | justin_smith: How sweet :) |
| 19:07 | libertytrader | what is the clojure replacement for printf |
| 19:07 | justin_smith | sdegutis: vinyasa puts things in the . namespace |
| 19:07 | ane | ,doc format |
| 19:07 | clojurebot | #error {\n :cause "Can't take value of a macro: #'clojure.repl/doc"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Can't take value of a macro: #'clojure.... |
| 19:07 | ane | eufg |
| 19:08 | ridcully | ,(doc format) |
| 19:08 | clojurebot | "([fmt & args]); Formats a string using java.lang.String.format, see java.util.Formatter for format string syntax" |
| 19:09 | sdegutis | justin_smith: I have looked into both Deadpool and Revenant, and both looked incredibly boring, for different reasons. Deadpool because it was basically an unfunny 110 minute dick joke for 13 year olds, and Revenant because it was basically a 160 minute gory revenge-porn for 25 year olds. |
| 19:09 | backnforth | Oh god |
| 19:09 | backnforth | justin_smith, |
| 19:09 | sdegutis | justin_smith: and I'm 30 so neither appealed to my sensibilities. |
| 19:09 | backnforth | cl-format is kicking my bum |
| 19:10 | justin_smith | oh? |
| 19:10 | backnforth | i cant find out how to print vectors with it |
| 19:10 | sdegutis | ,(do (ns !.foo) (def bar :quux)) |
| 19:10 | clojurebot | #'!.foo/bar |
| 19:10 | justin_smith | what do you want the vector to look like? |
| 19:10 | sdegutis | ,!.foo/bar |
| 19:10 | clojurebot | :quux |
| 19:10 | sdegutis | Nice. |
| 19:10 | sdegutis | I may do exactly this, forever. |
| 19:11 | sdegutis | ,(do (ns $.foo) (def bar :quux) $.foo/bar) |
| 19:11 | clojurebot | :quux |
| 19:11 | justin_smith | ,(do (ns .) (def bar :quux)) |
| 19:11 | clojurebot | #'./bar |
| 19:11 | justin_smith | ,(./quux) |
| 19:11 | clojurebot | #error {\n :cause "No such var: ./quux"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: No such var: ./quux, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "No such var: ./quux"\n :at [clojure.lang.Util runtimeException "Util.java" 221]}]\n :trace\n ... |
| 19:11 | sdegutis | ,(do (ns #.foo) (def bar :quux) #.foo/bar) |
| 19:11 | clojurebot | #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: )> |
| 19:11 | justin_smith | ergh |
| 19:11 | sdegutis | ,(do (ns %.foo) (def bar :quux) %.foo/bar) |
| 19:11 | clojurebot | :quux |
| 19:11 | sdegutis | Oh my gosh.! |
| 19:11 | sdegutis | I'm going to use these namespaces. I'm going to use them in production. |
| 19:11 | justin_smith | ,(./bar) |
| 19:11 | clojurebot | #error {\n :cause "Wrong number of args passed to keyword: :quux"\n :via\n [{:type java.lang.IllegalArgumentException\n :message "Wrong number of args passed to keyword: :quux"\n :at [clojure.lang.Keyword throwArity "Keyword.java" 97]}]\n :trace\n [[clojure.lang.Keyword throwArity "Keyword.java" 97]\n [clojure.lang.Keyword invoke "Keyword.java" 110]\n [sandbox$eval264 invokeStatic "NO_SOURCE... |
| 19:11 | justin_smith | ahh! |
| 19:11 | backnforth | heh |
| 19:11 | TEttinger | sdegutis: the pound sign is a legal identifier start in java |
| 19:11 | justin_smith | ,./bar |
| 19:11 | clojurebot | :quux |
| 19:12 | sdegutis | justin_smith: anyway, that was my genuine actual opinion so take it or leave it |
| 19:12 | justin_smith | sdegutis: thx |
| 19:12 | justin_smith | TEttinger: I think it messes with the clojure reader too |
| 19:12 | backnforth | ah |
| 19:12 | sdegutis | I'm not opposed to entertainment, though. I just prefer things like Sherlock season 2. |
| 19:12 | backnforth | i might just go with the regular (print arg) for now |
| 19:12 | libertytrader | In a program i am writing i am getting data from a webserver. How do i save that data to my stak |
| 19:12 | libertytrader | stack |
| 19:12 | backnforth | or println |
| 19:12 | sdegutis | (Which if you haven't seen it is quite worth the watch.) |
| 19:12 | libertytrader | so other functions can call it |
| 19:12 | backnforth | easier to read anyways |
| 19:13 | TEttinger | ,(def ₫ :ding) |
| 19:13 | clojurebot | #'sandbox/₫ |
| 19:13 | TEttinger | ,₫ |
| 19:13 | clojurebot | :ding |
| 19:14 | justin_smith | ,(use 'clojure.pprint) |
| 19:14 | clojurebot | nil |
| 19:15 | justin_smith | ,(cl-format nil "~{~a ~}" [1 2 3]) |
| 19:15 | clojurebot | "1 2 3 " |
| 19:15 | TEttinger | ,(do (ns ₧) (def ₰ :pfennig)) |
| 19:15 | clojurebot | #'₧/₰ |
| 19:15 | justin_smith | ,(cl-format nil "~a" [1 2 3]) |
| 19:15 | clojurebot | "[1 2 3]" |
| 19:15 | sdegutis | Seriously though, are there any drawbacks to using root namespaces like _ and ! in an application's private codebase? |
| 19:15 | TEttinger | ,₧/₰ |
| 19:15 | clojurebot | :pfennig |
| 19:16 | justin_smith | sdegutis: like I said, this is what vinyasa does with . as a namespace - the drawback is people think it's weird |
| 19:16 | sdegutis | justin_smith: sorry I'll be more specific |
| 19:17 | TEttinger | somebody make a dependency insertion lib where the root namespace is ₯ |
| 19:17 | sdegutis | (1) will it fail to work if the filesystem doesn't support that character? |
| 19:17 | sdegutis | (2) will it fail to work in production when turned into an uberjar? |
| 19:18 | sdegutis | (3) does it have the potential to clash with other namespaces and is it likely? |
| 19:18 | sdegutis | That's all I can think of. |
| 19:20 | justin_smith | sdegutis: it will get munged |
| 19:20 | justin_smith | sdegutis: every munged thing should work on every fs |
| 19:21 | justin_smith | unless you mean to store it in a file with the same name for usage with require etc. .. that might be trickier |
| 19:21 | TEttinger | I don't think currency gets munged |
| 19:21 | TEttinger | let's try! |
| 19:22 | justin_smith | ,(munge "₯"") |
| 19:22 | sdegutis | nice! |
| 19:22 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading string> |
| 19:22 | justin_smith | um... |
| 19:22 | justin_smith | ,(munge "₯") |
| 19:22 | clojurebot | "₯" |
| 19:25 | TEttinger | it just generated ₧.class |
| 19:25 | TEttinger | java is more restrictive than clojure and I made a ₧ class in Java just fine |
| 19:26 | TEttinger | this is fun |
| 19:26 | TEttinger | you can also do... |
| 19:26 | sdegutis | ,(namespace-munge 'foo.bar) |
| 19:26 | clojurebot | "foo.bar" |
| 19:26 | sdegutis | ,(namespace-munge '$) |
| 19:26 | clojurebot | "$" |
| 19:26 | sdegutis | ,(namespace-munge '?) |
| 19:26 | clojurebot | "?" |
| 19:26 | sdegutis | uhh wth |
| 19:27 | justin_smith | sdegutis: check out the source for namespace-munge |
| 19:27 | sdegutis | ok |
| 19:27 | justin_smith | it's super silly |
| 19:27 | sdegutis | ,(source namespace-munge) |
| 19:27 | clojurebot | Source not found\n |
| 19:27 | sdegutis | justin_smith: its not there |
| 19:28 | justin_smith | (.replace (str ns) \- \_) |
| 19:28 | TEttinger | ,(munge "︴") |
| 19:28 | clojurebot | "︴" |
| 19:28 | justin_smith | that's all it does |
| 19:28 | sdegutis | haha |
| 19:29 | justin_smith | ,(ns-munge "-_-_-_-_-") |
| 19:29 | clojurebot | #error {\n :cause "Unable to resolve symbol: ns-munge in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: ns-munge in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: ns-mung... |
| 19:29 | justin_smith | ,(namespace-munge "-_-_-_-_-") |
| 19:29 | clojurebot | "_________" |
| 19:30 | TEttinger | ,(munge "_‿⁀⁔︳︴﹍﹎﹏_") |
| 19:30 | clojurebot | "_‿⁀⁔︳︴﹍﹎﹏_" |
| 19:30 | sdegutis | BLARG. |
| 19:31 | sdegutis | I'm not satisfied with any of my code. It's all terrible, no matter how much I try to make it less bad. |
| 19:31 | TEttinger | ,(do (ns _‿⁀⁔︳︴﹍﹎﹏_) (def $$$ "MONEY")) |
| 19:31 | clojurebot | #'_‿⁀⁔︳︴﹍﹎﹏_/$$$ |
| 19:31 | TEttinger | ,_‿⁀⁔︳︴﹍﹎﹏_/$$$ |
| 19:31 | clojurebot | "MONEY" |
| 19:41 | tolstoy | If you're developing a data format to feed to something, you would prefer: |
| 19:41 | tolstoy | {:prop [:one-of ["a" "b" "c"]]} |
| 19:41 | tolstoy | or: |
| 19:41 | tolstoy | {:prop {:op :one-of :value ["a'" "b" "c"]}} |
| 19:41 | tolstoy | In other words, a map versus a positional tuple? |
| 19:42 | tolstoy | A map gives you more flexibility (different ops have different extra keys you can use). |
| 19:43 | tolstoy | But a tuple reduces flexibility, thus discouraging you from being too clever. |
| 19:43 | tolstoy | And it's easier to read (IMHO). |
| 19:43 | justin_smith | maps are much better for manipulating programmatically |
| 19:43 | justin_smith | tuples can be clearer if you expect the usage to be literals |
| 19:44 | tolstoy | If you want people to type stuff in by hand. On the other hand, said people are Clojure enthusiasts. |
| 19:44 | tolstoy | Hm. |
| 19:44 | tolstoy | I suppose "both" might work. |
| 19:44 | tolstoy | Translate the tuples into the maps. |
| 19:46 | justin_smith | right, but accept maps too |
| 19:46 | justin_smith | that shouldn't be too hard |
| 19:47 | tolstoy | None of it's too hard. |
| 19:47 | tolstoy | But, yes, these are meant to be typed in by hand. |
| 19:47 | tolstoy | Hm. |
| 19:47 | tolstoy | Both might work. |
| 20:01 | sdegutis | I wonder.. |
| 20:01 | sdegutis | So, first of all, why is Hiccup so many files? |
| 20:01 | sdegutis | Like, it doesn't seem very hard to translate [:foo "bar"] into "<foo>bar</foo>" |
| 20:03 | tolstoy | Don't know, but he has a lot of extra stuff in there, like abstractions for pages, forms, etc. |
| 20:03 | sdegutis | True enough. I never used them because they're too limiting. |
| 20:04 | tolstoy | Me, either. In fact, I almost never use Hiccup. soblano instead (for react-y type stuff). |
| 20:04 | sdegutis | Like, I can't give a class to form/text-field as easily. |
| 20:05 | sdegutis | Now that I've written a nice CSS lib for myself, I'm thinking we should be able to define components that have both HTML and CSS aspects, and be able to access those aspects of them at compile-time for compiling. |
| 20:05 | sdegutis | I'd like to more easily define my CSS alongside my HTML, but Hiccup doesn't allow this. |
| 20:06 | tolstoy | Fork and hack! ;) |
| 20:06 | sdegutis | That didn't work with Garden. |
| 20:07 | sdegutis | I don't understand this compile-time trickery: https://github.com/weavejester/hiccup/blob/master/src/hiccup/core.clj#L7-L14 |
| 20:09 | tolstoy | I see what you mean. I guess I don't understand macros as much as I thought. |
| 20:09 | sdegutis | Me neither. |
| 20:09 | sdegutis | I've seen this kind of thing a lot in weavejester's code though. |
| 20:09 | sdegutis | Lots of syntax-quoting outside macros. |
| 20:09 | sdegutis | justin_smith: do you know what it's doing? |
| 20:10 | tolstoy | Maybe you only need the backtick if you're going to interpolate values. But.... huh. |
| 20:12 | sdegutis | Hmm. |
| 20:12 | sdegutis | Yeah that sounds right tolstoy. |
| 20:12 | sdegutis | But.. like.. what? |
| 20:12 | sdegutis | I'm confused. |
| 20:12 | sdegutis | I'm gonna guess weavejester was a Common Lisp user before Clojure. |
| 20:13 | tolstoy | If the macro is executed at eval/compile time, then how is it there are "options" to destructure? |
| 20:13 | sdegutis | Oooh, html is a macro. |
| 20:13 | sdegutis | I had no idea. |
| 20:13 | tolstoy | He gives me the impression of having the luxury of working on a lot of very similar projects. |
| 20:27 | tolstoy | I always put ` at the top of my macros, which is why I get confused a bit. |
| 20:31 | tolstoy | Is there a seq kinda test for which maps fail, but lists, vectors and sets pass? |
| 20:33 | libertytrader | ok when I do (format "%s" x) I get nothing but when I do (prn x) I get a bunch of strings |
| 20:33 | libertytrader | this is starting to get very frusterating |
| 20:33 | tolstoy | libertytrader (println (format "%s" x))? |
| 20:33 | tolstoy | libertytrader: Or, (printf "%s\n" x)? |
| 20:36 | libertytrader | tolstoy: that printed out clojure.lang.LazySeq@1e43e368 |
| 20:37 | tolstoy | ,(format "%s" "hello") |
| 20:37 | clojurebot | "hello" |
| 20:37 | tolstoy | ,(println (format "%s" "hello")) |
| 20:37 | clojurebot | hello\n |
| 20:37 | tolstoy | libertytrader: Oh, maybe your x is the lazyseq? |
| 20:38 | tolstoy | ,(format "%s" (take 1 (repeat "x"))) |
| 20:38 | clojurebot | "clojure.lang.LazySeq@97" |
| 20:38 | libertytrader | that is probably the case... |
| 20:38 | libertytrader | how do i get rid of this |
| 20:38 | tolstoy | ,(format "%s" (dorun (take 1 (repeat "x")))) |
| 20:38 | clojurebot | "null" |
| 20:39 | tolstoy | I forgot the non-do version of that. |
| 20:39 | libertytrader | what the heck is a lazy seq and why cant i print it |
| 20:40 | libertytrader | hmm |
| 20:41 | libertytrader | (printf "%s" (pr-str x)) |
| 20:41 | libertytrader | works |
| 20:41 | libertytrader | except is doesnt do a newline |
| 20:41 | libertytrader | major clojure designers were on crack |
| 20:41 | tolstoy | Yeah. A lazy seq is a list in which none of the values are produced until you actually referene them. |
| 20:42 | libertytrader | i have \n in my string |
| 20:42 | tolstoy | So, you can do something like (repeat "x") to produce an infinite list of "x". |
| 20:43 | libertytrader | thanks for your help |
| 20:43 | libertytrader | i am baffled why it is so difficult to get a newline in clojure |
| 20:44 | tolstoy | (printf "%s\n" (pr-str x))? |
| 20:44 | tolstoy | (println (format "%s" (pr-str x))) |
| 20:46 | libertytrader | I think my data might all be part of one giant string now |
| 20:46 | libertytrader | after using pr-str |
| 20:47 | tolstoy | Usually, you use doall to realize all the data in a lazy sequence. |
| 20:47 | libertytrader | it prints out like "("data" "data" "data")" |
| 20:47 | tolstoy | Try just "str". |
| 20:51 | libertytrader | with str i get the lazyseq |
| 20:51 | tolstoy | ,(format "%s" (seq (take 10 (repeat :word)))) |
| 20:51 | clojurebot | "(:word :word :word :word :word ...)" |
| 20:51 | tolstoy | Seq might be it. |
| 20:56 | tolstoy | Or maybe (seq (doall (take 10 (repeat :w)))) |
| 20:57 | libertytrader | i am trying to do this in a doseq |
| 20:57 | libertytrader | basically i have collection of strings and a few functions that will return my desired output based on those strings |
| 20:57 | libertytrader | but i cant seem to be able to print out a line |
| 20:58 | libertytrader | if you have a better idea than doseq for output based on an array of strings |
| 20:58 | libertytrader | im all ears |
| 20:59 | tolstoy | When you're going to print out something that's a list, maybe (vec the-list) and see if that helps. |
| 21:00 | libertytrader | It seems like clojure is printing out the seq or vector |
| 21:00 | libertytrader | not taking them as inputs for a newline |
| 21:02 | libertytrader | the "count" of my seq is 19 |
| 21:02 | libertytrader | maybe a bug in clojure |
| 21:03 | tolstoy | I guess I don't understand. Why wouldn't it print out a vector if that's what you're asking? |
| 21:04 | libertytrader | I want to print out every element of the vector on a new line |
| 21:04 | tolstoy | Or do you want something like (doall (map #(println %) my-strings))? |
| 21:04 | libertytrader | The problem with that method is |
| 21:04 | libertytrader | I also need to print data from other functions |
| 21:05 | tolstoy | (println (string/join "\n" x))? |
| 21:06 | tolstoy | Maybe cl-format might work better? |
| 21:06 | libertytrader | I want to do something like this for(1 ....10)(printf %d %d %d", i, abcfunction(i), xyzfunction(i)) |
| 21:07 | libertytrader | in c |
| 21:07 | libertytrader | thanks a lot for your help |
| 21:07 | libertytrader | i am clueless in clojure |
| 21:07 | libertytrader | how would i print out three vectors in paraelle |
| 21:07 | libertytrader | parallel |
| 21:07 | tolstoy | (dotimes [n 10] (println (format "%d %d %d" n, (abc n) (xyz n)))) |
| 21:08 | libertytrader | ok except instead of an array of ints |
| 21:08 | libertytrader | I have an array of strings |
| 21:09 | tolstoy | Like: (doseq [s strings] (println (format "%s" s)))? |
| 21:09 | libertytrader | that is what i have been trying to do |
| 21:09 | libertytrader | unsuccessfully |
| 21:10 | tolstoy | Oh. Maybe your list of strings isn't really a list of strings? |
| 21:10 | libertytrader | it is more like (doseq [s [strings]]) though |
| 21:13 | tolstoy | (doseq [s1 strings] (doseq [s2 s1] (println s2))) |
| 21:14 | tolstoy | Or, just (clojure.pprint/pprint strings). ;) |
| 21:15 | libertytrader | ok |
| 21:15 | libertytrader | my strings are coming from a function call |
| 21:15 | libertytrader | i dont know if that make a difference |
| 21:15 | libertytrader | (apply printf (function ...)) wokrs |
| 22:33 | libertytrader | Ok I have a bad situation I have no idea how to resolve. In my code I have three S expressions |
| 22:33 | libertytrader | They evaluate to the output I want. |
| 22:34 | libertytrader | Ideally I want to output my code like "sexpr1.0, sepr2.0,expr3.0" ... etc... until I have gone through all of my lists |
| 22:34 | libertytrader | basicially like having three arrays and wanting to printf all three arrays next to each other |
| 22:34 | libertytrader | how do i do this in clojure |
| 22:34 | libertytrader | i am flabbergasterd |
| 22:43 | sdegutis | Hi! |
| 22:45 | sdegutis | amalloy: how are you? |
| 22:47 | sdegutis | tolstoy: how are you? |
| 23:17 | tolstoy | Eating figs. |
| 23:22 | tolstoy | Alas libertytrader. I bet it was something simple. refheap sis worth a 1000 misunderstandings. |
| 23:51 | backnforth | How I have a vector in a vector, how do I count the amount of the sub vectors there are on. |
| 23:55 | tolstoy | ,(count [[1 2] [3 4]]) ? |
| 23:55 | clojurebot | 2 |
| 23:55 | sdegutis | tolstoy: amazing |
| 23:55 | tolstoy | Heh. Is that what you mean? |
| 23:55 | sdegutis | backnforth: concat count |
| 23:56 | sdegutis | try: concat $ count $ vec |
| 23:56 | tolstoy | (apply + concat count)? ;) |
| 23:56 | backnforth | tolstoy, amazing |
| 23:56 | backnforth | i tried count |
| 23:57 | backnforth | such as (,count (vector :node)) |
| 23:57 | tolstoy | ,(apply + (mapcat identity [[1 2][3 4]])) |
| 23:57 | clojurebot | 10 |
| 23:58 | tolstoy | Yeah, that's what I was going for, but I bet that's not the problem you described. |
| 23:58 | backnforth | tolstoy, it isn't lol, but thanks for trying |
| 23:59 | backnforth | tolstoy, say I have 10 vectors with the namespace :node |
| 23:59 | tolstoy | Namespace? |
| 23:59 | backnforth | oh |
| 23:59 | backnforth | wrong name? |
| 23:59 | backnforth | should i use variable name? |