#clojure logs

2015-10-31

00:27pyonLet's say that (foo bar) returns a list. How do I instead return a lazy sequence, with the same contents as foo bar?
00:28justin_smith(lazy-seq (foo bar)) - but there is little advantage to this, the real advantage is to generating your result lazily
00:28pyonWell, in my case (foo bar) is actually a recursive call.
00:28pyonWait, just in case - `map` itself returns a lazy sequence, right?
00:28justin_smiththen instead of (cons h (foo arg)) do (lazy-seq (cons h (foo arg))) inside the body of foo
00:29justin_smithsure, map returns a lazy-seq
00:32pyonWhat I really want to delay is the recursive call itself.
00:32pyonRather than a cons.
00:33justin_smithyou need cons to construct the list
00:33justin_smiththe lazy-seq will delay all evaluation inside it
00:35pyonIn this situation, I'm almost sure that what needs to be delayed is the recursive call itself: https://www.refheap.com/111230
00:36justin_smithpyon: like I said, lazy-seq in that position delays both the cons and the recursive call
00:36amalloyit's easier to just wrap the whole body of the function in lazy-seq
00:36amalloybut you can indeed put it just about anywhere and it'd be fine
00:36justin_smithfair point
00:37pyon:-O
00:37justin_smithso yeah, like amalloy says, you can just do (defn mono [k xs] (lazy-seq (when-let ...)))
00:56jhnwhy does (merge-with concat {} {:a [1]}) => {:a [1]}
00:56jhnbut (swap! (atom {}) merge-with concat {:a [1]}) =>
00:56jhnIllegalArgumentException contains? not supported on type: clojure.core$concat
00:59amalloybecause that's (merge-with {} concat ...)
01:00jhnah! that makes sense. ty. :)
01:03jhnis this the least ugly way to make this work?
01:03jhn(swap! (atom {}) #(merge-with concat % {:a [1]}))
01:05pyonWhy is lazy-seq called lazy-*seq*, if it can be used on things other than sequences?
01:05jhnbecause seq is the name of the interface.
01:05jhnso you can use it with anything that is a seq
01:07jhnessentially, the "things other than sequences" you're referring to *are* actually sequences.
01:12mungojellyeverything is everything and programming is just an extended meditation on how similar everything is to everything else
01:21pyonjhn: Ah!
01:21pyonIs there any way to delay computations that don't yield (the beginning of) a sequence?
01:22rhg135defer
01:22pyonAh!
01:22rhg135Err, delay
01:23rhg135,(def v (delay (println *clojureversion*)))
01:23clojurebot#error {\n :cause "Unable to resolve symbol: *clojureversion* in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: *clojureversion* in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve...
01:24rhg135,(def v (delay (println *clojure-version*)))
01:24clojurebot#'sandbox/v
01:24rhg135,@v
01:24clojurebot{:major 1, :minor 8, :incremental 0, :qualifier alpha3}\n
03:28pyonIs there anything like a recursive macroexpand?
03:29pyonThat is, macroexpand everything. Or, even better, only macroexpand specific macros that I tell it to expand.
03:45TEttingerpyon: yeah
03:46TEttingerhttp://clojure.github.io/clojure/clojure.walk-api.html#clojure.walk/macroexpand-all
03:47TEttinger,(clojure.walk/macroexpand-all (if (and true "yay") :hooray :boo))
03:47TEttinger,(clojure.walk/macroexpand-all (if (and true "yay") :hooray :boo)))
03:47clojurebot#error {\n :cause "clojure.walk"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "clojure.walk"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.net.U...
03:47clojurebot#error {\n :cause "clojure.walk"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "clojure.walk"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.net.U...
03:47TEttinger,(require '[clojure.walk])
03:47clojurebotnil
03:47TEttinger,(clojure.walk/macroexpand-all (if (and true "yay") :hooray :boo))
03:47clojurebot:hooray
03:47TEttinger,(clojure.walk/macroexpand-all '(if (and true "yay") :hooray :boo))
03:47clojurebot(if (let* [and__4224__auto__ true] (if and__4224__auto__ "yay" and__4224__auto__)) :hooray :boo)
03:49pyonTEttinger: Ah, nice, thanks. :-)
03:54pyonIf I defined a function `foo' inside a macro or function `bar', then `foo' can only be used inside `bar', right?
03:54pyondefine*
04:02pyonIs there anything like `when-let`, but accepting multiple bindings?
04:03pyonAlso, what's the difference between `defn` and `letfn`?
04:03pyonOr, rather, why do we need them both?
04:15hiredmanbecause clojure is not scheme
04:15hiredmandef in clojure always creates a top level binding, defn expands to a def + fn
04:16hiredmanletfn creates local bindings and the names are all in scope for the functions bound to the names
04:16hiredman(similar to letrec)
04:33pyonhiredman: ah!
05:24zajirai'm new to clojure, how I import http-kit into the lein REPL? I already added http-kit to my project.clj, but I get "No such namespace: http-kit"
05:47macro-pyonWhat's the convention for embedding code in docstrings?
05:47macro-pyonMarkdown?
06:10expezmacro-pyon: no real convention, but I've only ever seen people use MD.
06:11expezmacro-pyon: It's more about what your tools can handle. CIDER will highlight stuff embedded with `` in docstrings and comments for example.
06:11expezembedded in*
06:12expezIs : a part of the keyword, or is it more correct to think of this as a token for the reader?
06:12expezI'm leaning toward the latter
06:12expez,(name :foo)
06:12clojurebot"foo"
06:13expezwhich I think should return ":foo", for the former interpretation to hold
06:14expezI'm asking because we're still highlighting the : with keyword face in clojure-mode, even though the package prefix is now in a different color. I'm starting to think this is a mistake.
06:14vijaykiran,[(keyword "a")(keyword :a)(keyword "a")]
06:14clojurebot[:a :a :a]
06:17justin_smith,(keyword ":do not do this")
06:17clojurebot::do not do this
06:30WickedShellIs the ^:const hint considered valid/used with fn's?
06:30justin_smithyou can use it, bu afaik it won't do anything
06:31WickedShellNot surprised to hear that (or really bothered tbh)
07:09pyonIs there a better way to do this? https://www.refheap.com/111232
07:09pyonI've been wondering if I could use `loop` instead.
07:11pyonErrr, replace diff-loop with differentiate.
07:11pyonhttps://www.refheap.com/111234 fix'd
07:20justin_smiththat seq call is redundant - the destructuring implies it
07:20pyonAh!
07:21justin_smithotherwise, looks good to me (maybe you could avoid using the same lhs twice in the let binding).
07:22justin_smith,(let [[h & t] "hello"] [h t])
07:22clojurebot[\h (\e \l \l \o)]
07:23pyonAh!
07:23pyonIf let bindings are sequential, this should do what I want it to do.
07:23pyonBut, yeah, I should probably rename the second `xss`.
07:24justin_smithyes they are sequential
07:29pyonIs there no way to make this code shorter? (fn [[i xs]] [i (cons x xs)]) seems too long for what it achieves.
07:31justin_smith#(update-in % 1 conj x) if xs is a list, and [i xs] is a vector
07:31justin_smitherr
07:31justin_smithupdate, not update-in
07:31pyonAh!
07:32justin_smith,(update [:a '(:b :c :d)] 1 conj :aa)
07:32clojurebot[:a (:aa :b :c :d)]
07:32justin_smithit breaks if they are not list and vector though
07:44xeqipyon: I'd prolly write that as a variation of https://www.refheap.com/111236
07:44pyonWhoa, that's so much neater.
07:45pyonAlas, incorrect. :-|
07:46pyonAlso, constantly performing (take i) and (drop i) for all values of i... is a little tad inefficient, isn't it? :-O
07:46xeqiack, pasted the wrong one. (drop (inc i) xs)
07:46pyonAh, good.
07:50xeqimight be. But I could see it the same as conj-ing the list when the (map fun (map fun (map fun xss))) stack unwinds with a layer for each previous value in the original
07:50xeqiif I was performance sensitive, I'd assume xs is a vector and use (subvec ...)
07:51pyonWhat's subvec do?
07:51pyonNever mind. Me being stupid. :-|
07:51pyonCan vectors be efficiently concatenated, though?
07:59xeqi`concat` returns a lazy seq that walks underneath, so depends on how you're going to use it later. An alternative is `into` (https://www.refheap.com/111237) which uses transients underneath to build a new sequence
08:00xeqihere's where I refer you to setup a suite with https://github.com/hugoduncan/criterium if this seems performance sensitive
08:00pyonChecking.
08:07pyonFrom [1 2 3 4 5], how do I get [[] [1] [1 2] [1 2 3] [1 2 3 4] [1 2 3 4 5]]? (not necessarily vectors)
08:07pyonAnd also [[1 2 3 4 5] [2 3 4 5] [3 4 5] [4 5] [5] []].
08:09justin_smith,(iterate pop [1 2 3 4 5])
08:09clojurebot([1 2 3 4 5] [1 2 3 4] [1 2 3] [1 2] [1] ...)
08:09justin_smith,(iterate rest [1 2 3 4 5])
08:09clojurebot([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5) ...)
08:10justin_smithyou'll want a test for when it ends up empty
08:10justin_smithor a take-while
08:10pyonAh!
08:10justin_smith,(take-while seq (iterate rest [1 2 3 4 5]))
08:10clojurebot([1 2 3 4 5] (2 3 4 5) (3 4 5) (4 5) (5))
08:10justin_smith,(take-while seq (iterate pop [1 2 3 4 5]))
08:10clojurebot([1 2 3 4 5] [1 2 3 4] [1 2 3] [1 2] [1])
08:11justin_smithwhen it's not a vector, you can use but-last instead of pop, but pop is much better for vectors
08:11pyonAh!
08:11pyon,(let [xs [1 2 3 4 5]] (map vector (range) xs (iterate pop xs) (iterate rest xs)))
08:11clojurebot([0 1 [1 2 3 4 5] [1 2 3 4 5]] [1 2 [1 2 3 4] (2 3 4 5)] [2 3 [1 2 3] (3 4 5)] [3 4 [1 2] (4 5)] [4 5 [1] (5)])
08:12pyonWait, no, I need something like the reverse of (iterate pop xs).
08:13justin_smithwell, we do have reverse
08:13pyonyeah, but that turns out to be O(n²).
08:14justin_smithwhy n squared instead of n?
08:15pyonI mean, for the thing. Each reverse is O(n).
08:15pyonBut I need n reverses.
08:17justin_smith,(reduce conj [] [1 2 3 4 5])
08:17clojurebot[1 2 3 4 5]
08:17justin_smitherr
08:17justin_smith,(reductions conj [] [1 2 3 4 5])
08:17clojurebot([] [1] [1 2] [1 2 3] [1 2 3 4] ...)
08:17pyonWhy can I do (#(vector %1 %2 %1 %2) "foo" "bar"), but not (#([ %1 %2 %1 %2]) "foo" "bar") ?
08:17pyonAh!
08:18justin_smith,'#([:a]) ; this should help
08:18clojurebot(fn* [] ([:a]))
08:19pyonAh!
08:25pyonWhat's the function for getting the i-th element of a vector?
08:25justin_smithnth
08:25justin_smithwith a vector you can also use get
08:25pyonAh, sweet. :-)
08:26justin_smith,((juxt nth get) [:a :b :c] 1)
08:26clojurebot[:b :b]
08:26justin_smith,(get-in [:a [:b [:c [:d [:e]]]]] [1 1 1 0])
08:26clojurebot:d
08:26justin_smith,(get-in [:a [:b [:c [:d [:e]]]]] [1 1 1 1 0])
08:26clojurebot:e
08:30pyonI found a neat solution: https://www.refheap.com/111238 :-)
08:31pyonWell, actually, it's mostly based on what you guys suggested. :-)
08:31TEttinger,([0 1 2 3] 0)
08:31clojurebot0
08:31TEttinger,([0 1 2 3] 3)
08:31clojurebot3
08:31TEttinger,([0 1 2 30] 3)
08:31clojurebot30
08:31TEttingervectors are functions of numerical indices too
08:31pyon:-O
08:32pyonThat makes sense.
08:32TEttingersimilar to maps and their keys
08:32TEttinger,({:a 1 :b 2} :b)
08:32clojurebot2
09:28sobelbut keys are functions and indices are not, so you can write (:a {:a 1 :b 2}) => 1 but (1 [2 3 4]) yields an exception
09:29sobeljust to note a little asymmetry there :)
09:49pyonWhat was the syntax for creating a record value? (not the record type)
09:50pyonOh, there was a dot at the end of the record's name! I forgot that.
09:57Glenjaminthere's also the clojure function ->Record
09:58Glenjamin,(do (defrecord Example [a b]) [(Example. 1 2) (->Example 1 2) (map->Example {:a 1 :b 2})])
09:58clojurebot[#sandbox.Example{:a 1, :b 2} #sandbox.Example{:a 1, :b 2} #sandbox.Example{:a 1, :b 2}]
10:10pyonCould someone please help me debug this macro? https://www.refheap.com/111241
10:10pyonWhen I run this in the REPL, I get the desired result: `[~@(mapcat (partial constructor-partial-derivative :r) node)]
10:10pyonBut, for some reason, when I run it from within the macro, it doesn't work. :-|
10:34xeqipyon: in total-differential you want `map-indexed` instead of `keep-indexed` since you keep everything
10:34pyonAh, thanks!
10:34pyonAlso, I found the solution to the defderivative problem.
10:34pyonI needed an eval.
10:34pyon(eval base)
10:41xeqipyon: can defderivative be a function? looks like it just evaluates everything and passes it through?
10:41pyonxeqi: defderivative isn't finished.
10:41pyonIn the end, it will be a macro - a much more complex one than defpolynomial.
10:42pyonIt's just that I needed to see something for debugging purposes.
11:34pyonIs there anything like map, but which leaves the first element untouched?
13:50gfrederickspyon: that'd be a pretty weird function to have built in I think, but it's easy to write yourself
13:51gfredericks,(defn map-rest [f coll] (if (empty? coll) coll (cons (first coll) (map f (rest coll)))))
13:51clojurebot#'sandbox/map-rest
13:51gfredericks,(map-rest inc (range 5))
13:51clojurebot(0 2 3 4 5)
13:51gfredericks,(map-rest dec ())
13:51clojurebot()
13:55xeqi,(map-rest dec nil)
13:55clojurebotnil
13:56xeqiah, map returns () cause it uses lazy-seq
13:57J_Arcane,(first ())
13:57clojurebotnil
13:57J_Arcane,(rest ())
13:57clojurebot()
14:36justin_smith,(map (juxt rest next) [() [] nil])
14:36clojurebot([() nil] [() nil] [() nil])
14:53xeqiwhat function turns a vec of keys and a vec of vals into a map?
14:53justin_smithzipmap
14:53justin_smith,(zipmap [:a :b :c] [1 2 3])
14:53clojurebot{:a 1, :b 2, :c 3}
14:54xeqi(inc justin_smith)
14:54xeqioh, right.. no lazybot
15:24skoudeNoob question,, but I have a json parsed with chesire.. and it's like [ { employee: {firstname: "test", lastname: "test" }, employer: { companyid: "test"} } , {employee: {firstname: "test2", lastname: "test2}, employer: {companyid: "test2"} }].. So how can I get all of the firstnames?
15:25skoudeI tried to use (get-in parsed_json["employee" "firstname"], but it does not work
15:27justin_smithif that's the real structure, it should be (get-in parsed_json [0 "employee" "firstname"])
15:28justin_smithunless you provided the keywordize option to cheshire, in that case change the strings to keywords
15:28rhg135 or map it
15:28justin_smithoh, all the first names
15:28justin_smithmissed that part, right you are rhg135
15:29skoudethanks, now I got it. I had the keywordize option so I use keywords and it works :)
15:36skoudehmm.. I used (cheshire.core/parse-string s true)) to parse the json.. and if I print the parsed json, it looks okay.. but still I get only nil when using: get-in parsed_json [0 "employee" "firstname"])
15:36justin_smithskoude: those still are not keywords
15:36justin_smithand the true option specifies it should make kewords
15:36skoudesorry pasted wrong line: ude (+i) 8:fn/#clojure (+cnt) Act: 1,2,3,4,5,6,11,13
15:37justin_smith(map #(get-in % [:employee :firstname]) parsed_json)
15:37skoudeused get-in parsed_json [0 :employee :firstname])
15:38skoudeand still get nil
15:38justin_smithwhat does it look like when you just enter parsed_json at the repl and see the contents?
15:38skoudeit looks perfectly okay :)
15:38justin_smithskoude: can I see it?
15:39skoudejustin_smith: I cannot paste it straight because it's a json from production system... But it starts like:
15:40skoude[
15:40skoude {
15:40skoude "employee": {
15:40skoude "firstname": "KAI",
15:40skoude "lastname": "KALLUNKI",
15:40justin_smiththat's not parsed
15:40justin_smiththat's json
15:40skoudeI use println to print it, and I tough that just a clojures way to display it?
15:41justin_smithno, clojure will not display a real hash-map that way, use prn on it
15:41justin_smithI bet you will discover an unparsed string with prn
15:42skoudeyeah prn displays: "[\n {\n \"employee\": {\n \"firstname\": \"KAI\",\n
15:42justin_smithyes, that is an unparsed string
15:43skoudehmm.. strange, because I still call: (def parsed_json( parse json))
15:44justin_smithis the json somehow double-encoded?
15:44skoudeand parse is the function that has: (cheshire.core/parse-string s true)) -defined
15:46skoudeaah now I got it.. the problem was this: (def json (pr-str(:body (http-get-request
15:46skoudeit should be only: (def json (:body (http-get-request "http
15:48skoudenow if I do prn it shows like: ({:employee {
16:03skoudeThanks for the help, it works perfectly now.. Just takes a little time to get used to clojure when coming from java
16:05justin_smithin general, don't trust println to show you what something actually is - use prn for less ambiguity
16:05skoudethanks for the tip, will do and use that
16:06justin_smith,(println {:a "0 :b 1"})
16:06clojurebot{:a 0 :b 1}\n
16:06justin_smith,(prn {:a "0 :b 1"})
16:06clojurebot{:a "0 :b 1"}\n
16:09cloj_devwhats wrong with this destructuring of a vector? http://pastebin.com/kbvDGxCj
16:24Glenjaminyou have two arguments
16:24Glenjamina map, then a vector
16:24Glenjaminbut you're calling it with only a vector
16:25ianhedoesitalso your map destructuring is not probably how you expect it to be.
16:26ianhedoesitif you try `(foo {0 :a 3 :b} [1 2 3 4])` you might see part of the problem.
16:26ianhedoesitI might recommend this helpful cheatsheat (https://gist.github.com/john2x/e1dca953548bfdfb9844) to compare - specifically https://gist.github.com/john2x/e1dca953548bfdfb9844#maps in this case.
16:27justin_smith ,(let [{a 0 b 1} [:foo :bar]] [b a])
16:27clojurebot[:bar :foo]
16:27jonathanjhmm, how do i return a value from :post! in liberator?
16:28justin_smithianhedoesit: the map syntax works fine for selecting indexes, see above
16:28ianhedoesitjustin_smith: huh, interesting.
16:28justin_smithianhedoesit: because vectors are associative by index
16:28ianhedoesitright, that makes sense.
16:28irctcHello everyone.
16:28justin_smithit should fail with a list though
16:29ianhedoesit(it does)
16:29irctcI need help setting up reagent. I've been trying to figure it out but I just can't get it to work. Can somebody help me please?
16:29ianhedoesitI'm still going to assume that that wasn't what cloj_dev was trying to do, however. but maybe I'm wrong
16:30justin_smithirctc: do you have specific questions?
16:31cloj_devlein new reagent
16:31irctcYes. I put reagent in the dependencies in the project.clj file in my compojure project and Eclipse/counterclockwise plugin downloaded them all automatically for me. Now, how do I actually imlplement reagent in my web pages?
16:32irctcDo I put require [reagent.core :as r] in my views.clj file that renders my webpage and write my reagent code there or should I do something else?
16:33justin_smithirctc: first step is to set up clojurescript. reagent is not clojure (clj) it is clojurescript (cljs)
16:34irctcOk, so in order for reagent to work I first need to download the dependencies for clojurescript?
16:34justin_smithirctc: next step is to have a cljs file that calls reagent.core/render-component, that sets up the rendering and you need to pass it an atom, changes to that atom will make new re-rendering of the page happen
16:34justin_smithirctc: your dep manager should do that for you, what you need to do is define a clojurescript build in your project
16:34justin_smithirctc: are you using leiningen?
16:35irctcYes I am. leiningen and compojure for my web app.
16:35irctcAnd hiccup to render html5 components.
16:35justin_smithOK, so your first step is to check out lein-cljsbuild which you can use to set up clojurescript building
16:36justin_smithirctc: reagent is similar to hiccup (uses the same input syntax just about) but runs on the browser instead of your server
16:37justin_smithirctc: once you can get a basic hello-world cljs built and embedded into your html page and displaying when you load the page, you can move on to pulling in reagent
16:37irctcOk, so I should set up lein-cljsbuild in my compojure app before I set up reagent?
16:37cloj_devI'm trying to do something like this in clj http://pastebin.com/8mz7yZBT
16:37cloj_devI know why its wrong but I can't figure out a good solution
16:38justin_smithirctc: right, reagent is a dep that cljsbuild will use, cljsbuild will make javascript from your clojurescript code, that the browser will run to create your page
16:39irctcOk, great. Thanks for your guidance. I might have some more questions as I go along setting it up, but I'm gonig to try and set everything up now.
16:39justin_smithlein-cljsbuild and the reagent project both have good docs
16:40cloj_devreagent is very easy to get going if you have lein
16:40ianhedoesitcloj_dev: are you trying to reverse a vector?
16:40cloj_devsort of
16:41ianhedoesitor are you trying to stagger it backwards?
16:41justin_smithcloj_dev: that won't ever return - you need a conditional around recur
16:41cloj_devI want (foo [1 2 3 4]) to be [2 1 4 3]
16:42justin_smithyeah, all you need is an if check for rest being empty, and just returning [b a] if rest is empty
16:42justin_smithwell - you might need one or two other things, but that will be a start
16:42jonathanjany recommended HTTP client libraries?
16:43jonathanji have no idea how to choose between the top few google results
16:43justin_smithjonathanj: I've found http-kit.client better than clj-http.client
16:43jonathanjjustin_smith: why?
16:44justin_smithclj-http has some bad behaviors for poorly behaved endpoints in my experience, and wasn't nearly as nice for async stuff
16:44justin_smithfor example timeout arguments seemingly not working as expected
16:44cloj_devhm this function won't work
16:44cloj_devhttp://pastebin.com/zhmDfU09
16:45jonathanjjustin_smith: thanks, that sounds like a good recommendation
16:46ianhedoesitcloj_dev: what do you mean it won't work?
16:46justin_smithcloj_dev: do you expect your input to be individual items, or a sequence?
16:46cloj_deva sequence I beliece
16:46ianhedoesit(foo 1 2 3 4) outputs "fun"
16:46cloj_devlike [1 2 3 4]
16:46cloj_devoh
16:46justin_smithcloj_dev: because as of now it is looking for individual items, you need an extra pair of [] around the arg list
16:46cloj_devah okay
16:46cloj_devgood call
16:47justin_smithbecause the recursive version would be a pain without that
16:47cloj_devthanks
16:57irctcI ran into a problem installing lein-cljsbuild. When I try to do lein cljsbuild auto like it says on the github page: https://github.com/emezeske/lein-cljsbuild I get an error.
16:57irctclein cljsbuild auto Watching for changes before compiling ClojureScript... Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/util__init.class or cljs/util.clj on classpath: , compiling:(cljs/closure.clj:1:1)
16:58irctcI have no idea what that exception is all about.
16:58justin_smithirctc: can you share your project.clj on refheap?
17:00irctcSure. Here it is: https://www.refheap.com/78c74e95513c162e1816f5cec
17:02justin_smithmy first guess is an incompatibility between your clojurescript dep version and the lein-cljsbuild dep version
17:03irctcI just took the latest ones, like it says on their github pages.
17:03cloj_dev_hm, this gives an infinite loop http://pastebin.com/Bbk4rS9x
17:04justin_smithirctc: sure, but I don't think they can guarantee they are compatible with every cljs version - and the error you got looks like an incompatible version issue between cljs and cljsbuild
17:05justin_smithcloj_dev_: you are never modifying that "rest" argument - it will never change in that loop
17:05justin_smithso if it starts non-empty, it can never end up empty
17:05cloj_dev_ah right
17:06irctcOk, I'm going back to 0.0-3190 Hopefully that works.
17:06irctcI tried 1.7.10 but that just produced the same error.
17:11irctcOk if it works is it supposed to just say Watching for changes before compiling ClojureScript... and not give me back my prompt?
17:11justin_smithright
17:11justin_smithunless you provide the "once" arg
17:11justin_smithif you provide once it will exit after compiling
17:11justin_smithit will recompile if it sees new cljs files or edits to existing files
17:12justin_smithnext step is to pull the generated js into your html so that it can run
17:12irctcOk. And how do I now run my lein ring server command? Do I just leave this terminal window open and just run it from another one?
17:12justin_smithyeah, just run it in a different terminal
17:13justin_smithstepping away from the computer for a bit... I'll check in later
17:13irctcOh, ok, so the next step for me is to actually create a clojurescript file and then incorporate it into my views.clj function that will generate my page?
17:13irctcOk, thanks a lot for all your help. :)
17:13jonathanjjustin_smith: how do i send a custom body with http-kit.client?
17:14jonathanjjustin_smith: in this case i want to send a JSON body in a POST request
17:14jonathanji see :form-params but it sounds like it's form-encoded?
17:15jonathanjapparently :body is an option, although the client docs <http://www.http-kit.org/client.html&gt; fail to mention it
17:16cloj_dev_darn, still getting an infinite loop http://pastebin.com/ZmDbh6T5
17:21ianhedoesitcloj_dev_: you're still not doing anything with the rest of the list. if you change `[d c]` to `(println [d c])` you'll see what's happening
17:24cloj_dev_hm tried that
17:24cloj_dev_it did what I expected I think
17:26oddcullyjonathanj: something like e.g. (es/post (str uri url-part) {:content-type :json :as :json :body (json/generate-string request)}))
17:52irctcIn clojurescript in my project.clj where it says: :source-paths ["src-cljs"] where is that source path actually supposed to be?
17:52irctcIs it supposed to be on the same level as src or in the resources or in resources/public?
17:52irctcOr somewhere else?
18:05justin_smithirctc: that is the path from the project.clj to the top level of the sources
18:06justin_smithso yeah, same level as src
18:07irctcThank you. :)
18:08irctcI actually compiled my clojurescript file into a main.js file, but I can't see the newly formed file in my eclipse editor.
18:09irctcNevermind. I found it in my file system.
18:09irctcFor some reason eclipse is just not showing it in the file structure.
18:11irctcSo when I have multiple clojurescript files, will they all get compiled into this single main.js file?
18:16justin_smiththe main.js file will make the rest of them load, but you don't get the single file without advanced compilation iirc
18:18irctcOk.
18:18irctcAnd now when I call the main.js in my views.clj file, how do I point to the actual function that I want to display its results on my page?
18:19irctcI am using this to call the main.js file: (hic-p/include-js "/js/main.js")
18:19justin_smithyour html should load your main.js and run some function in it
18:19irctcThat doesn't happen.
18:19justin_smithirctc: it has to
18:20justin_smithirctc: there's no magic that makes a browser run clojurescript
18:20justin_smiththere has to be a js file, and there has to be some html file that makes the browser load the js file
18:20justin_smithyour cljs is just there to be compiled and turned into that js
18:20irctcI put the call to the main.js in my hed generating function which works as it generates all other html elements, but it doesn't render the simple "Hello world text" from my clojurescript file.
18:21irctcHead generating function*
18:21justin_smithOK sure, you can generate the html
18:22justin_smithpoint is, the entry point is the html which the browser understands, then you set up your rendering to happen when your main method in cljs gets called
18:22justin_smitheventually, that should be a call to reagent
18:22justin_smithonce you establish you can get your cljs to load and run
18:23irctcSo do I call the cljs function from my views.clj file just like I would with any other function?
18:23justin_smithhow would your clj code make anything happen in the browser?
18:24justin_smithI mean it can, but you need some mechanism of communication...
18:26irctcWell this is what I am confused about. I am calling the main.js file and I am assuming that it loads because I loaded a plain javascript file the same way. Next I want it to display the words "Hello world" on my page that the clojurescript function (hello) makes, but when I open my browser window that doesn't write anything on my page.
18:28rhg135You have to call that function
18:28justin_smithirctc: right, this is the part where reagent comes in. First verify your cljs runs (eg. you can run (.alert js/window "hello") inside your cljs and verify you get the popup), after that to get rendering happening, that is when you start using reagent
18:28irctcIf the main.js file makes the rest of the clojurescript files load, then how do I access my hello function in example.cljs and load the results of executing that function on my page?
18:28justin_smithrhg135: well, just because some function returned "hello world" isn't enough to make the browser show the message
18:29justin_smithirctc: you need a client side renderer, that's what reagent does
18:29justin_smithirctc: or you can play with the dom, or with jquery, but right now those would both be wastes of your time
18:29irctcOk, I'm going to verify that it works first with that alert message.
18:30rhg135Oh, I misread, justin_smith, right
18:30justin_smithcool, and if that works, you can start hooking up reagent, then things get fun :)
18:30irctcI can't wait. Keeping my fingers crossed. :)
18:32irctcIt worked!!! :D
18:33irctcI don't know I've ever been so happy to see an alert message before. lol :D
18:34justin_smithirctc: cool, next step, now that you know you can compile cljs and make it run, is make sure you have reagent in your deps, and call reagent/render-component with the apropriate args
18:34justin_smithirctc: spend some time with the reagent docs, they are really good and thorough, and you should be able to follow along with any examples now that you have this much set up
18:35justin_smithirctc: reagent/render-component will watch an atom, and every time the atom changes, it will update the contents of the page (that's the big picture, of course there are lots of details to set up)
18:36irctcThanks so much! :)
18:36irctcBtw, when calling reagent/render-component, do I call that in my views.clj file or in the cljs file?
18:37justin_smithin the cljs
18:37irctcAnd when I require reagent do I need to require it in my views.clj as well or just in my cljs file?
18:37justin_smithsince it needs to run in the browser
18:37justin_smithirctc: what does views.clj do?
18:37irctcGenerates my pages.
18:37irctcPart of my compojure framework.
18:38justin_smithyeah, this is actually an alternate way to generate pages - because compojure doesn't run in the browser
18:38justin_smiththe concept is that instead of making the page on the server and sending to the client, the cljs code constructs the page on the client side, and just asks the server for data - views.clj would be used to make handlers that send data the frontend needs
18:39irctcOk, so in my cljs file, right after I write my function I'll call (reagent/render-component) and that will watch over all of my atoms, and then I can just compile it and load it the same way I did with this previous alert message?
18:41irctcOk, cool, because then I can use the client to make some async calls to the server to avoid blocking the user.
18:41justin_smithsomething like that - add the render-component to the main cljs function, and what the reagent docs will show is how to hook up the atoms to manage the page state
18:41irctcThat's the whole reason why I'm using cljs and trying to use reagent in the first place. :)
18:41justin_smithand yeah, make async calls to the server (calling functions in views.clj) that load the data you need to load into the page
18:41justin_smithright
18:42irctcCool, thanks. :)
18:42irctcI am using this for the reagent tutorial https://reagent-project.github.io/ Hopefully I'll be successful in setting it all up.
18:43justin_smithyup, that's the one
18:44justin_smithirctc: if you scroll down a bit, it shows how to set up the cljs namespace and call render-component
18:46irctcCool. Thanks. :)
18:50irctcI copied and pasted the entire first example that mentions reagent/render-component except for the name of the namespace just to test it out but I can't get anything to display on my page.
18:51justin_smithOK, I bet you will find compilation errors in your cljsbuild window, or js errors in the browser console
18:52irctcCompiling ClojureScript... Compiling "resources/public/js/main.js" from ["srccljs"]... Successfully compiled "resources/public/js/main.js" in 7.157 seconds.
18:52irctcEverything seems allright.
18:52irctcI even restarted the server.
18:52justin_smithok, how about the browser js console
18:53irctcYou were right. There is something in the browser js console: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create
18:53irctcAlthough I don't know what that means.
18:54justin_smiththat's not an error though
18:56irctcI know, but that's all I get and I don't know why I'm not getting any output on my page.
18:57justin_smithwhat do you see when you inspect the page (via right-click)
18:58irctcI see it loads the main.js file: <script src="/js/main.js" type="text/javascript"></script>
18:58justin_smithis there anything in the page body?
18:59irctcOther than that there's nothing else there.
18:59justin_smithirctc: in the r/render-component call, what is the last arg?
19:00irctc(.-body js/document)
19:00justin_smithOK, so you tell reagent to render to the document body, but when you inspect the page there is no body?
19:01irctcExactly.
19:02justin_smithhow about making sure there is a body to the page so that it can render?
19:02irctcWell I mean there is a body, there's jut no content in it.
19:02justin_smithI have to go
19:03irctcOk, thanks for all your help.
19:03irctcI really appreciate it.
19:03irctc:)
19:30pyonI want to make two macros, `deffoo` and `defbar`. `deffoo` creates a bunch of stuff, and the last thing it creates is a variable foo: (`def ~name { :meta ... :data ... :goes ... :here ... }). What I want `defbar` to do is (0) create a foo, (1) some bar-specific work, (2) insert more metadata into the metadata object.
19:31pyonIn a language like Common Lisp, I'd just create the metadata object from `deffoo` and then mutate it from `defbar`.
19:31pyonWhat would a more idiomatic Clojure solution, without mutability, look like?
19:49pyonIs there any function like `map`, but which discards the result of applying the function to the list's elements?
19:50pyonBasically something like (keep func seq), except (func elem) *always* returns nil.
19:51rhg135run!
19:52rhg135in 1.8 of course
19:52pyonrhg135: Oh, nice, thanks!
19:52rhg1351.7*
19:52pyonI'm using 1.7.0, which comes with my package manager, and run! works.
19:52rhg135ok good
20:01pyonHow do I check whether a symbol refers to an existing variable.
20:01pyon?
20:03rhg135resolve
20:04rhg135,(do (resolve 'x2) (resolve '+))
20:04clojurebot#'clojure.core/+
20:05rhg135uhh, the former returns nil
20:05justin_smith,(resolve 'to-quit-smoking)
20:05clojurebotnil
20:06rhg135,(resolve 'to-lose-weight)
20:06clojurebotnil
20:06pyonAh!
20:06justin_smithhaha
20:06pyonlol
20:06pyonrhg135: ty!
20:06rhg135not in cljs though
20:07rhg135in cljs you need to intrude on the compiler
20:07justin_smithrhg135: can't you do like (aget js/window "your-ns/your-var") or something like that?
20:08rhg135that assumes you want to hardcode the ns name. so forget DRY
20:08justin_smithrhg135: aget takes a string as an arg...
20:09rhg135cljs lacks getting the name at runtime, at least back in 201.r4
20:09pyonIs there any way to tell the Clojure REPL “forget every single thing I've defined before”, without restarting it?
20:10justin_smithrhg135: it's an array operation, you are treating the object as an array and looking up a key in it
20:10rhg135,(run! (partial ns-unmap *ns*) (ns-publics *ns))
20:10clojurebot#error {\n :cause "Unable to resolve symbol: *ns in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: *ns in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: *ns in this conte...
20:11rhg135err, something lise that
20:11justin_smithrun takes a function and a collection
20:11justin_smitherr, run! does I mean
20:12pyon:-O
20:13rhg135justin_smith: I mean you can't know the actual ns name at runtime without hardcoding at compile time. unless dnolen endowed it by now
20:14Bronsajustin_smith: that won't work with advanced compilation
20:14justin_smithBronsa: ahh, good point
20:14BronsaI don't think there's a good way to do resolve in cljs
20:14justin_smithrhg135: the ns at runtime is 'user anyway, aside from dev time shenanigans
20:14rhg135oh and that. thx Bronsa
20:15rhg135'cljs.user but yeah
20:16rhg135you can do it at compile time via the api
20:16rhg135I think
20:32pyonHow could I make a macro for asserting multiple things in a single place?
20:32pyon(multi-assert test1 "failed test1" test2 "failed test2" ...)
20:51rhg135,(defmacro multi-assert [& pairs] `(do ~@(for [[t msg] (partition 2 pairs)] `(assert ~t ~msg))))
20:52clojurebot#'sandbox/multi-assert
20:52justin_smithwhy would this need to be a macro?
20:52rhg135ah. yeah he's right
20:54justin_smithwell, because assert is a macro I guess...
20:54rhg135maybe lazyness, aka if a certain test is very expensive
20:54justin_smiththough we can still do this without another macro
20:55justin_smith,(map #(assert (first %) (second %)) [[true "ok"] [false "oops"]])
20:55clojurebot#<AssertionError java.lang.AssertionError: Assert failed: oops\n(first p1__68#)>
21:32pyonrhg135: justin_smith: ah, thanks!
21:36pyonhttps://www.refheap.com/111249 -- here, in constructor-metadata, how do I quote the name?
21:37pyonIf I do 'name , it gives me (quote name), but what I actually want to quote is the *value* of the variable name.
21:38pyonTo be clearer - how do I quote the value of a variable?
21:38justin_smitheither the caller needs to quote name, or constructor-metadata needs to be a macro
21:39justin_smithyou can't get the quoted version of an argument in a function
21:39pyonOh.
21:39pyonBut, if I make it a macro, then I can't map over it in defpolynomial. Mmm...
21:40justin_smithsounds like the caller needs to quote the names
21:41pyonI can think of ways to do it, but not in syntactically pleasing ways. :-|
21:47cloj_devI'm still working on this problem : http://pastebin.com/9mBXSgxm
21:47cloj_devanyone have a suggestion?
21:48justin_smithcloj_dev: next never changes
21:48cloj_devhuh
21:49cloj_devah I see that now
21:49justin_smith,((fn [[a b & rest]] (if (empty? rest) [b a] (concat [b a] (recur rest)))) [1 2 3 4 5 6])
21:49clojurebot#error {\n :cause "Can only recur from tail position"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.UnsupportedOperationException: Can only recur from tail position, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyzeSeq "Compiler.java" 6891]}\n {:type java.lang.UnsupportedOperationException\n :message "Can only recur from tail position"\n ...
21:49justin_smithhrmph
21:50justin_smith,((fn flipper [[a b & rest]] (if (empty? rest) [b a] (concat [b a] (flipper rest)))) [1 2 3 4 5 6])
21:50clojurebot(2 1 4 3 6 ...)
21:50justin_smithit's still bad if the arg count is odd though
21:50cloj_devoh nice
21:51cloj_devI thought you can't have recursive functions that don't call recur
21:51justin_smithyou can, they just don't get optimized
21:51justin_smithbut with laziness (concat) that is less of an issue
21:51cloj_devoh
21:54justin_smithcloj_dev: it's normal for lazy functions to use direct self-call instead of recur
21:54cloj_devinteresting
21:54cloj_devhow do you know if a function is lazy?
21:54cloj_devis it self evident, or documented?
21:54cloj_devor you just know by rote?
21:54justin_smiththere's basically one lazy class: clojure.lang.LazySeq
21:55justin_smithlazy functions are the ones that use that class directly (via the lazy-seq function) or call others that use it (like map or concat or filter)
21:55justin_smithfunctions should document if they are lazy
21:55cloj_devright cool
21:56rarebreedthere's also the delay macro
21:56justin_smiththat's not lazy
21:56rarebreedwhich will delay evaluation of a function
21:57justin_smithyes, but it's not considered lazy by clojure's standards - with a lazy seq accessing the value can force execution, with delay you need to deref
21:57justin_smithI'd group delay closer to future and promise
21:57justin_smithin terms of spheres of functionality
21:58rarebreedyes, if you use delay, you have to force on the result or deref it
21:58justin_smiththings that could give you a value, but you may need to wait, and you can check exlicitly whether they are realized
22:01pyonOk, just to be sure. What's the simplest way to make a macro quoteall, such that (quoteall foo bar qux) expands to ['foo 'bar 'qux] ?
22:05pyon,(defmacro unusable [foo] (class foo)) (unusable 'foo) ; why?
22:05clojurebot#'sandbox/unusable
22:06pyon,(unusable 'foo) ; why?
22:06clojurebotclojure.lang.Cons
22:06pyonHow is this a cons cell?
22:12justin_smith,''foo
22:12clojurebot(quote foo)
22:12justin_smiththat's why
22:13gfredericks,(defmacro quoteall [& args] (mapv #(list 'quote %) args))
22:13clojurebot#'sandbox/quoteall
22:13gfredericks,(quoteall foo bar qux)
22:13clojurebot[foo bar qux]
22:13justin_smith~macros
22:13clojurebotmacros are just a game with symbols
22:13gfredericks,(defmacro quoteall [& args] `'[~@args])
22:13clojurebot#'sandbox/quoteall
22:13gfredericks,(quoteall foo bar qux)
22:13clojurebot[foo bar qux]
22:13gfrederickshaha I just wrote `'[~@args] #yolo
22:14pyonjustin_smith: Ah!
22:14justin_smithgfredericks: you could have gotten a #reader-macro in there if you tried
22:15justin_smithand #yolo doesn't count :P
22:15pyon,(class (first (quoteall (foo bar qux)))
22:15clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:15pyonoops
22:15pyon,(class (first (quoteall (foo bar qux))))
22:15clojurebot#error {\n :cause "Unable to resolve symbol: quoteall in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: quoteall in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: quoteal...
22:15pyonI'm dumb.
22:15pyon,(class (first (quoteall foo bar qux))
22:15clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:15pyonNever mind.
22:16gfredericks,(class (first (quoteall foo bar qux)))
22:16clojurebot#error {\n :cause "Unable to resolve symbol: quoteall in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: quoteall in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: quoteal...
22:16gfredericks,(defmacro quoteall [& args] `'[~@args])
22:16clojurebot#'sandbox/quoteall
22:16gfredericks,(class (first (quoteall foo bar qux)))
22:16clojurebotclojure.lang.Symbol
22:16pyonAh!
22:16pyonWhat exactly does `' do?
22:16gfredericksclojurebot is forgetful
22:17pyonHeh, makes sense. :-)
22:17justin_smithpyon: it wraps quote in syntax-quote, and it is usually a sign of mischeaf
22:17gfredericks,(defmacro quoteall [& args] (list 'quote (vec args)))
22:17clojurebot#'sandbox/quoteall
22:17gfredericks,(quoteall foo bar qux)
22:17clojurebot[foo bar qux]
22:17gfrederickspyon: ^ that oughta be a much simpler definition to understand
22:17pyonAh :-)
22:21amalloy,'`'[~@args]
22:21clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat args))))))
22:21amalloy^ that oughta be a less simple explanation to understand
22:21justin_smithlol
22:23OrbitalKittenhi guys, do you know if there's a way to generate the members in deftype/defrecord without going into eval hell?
22:23gfredericks,(inc amalloy)
22:23clojurebot#error {\n :cause "Unable to resolve symbol: amalloy in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: amalloy in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: amalloy i...
22:23gfredericks(inc amalloy)
22:23gfredericksOrbitalKitten: I think defrecord has a way
22:24gfredericks,(defrecord OrbitalKitty [weight velocity])
22:24clojurebotsandbox.OrbitalKitty
22:24gfredericks,(OrbitalKitty/getBasis)
22:24clojurebot[weight velocity]
22:24OrbitalKittenooh by member I mean implementations of the methods
22:24gfredericksooooh you want to generate implementations of protocol programmatically
22:24OrbitalKittenyeah
22:24gfredericks,(doc extend)
22:24clojurebot"([atype & proto+mmaps]); Implementations of protocol methods can be provided using the extend construct: (extend AType AProtocol {:foo an-existing-fn :bar (fn [a b] ...) :baz (fn ([a]...) ([a b] ...)...)} BProtocol {...} ...) extend takes a type/class (or interface, see below), and one or more protocol + method map pairs. It will extend the polymorphism of the protocol's methods to call the suppl...
22:25gfredericksit's surprisingly easy :)
22:25OrbitalKittenthanks, I will look at this
22:30OrbitalKittenhmm looks like it only works with Protocols, and i'm implementing a huge ass interface
22:30OrbitalKittenbasically it's a visitor that has a ton of visit/endVisit methods
22:31OrbitalKittenI'm using reflection to find out what I need to implement and generate the corresponding methods
22:31OrbitalKittenheh I'll stick with the evil code for now
23:12pyonDoes Clojure have anything like Common Lisp's keyword arguments?
23:33TEttingerpyon: I don't know CL, but we do have keyword destructuring for maps as args. I think it's frowned upon
23:34TEttinger~kwargs
23:34clojurebotkwargs are a bad idea.
23:34TEttinger~kwargs
23:34clojurebotkwargs are a bad idea.
23:34TEttingerhm
23:34pyonAh!
23:34TEttingerthere's another one
23:34TEttingerit doesn't play well with other clojure stuff though
23:34TEttingersince you can't make a partial fn of it, for instance
23:35pyonMakes sense.
23:35TEttingerit technically takes a single arg, a map that may contain lots of keywords and values, so partial would need a whole new map
23:37pyonCan I understand a macro as a normal function, except its arguments are passed all quoted?
23:39amalloypyon: yes, except that also its result is expanded into the function calling it, rather than being returned as a value
23:39pyonAh!
23:40pyonSo, in principle, I would write everything in terms of normal functions, and use a single macro `macroize`, that lets me use other existing functions as macros, right?
23:40pyons/would/could/
23:41TEttingerusually you should prefer fns because macros can't be passed around as first-class values
23:41TEttinger,(reduce and [true true true])
23:41pyonYeah. I've been running into that a lot.
23:41clojurebot#error {\n :cause "Can't take value of a macro: #'clojure.core/and"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/and, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6704]}\n {:type java.lang.RuntimeException\n :message "Can't take value of a macro: #'clojure....
23:50pyonSo, I could use (defmacro macroize [function & arguments] `(~function ~@(map #(list 'quote %1) arguments))), and define all other macros in terms of normal functions and macroize, right?
23:50pyonOr, is this a bad idea for some reason?
23:51amalloyit's not clear how you intend macroize to work but i'm fairly sure it won't work that way
23:58pyonCan I “delay a ~”?
23:58pyonI'm trying to write a macro that produces a macro.
23:59spradnyeshcan someone please explain this?
23:59spradnyesh(= (double 1.0) (float 1.0)) => *true*
23:59spradnyeshand (= (cast java.lang.Double 1.0) (cast java.lang.Float (float 1.0))) => *true*
23:59spradnyeshbut (= (:close (second data)) (:close (second rslt))) => *false*, where
23:59spradnyesh(:close (second data)) => 95.2
23:59spradnyesh(:close (second rslt)) => 95.2
23:59spradnyesh(type (:close (second rslt))) => java.lang.Float
23:59spradnyesh(type (:close (second data))) => java.lang.Double