#clojure logs

2014-07-04

00:01dbaschto be fair the design of Go started 7 years ago, not that it makes a huge difference
00:02nathan7dbasch: Yeah, that doesn't change much in my eyes
00:02serjeemhaskell is like 30 years old :V
00:02nathan7jesus, 30 already
00:03tbaldridgego is language that stresses CSP that's it's killer feature, all the rest of it is just to make the CSP usable.
00:03serjeem"The first version of Haskell ("Haskell 1.0") was defined in 1990" so almost
00:03nathan7Rust has CSP too though, so that changes very little for me too
00:03nathan7however, Rust is very strongly focused on safety, especially concurrency safety
00:04nathan7which I'd argue is the stuff that makes any concurrency feature useful
00:04nathan7which directly covers "just to make CSP usable"
00:04tbaldridgeyeah, but if you listen to Rob Pike, he just got done with a parallel language, and the CSP stuff was mostly addressing problems with that approach
00:05nathan7Go feels like what would happen if I built out one of my toy languages and started believing it was a serious project
00:05platzhaskell was not haskell as you know it 30 years ago; it was pretty useless - monadic IO added more recently
00:05serjeemIs there a reason to prefer csp to an actor based model?
00:05tbaldridgeYeah, but if you think of Go as "Java with a C syntax minus the VM" it's actually fairly practical.
00:05nathan7serjeem: CSP is te more general model
00:05nathan7serjeem: like, an actor is a loop and a channel
00:06nathan7serjeem: given CSP, actors are two lines of code
00:06tbaldridgeserjeem: my take: https://github.com/halgari/clojure-conj-2013-core.async-examples/blob/master/src/clojure_conj_talk/core.clj#L496
00:06tbaldridgeserjeem: actors complect processes with channels.
00:07serjeemsweet! thanks nathan7 and tbaldridge <3
00:07tbaldridgeasync OOP is my favorite way to make snarky comments about the actor model ;-)
00:08serjeem(tbaldridge: also thanks for the go macro videos, they were the most effective couple hours of my time learning clj)
00:08platzactors are pretty much toys absent the resiliency of the Erlang BEAM system
00:09tbaldridgemy favorite quote from Alen Kay (father of OOP): "Actually I made up the term "object-oriented", and I can tell you I did not have C++ in mind."
00:09nathan7(defmacro actor [message-sym & body] `(let [ch# (chan)] (go-loop [~message-sym (<! ch#)] ~@body (recur (<! ch#))) ch#))
00:09nathan7tbaldridge: Alan Kay
00:10nathan7tbaldridge: the man who can take most modern programming concepts and go "well actually, I came up with that, and …"
00:11platz" Pop culture is all about identity and feeling like you're participating. It has nothing to do with cooperation, the past or the future — it's living in the present. I think the same is true of most people who write code for money." - Kay
00:11nathan7almost ended up working at a consultancy with him and various other legends on the board
00:11nathan7was kind of bummed that my would-be employer wanted like a three-month termination period
00:12nathan7pretty weird company anyway, their dev team is in South Africa, and they just wanted to hire me over here in Amsterdam
00:13nathan7mainly run by one guy with *that* kind of maniacal cackle
01:00FareI'm still not sure why I need all these subdirectories
01:14Farewhere is the format of project.clj documented? do I need to put test and src in separate directories? What if I don't?
01:17noidiI think this is the most comprehensive documentation for it https://github.com/technomancy/leiningen/blob/master/sample.project.clj
01:17Farenoidi: I was reading that
01:18noidione reason to keep src and test separate is that src gets packaged into a jar while test doesn't
01:18noidithere's no reason to ship your tests to the users of a library
01:21Farehow does lein know which files in the project to compile / load and in which order?
01:24noidiit tells Clojure to compile the main namespace, and Clojure checks the (:require ...) bits in its ns form to find its dependencies and compiles them as well
02:23rurumatesorry fell asleep
02:34tjahanhello, good book to start learning clojure?
02:41ddellacosta_tjahan: lots of folks recommend Clojure Programming as a good starting book: http://www.clojurebook.com/
02:42ddellacosta_tjahan: The Joy of Clojure is really great too, but a bit denser and move a bit more quickly, in my opinion: http://www.manning.com/fogus2/
02:44tjahanddellacosta_, thank you
02:44ddellacosta_tjahan: np
03:09_kardanForgive me if my tired brain is confusing me. I have a string which represents a Prismatic schema e.g. "UserType" but now I want to use that string in the validation e.i. do (s/validate UserType user). Any ideas?
03:10nathan7_kardan: have a map of { schema-name schema }?
03:13_kardanSo I get events from a queue and then need to dispatch different validations based on "types". Maybe I just need to understand what you explained (brain need coffee..)
03:25_kardanthanks nathan7 - as suspected I was confused :-)
03:26nathan7_kardan: 20 hours in and still bright out here, apparently [=
04:19ckuttruffevening all; was looking at the following thread regarding relative path references with leiningen: http://stackoverflow.com/a/15884225/1566623 . Does anyone happen to know if it's possible to get all files within a directory specified within the resource-paths option?
04:20ckuttruffso if you specify ":resource-paths ["foo"]" and want all the files foo/*.txt ... is there a way to specify that using java io API?
04:56mpenetWhen packaged as a jar? I think there are only gory solutions to this (using JarFile for instance)
07:59perplexaheya
08:01perplexawhen i have a vector ["a","b","c","d"] and i have a string like "/%1/%2/%3/%4", how would i replace the variables in the string with the indexes found in vector? ie. /b/c/d/%4/
08:01perplexais there an easy solution or do i have to iterate over the string? ;x
08:03borkdudeDoes Scala have a clojurescript + core.async (in the javascript variant) equivalent?
08:09Fareperplexa, with apply?
08:10Fareadding an extra argument to be 1-based rather than 0?
08:10silasdavisI'm probably missing something simple but I'm trying to pull in: http://search.maven.org/#artifactdetails%7Corg.apache.storm%7Cstorm%7C0.9.2-incubating%7Cpom
08:10silasdaviswith ... :profiles {:dev {:dependencies [[org.apache.storm/storm "0.9.2-incubating"]]}}
08:11perplexaFare: wat
08:12perplexai don't want it to be 1-based btw
08:13silasdavisin my project.clj, but it can't find it in http://repo1.maven.org/maven2/
08:13perplexabut i think apply is the right way :)
08:13silasdavisis that a reliable mirror or am I missing something?
08:15mpenetperplexa: you could just use clojure.string/replace
08:15perplexampenet: but how would i make it look up the strings dynamically? :)
08:16mpenet,(let [x ["a" "b" "c" "d"]] (clojure.string/replace "/%1/%2/%3/%4" #"%([0-9]+)" (fn [[_ idx]] (str (nth x (dec (Long/parseLong idx)))))))
08:16clojurebot"/a/b/c/d"
08:16mpenetnot super nice but it does the job
08:16perplexaheh
08:16perplexa(inc mpenet)
08:16lazybot⇒ 3
08:16perplexaawesome
08:16mpenet:]
08:16perplexaalso thanks for destroying my self-esteem ;p
08:16Farenot super nice? It's *very* nice
08:17Fare(inc mpenet)
08:17lazybot⇒ 4
08:17mpenetyou could do something with reduce and map-indexed
08:17martinklepschwhen using timbre, does it log occuring exceptions without me needing to explicitly feed them to timbre?
08:18perplexampenet: yeah i was just looking into reduce
08:20silasdavismartinklepsch, no you'd need to catch them and log yourself
08:21martinklepschsilasdavis, if exceptions would occur within an nrepl-server I started would it be enough to wrap the nrepl/start-server in the catch statement?
08:23silasdavismartinklepsch, yeah if you want to catch everything you can just wrap the entry point, but beware errors that occur in child threads won't surface necessarily
08:28martinklepschhm, I run many threads. maybe I'm overseeing: the more general problem is that I have a long running pmap job and sometimes it crashes inbetween. but since I started the process in the nrepl server (which I detached after starting) I wont see the exception
08:39kungiHello!
08:56silasdavismartinklepsch, you may want to implement the parallelism yourself
08:57silasdavisand you can catch the errors
08:58razum2umhow can i redefine function in other ns and use old version inside? (i.e like calling "super" inside with-redefs)
08:59martinklepschsilasdavis, hm I mainly used pmap because I didn't want into implement it myself
09:00silasdavispmap just steps through a lazy sequence of map #(future (f %)) coll
09:00silasdavisoften pmap isn't want you want... some people avoid on principle
09:01Janiczek_Can you somehow run Eastwood on ClojureScript?
09:01mpenet~pmap
09:01clojurebotpmap is not what you want
09:01mpenet:)
09:01hyPiRionsilasdavis: no, it doesn't even do that. It does it semi-chunked, but in a strange way
09:02martinklepschok so what do I want? I'm basically parsing 100s of big xml files and saving them into a DB (db is bottleneck I believe)
09:03koreth_Is there a built-in function to expand all non-namespaced symbols to include namespaces like the reader does? That is, to turn '(inc 1) into '(clojure.core/inc 1) using the current *ns* and other bindings?
09:03dbasch~pmap
09:03clojurebotpmap is not what you want
09:04martinklepsch:D
09:04hyPiRionmartinklepsch: I'm trying to find a library which is a bit more efficient. Give me a second.
09:06silasdavismartinklepsch, crude but potentially workable
09:06silasdavis,(mapcat (comp (partial map deref) (partial map #(future (inc %)))) (partition 10 (range 100)))
09:06clojurebot#<SecurityException java.lang.SecurityException: no threads please>
09:06silasdavisah
09:06hyPiRionmartinklepsch: https://github.com/TheClimateCorporation/claypoole there
09:07dbaschif the db is the bottleneck, it probably won't help to launch hundreds of threads
09:07silasdavisanyway, your partition n is the batch size is the number of simultaneous function applications you think your system can handle at at a time
09:07dbaschyou could have a queue with a small number of threads, deref the first one and then add to the queue
09:07dbaschs/threads/futures
09:08hyPiRionSo you can say (cp/pmap (+ 2 (cp/ncpus)) f input) and get it to work as you'd expect an eager version of pmap would work
09:09aroemerskoreth_: syntax-quote not enough?
09:10martinklepschI don't have a problem with pmaps lazinesss
09:10koreth_aroemers: The expression is in an EDN file, not in my source code.
09:12martinklepschhyPiRion, except for the last point the stuff claypool does doesn't seem to be something I need
09:12silasdavismartinklepsch, so my suggestion will probably do what you want
09:12martinklepsch"We would like to be able to do an unordered pmap, so that we can start handling the first response as fast as possible."
09:12silasdavisreplace inc with your parsing function, and stick a finger in the air to set the n in (partition n files)
09:14martinklepschsilasdavis, would you mind elaborating how this differs from pmap?
09:14silasdavisif your inputs are similarly costly it should give reasonably parallelism
09:14martinklepschsilasdavis, seems pretty similar to how I thought/assumed it would work
09:14silasdavisoh you can log your exceptions
09:14martinklepschsilasdavis, ah right!
09:14silasdavisit is pretty similar
09:15silasdavisactually you could do that already
09:16mpenetmartinklepsch: you could use core async, a list of channels in a go block and you loop then call alt!! on the list
09:16martinklepschmpenet, yeah wondered about that too but didn't really investigate it yet
09:16mpenetsomething similar to the example here https://github.com/mpenet/alia#async-using-clojurecoreasync
09:17mpenetyou'd get the first realized no matter the ordering
09:17mpenetand so on
09:18mpenetchans would be c.c.async/thread
09:29benzapwas wondering, does (load-string) evaluate stuff within the current namespace?
09:30benzapor maybe I have a problem specific to the :as clause, I have a required namespace :as foo, and I can't access foo/bar from load-string
09:32dbaschbenzap: what error do you get?
09:33benzapI have a (:require [foo.bar.state :as state]), and i'm calling (load-string "(state/get-device-id)") --> No such namespace: state, compiling:(null:1:1)
09:34benzapit works fine if I (use 'foo.bar.state)(get-device-id)
09:34benzapand then subsequent calls are fine
09:35benzapto (get-device-id)
09:36dbaschwhy are you using load-string?
09:37benzapi'm exposing my clojure environment to a remote web client
09:37benzaplike a repl
09:37dbaschdoes it work without the load-string?
09:37benzapya
09:38dbaschyou can still use the fully qualified namespace, does that work?
09:39benzapif I use an actual repl on my code, and eval, the state/device-get-id works
09:39benzap*get-device-id
09:40dbaschI mean (load-string "(foo.bar.state/get-…
09:41benzapya
11:34ziltiIs there a way to "shut down" core.async? It seems to block leiningen plugins. Adding a shutdown hook which closes the channel unfortunately doesn't help.
12:21tbaldridgezilti: sometimes shutdown-agents can help with that
12:21tbaldridgethe function in clojure.core
12:58Farewhat's a nice short prefix for all my lexer functions? I used lex- but that's ugly. m- was weakly suggested by my using monads. I was thinking "?" or "!" or "%" as a prefix.
12:59Fareor maybe some unicode character?
12:59Fare$ ?
12:59bbloomFare: why not stick them in a lexer namespace and drop the prefix?
13:00Farebbloom: (1) I'm not sure how to avoid with clojure core symbols, and (2) I still wanted to distinguish them somehow.
13:01Fareavoid clash
13:01bbloomFare: in your ns form, put (:refer-clojure :exclude [whatever will clash])
13:01bbloomthen you can also put (:require [clojure.core as :clj]) or something like that, if you need to use them stilll you can use clj/whatever
13:02Faredo will clash
13:02bbloomon the consuming side of it, you can choose an alias (:require [mylib.lexer :as yourprefixofchoicehere])
13:02bbloomFare: argh. yes, the specials are annoying
13:06bbloomFare: seems like not a great choice, given the fact that % is used for syntax in #(...) forms
13:06Fareoh
13:07Fareis % followed by non-numeric also used specially?
13:07Farethings like %do
13:07bbloomhttps://github.com/edn-format/edn#symbols
13:07FareWhat about & ?
13:07bbloom% and & are both 100% valid symbols, but they are used specially by various core syntax
13:08FareI mean as a prefix, not as standalone
13:08bbloomas far as i know, they are only used as complete, unqualified symbols, with the exception of &env and &form which are anaphoric in defmacro
13:08Farebbloom, that page seems to imply that unicode characters are no good, but I've been using greek letters all over the place
13:09bbloomFare: 1) that page defines edn, which is a subset of clojure syntax
13:09Fareok
13:09bbloom2) clojure is notoriously permissive in what it accepts
13:09bbloom,(symbol "including wildly invalid shit like spaces")
13:09Fareis it bad form to use greek letters as variable names?
13:09clojurebotincluding wildly invalid shit like spaces
13:10bbloomFare: i haven't seen any greek letters in clojure code except when done at the display layer in emacs
13:11bbloomie fn -> a lambda, but fn gets stored in the file
13:11Faremy state variables are all named σ
13:11Fareand my type-parametric variables are named α and α
13:11Fareβ
13:12amalloyFare: if you don't intend anyone else to ever edit your code, feel free
13:12Fareamalloy, what's wrong with those variable names?
13:12amalloybut most people are not set up to type greek letters trivially, so they will just tell you to go to hell. i would change them all back to ascii symbols if the code were ever my responsibility
13:13bbloomagreed w/ amalloy
13:13FareC-u C-\ t e x RET \ l a m b d a
13:13clojurebotNo entiendo
13:14bbloomi even wish the usual suspects like + and * had ascii equivs... i really enjoy FullForm[...] in mathematica
13:14amalloyeven as an emacs user that sounds like a pointless hassle. imagine how useless it sounds to anyone else
13:14Fareanyway renaming later is a trivial search-and-replace away
13:14FareI'll keep it that way for now
13:14amalloysure. do what you want in code nobody else has to use
13:15FareI'm reminded of that japanese lisp where everything was in Kanji.
13:15amalloyand it reads fine, as long as you don't use the letter B next to your betas
13:16Fareanyway, it's not like they need to type the greek letters to use the code — exported functionality is all ascii
13:16ddellacosta_omg, Japanese lisp sounds terrible
13:17Farewhich brings me back to prefix for my monadic functions and macros
13:17FareI'm thinking "&" instead of "%" as the prefix
13:17Fareif only "&" alone is special, then I should be fine, isn't it?
13:17bbloomnothing will blow up
13:18Farethanks
13:19amalloy&foo is sorta conventionally used for stuff introduced anaphorically, by some people anyway. it's not seen very often, because anaphora aren't that common
13:19lazybotjava.lang.RuntimeException: Unable to resolve symbol: foo in this context
13:19bbloomnice. somebody else got bit by lazybot's overzealous metacharacter
13:19amalloyyou could maybe use uh...$foo instead? or *foo, so everyone knows it's a function pointer
13:19amalloybbloom: happens to me all the time, for some reason
13:19bbloom& me to as you know ;-)
13:19lazybotjava.lang.RuntimeException: Unable to resolve symbol: me in this context
13:20FareI'm no big fan of anaphora — I removed them all from ASDF when I took it over.
13:20amalloyand it's hardly overzealous; clojurebot's the same way with comma, just nobody accidentally puts that one first
13:20bbloom, but i was taught a comma always comes before a, but
13:20clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: but in this context, compiling:(NO_SOURCE_PATH:0:0)>
13:22Farewhen lexing, is a symbol without namespace the proper data structure to intern identifiers to? Seems to me that it is.
13:25bbloomthat's reasonable, assuming the identifiers you're parsing are a subset of symbols
13:25bbloomit's worth noting that symbols are not interned, their contained strings are
13:25bbloomkeywords are however interned
13:25bbloomif memory usage and equality speed were a concern
13:26Fareshould I intern my identifiers as keywords?
13:27bbloomreally depends on what you're doing
13:27Farenot sure yet
13:27bbloomjust leaving them as strings are perfectly fine too
13:27FareI'm at the lexing phase still
13:28Fareimplementing a language by ultimately turning it into clojure forms, is I suppose what I'm doing
13:29bbloomin that case, if you expect a 1-to-1 relationship between source code identifiers and object code identifiers, symbols seems like a good choice
13:34Farebbloom: probably, though some identifiers may have to be massaged, especially so to prevent clashes
13:34FareI suppose that when it comes to compiling those forms, I'll have to do some namespace magic
13:37Fare(I love how purity of my monads make backtracking trivial)
13:51sritchiehey all - is anyone here using lein-cljsbuild with :optimizations :none in development mode?
13:51sritchieI can’t figure out which files to include in my generated HTML to make this work
13:51sritchieit’s easy with :whitespace optimizations, since only one file is generated
13:52sritchiethis example uses whitespace, for example...
13:52sritchiehttps://github.com/magomimmo/modern-cljs/blob/master/project.clj
13:52sritchieI just can’t find anyone using :none
13:53bbloomsritchie: you should only need to include the google closure base.js file & then your root output js file
13:53bbloomthe dev mode stuff in base.js will inject script tags for all the other files
13:53sritchiebbloom: interesting, I’ve got those two,
13:54sritchieand I’m getting “paddleguru is not defined"
13:54sritchiebbloom: do I need to make sure any specific routes are open so that the relative paths in base.js work?
13:55bbloomsritchie: check the network tab in your browser's inspector
13:55bbloom404s or 503s or whatever should make it clear
13:55Farewhat's the simplest way to concatenate two strings?
13:55bbloom,(doc str)
13:55clojurebot"([] [x] [x & ys]); With no args, returns the empty string. With one arg x, returns x.toString(). (str nil) returns the empty string. With more than one arg, returns the concatenation of the str values of the args."
13:55Fareduh. thanks!
13:55bbloom,(str "like" "this")
13:55clojurebot"likethis"
13:56FareIs there a simpler variant for #(do true) ?
13:56sritchiebbloom: none of ‘em
13:56sritchielet me check the load order...
13:56bbloom(doc constantly)
13:56clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
13:56sritchieyeah, goog/base.js loads fine, then generated.js loads as well
13:58bbloom,(#(do true) "this will fail b/c the #(...) generates a nullary function in this case")
13:58clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox/eval93/fn--94>
13:58bbloom,((constantly true) "but this will work" :just-fine)
13:58clojurebottrue
13:58sritchiebbloom: the goog.addDependency calls execute with no problem, too
13:59bbloomsritchie: you're now beyond my help. i've struggled much w/ cljsbuild etc, ultimately i gave up and did some custom build kludgery in a custom ring handler
13:59bbloomsritchie: frankly, the tooling for cljs is a complexity disaster
13:59Fareis there an escape sequence for (char 7) in clojure?
13:59sritchiethanks for the help… man, what a bummer
13:59sritchieyeah
13:59sritchiewithout this it’s 15 seconds to build
13:59sritchiefor every change
13:59bbloomFare: https://github.com/edn-format/edn#characters
14:00sritchiefinally trying to make this work, and fail time
14:00arohnersritchie: are your generated files in the resource path
14:00sritchieyeah
14:00bbloom,\u0007
14:00clojurebot\
14:00sritchiearohner: I may not be exposing them
14:00sritchiewell, yeah, I am
14:00arohnerthey need to be in a path where ring/wrap-resource can find them
14:00sritchiesince they load fine
14:00sritchieno 404s
14:01arohnerso what problem are you seeing?
14:01bbloomFare: see also http://clojure.org/reader
14:01sritchiebase.js and my generated.js load with no errors, but none of the cljs namespaces, my namespaces, or my dependencies’ namespaces are loaded
14:01sritchieso I immediately get a “paddleguru is not defined"
14:01sritchiewhen I try to load some cljs
14:01arohnerthe Om docs mention needing to use goog.require
14:02arohner <script type="text/javascript">goog.require("main.core");</script>
14:02arohner(I assume you're using om?)
14:02sritchieno, I’m not yet, anyway
14:03sritchiegoog.require(‘paddleguru.util’);
14:03sritchieError: Cannot write "https://local.paddleguru.com/cljs/dev/goog/string/string.js&quot; after document load
14:03bbloomFare: generally, the clojure.org docs are very good & especially clear for CL folks. worth reading through them in their entirety
14:04sritchiearohner: or when I try to require clojure.string;
14:04sritchieError: Cannot write "https://local.paddleguru.com/cljs/dev/goog/../paddleguru/util.js&quot; after document load
14:04technomancy"very good"?
14:04sritchiearohner: does that work for you?
14:04bbloomtechnomancy: yes. i think they are excellent for their intended audience
14:04technomancybbloom: hm; ok.
14:04arohnerI'm using :whitespace, and I don't need the goog.require, for unknown reasons
14:05technomancybbloom: they're shit for introductory material
14:05bbloomtechnomancy: when i was learning clojure, i found them to be by far the best bang for buck
14:05sritchiearohner: yeah, whitespace is just unbelievably slow
14:05sritchie18 seconds per compile
14:05arohneryeah :-(
14:05bbloomtechnomancy: sure, but there's lots of other introductory material places. Fare knows common lisp quite well
14:05technomancywhich seems to be the most common kind of audience likely to visit clojure.org
14:05sritchiecoventry had this issue, looks like: http://clojure-log.n01se.net/date/2014-04-19.html
14:05bbloomtechnomancy: he should have no trouble getting lots of valuable info from the clojure.org docs
14:05sritchiearohner: so is everyone just suffering through this stuff?
14:06bbloomtechnomancy: i mean, noooooow. but when clojure was new? language geeks, lispers, etc
14:06technomancybbloom: oh I see; didn't have the context
14:06arohnersritchie: IDK. I didn't realize :none was so much faster
14:06arohnerI also use the cljs repl a lot
14:06sritchieyeah, less than a second
14:06arohnermy bigger problems w/ CLJS compliation is the lack of tracking which files need to be recompiled
14:06sritchieyeah, I do too, but austin is really unreliable for me
14:07sritchieand cemerick is profoundly uninterested in working on it anymore
14:07arohnerthat, and recompiling both :dev and :prod when I start in dev mode
14:07sritchieoh, that’s odd
14:07sritchiethat doesn’t happen for me
14:07bbloomsritchie: i found that https://github.com/tomjakubowski/weasel was much easier to get working
14:07sritchie“lein cljsbuild auto dev”, yeah?
14:08sritchieoh shiz
14:08sritchienice
14:08arohnerI have the cljsbuild :hook in my project.clj. I'm threatening to take it out because it slows down startup so much
14:08sritchieyeah, take it out for sure
14:08bbloomi really dislike cljsbuild
14:08sritchiearohner: I can show you what I do
14:08sritchie(defn with-generated [& tasks] (apply vector "do" "cljx," "cljsbuild" "once" "dev," tasks))
14:09sritchieI have that in my project.clj
14:09arohnernice
14:09sritchiethen this: :aliases {"launch" ~(with-generated "repl”), "test" ~(with-generated "test")}
14:09sritchieso “lein launch” generates everything, “lein repl” is clean
14:09sritchiebut “lein test” always goes the generation
14:10arohnerI like it
14:11sritchiednolen_ was making fun of me for using :whitespace instead of none,
14:11sritchiebut it seems that no one is actually using :none :)
14:12sritchiesince it’s such a pain in the ass
14:20rkneufeldAnyone remember what that recent clojure-test runner was that had really nice diffs?
14:20rkneufeldI remember reading an article about it lately, but can't track it down.
14:22rkneufeldFound it. It was "humane-test-output" from http://jakemccrary.com/blog/2014/06/22/comparing-clojure-testing-libraries-output/
14:24Faredoes clojure have a function to map character names to name, without loading the Java ICU4J library?
14:39Farecan I have a case with multiple values?
14:39amalloyFare: you mean like a function f such that (= (f \≇) "NEITHER APPROXIMATELY NOR ACTUALLY EQUAL TO")?
14:39amalloyand if you mean the case macro: yes, read the docstring for case
14:41dnolen_arohner: if you have a reproducible case of that I would like to know, I haven't encountered that unless you're talking about cold start
14:41bbloomFare: which you can get in your repl with the doc macro
14:41dnolen_sritchie: I never dev w/ anything but :none, everything else is way to slow for dev
14:42dnolen_sritchie: also the only compilation mode where source maps are truly accurate
14:42sritchiednolen_: how do you include the generated files?
14:42sritchiein your HTML?
14:42sritchiesritchie: goog.require(‘paddleguru.util’);
14:42sritchie[12:01pm] sritchie: Error: Cannot write "https://local.paddleguru.com/cljs/dev/goog/string/string.js&quot; after document load
14:42sritchieI get that error when I try to require anything;
14:42sritchieand without requiring, of course, nothing’s available
14:42dnolen_sritchie: never seen that before
14:42sritchiethat happens when I try to require any cljs namespace
14:43dnolen_sritchie: no idea, are you sure this isn't a server config issue?
14:43sritchieno, it very well could be -
14:43Fareamalloy: apparently I can crash the clojure 1.6.0 compiler with my case statement :-/
14:43sritchieI just haven’t found a single example config that uses :none. I’m guessing it’s some goof with the way I’m exposing static routes
14:43dnolen_sritchie: anyway I've gotten :none to work w/o and without webserver
14:44dnolen_sritchie: and in fact sunk a lot of time making sure it does work :)
14:45Fareif I include \1 in the list of octal characters in that case, it blows up with java.lang.NegativeArraySizeException, compiling:(/tmp/form-init6222044222718782545.clj:2:3)
14:45Fare at clojure.lang.Compiler.analyzeSeq (Compiler.java:6651)
14:45sritchiednolen_: I believe it, and the sub second compile times make me want to get there too
14:45sritchieI’ll play around with the routes
14:45sritchiein the meantime, weasel is hugely helpful: https://github.com/tomjakubowski/weasel
14:45dnolen_sritchie: I'd be surprised if modern-cljs doesn't cover this
14:45sritchieit doesn't
14:45sritchiethey use whitespace
14:45dnolen_huh weird, someone should fix that
14:46sritchieyeah, everyone I could find in here is using whitespace as well -
14:46sritchieI’ll push an example if I can figure out what’s goofed over here
14:46dnolen_sritchie: https://github.com/KitchenTableCoders/immutable-stack/blob/master/contacts/project.clj
14:47dnolen_sritchie: older deps but that should work even w/ newer deps
14:47dnolen_if it doesn't I'd like to know about it
14:47sritchienice, looking for the html generation...
14:47sritchieah, I see index.html
14:47dnolen_sritchie: no html generation in this case, just static
14:47dnolen_shouldn't really matter though
14:48sritchiethanks for that link
14:51TimMcFare: Compile errors are indistinguishable from compiler crashes. :-(
14:57ToxicFrogTimMc: yep :(
14:58sritchiebbloom: this is huge - thanks so much for pointing out weasel!
14:58sritchiethis is WAY more reliable.
14:58bbloomsritchie: awesome
14:58bbloom(inc weasel)
14:58lazybot⇒ 1
15:09benzapanyone know where I can find the implementation of the defn macro?
15:09benzapi'm trying to write a new macro that defines a function, but assigns it to some sortof handler
15:09benzapneed some direction
15:10Faredown to one line: (defn err1 [c] (domonad sequence-m [_ (case c \U c (\0 \2 \3 \4 \5 \6 \7) c \1 c)] c))
15:18Fareexpanded a bit: (defn err2 [c] (case* c 0 0 nil {55 [\7 c], 85 [\U c], 54 [\6 c], 48 [\0 c], 50 [\2 c], 51 [\3 c], 53 [\5 c], 52 [\4 c], 49 [\1 c]} :compact :hash-equiv nil))
15:21Farewhere do I report such compiler failures?
15:21Farebenzap: macroexpand ?
15:21avshalomHi All, I am looking for an "Everyman's List of What's new in Clojure 1.6"
15:22nkozabenzap: (source defn)
15:24benzapwell damn, it's not implemented as a macro
15:25Bronsabenzap: it is
15:26Bronsabenzap: it doesn't use defmacro because it's definied later in the bootstrap process
15:26benzapSo the way it's implementing itself resembles that of a macro
15:27Bronsabenzap: it's manually marked as a macro a couple of lines after its definition
15:27Bronsa(. (var defn) setMacro)
15:27Bronsaor something like that
15:28benzapit's implementing itself in a rather strange way
15:28benzapkeeps redefining the local variables in a let, i've never seen that before
15:28dnolen_avshalom: https://github.com/clojure/clojure/blob/master/changes.md
15:30BronsaFare: it looks like this problem is caused when the gensym'd symbol is not type hinted as Object
15:30BronsaFare: so probably algo.monads loses some metadata
15:30FareBronsa: I didn't understand your explanation :-(
15:31bbloomBronsa: why would you hint something as Object?
15:31Bronsabbloom: clojure.core/case does, and apparently for a reason
15:31BronsaI was never able to understand why
15:31bbloomBronsa: weird
15:31bbloomclojure.core/case is crazy
15:32Bronsawell maybe now I'll get it.
15:32BronsaFare: e.g. try your last expression but with (case* ^Object c
15:34avshalomdnolen_: i was blushing after asking the question and seeing that link. Thanks.
15:34dnolen_avshalom: np
15:34FareBronsa, doesn't help me
15:35Farewhat makes it magically compile is removing the \1 case
15:35Fareor the clojure.tools.macro/with-symbol-macros macro
15:36Fareor any of the numeric cases
15:36BronsaFare: bbloom uhm disregard all I've said wrt ^Object, I misread my repl output
15:37Fareif I remove one of the numeric cases, it works
15:37bbloomBronsa: already done. that seemed too crazy for me to bother comprehending
15:37Farereduced case so far: (fn [c] (clojure.tools.macro/with-symbol-macros (case c \U c (\0 \1 \2 \3 \4 \5 \6 \7) c) c))
15:38Farewhat does that with-symbol-macros do?
15:38Bronsabbloom: what I can't explain is that on my repl that case expression works, but if type in the macroexpansion it stops working
15:38Bronsa& the only difference seems to be the ^Object hinting
15:38lazybotjava.lang.RuntimeException: Unable to resolve symbol: the in this context
15:39bbloomBronsa: yeah, that sounds like a metadata or subtle type issue
15:39bbloomBronsa: what does print-dup show?
15:39bbloomor *print-meta*
15:39Fareshould I send a message to the mailing-list?
15:40bbloomFare: in the meantime, use `condp =` instead of case
15:40Farebbloom: thanks
15:40bbloomFare: case is just an optimization for table dispatch, condp = will do the same thing as linear ordered choice
15:40Bronsaah
15:40Bronsawait
15:41BronsaI think I got it
15:47FareBronsa, yes?
15:47FareI was ready to click the send button for my bug report...
15:48BronsaFare: I'm trying to prove my guess
15:48Fareok
15:48FareI will refrain from sending...
15:48BronsaFare: no, no go ahead, it's still probably a bug
15:54BronsaFare: bbloom got it
15:54bbloomBronsa: i got what?
15:54Bronsano, I got it
15:55bbloomBronsa: whoa whoa, you can't take this away from me!
15:55bbloom(what is is? :-P)
15:55Bronsathe issue is that the emitted map {48 [\0 'c] ..}
15:55Bronsais a sorted map
15:55bbloomfucking sorted maps.
15:55Bronsawhen you read that back, it's a normal unsorted map
15:55bbloomgrumble grumble. the default printing behavior for sorted maps is atrociously broken
15:55Bronsabbloom: I never liked that sorted maps prints as normal maps
15:55bbloomit's terrible
15:55Bronsayeah
15:57bbloomso why is the printed representation an issue here?
15:57bbloomis fare explicitly calling macroexpand or something?
15:57bbloomthe jvm clojure macro system has cross-stage persistence of objects that don't have printable forms
15:58bbloomscheme on the other hand only requires that forms with external representations be persistable across stages
15:58Bronsabbloom: except it doesn't really work for sorted maps
15:59Bronsabbloom: http://sprunge.us/IHHh
15:59bbloomhmm i wonder why
15:59bbloommaybe a bogus map? test in there somewhere?
15:59BronsaI already opened a bug for that months ago
15:59bbloom,(defmacro m [] (Object.))
15:59clojurebot#'sandbox/m
15:59bbloom,(class (m))
15:59clojurebot#<CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: java.lang.Object@14aeb29, compiling:(NO_SOURCE_PATH:0:0)>
15:59bbloomah no
15:59bbloomnow i remember
16:00bbloomyou need to define print-dup for your form to get cross stage persistence when compiling
16:00bbloom,(macroexpand '(m))
16:00clojurebot#<Object java.lang.Object@e64543>
16:00bbloomsee?
16:01Bronsabbloom: http://dev.clojure.org/jira/browse/CLJ-1093
16:01BronsaI haven't found any good fix for this
16:01Bronsathere are a couple of proposed patches but they're more workarounds than fixes
16:02bbloomlots of gross broken edge cases where clojure's syntax and its bolted on type system collide :-/
16:02Bronsayeah
16:02Bronsawhat's worse is that it's not only going to break sorted maps
16:02bbloomthe original :type metadata idea was cute, but it became pretty obvious that type tags were useful for creating separate equality classes
16:03Bronsaevery deftype that's also an IPersistentMap will be transformed in a PAM/PHM in this case
16:03Bronsato*
16:04Bronsauhm no, that's not true
16:04synkteIs let lazy?
16:04synktei.e. local variables only created when the expression is evaluated?
16:04Bronsaluckly all deftypes get emitted using their /create static method so there's not that issue
16:05bbloomsynkte: no, the only thing that is lazy are seqs
16:06bbloomsynkte: and the traditional control operators, like if
16:06bbloomBronsa: but aren't empty seqs special cased?
16:06bbloomBronsa: since the interned value can be used
16:06clojurebotTitim gan éirí ort.
16:06bbloomsome of the create methods work on empty and some fail
16:06bbloom(i discovered while working on eclj)
16:06Bronsayep
16:07Bronsaprint-dup is broken on IPersistenCollections
16:07synktebbloom: Interesting, I'm trying to test a sql insert method using let binding the create, and then searching for the entry in the database with a query binding in the same let statement, and the query is returning nothing
16:07Bronsait assumes all IPersistentCollections have a /create method
16:07Bronsawhich is not true
16:07synkteso I can compare that it actually inserted
16:07bbloomsynkte: there are infinite things that could be wrong w/ that. can't help w/o seeing code
16:09synktebbloom: http://pastebin.com/YMrUP723
16:09synkteThe create and find functions work
16:09synktetested already
16:11bbloomsynkte: what type of objects do they return?
16:11synktebbloom: Both are lazyseq
16:12bbloomsynkte: *shrug* you didn't provide enough code to actually debug. i suggest you create a minimal self-contained reproduction, and i'm sure you'll find the issue along the way
16:16synktebbloom: Ah, id is being set to nil
16:16synktebbloom: I'm an idiot haha
16:16synktebbloom: Thanks :)
16:18noncomi have been examining DotLisp, the previous creation of Rich Hickey. the bootstraping file, which defines the most part of the language is full of macros definitions, not function definitions
16:18noncomi have read that it is better to avoid macros if not completely necessary
16:18noncomso the question is: why is it 100% made of macros ?
16:18Fareok, how do I debug a stack overflow?
16:18amalloythe language core usually has a lot of unusual work to do
16:18noncomis this because speed concerns? do macros save a funcall ?
16:19amalloyFare: look at the stacktrace, gist the stacktrace, ...
16:19noncomFare: it depends.. but you can show us..
16:19FareI must be recursing without a proper stop condition... but where?
16:19noncomshow us stack trace :)
16:19Fareit just tells me StackOverflowError clojure.lang.PersistentArrayMap.assoc (PersistentArrayMap.java:189)
16:20noncomand the code ?
16:20Fareit's hundreds of lines
16:20noncom:(
16:20Farethat depend on other libraries
16:20amalloyFare: the built-in repl hides stacktraces from you for some misguided reason
16:20amalloyare you using cider, or what?
16:20Farecider
16:20amalloyyou can (.printStackTrace *e)
16:20dbaschFare: (pst *e)
16:21amalloydbasch: clojure.repl isn't auto-referred in cider afaik.
16:21dbaschamalloy: true, I have it in my user.clj
16:21noncomamalloy: so, yes, the core has to do strange stuff, but why macros, why not functions ? the only reason i can think of is that macros save a funcall and some resolutions..
16:22noncom*in runtime
16:22amalloybecause it's building the whole dang language. you use macros to introduce new linguistic constructs; probably a lot of those end up needing to be macros in dotlisp, i dunno
16:22FareI don't get to the print stack trace... the stack overflows.
16:22amalloyFare: yes, and after it does that, in your repl *e is bound to the exception
16:22amalloyso you can write (.printStackTrace *e)
16:22dbaschFare: refheap?
16:23noncomamalloy: i see..
16:23Fareit prints nil
16:23noncomi use counterclockwise for eclipse, it always shows the trace, idk for other tools.. but there must be some unversal way
16:23dbaschFare: how about (clojure.repl/pst *e)
16:24Fareworks better, thanks!
16:25noncomso macros are used to represent linguistical constructs, but how would you say what functions are for?
16:25noncomi am just interesrted in theory behind that
16:25noncomand implications
16:26gfredericksfunctions are for computations?
16:26bbloomnoncom: if you're interested in theory, start here: https://en.wikipedia.org/wiki/Evaluation_strategy
16:28noncomi just never before really thought about what is their nominal difference beside that one of them executes at startup and the other one in runtime..
16:28noncomthanks for the link! looks like a cool explanations for the general thing!
16:28dbaschnoncom: suppose you want something like (do-not-evaluate (/ 1 0))
16:28dbaschnoncom: could do-not-evaluate be a function?
16:28noncomaha, macros will prevent immediate evaluation..
16:29noncomit could be a fund only if i quote the arg.. but that is rarely good, so macros do not eval args..
16:29noncomevaluation strategy! :)
16:34Farejust because it compiles doesn't make case work... falling back to condp
16:35Fareyup, there was more brokenness in case. Sigh.
16:41Faresent a bug report to the clojure@ mailing list
16:41Fareoh, it's moderated (thus far)
16:53ivanis there a Clojure code reformatter (that handles all the edge cases like https://github.com/odyssomay/sublime-lispindent/issues/7 ) that I could integrate into Sublime Text?
16:57ivanperhaps over the network; doesn't have to be in Python
16:59amalloyivan: for just indentation, you can fire up emacs in batch mode and ask it to indent for you. if you want something to also decide when to indent newlines that's impossible because it's a matter of taste and style
16:59ivanamalloy: thanks. I'll take a look at what Emacs' formatter does
17:10sritchiedoes anyone here have any good tooling on managing trees of utility dependencies in JVM land?
17:10sritchiethinking of this -
17:10sritchieif I split out schemas and utils into their own libraries, if I want to add to util, I need to
17:10sritchieadd the code, bump util’s version, release util, bump my main project’s version of util, run tests, bump my project’s version
17:11sritchielein-voom starts to address this problem; curious to know if anyone’s used it to automate this process
17:47sritchiednolen_: hey, do you know of a react hosted behind https?
17:48sritchielooks like https://fb.me/react-0.9.0.js redirects to non-https
17:48sritchiecausing chrome to block it
17:48sritchieI can just download it, I guess
17:50sritchieah, here we go
17:50sritchiehttps://cdnjs.cloudflare.com/ajax/libs/react/0.9.0/react.min.js
18:24cbphow do i get a stactrace from clojurescript?
18:25cbpstacktrace even
18:25cbpis there some sort of magical pst function somewhere?
18:26Fareyou debug with clojure, then port to cljs?
18:26cbpyou funny Fare
18:26bbloomactually, the cljs debugging story is pretty decent
18:27bbloomturn off optimizations & turn on source maps
18:27cbpbbloom: theyre both on
18:27bbloomin your browser, turn on "break on unhandled exception"
18:27bbloomin chrome you gotta click that stupid little icon for it on the script tab
18:28irctcAnybody know if there's a debian/Unbuntu with Leinigen 2.0 in? - So I can use my package manager to manage it?
18:30cbpbbloom: Is it "pause on exceptions" on the sources tab?
18:31bbloomyeah
18:31cbpwell will you look at that
18:31cbpif I had known this 2 months ago
18:32bbloomfurther proof that browsers are just crappy IDEs and IDEs just crappy operating systems
18:37annapawlickabbloom: that's one useful tip! i'm glad i read that
18:38bbloomamazing just how un-learnable most UIs are...
18:39bbloomit's utterly brain dead that loading the dev console doesn't have any impact on the system menubar
18:39bbloomat least when stuff is in the menu bar, you can scan through textual descriptions of the possible operations available to you
19:06annapawlickayeah, you would think this is a given
19:46Farewhat's the standard way of getting a string's length? (.length s) ?
19:53Jaood,(count "foo")
19:53clojurebot3
19:58JaoodFare: ^^ - I guess that's the standard (using polymorphic functions)
20:21gfredericksdoes anybody make use of the version field of their project.clj for applications?
20:22gfredericksI can't think of a use for it
20:34amalloygfredericks: so that when something goes wrong in production, the version number on the uberjar tells you what code is running
20:40gfredericksamalloy: I do that via a plugin & jenkins config; I can't imagine wanting to do it manually in the project.clj file.
20:41gfredericksI guess lein-release works by editing the file...hmm.
20:42amalloy*shrug* you asked if there's a use for it. maybe your way is better, but this way is useful
20:59technomancygfredericks: lots of people use it for bug reporting
21:01gfrederickstechnomancy: I get the value of knowing the version of your application that's running; I just didn't think line 1 of the project.clj file was the easiest way to get that feature
21:02gfrederickscompared to e.g. a lein plugin
21:04technomancygfredericks: oh, like literally reading it out of the file?
21:05technomancyyeah, not so much. lein 2.4.2 actually includes a pom.properties file during development time so you can check a single source that works in dev and production
21:05gfredericksno not literally reading it out of the properties file, but literally putting it there
21:06gfrederickse.g., my project.clj line one is (defproject woohoo "0.1.0-DUMMY-VERSION"
21:06gfredericksand I use a lein plugin that inserts my git sha into the uberjar name
21:07technomancythe sha is already in the uberjar, but maybe the filename is a more convenient place to read it from
21:08gfrederickssure
21:08gfredericksmy point is that line 1 of project.clj does not change
21:10technomancyyeah, manually maintaining it for an application might not be worth the trouble
21:11technomancybut you don't have to maintain it with lein-release; you just have to tell it whether you're doing a bugfix/minor/major bump
21:16Farewhat's the correct way to parse a number in clojure?
21:17Fareparticularly so floating point numbers
21:17Bird|otherboxFare: as in numeric string -> int or float? why, it's the exact same method any Java programmer would call
21:18Bird|otherbox(Integer/parseInt "42")
21:19ivanFare: depends on if you want doubles or integers for integer strings
21:20Fareand for the neophyte Java programmer, that would be, what, NumberFormat.getInstance(Locale.POSIX).parse(string) ?
21:20Fareivan: I suppose I want (a) doubles, and (b) bignums
21:20Bird|otherboxFare: that's actually a direct call to Integer.parseInt
21:20ivan,(Double/parseDouble "123.123123123123")
21:20clojurebot123.123123123123
21:20FareBird|otherbox, I believe for my Integers, I want bignums.
21:21ivanClojure BigInt or Java BigInteger?
21:22Fareprobably Clojure
21:23ivan,(require '[clojure.edn :as edn])
21:23clojurebotnil
21:23ivan,(type (edn/read-string "123123123123123123123"))
21:23clojurebotclojure.lang.BigInt
21:23ivan,(type (edn/read-string "0.012312312412434"))
21:23clojurebotjava.lang.Double
21:24ivanof course, that can read a bunch of other things as well, so you might want a regexp check as in http://stackoverflow.com/questions/2640169/whats-the-easiest-way-to-parse-numbers-in-clojure
21:38blur3dHey guys, are there any good resources on javascript/nodejs and clojurescript interop? I’ve been finding it hard to get the interop working.
21:46blaenkhey, I'm kind of confused about aleph and http-kit, specifically, where they fit. my understanding is that aleph would replace ring, but http-kit is a server. so theoretically one could run aleph on http-kit? is there a reason to?
21:52blaenkyeah I guess I'm mainly looking for the difference between aleph and http-kit
22:00blur3dblaenk: I am no authority on it, but I tried using aleph and hated that is uses lamina
22:00blaenkthanks blur3d, why's that bad?
22:00blaenkoh I see what it is
22:01blur3dWell for one, it made debugging really hard… the lamina outputs are not helpful
22:01blur3dI’ve been using http-kit for simple web servers and also making use of websockets and found it to be great
22:02blur3dI could be using it completely wrong, but lamina seems to be outdated by core.async (although core.async is very new and may not fit your needs)
22:04blaenkyeah I'm new to clojure but when I saw the page for lamina it reminded me of core.async, though I haven't learned it yet
22:04blur3dwell, core.async has a very nice API
22:04blur3dit’s not to hard to learn
22:05blur3dand I’ve found it easy to debug and test
22:06blur3dI was trying to use aleph for UDP - but take a look at https://github.com/ztellman/aleph/pull/96
22:06blur3da pull request that fixes an api inconsistancy with the rest of the code and the docs from Jun 4, 2013 - and not yet pulled
22:07blaenkwoah
22:07blur3dso yeah, I can’t recommend using it
22:09blur3dI haven’t had to scale things using httpkit, but this looks promising http://http-kit.org/600k-concurrent-connection-http-kit.html
22:15egosumis there a name for a function which accepts a list of functions, and returns a function which, when called, calls all the passed functions?
22:15egosum(with no arguments)
22:17egosumthese would be side-effectual functions, clearly
22:18gfredericksand then returns nil?
22:18egosumsure
22:19gfredericks,(doc pcalls)
22:19clojurebot"([& fns]); Executes the no-arg fns in parallel, returning a lazy sequence of their values"
22:19gfrederickshm
22:19gfrederickscall it docalls
22:19gfredericksno wait
22:19blur3d,(doc comp)
22:19clojurebot"([] [f] [f g] [f g h] [f1 f2 f3 & fs]); Takes a set of functions and returns a fn that is the composition of those fns. The returned fn takes a variable number of args, applies the rightmost of fns to the args, the next fn (right-to-left) to the result, etc."
22:20gfredericksdocomp :)
22:20gfredericksdobind?
22:20egosumhah, i like docomp
22:20blur3dI’ve never used it, but I think it’s what you're after
22:20egosumi was thinking doall, but that clashes
22:20gfredericksblur3d: no comp is functional
22:21egosumblur3d: comp composes functions--passes the output of one to the other etc
22:21egosumreturns the final value
22:22blur3doh, you want them called separately
22:22gfredericks,(defn docomp [fns] #(doseq [f fns] (f)))
22:22clojurebot#'sandbox/docomp
22:22egosumgfredericks: yeah that's the idea--this isn't for clojure, just looking for a name
22:22egosumfigured y'all might have some ideas :)
22:23gfredericks,(defmacro don't [& _])
22:24clojurebot#'sandbox/don't
22:25gfredericks,(don't worry)
22:25clojurebotnil
22:30blur3ddoes anyone know any good resources for javascript clojurescript interop, I’m finding it hard to get my head around
22:31gfredericks(.foo bar) ;; bar.foo()
22:31gfredericks(.-foo bar) ;; bar.foo
22:32blur3dwhat about something like this http://pastebin.com/SMN3b8C6
22:34sdegutisegosum: lol
22:35sdegutisclever
22:35bbloom(js/SerializePort "/whatever" #js {:baudrate 57600})
22:36bbloomactually, don't do the js/SerialPort bit, just do (def SerialPort (.-SerialPort (js/require "serialport")))
22:36bbloomalthough i'm sure there's something much better for interop w/ the node module system
22:36bbloombut as far as i know, node.js support for cljs is kinda experimental
22:38blur3dyeah, i’ve been getting horrible errors trying to use it
22:38blur3dbut some had bug reports of over a year ago
22:38blur3dI was hoping to write a web-app using node-webkit and clojurescript that can communicate with arduinos (microcontrollers)
22:39bbloomthere's no champion for cljs on node actively contributing that i know of
22:40blur3dI just found some chrome apis, which node-webit may support, so I might be able to do it all in js
22:40Jaoodcljs hardly has a maintainer
22:40blur3dbut I was hoping for TCP support
22:40blur3dhmm, it’s all so much better then using javascript
22:41bbloomJaood: i don't really think that's fair to david, he dedicates a lot of time to it
22:42blur3dclojurescript gets once a month releases, so it is making progress
22:43blur3dusing react and om is also really amazing
22:45Jaoodbbloom: oh, didn't mean to take on him, his work on cljs is awesome, just meant that cljs could doesn't have many contributors and no one is working on it full time
22:46Jaoodbbloom: I wonder if Hicker lost interest on it?
22:46JaoodHickey
22:46bbloomJaood: the thing is that the compiler itself is already quite solid, there is no need for a full time maintainer
22:46bbloomthe biggest shortcomings are in external tools
22:47Jaoodbbloom: I see, is the interop quite solid too?
22:47bbloomJaood: with javascript, yes
22:48bbloomwith node, no, not really
22:48blur3dwhat kind of tools would help?
22:48bbloomsince there's really no good reason to interop with node.js as far as i can tell
22:48blur3dyeah, I haven’t had any javascript issues
22:48Jaoodblur3d: I guess be tooling he means user experience
22:48Jaoods/be/by/
22:48bbloomyes, ux
22:48blur3dI just needed to use sockets, and I was hoping not to have to use nodejs
22:49bbloomblur3d: surely java has sockets, right?
22:49bbloom(i know it does)
22:49blur3dyeah, but I want to embed in node-webkit
22:49Jaoodblur3d: yeah, why not use the jvm?
22:49Jaoodoh
22:50blur3dI have it working now using clojure as a server, but I was hoping to embed a mini server into node-wekbit
22:50bbloom...why?
22:50blur3dand that would mean using nodejs… at least for TCP/WS
22:51blur3dBasically, I have been working on make a visualisation library for Arduinos (microcontrollers), so people can easily see what they are doing in real-time - with current values and graphs, etc
22:52blur3dI want to support Serial, TCP, UDP and WS communication (so you can be wireless)
22:52blur3dand then show all the data using clojurescript
22:53Fareok, my python lexer is complete in 458 lines of monadic clojure code.
22:53blur3dand since making people go to localhost:4567 sucks, I was hoping to embed it inside node-webkit
22:53blur3dand have it portable for windows/linux/osx
22:53Fare(plus 166 for a line/column position library)
22:54Jaoodblur3d: lighttable is a node-webkit app, maybe you can get some ideas from there
22:54blur3dyeah, I’ve been slowly reading its code - also the github atom editor
22:55blur3dthe problem is that browser serial/tcp/udp/ws support sucks, and I’ll likely need a mini proxy server that communicates between the arduino and the clojurescript app
23:00Fareand now, for monadic parsing!
23:02Jaoodblur3d: I hate to say if you don't want to do it C maybe Go would be less of a headache there?
23:03Jaoodor racket
23:03blur3dWell, nodejs might work fine for it
23:03blur3dI’m just not sure yet of the limitations of nodejs and node-webkit
23:03technomancywith a few tweaks racket can feel a bit like a lightweight clj
23:04blur3dcould I package racket in a node-webkit app?
23:05Jaoodblur3d: no, but it has a built-in http server and lets creates executables for your three platforms
23:05Jaood*you
23:05blur3dI guess technically I could use a nodejs loaded to name anything run… but it just gets complex managing all the processes
23:05blur3dok, I’ll take a look
23:05blur3da nodejs loader’ to make’
23:09Jaoodtechnomancy: true, seems like a nice replacement for clj where you don't need/want the baggage of the jvm
23:12blur3dare there any good racket books?
23:12Jaoodblur3d: many
23:12Jaoodblur3d: Realm of Racket
23:13blur3dhere is a preview of what I am trying to setup https://imgur.com/dBVDBon - basically a realtime dashboard for arduinos
23:13blur3dok, thanks
23:13Farethe clojure code is about half the size of the java code, but does more. It's also much slower :-/
23:15JaoodFare: I guess that normal? :P
23:15bbloomFare: how much slower?
23:15bbloomFare: what more is it doing?
23:17blur3dI have a quick question for people - how many languages would you say that you are reasonable fimiliar with (aka. able to write a minimal app)?
23:18seancorfieldProbably a dozen, maybe two dozen... but I'm a bit of a language whore so I suspect I'm unusual...
23:18Farebbloom: it's hard to time, since it's not hooked to the same things. I'll try to time it, eventually. It's lexing various additional things that the Java variant of that code I have was not processing, such as floating-point numbers.
23:18FareOn the other hand, my error messages suck beyond measure
23:18blur3dI’ve spent a fair amount of time learning more then I can count - and it can get hard to recall the right functions and such
23:19bbloomFare: you mentioned your lexers were monadic? or just the parser?
23:20blur3dI’d say I am comfortable with using around a dozen, but am familiar with a lot more (excluding windows)
23:20FareI didn't write the new parser yet, only the lexer. There is an existing codebase in Java that I want to bypass using clojure so I can experiment more easily.
23:20Farethe parser is next.
23:20Farethere I expect to be at least 3-5 times smaller than the java code.
23:22bbloomFare: you mentioned backtracking earlier... what backtracking is happening in the lexer?
23:22FareI'm following the official grammar quite closely, and not trying to optimize in terms of look-ahead
23:22bbloomwhat state does the lexer have in general? how is it encoded?
23:22Farefor instance, I try to parse a float, and if that fails I try to parse an integer
23:22seancorfieldblur3d: yeah, I'm rusty with some of things I haven't used for several years... but I've done professional, production work in C, C++, Java, CFML, COBOL, FORTRAN, Groovy, Scala, Clojure, several assemblers... I used to do a lot of Prolog, some APL...
23:23bbloomwhat does the lexer produce? a lazy seq?
23:23Fare[in out indent-stack delimiter-stack]
23:23bbloomwhat are in and out?
23:23Jaoodseancorfield: oh man, you are old school ;)
23:23Farein is a sequence of [char line column], out is a sequence of [token-type data position-info]
23:23Fareindent-stack is a list of integers, delimiter-stack is a list of expected closing delimiters.
23:24bbloomFare: what is the out sequence? a vector? and you're conj-ing on to it?
23:24Jaoodseancorfield: do you still use Scala?
23:24Fareout is a list, that gets reversed in the end.
23:24bbloomFare: arg.
23:24bbloomdon't do that
23:24bbloommake it a vector
23:24bbloomuse conj instead of cons
23:24FareI use conj on a list
23:24bbloomit won't need to be reversed at the end
23:24bbloomvectors have fast append
23:24Farereversing is O(n), conj'ing to a vec is O(n log n)
23:25bbloomFare: try it, should be a 2 line change
23:25bbloomconj-ing on to the tail is amortized O(1)
23:25FareI don't see why pessimize the program... it's already pretty dismal, performance-wise
23:26bbloomthere's a tail array in the root node
23:26Fareit's used only once, anyway
23:27bbloomyou were complaning it's slow. i'd be willing to bet that's a reasonably good win :-)
23:27FareI'm hoping to getting it released some time this year, but meh.
23:28Farebbloom: what is slow is all the allocation and all the wrapping/unwrapping of the state along the monadic style.
23:28Farealso, the backtracking through exceptions.
23:28bbloomFare: oh absolutely, that's by far the slowest
23:29bbloomi'm confused why a lexer has backtracking though, heh
23:29bbloomor a stack for that matter
23:29bbloomseems more like a parser to me....
23:29Farebecause it was simpler to write that way — the source code is much more modular
23:30bbloomok
23:30Faree.g. (def &exponent-float (&bind (&or &point-float (&intpart ())) &exponent))
23:30Farethat's pretty much straight out of the spec — except with left-to-right reordering so the longest is tried first.
23:31Farehence the expensive backtracking
23:31Fareif/when I decide to optimize for speed, I could modify the monad so the backtracking doesn't rely on exceptions.
23:32Farebut really, having an implementation that closely follows the spec is great.
23:32bbloomfor sure
23:33Fareunlike the java implementation I'm trying to replace, that is just butt ugly.
23:34Farefor now, I'm just experimenting, speed is not essential
23:36Fare(a lexer is just a parser that outputs a sequence of tokens)
23:39bbloomFare: generally a lexer also implies a regular language
23:40bbloomie one that can be parsed with a finite state machine
23:40bbloomrather than a pushdown machine
23:41Farewell, in python, you need an indentation stack and a delimiter stack to properly lex
23:41Fareso exit the finite state machine
23:42Farealso, I'm not sure how to parse those numeric literals without backtracking, it sounds awful to me.
23:42seancorfieldJaood: I no longer use Scala professionally... At work we switched from Scala to Clojure about three years ago...
23:42bbloomah, the joys of parsing languages whose grammars are retroactively formalized from their primary C-based recursive descent parser
23:42bbloomweee
23:42Fare01234 -- looks octal? only if it's not followed by . or e
23:43seancorfieldI don't think I have Scala installed anywhere now... possibly on my Windows tablet but not on my main work machine (Mac Desktop)
23:43Fareswitching from Scala to Clojure? Why?
23:43seancorfieldtime to go watch TV etc... probably back on later...
23:44seancorfieldFare: I posted to the Clojure mailing list about it ages ago and it caught fire on HN (unfortunately!)
23:44seancorfieldlots of reasons :)
23:45Farehttps://groups.google.com/forum/#!topic/clojure/sY-QBsBo8KA ?