#clojure logs

2012-03-30

00:54zawzeyhi, just checking with anyone has the same problem with clojurescript generating
00:54zawzeyhi, just checking with anyone has the same problem with clojurescript generating "can't recur here"
00:55zawzeythe live-cljs also has the same problem https://github.com/ibdknox/live-cljs/blob/master/README.md
01:01zawzeyibdknox: I'm also getting the same problem as you
01:06ibdknoxzawzey: you can't aot the compiler
01:06ibdknoxdelete your classes dir
01:06ibdknoxand add ^{:skip-aot true}
01:07zawzeyibdknow: yeah, well, is this a bug?
01:08zawzeywe have to file that somewhere, it took me over a day to discover this fix
01:56nybbles hey does anyone know the opposite of interleave function?
01:56nybblesi.e. i have a sequence of [a b] and i want two sequences, one with all the a's and the other with all the b's
01:57amalloy&(let [in '[a b a b a b a b]] (apply map list (partition 2 in)))
01:57lazybot⇒ ((a a a a) (b b b b))
02:01nybblesamalloy: cool, thanks.. was hoping it would be a builtin
02:01nybblesbut whatever works :P
02:35muhoohmm, noir question. let's say i've defpartialed a layout, and the :head is defined in there. now inside a page, i want to include-js something, and have it appear in the head of the generated html
02:36muhoo(and "don't use js, use cljs" is NOT a valid answer)
02:37muhooso i guess it's a hiccup question really, or rather a hiccup + ring question maybe
02:37ibdknoxjust make your layout take an additional parameter
02:37muhooah, cool.
02:37ibdknox(defn layout [array-of-js & content] ...)
02:37muhoothat was easy :-)
02:37muhoothanks
02:37ibdknoxnp :)
02:38muhooi guess it could even take map-of-head-things, i could have code in there which stuffs them in as needed
02:39muhoolike :title, frinstance
02:39ibdknoxyeah, that's what I do
03:16progoyou think it'd be idiomatic enough to write a macro that parses strings like "a beautiful_ day out there" into (str "a " (somefunc) " day out there") ?
03:18progoI probably would use such a thing for in-game dialogues which can have different level of profanity ... depending on user setting. And it could also shuffle something random each time :)
03:26amalloywhy would you parse strings? you have a gorgeous reader/macro system that gives you a rich set of symbols and lists, trivially pre-parsed
03:28progoyeah... it is about the fluentliness of writing dialogue. Natural languages, see.
03:29progowere I to write the next Fallout in clojure, I wouldn't prefer writing thousands of lines in exact S-expression syntax because it is bit too verbose.
03:34ibdknoxprogo: that doesn't need to be a macro
03:35progoyou are right about that.
03:35progoI went to premature optimization already with macro thinking :/
03:36ibdknoxa decent rule of thumb: macros are for creating new syntax
03:39progoIn most schemes, I understand, macros are used to lift some of the static computing to read phase. I take it JVM helps here in the case of clojure?
03:40progoor rather, can also be used *
03:41ibdknoxhotspotting definitely helps remove redundancies and such
03:42ibdknoxand my suggestion wasn't a steadfast rule
03:42ibdknoxbut in general, I think it's a good way of thinking about it
03:42progoI agree.
03:42ibdknoxThere are certainly some things that are nice to do at read/load time
03:42ibdknoxkorma, for examples, walks where clauses and does symbol replacement
03:43ibdknoxno value in doing that at runtime if you don't need to
03:44ibdknoxbut I think those cases are relatively rare
03:45ibdknoxin your case, I could imagine a compilation phase where you simply turn all your dialogue possibilities into functions and when you need some permutation you just call the function
03:46ibdknoxthat can be done at "load" time and have nothing to do with macros
03:47progookay :)
03:48ibdknoxSo you're building a game in Clojure? :)
03:50progojust thinking about writing one
03:51progoand it's been for a long time. Now that Clojure has come up, I actually think I have a chance of maintaining such a project by myself
03:55emezeskeprogo: Have you seen this? https://gist.github.com/1678577
03:59progoemezeske, nope. Looks nice :(
03:59progo*:)
04:20kral'morning
05:37AWizzArdhttp://isjavaexploitable.com/
06:20tacit-phoenixwhois technomancy
07:19mindbender1Is there a way to inspect the ring and compojure request map from the repl. And is the request map modifiable by the user?
07:20weavejestermindbender1: If you're using an IDE or Emacs you could add a debug step at the top of your handler
07:20weavejestermindbender1: Or you could use the debug-repl project
07:21mindbender1weavejester: I'm using emacs.. how would I do that
07:21mindbender1any links
07:21weavejestermindbender1: The only way you can change the request map is to add a wrapper, like middleware.
07:21weavejestermindbender1: How are you running Ring?
07:22mindbender1I'm using it with clojurescript one.. as a development server
07:23mindbender1I'm finding it hard inspecting the request map from the repl
07:23weavejestermindbender1: Hm, I'm not sure if that's been started with swank support then...
07:23mindbender1Ok if you giude me I'm sure I can tweak my settings
07:23weavejesterBut if you've started a server from a swank process, you can use (swank.core/break)
07:24weavejesterI don't have time to guide you, I'm afraid
07:24weavejesterBut take a look at: https://github.com/weavejester/ring-serve
07:24mindbender1weavejester: you are saying that I can only inspect the map with swanl.core/break
07:25mindbender1weavejester: *swank.core/break
07:25weavejestermindbender1: No, you could also use debug-repl
07:25weavejestermindbender1: Or print it out
07:25mindbender1weavejester: Ok point me to a link for debug-repl
07:25weavejestermindbender1: https://github.com/GeorgeJahad/debug-repl
07:26mindbender1weavejester: thanks let me study those
07:28mindbender1weavejester: what's the recommended way recently for swanking clojure projects
07:30mindbender1I still use my old clojure-jack-in style when working with clojure only projects
07:59y3didid rhickey say that simplicity was the opposite of complexity, or the opposite of complicatedness..?'
08:00gtrak``complectedness?
08:01gtrak``i guess that would be simplectedness
08:01gtrak``it's so complicated
08:08y3dihe did say that things could be both simple and complex right?
08:13josteinkso what do you guys use to search up syntax things in clojure when you're fooling around?
08:13josteinkI find that google is pretty poor at indexing things which are central in clojure syntax...
08:13josteinklike trying to lookup set! on google is hopeless :P
08:20headiussimplexity is the mother of complicity
08:25gtrak``josteink, try clojuredocs
08:26gtrak``there is like a symbol oriented search engine somewhere, too, but the name escapes me
08:27TimMcsymbolhound
08:30TimMcjosteink: ^
08:34Scorchinwhat's the best way to model a Java Object which is to be accepted as a parameter? Should it look like a map with relevant methods, or as a function?
08:35gtrak``huh what?
08:35gtrak``you making something to be consumed by java, or from java to clojure, or clojure-to-clojure
08:35Scorchinto be consumed in Clojure, but I'm wrapping Java
08:36gtrak``you could just leave it
08:36Scorchincurrently I'm just passing the Java object, but want to know if there's a cleaner way to wrap it
08:36gtrak``zach tellman had a good talk about this
08:37gtrak``https://github.com/strangeloop/clojurewest2012-slides/blob/master/Tellman-Distilling-Java-Libraries.pdf?raw=true
09:40jtoyon clojure 1.3, how do I use split? I tried with: (clojure.string/split (slurp "stop.txt")) and get java.lang.ClassNotFoundException: clojure.string (NO_SOURCE_FILE:0)
09:41chouserhave you done (ns ... (:require clojure.string)) ?
09:41cemerickYou have to require the namespace first, e.g. (require 'clojure.string)
09:41chousercemerick: good morning!
09:41cemerickchouser: morning!
09:42cemerickStill beating me out by an instant ;-)
09:42jtoyyes, that works, thx
09:42jtoyhow does one only allow the file to load once in idiomatic clojure?
09:43cemerickjtoy: namespaces will only be loaded once unless you specify :reload or :reload-all in the require/use form
09:44cemerickBut outside of the REPL, you should make sure to use a top-level ns form, as chouser hinted at.
09:48jtoysorry, i explained it wrong, i mean with a slurp, i have: (defn filter_words [word] (not (some #(= % word) (clojure.string/split (slurp "stop.txt")) ))) how do I have the slurp only happen once? or is the file already loaded for each subsequent call to filter_words ?
09:51pandeirojtoy: i would def a var, slurp into that, and then pass that var to my filter-words fn, but i'm pretty new here... maybe there's a better way?
09:51jtoyI'm new too
09:52clgvjtoy: there is 'defonce
09:52pandeirothere's the clojure.java.io ns too for doing more elaborate things but not sure you need that
09:53cemerickjtoy: if stop.txt isn't going to change, use defonce
09:53cemerickfeh, I'm slow today :-P
09:53jtoycool, thanks
09:53clgvcemerick: ;)
09:53pandeirocemerick: would the ns get re-evaled every time another ns in the execution path refers to it?
09:53pandeirohence the need for defonce?
09:54cemerickdefonce just ensures that the var's definition isn't re-evaluated and reset each time the ns is loaded
09:54pandeiroright, gotcha... things i'm still learning 7-8 months in... man
09:55stuartsierradefonce really only matters if you're reloading code during development
09:55cemerickthe ns won't get re-loaded due to another namespace referring to it; defonce is largely to prevent against redefinition when loading files via the REPL
09:55pandeirostuartsierra: that's what i was wondering, if i have a ns being required in different parts of my code, is it getting evaled each time?
09:55stuartsierrano
09:56stuartsierra`require` never loads the same namespace more than once unless you tell it to
09:56pandeirowonderful, that's the behavior i assumed
09:57clgvHas there ever been a discussion about caching the byte[] representation of dynamically created classes (via proxy, deftype...) in Clojure's DynamicClassLoader?
09:57stuartsierraclgv: discussion, yes, vaguely and briefly
09:57stuartsierraessentially that's what AOT-compile does
09:58clgvbut AOT is different. I have written down my issue here: http://groups.google.com/group/clojure/browse_frm/thread/613998ce1682c293#
09:59clgvsummarizing, the byte[] representation of dynamically created classes is need when the class is loaded from a remote location when using JPPF
10:00stuartsierrano idea, that's a very special case
10:00stuartsierrayou can always hack the compiler :)
10:01clgvyeah but you have to hack it again and again for each release... ;)
10:01stuartsierraNever Stop Hacking.
10:01cemerickclgv: there was a ML post on that, right?
10:01clgvcemerick: yes, the link above
10:02cemerickjeez
10:02clgvif AOT wouldnt be required, I could have a future-like command that distributes the jobs via JPPF which is also usable from REPL
10:03cemerickI was going to say, it sounds like JPPF should work fine if everything is AOT'd right?
10:03clgvyes it does.
10:05clgvbut the interactive usage on a REPL would be the killer feature ;)
10:06cemerickregular functions presumably work fine as well?
10:08clgvcemerick: good question. as far as I understood: if they have no classfile on the classpath it will not work
10:09pandeiroeach java process entails a unique jvm instance, am i understanding that right?
10:10pandeiroi'm running into memory problems on my netbook having a web server, browser repl, and swank all running at the same time, but i guess there's no way around that
10:10clgvcemerick: I couldnt try it since the proxy is needed and it already fails with loading the proxy-class
10:11cemerickCool JVM failure: Invalid access of stack red zone 0x11626bff8 rip=0x115e15c1d
10:11clgvpandeiro: upgrade to a laptop ;)
10:11pandeiroclgv: actually it's a tweener but yeah, 2GB of ram and netbook-grade processor :(
10:12pandeiroi also think it's because i am working with a large dataset and 5-10mb svg files open in the browser :) not all java's fault
10:14fdaoudpandeiro: I love my netbook but yeah you gotta go a bit more easy on it :)
10:15pandeiroi love the portability, hate the processor
10:16fdaoudhave had mine for 4 years, it has taken the use and abuse of being pounded on every day on the bus and subway, have run many different things on it, even wrote a book on it, and it hasn't complained
10:17pandeirofdaoud: model?
10:18fdaoudpandeiro: it's an asus eee
10:18pandeirocool yeah always heard good things about them
10:18stuartsierracemerick: You red-lined your stack?
10:18fdaoudpretty much looks like this: http://en.wikipedia.org/wiki/File:ASUS_Eee_White_Alt-small.png
10:19pandeirofdaoud: what os?
10:19fdaoudpandeiro: and the battery life is pretty good too
10:19fdaoudlubuntu
10:19pandeironice
10:20fdaoudI've tried others including eeebuntu, but lubuntu has proven the most stable (on this netbook anyway)
10:23pandeirofdaoud: i have a toshiba satellite t215 and it wouldn't install ubuntu, part of what precipitated my move to arch
10:23pandeiroi like not running gnome too, seems like a resource hog
10:26muhooRaynes: what did you end up choosing as a templating engine for refheap?
10:32fdaoudpandeiro: indeed. what did it come with preinstalled? mine came with Xandros
10:34chouserpandeiro, fdaoud: what do you use for wifi network management?
10:35pandeirofdaoud: wow, yeah mine came with Windows 7 Inferior Edition
10:35pandeirochouser: i use wicd
10:36devngood morning all
10:37pandeirochouser: i installed dhclient too b/c the default dhcpd was pissing me off, performs better now
10:37chouserpandeiro: ok, thanks.
10:37chouserdevn: g'morning.
10:38fdaoudchouser: gnome network manager
10:43fdaoudchouser: are you having linux wifi problems?
10:45chouserfdaoud: no, not for a long time.
10:46fdaoudchouser: ah ok, good :)
10:46pandeirosomewhat of a linux rite of passage, that
10:46chouserBut the desire to use gnome network manager was my gateway drug into using gnome again after years of not.
10:46pandeirochouser: what did you use previously?
10:47chouseroh, goodness. wpa_supplicant or something
10:59fliebelWhat do you recommend for doing stuff to a /dev/ttyblah device? I read there is javax.comm aand rxtx, but... do I need them?
11:01Zokacemerick: drawbridge looks really cool.
11:01cemerick:-)
11:02Zokaand very compact too:)
11:02cemerickZoka: I hope you find it usable. Let me know if you hit problems.
11:02cemerickMaybe I'm finally learning to keep things simple.
11:02cemericksimpler*, perhaps
11:02pandeiroi want to invoke a fn with a keyword as first argument which then determines how the fn executes - would that be a case for multimethods or just a (cond) in a regular fn?
11:03Tweypandeiro: Are you sure this wouldn't be a better case for several different functions?
11:04pandeiroTwey: i don't think so, they just trigger a small tweak to the jquery selector syntax depending on that keyword
11:06Tweypandeiro: Multimethods are more for cases where the function performs semantically ‘the same’ operation on different values or types
11:07Tweypandeiro: If you've got a value that's explicitly for switching, you probably don't want multimethods
11:07pandeiroTwey: gotcha, so i will go with the (defn (cond combo i guess
11:08Twey*nod* Seems reasonable
11:10TweyMultimethods aren't really for things that ‘just trigger a small tweak’; the idea is that they're useful for making the operation transparent when it's basically the same operation, but may be implemented completely differently based on the values passed to it (hence the syntax of defining methods as totally separate functions)
11:10Zokacemirick: for the time being I am staying with my transport, while I am working on more sessions features. Using Ring for nREPL communication was your idea anyway, I just have not implemented it in a such elegant way, but I am more familiar with it at the moment.
11:11devnwait, what's drawbridge?
11:12fdaouddevn: https://github.com/cemerick/drawbridge
11:12pandeiroTwey: so in another case, say I want this fn to accept both strings and RegEx, which obviously need different impls, that would be a case for multimethods?
11:13fliebelMaybe I'll just use Python for this project... I don't feel like fighting the classpath today, which seems to be required for getting rxtx to work.
11:20fliebel"RXTX is actually in central, but only the java portion; the native libraries are not distributed."
11:27fliebelSo, before I just walk over to Python, how can I depend on a native library that is not on Maven?
11:30devnaww, chas left :(
11:31rplevyin lein2 is there a new way of specifying the groupid for plugins? it seems to ignore the groupid
11:31TimMcrplevy: Yes. The first step is, come to BAZNEX.
11:31TimMcWe'll tell you the rest there.
11:31rplevyI live in Burlington, VT now
11:31rplevyso there's no way
11:31TimMcNO EXCUSES
11:31rplevyhaha
11:32TimMcWhat do you mean by ignoring the groupid?
11:33rplevyok so I have installed in my local maven a little fork of lein-cucumber, i put in my profiles.clj {:user {:plugins [[rplevy-draker/lein-cucumber "1.0.0.M1-SNAPSHOT"]]}}
11:33rplevyrplevy-draker, the groupid appears to be ignored
11:33muhoofliebel: i saw there's a better replacement for rxtx
11:33muhooit's pure java, less bugs than the jni-laden mess that is rxtx
11:34fliebelmuhoo: What? Where? *drool*
11:34muhooi don't recall the name but it's used in the ols project
11:34muhooi can look it up, hang on
11:34TimMcrplevy: And it's picking up the regular lein-cucumber?
11:34rplevyyeah
11:35rplevyactually it look for it with no groupid in the repos
11:35fliebelmuhoo: http://www.sparetimelabs.com/purejavacomm/index.html
11:35TimMcAnd you've saved your buffers? *dubious*
11:37muhoofliebel: http://www.sparetimelabs.com/purejavacomm/index.html
11:37muhooyep
11:38fliebelmuhoo: Thanks, I guess you just saved me a ton of nastiness.
11:38muhooit's thread safe :-O
11:38rplevyTimMc: and when I make a local maven install of it with no groupid that works fine
11:38muhoofliebel: np, glad to help
11:38fliebelwow, that... exceptional for a hardare interfacing thing.
11:38rplevy(it's not in a repo online yet)
11:38TimMcrplevy: Freaky.
11:39rplevyso either there's a bug, or group/artifact is no longer the way
11:41rplevymaybe there should be a lein help sample-profile
11:42rplevybecause the upgrade guid doesn't contain an example of this
11:43rplevysource dive time I guess, if no IRC answer :)
11:45TimMcI haven't really mucked about with lein2 yet.
11:48muhoohmm, the idea of calling directly from clojure to c library and os functions seems kinky and appealing to me, if i ever have occasion to use it: https://github.com/twall/jna
11:48rplevyI'v been using and making a few contributions to lein-cucumber and cucumber-jvm. Nils' latest change to use the new cucumber-jvm stuff is on a lein2-only branch, so I get to play with lein 2.
11:50chousermuhoo: it's old, but... https://github.com/chouser/clojure-jna
11:50muhoooh, cool, thanks
11:55rplevylein2 also ignores groupid when declaring plugins in project.clj in :plugins vector
11:57muhoo{:vector "Victor", :clearance "Clarence", :over "Ouvre", :roger "Roger"} => "what?"
11:59rplevyI figured it out
11:59rplevythere's no bug
11:59rplevylein2 install must have a different convention, because when I lein2 install the library it works
11:59rplevyit must name or write the pom somehow differently
12:01markgunnelsI'm trying to include json-lib in my leiningen project. It exists in maven central and sonatype (which I have added as a repository in my project.clj). The pom for json-lib is <dependency><groupId>net.sf.json-lib</groupId><artifactId>json-lib</artifactId><version>2.4</version></dependency> and my entry in dependencies is [net.sf.json-lib/json-lib "2.4" :classifier "jdk15"] or [net.sf.json-lib/json-lib "2.4"] (tried both).
12:01markgunnelslein for some reason can't resolve it though.
12:03markgunnelsAnybody see anything immediately that I am doing it wrong?
12:04TimMcrplevy: But it's still searching on just the artifact ID?
12:04rplevyno it works, I jumped to an incorrect conclusion, it wasn't ignored, it just couldn't find it
12:06rplevyis there anyone already working on making leiningen-war work with lein 2?
12:12dakroneZoka: lemme know if cheshire 3.1.0 works for you, it should now
12:17clizzinanyone know the story for asset packaging in clojure web apps?
12:18dakroneibdknox: just release cheshire 3.1.0, which now won't complain if clj-json is in the same project, so hopefully that will help with the noir issues for 1.2.1
12:21rplevyclizzin: you mean like war files?
12:38offby1Help -- M-x clojure-jack-in keeps failing with a baffling error: http://ix.io/2g7
12:38offby1I cannot for the life of me find any file that contains the symbol "slime-fancy"
12:38rplevyTimMc: on second thought I still think there is some groupid weirdness
12:38offby1I suspect this is due to leftover cruft somewhere in my home directory; M-x clojure-jack-in works OK when I start emacs with -Q
12:40Frozenlockoffby1: I personally gave up trying to make it work with 'fancy'.
12:40rplevytechnomancy: have you noticed any problems in lein2 using plugins specified like <groupid>/<artifact> as opposed to just the artifact?
12:41offby1Frozenlock: that'd be fine. How do I tell it "I don't want fancy"?
12:41technomancyoffby1: definitely a hold-over from manually-installed slime; maybe rgrep ~/.emacs.d?
12:41offby1been there done that
12:41technomancyrplevy: I don't think I've tried that yet
12:41technomancyoffby1: maybe apt-get?
12:42offby1well, this is OS X, but I'll look in macports
12:42Frozenlockoffby1: install slime from marmalade, make sure there isn't another slime around (for CL for example). Someone else might tell you how to mix the two, but I have no idea.
12:42technomancyFrozenlock: actually with jack-in you don't need to install slime yourself
12:42technomancyit can bootstrap itself
12:42technomancyso it's just a matter of finding the existing version and destroying it
12:42Frozenlocktechnomancy: Oh nice!
12:43offby1or as I say: hunting it down and killing it
12:43offby1I see a version in ~/quicklisp but I assume that you put that there.
12:43offby1since I deleted it recently and it just came back.
12:44FrozenlockIndeed, in my notes I see "Install clojure-mode from git or Marmalade." No mention of slime. My apologies.
12:44offby1can't find any other version: "locate slime.el" yields just those two hits under ~/quicklisp
12:45TimMcrplevy: Try pulling in [org.timmc/lein-otf "1.1.0"]
12:46offby1weird, M-x slime tries to run sbcl ... but M-x find-function RET slime RET errors: signal(error ("Don't know where `slime' is defined"))
12:47Frozenlockoffby1: You should start it with clojure-jack-in
12:48Frozenlocktechnomancy: Is lein2 ready for showtime? I would like to install it on my machine, but I'm afraid of the consequences on my Win7 OS...
12:49offby1Frozenlock: that's what I've been doing.
12:49offby1huh, rebooting emacs ... now it worked.
12:49offby1weird
12:50Frozenlockoffby1: If you just installed Lein your environnement variables might have been outdated. (I know I lost hours before thinking of rebooting emacs)
12:52technomancyFrozenlock: someone claimed to get it working on Windows
12:53technomancyFrozenlock: I use it every day on debian, but I'm not sure if the batch file has been updated
12:54offby1Frozenlock: I haven't explicitly installed lein
12:55technomancyrplevy: leiningen-war is deprecated IIRC
12:55Frozenlocktechnomancy: 'get it working' scares me :P
12:55technomancyFrozenlock: well I mean they got it working and submitted a patch =)
12:55technomancywhich is a lot better than getting it working and not submitting a patch
12:56FrozenlockIndeed :)
12:56rplevytechnomancy: what is the new way of doing what leiningen-war did?
12:57technomancyrplevy: lein-ring is generally the way to go these days I believe
12:57fdaoudrplevy: lein ring uberwar
12:57rplevyok, neat, I'll use that
12:58TimMcIn noir, is there a way to get automatic resource reloading?
12:59TimMcE.g., I'd like to be able to do (defresource foo "path/to/query.sparql") and have it define an IDeref that will be swapped whenever the resource changes on disk.
13:00TimMc(only in dev mode, perhaps)
13:16simard`what's the simplest way to run (swank.swank/start-server) in a thread of its own ? I basically want to start a swank server within my clojure VM without blocking at that call
13:18technomancysimard: easiest to wrap it in a future
13:19simardtechnomancy: thank you
13:23sritchietechnomancy, do I need to run anything special to get checkout dependencies working w/ lein swank?
13:24sritchieoh, never mind
13:24sritchieworking
13:24sritchienice
13:24sritchie!
13:28fdaoud[ibo;c vpod
13:28muhoo! was my reaction to lein too. i couldn't imaagine clj without it.
13:28fdaoudsorry, handed shifted on kbd + wrong window!
13:29technomancyfdaoud: just blame the cat; works every time
13:29fdaoudtechnomancy: :D
13:29muhoook, just convinced a customer to let me deliver him code written in clojure. win.
13:29progofantastic :)
13:29muhoothanks!
13:34phiathello clojurians... I have a question about Java interop that I can't find the answer to...
13:35phiathow do i instantiate a new java class like Polygon Polygon(int[] xpoints,
13:35phiat int[] ypoints,
13:35phiat int npoints)
13:35phiat(i.e. mulitple params in the ctor)
13:36sritchie(Polygon. array-1 array-2 points)
13:36phiatwow thanks. i'll try that
13:37TimMc&(doc int-array)
13:37lazybot⇒ "([size-or-seq] [size init-val-or-seq]); Creates an array of ints"
13:38sritchiephiat: yeah, that might be what's getting in your way
13:38mega`,(int-array [1 2 3])
13:38clojurebot#<int[] [I@1685b65>
13:38sritchieit's gotta be a primitive array for that constructor
13:38phiatah ok.. thanks a buynch
13:38phiatbunch
13:38sritchie(defn mk-polygon [xs ys n] (Polygon. (int-array xs) (int-array ys) n))
13:38phiatvery nice
13:39fdaoudsritchie: SICP flashback
13:39sritchiepainters!!
13:39fdaoud:)
13:39sritchie(def x-coord car)
13:39sritchieyup
13:48dnolennice, new CLJS release going out with PersistentVector
13:51fdaouddnolen: very cool
14:09dnolenand no more warning about .foo
14:12fliebelmuhoo: Do you have any personal experience with the purejavacomm thing?
14:15fdaouddnolen: oh that's nice. I'd been somewhat relunctantly ignoring those.
14:21dnolenk core.logic 0.7.0 out the door, now works easily with Clojure and ClojureScript
14:24fliebeldnolen: yay!
14:25kmicuAnyone has problems with 'lein cljsbuild auto' on project https://github.com/swannodette/cljs-demo ?
14:29dnolenkmicu: sorry, been busy with a few things - soon as core.logic 0.7.0 hits maven central that project should just work.
14:32fdaouddnolen: so first clojurescript has to hit maven central, and then a new version of cljsbuild needs to use the new version of clojurescript?
14:33dnolenanother reason to get cooking on the killer Clojure REPL in HTML 5, put this in your google search input: sqrt(x*x+y*y)+3*cos(sqrt(x*x+y*y))+5
14:33dnolenfdaoud: no, just core.logic
14:34dnolenfdaoud: oh, yes, if you're talking about the latest CLJS
14:34fdaouddnolen: yes sorry meant the new CLJS release you mentioned earlier, and using cljsbuild.
14:35kmicudnolen: Im on ubuntu 12.04 beta and I have lein 1.7.1 and lein 2 and I don't know if problems are on my side or not :), I can't even get core.logic 0.6.9 from clojars/maven but I can see this version on mvn Central :/ so I added 0.6.9 jar manually, but now when I run lein cljsbuild auto I get java.io.FileNotFoundException: Could not locate clj/core/logic/macros__init.class or clj/core/logic/macros.clj on classpath :P
14:36dnolenkmicu: nothing will work until 0.7.0 hits maven central - you'll have to be patient - it takes some time.
14:36Zokadakrone: cheshire 3.1.0 fine
14:36dnolenkmicu: if you really want to get going - you'll have to clone core.logic and install it by hand - which is pretty easy.
14:36kmicudnolen: 0.7.0 not 0.6.9?
14:37dnolenkmicu: yes
14:37dnolenkmicu: anything prior to 0.7.0 will have the wrong jar layout.
14:37kmicudnolen: thx, you're great! ;)
14:37dnolenkmicu: so 0.6.9 has CLJS support but nothing works because the JAR layout is wrong.
14:37dnolenkmicu: np
14:46offby1basic Java ignorance: I've attempted to set CLASSPATH inside of emacs like this: (setenv "CLASSPATH" "/opt/local/share/java/clojure/lib/clojure-contrib.jar") ...
14:46offby1... then I killed "java" and re-did M-x clojure-jack-in ...
14:46offby1But now I see user> (System/getProperty "java.class.path") => "/Users/erichanchrow/doodles/clojure/hello/test:/Users/erichanchrow/doodles/clojure/hello/src:/Users/erichanchrow/doodles/clojure/hello/classes:/Users/erichanchrow/doodles/clojure/hello/lib/clojure-1.2.1.jar:/Users/erichanchrow/.lein/plugins/swank-clojure-1.4.0.jar"
14:47offby1which seems wrong: shouldn't the clojure-contrib.jar appear in that output?
14:47offby1this is OS X; is this one of those deals where the new java process _doesn't_ inherit the environment from the process that started it?
14:47technomancyoffby1: you should be able to avoid setting the classpath by hand by just changing project.clj
14:47offby1technomancy: hmm, uh OK
14:47technomancymanaging dependencies by hand is just no fun
14:47offby1well, sure
14:48offby1even if this worked I wouldn't want to _always_ do it this way.
14:48offby1But I'm at such a baby-beginner level that I'd like to understand _why_ it's not working
14:48offby1do I just add clojure-contrib to the :dependencies in the semi-obvious way?
14:49Tweyoffby1: Could be that emacs isn't passing that on, or that the Java instance started by emacs has an explicit -cp argument?
14:49technomancyoffby1: yes, but with caveats
14:49technomancy:dependencies [[org.clojure/clojure-contrib "1.2.0"]]
14:50offby1technomancy: that's pretty much what I guessed; tx
14:50technomancyand that's fine for messing around, but in general "monolithic contrib" is deprecated
14:50offby1Twey: ooh, good point about the explicit -cp
14:50offby1technomancy: what does that mean in English?
14:50technomancyoffby1: it means rather than a bucket-o-libraries all mushed into one jar, the path forward is having each library in contrib maintained separately
14:50amalloyoffby1: don't use clojure-contrib; use the new broken-up contrib modules
14:50technomancyclojurebot: where did contrib go?
14:50clojurebotwell... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
14:51offby1*sigh*
14:51technomancyoffby1: contrib-as-a-single-jar is just a holdover from the days when having more than two jars was a huge pain in the neck
14:51technomancybut if you're just messing around it's not a big deal
14:52technomancyoffby1: the list is pretty short
14:52offby1good
14:52technomancy0) contrib, 1) #^ for metadata is replaced with just ^, and a couple other fairly obscure things
14:52amalloyi bet structs and duck-streams are on the list (not having read the book though)
14:52technomancyyeah, no more structs
14:53technomancyclojure.java.io and clojure.test are included in clojure itself now
14:53amalloyduck-streams is what i hear most often from people who read some old book
14:54technomancyc.j.io being the duck-streams replacement
14:55offby1looks like there's no "clojure.contrib.str-utils" although there is a "clojure.contrib.string"
14:55amalloyclojure.string
14:55emezeskefdaoud: I just saw the new clojurescript release on the ML. I'll try to squeeze out a quick cljsbuild release today, although I do have to hit the road here in a bit... :)
14:56offby1I just don't know what it is about Clojure -- every time I try to learn it, I seem overwhelmed with hindrances. Either I'm consistently doing something wrong, or I just lack sufficient motivation ...
14:57offby1maybe it's my insistence on using it via Emacs, combined with my utter ignorance of Java
14:57technomancycoming at it fresh would probably be easier than coming at it after two years away =\
14:57amalloyoffby1: emacs is the way to go, especially if (as you of course are) you're already familiar with emacs
14:58offby1I try to start from scratch each time.
14:58RickInGAoffby1 if you use emacs for other things, it is a good way to go. If you are not an emacs user normally, try clooj. It is a great way to start with Clojure
14:59technomancyoffby1: there's an updated edition of the halloway book, plus the new oreilly book is good
14:59lynaghk`emezeske: where are you off to? JSConf?
15:00amalloyRickInGA: offby1 has probably never turned off emacs in his entire life
15:00offby1technomancy: oh! I didn't know.
15:00emezeskelynaghk`: Nah, just a little road trip. Up to your neck of the woods, actually!
15:00lynaghk`emezeske: yeah? If you're in PDX and need a beer, drop me a line
15:00emezeskelynaghk`: Sounds good!
15:01aperiodici like beer
15:01aperiodic;)
15:01emezeskeBEEEEEEEEEEER
15:02aperiodiclynaghk` has my number, so you should hit me up if y'all are doing that
15:02lynaghk`Does anyone know if trying to use pushState and hashChange at the same time is asking for a boatload of trouble?
15:02lynaghk`aperiodic: will do.
15:02RickInGA,(symbol :foo)
15:03clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.String>
15:03dnolenemezeske: sick, thx for the quick switch to latest!
15:03RickInGAIs there a function for converting keyword to symbol?
15:03dnolenemezeske: oh, you haven't got there yet :)
15:03emezeskednolen: I'd have it done already if 0.0-1006 was in maven (or whatever)
15:04dnolenemezeske: yeah it usually takes a few hours
15:04emezeskednolen: Hopefully I can sneak away later tonight to push out the release real fast :)
15:05kmicudnolen: It works, pure madness!
15:05emezeskeaperiodic: Souns good, man!
15:05dnolenkmicu: excellent! did you just install core.logic yourself?
15:05kmicudnolen: yes, fresh 0.7.0!
15:06dnolenkmicu: cool, glad to hear that the instructions weren't too obtuse.
15:07xeqi$findfn :a 'a
15:07lazybot[]
15:08kmicu:dnolen one question about this warnings during cljs build e.g.: WARNING: The form (. this toString) is no longer a property access. Maybe you meant (. this -toString) instead? For now it is ok?
15:08xeqi$findfn 'a :a
15:08lazybot[clojure.core/keyword clojure.core/find-keyword]
15:09RickInGAis findfn just a bot thing? I got an error in inferior-lisp
15:09xeqiyeah
15:09dnolenkmicu: for now it is OK, we're waiting for CLJS 1006 to hit maven, I'll update cljs-demo soon as it does to grab latest lein-cljsbuild
15:09RickInGAcool
15:09xeqi,((comp symbol name) :x)
15:09clojurebotx
15:09RaynesRickInGA: It is a library too though.
15:09RaynesRickInGA: https://github.com/Raynes/find-fn
15:10RickInGAthanks
15:10RaynesEr, https://github.com/Raynes/findfn
15:18gfrederickswhat's the deps.js file for that my app.js keeps trying to load?
15:19gfredericksi.e., what's it expecting to be in there and how would I go about fulfilling those expectations (or changing them)?
15:19emezeskegfredericks: That file is something that would be used if you were not compiling down to one file
15:19gfredericks(using lein-cljsbuild)
15:19emezeskegfredericks: Here's an example of how to make that go away: https://github.com/emezeske/lein-cljsbuild/blob/master/example-projects/simple/src-clj/example/views.clj#L13
15:20gfredericksemezeske: thx
15:21gfredericksemezeske: on a related note, I have no idea how to do clojurescript deps anyhow -- is there some doc on that somewhere?
15:22emezeskegfredericks: All you have to do is (require ...) them, and if they're in the classpath you're good
15:22emezeskegfredericks: And they can get in the classpath by adding them to your :dev-dependencies or whatever
15:23gfredericksokay sweet
15:23gfrederickswait a minute
15:23gfredericksuh
15:24gfrederickswhat does that assume about what I'm doing in the project.clj config with cljsbuild?
15:24emezeskegfredericks: Nothing at all.
15:24gfredericksokay
15:24emezeskegfredericks: It really is just as simple as "is it on the classpath"
15:25emezeskegfredericks: Whether or not the classpath is simple is another discussion :P
15:25mega`sup cljs experts getting some error with clojure.browser.repl/connect in the newest cljs version parentElm is null.. anny one seen this before?
15:25gfredericksI'll not ask anything else until I can't get it to work :)
15:26emezeskegfredericks: ^_^
15:30fdaoudemezeske: great, thanks!
15:31emezeskefdaoud: Note that, as others have mentioned, it could be a few hours before the upstream release hits the repositories
15:31fdaoudemezeske: noted. I'll be patient. :)
15:33ipostelnikis there a way to get "lein uberjar" to not check for dependency updates?
15:42offby1is it normal for "lein search" to take many minutes?
15:51TimMcthe first time, yes
15:54Raynesoffby1: It downloads lucene indexes.
15:54Raynesoffby1: Which is the equivalent of downloading the internet.
15:55fdaoudif only lein clean cleaned the internet.
15:56RaynesEvery time you run `lein clean`, 12 comments disappear from hacker news forever.
15:56offby1anyone know offhand if some bit of Clojure creates a directory ~/.m2, and fills it with class files?
15:56dnolenkibit is headed towards being as cool as this: http://soft.vub.ac.be/SOUL/
15:57offby1Raynes: that'd be a _good_ thing, no? :-)
15:58fdaoudoffby1: that's a maven thing, which I believe lein uses as well
15:58offby1hm, OK; I'll spare it the wrath of my "nuke everything that I don't understand" impulse
15:58offby1since it does have a ton o' stuff in it
15:59fdaoudoffby1: for example, clojurescript might come from here: http://repo1.maven.org/maven2/org/clojure/clojurescript/
15:59fdaoudthen it would go into your .m2/repository/org/clojure/clojurescript
15:59offby1ah, ~/.m2 implies "maven2". Got it
16:00offby1thanks
16:00fdaoudright, sorry should have mentioned that.
16:00fdaoudwelcome
16:01jtoyif i need a very simple web app to serve the contents of a file on the fs to the browser, what lib would you guys recommend? Im a clojure newb
16:01fdaoudoffby1: my .m2 has about 500-600MB in it.. you might want to hold off on nuking it.
16:01hiredmanjtoy: I would recommend this thing called "apache" it's pretty good
16:02jtoyhiredman: i will convert the file a little bit
16:02jtoy with some code
16:02offby1fdaoud: yeah, I've put lamb's blood around its doorframe; it shall be spared my wrath
16:02jtoyhiredman: because, if it was just a web server, i would use nginx, it uses less resources
16:03jtoybesides
16:03offby1I'd put in an ignorant vote for nginx too -- I vaguely recall it's easier to set up than apache
16:04fdaouddoes this mean I shall never ever again suffer the wrath of offby1 errors?
16:04offby1I don't see no lamb's blood round _your_ doorway.
16:05fdaoudwait, didn't you see what I did above?
16:05offby1oops!
16:05offby1I guess I'm not as omniscient as y'all thought
16:07fdaoud,(map list "abcde" (cycle [:odd :even]))
16:07clojurebot((\a :odd) (\b :even) (\c :odd) (\d :even) (\e :odd))
16:08fdaoudlove stuff like that, no more (for i = 0, t = ...) { (i % 2 == 0) ? .. : ..)
16:08offby1that's exactly the sort of thing that keeps me plugging away at trying to learn this beast
16:12fdaoudoffby1: I agree. One hurdle I'm trying to overcome is to "unthink" the ways I've always done this stuff, and find better functional-style solutions
16:12autodidaktojtoy: lib? you mean web framework, or?
16:12jtoyyeah, web framework
16:13amalloy:( web framework. "Clojure: build libraries, not frameworks"
16:13jtoyor lib is fine
16:14autodidaktoIt's helpful to make comparisons/analogies *cough*
16:14fdaoud(map (fn [name] (amalloy :description)) ["ring" "compojure" "noir" "hiccup"])
16:14autodidaktojtoy: so there's ring, on top of ring, there's compojure, on top of compojure there's noir
16:15autodidaktoif you know ruby, ring is like rack
16:15jtoyi know ruby
16:15amalloypersonally, i'd just slap something together with ring/compojure. a lot of people would use noir. the smart people would use probably use nginx or apache for production
16:15autodidaktonoir is something like sinatra
16:16amalloyfdaoud: '(library library framework/but-pretty-cool-anyway library)
16:17fdaoudamalloy: cool. so why is compojure a library, but noir a framework?
16:17technomancyoffby1: lein2 has a progress bar for search index downloading now
16:17offby1fdaoud: I'm quite familiar with functional style and Lisp; what's tripping me up is the Java-ness.
16:17offby1and the always-quickly-changing-ness.
16:18amalloynoir has all this implicit stuff about views and models and partials and middleware it injects automatically for you. but also, because i don't know that much about it
16:18amalloyso don't take my word for it
16:19technomancyoffby1: picking up Clojure c. 1.4.0 when you last touched it at 1.0 would be a bit like getting back into Emacs when you hadn't touched it since version 20. =)
16:19autodidaktoAbout the "framework" word.... I agree that it isn't the right word... what's great about the clojure web..sphere... how these small, well written parts (ring/compojure/noir) fit one ontop of the other
16:19technomancywhich I believe seancorfield actually did, but it wasn't pretty
16:19fdaoudoffby1: oic. I'm coming from the other side. 15 years of Java. Not so many of lisp/FP. I'd say interested in FP since about the last 4 years or so (FunctionalJ, 2008)
16:19offby1technomancy: Actually it's not a problem since I remember approximately nothing
16:19technomancyah, perfect then
16:20autodidaktoamalloy: I think ibdknox would disagree about noir doing a substantial amount of background magic. In any case, you should check it out
16:20fdaoudamalloy: np. I'm just curious at the boundary between library and framework. Framework would be where you have to mostly go "all-in", then?
16:20fdaoudas opposed to library which is more "use what you need"?
16:22weavejesterA framework is usually something that dictates how your code is laid out.
16:22weavejesterSo Rails sets up a folder structure and a way of doing things for you
16:22weavejesterA library just provides an API you use. It's a servant, rather than a master.
16:23fdaoudweavejester: well said.
16:24fdaoudthat is useful since I am trying to write about all this stuff.
16:26offby1is there some reason that "lein search" can't cause the search to run remotely? That way I wouldn't have to wait half an hour for the index to download :-|
16:27weavejesteroffby1: As far as I know, Maven repositories are just static folder structures - no search
16:28technomancyoffby1: you can use http://search.maven.org and the search box on http://clojars.org if you know which repository contains the dependency
16:29RaynesOr technomancy can make his broken softwares faster.
16:29technomancyrepo1.maven.org is not my software =P
16:29fdaoudRaynes: you still lacking sleep bro? :)
16:29autodidaktoRaynes: come on now, be nice, he's making broken software as fast as he can
16:29Raynesfdaoud: A little bit.
16:29Raynesautodidakto: :p
16:29dnolenjust tried kibit - very neat!
16:29fdaoudRaynes: I hope your weekend is RESTful.
16:30Raynesfdaoud: :)
16:37TimMcibdknox: How hard would it be to hook into noir's view reloading to provide an atom that kept getting refreshed with the contents of some resource?
16:40fdaoudRaynes: what's happening with Meet Clojure?
16:41Raynesfdaoud: It's just taking a while because I have a lot on my plate.
16:41RaynesStill in progress though.
16:41fdaoudcool. believe me, I know how much work it is.
16:44autodidaktoRaynes: The yellow E in the MSPaint-cover-concept-art is a nice touch
16:44RaynesThat was something a friend just threw together as a placeholder for an actual cover.
16:46autodidaktoLearn You a Haskell has the elephant, Land of lisp the alien (elephant like creature). Meet clojure maybe needs an animal mascott too
16:46fdaoudautodidakto: O'Reilly's Clojure and Closure both have birds :D
16:47autodidaktoThe sometimes-italic j in Clojure is suggestive of an ant-eater or aardvark
16:47autodidaktofdaoud: I see they're not concerned about confusion
16:47fdaoudhehe
16:48TimMcThe animals they use are completely random, right?
16:49TimMcI'm pretty sure their Python book has a rat on the cover.
16:49autodidaktonah it has a snake
16:49autodidaktobut I vaguely remember hearing that it's not exactly author's choice. i'll look it up
16:49fdaoudnothing beats the drunk dude on the Joy of Clojure cover.
16:50dnolenhuh kibit runs in a reasonable amount of time even on large Clojure code bases
16:50autodidaktoWait. there is an edition with a rat... weird
16:51autodidaktofdaoud: haha yeah
16:51raekthe joy of clojure cover guy looks like the břežňák man
16:51autodidaktoTimMc: you're right, latest python has rat on it. Python food methinks.
16:54autodidaktono wait, was rat until latest edition. then they changed the name slightly and put a python. same author.
16:58TimMcAuthors usually have little to no control over book covers.
16:59autodidaktoTimMc: "explaination" here -> http://oreilly.com/news/ediemals_0400.html TL;DR, cover design just makes it up and gives no explanation
16:59autodidaktoTimMc: Title and subtitles too. Crazy marketers get more say
17:00autodidakto*Cover designer just makes it up...
17:02TimMcI love it: "One author desperately wanted to have a boll weevil on his book cover"
17:02offby1Damn, more trouble: on Ubuntu, now, M-x clojure-jack-in is getting me ``Starting swank server... Connecting to Swank on port 62854.. [2 times] error in process filter: Symbol's function definition is void: slime-output-buffer [2 times]''
17:02offby1what's odd is that I can see there's a hidden buffer that contains slime, and it contains a definition for that function
17:03technomancyoffby1: looks like you still have something installed that's expecting a newer version of slime
17:03offby1*sigh*
17:03offby1emacs does not make it easy to see where code is loaded
17:03autodidaktoTimMc: The boll weevil really is the king of the weevils
17:04offby1technomancy: so is that *swank* buffer supposed to get evalled?
17:04TimMcs/evalled/weeviled/
17:04dnolenemezeske: looks like cljs might have made it to maven
17:04autodidaktohehe
17:04technomancyoffby1: oh my bad; I thought you said it was a variable rather than a function
17:05technomancyoffby1: older swank-clojure implementations spewed out all of slime.el into *swank*, but in 1.4.0 it's a bit more streamlined
17:05offby1hmm
17:05technomancyoffby1: you could try lein plugin install swank-clojure 1.4.0
17:05offby1sure why not
17:06offby1by the way, I'm using lein 1.6.0 which appears to have come from Ubuntu, since it's in /usr/bin/lein ... Is that bad?
17:06technomancyno, that should be fine
17:06technomancyif you do have slime from marmalade already, you can just do "lein swank" and M-x slime-connect
17:06offby1ok, installing the plugin appears to have succeeded
17:07technomancyjack-in is mostly there to avoid all the headaches people get from figuring out how marmalade works
17:07offby1you totally lost me
17:07offby1I'll try clojure-jack-in again
17:07technomancysure
17:09offby1apparently lein 1.6.0 _is_ bad: it says "lein swank is not a task"
17:09offby1life on the bleeding edge!
17:09technomancyoh cripes; yeah... I thought that bug was older
17:10technomancyeasy fix though; remove the old swank from ~/.lein/plugins
17:10fdaouddnolen: sweet!
17:11offby1may just nuke all of ~/.lein
17:11technomancyoffby1: if it placates your fury
17:12fdaoudprecates?
17:12fdaoud;)
17:18offby1hooray, shiny new lein fixes all problems. I even noticed my hair growing back.
17:19technomancyfwiw 1.7.1 is in debian testing =)
17:19technomancythere's hope for a brighter tomorrow
17:22fdaoudgood weekend all
17:46emezeskednolen: sweet, it sure did!
17:48lynaghk`emezeske: have you ever used cljsbuild with ibdknox's fetch?
17:48emezeskelynaghk`: Yeah, I use that in my closed-sauce project
17:48lynaghk`I ran into an issue where cljsbuild auto wasn't refreshing properly.
17:49emezeskeUnder what circumstances?
17:49lynaghk`nothing crazy as far as I could tell. I just added fetch to my project and started playing around with it and ran into that issue
17:50emezeskeLike, you saved one of your project's cljs files and it didn't rebuild?
17:50lynaghk`not using the macro made it go away; I was going to dig into it more but decided to just switch over to using Compojure with XHR manually.
17:50ibdknoxlynaghk`: when you add a new clj dependency you have to restart the watcher
17:50lynaghk`no, it rebuilt and no errors showed up but It would serve a stale version
17:50ibdknoxlike the macros for fetch
17:51lynaghk`ibdknox: yep, it persisted after that though.
17:51ibdknoxhm
17:51lynaghk`ibdknox: I just integrated waltz into a project this morning; it's rad.
17:51ibdknox:)
17:51lynaghk`I have some wishlist items---I can submit a pull if you're game
17:51lynaghk`one would be to have a listener called on all state changes
17:52ibdknoxyeah, that was on my list
17:52emezeskelynaghk`: That's weird, I don't know what's up with that.
17:52ibdknoxhaving a deterministic version
17:52ibdknoxand renaming those stupid names
17:52ibdknoxlol
17:52lynaghk`emezeske: yeah, I'll try the new cljs build and put together a minimal example if I run into it again
17:52ibdknoxdeftrans/transition is confusing :(
17:52lynaghk`yeah, I was confused about that too. Also, I'd love a macro where you can define it all in one form (like compojure's defroutes)
17:53ibdknoxsure
17:53ibdknoxyou can do that already just with (->
17:53ibdknoxI think
17:53lynaghk`ahhh, good point.
17:53emezeskelynaghk`: That would be aweesome.
17:54ibdknoxdefevent or definput?
17:54lynaghk`ibdknox: have you seen https://github.com/gf3/secretary ?
17:54ibdknoxyeah, I have something similarish in waltz
17:55ibdknoxwhere you can do transitions based on hash changes or urls
17:55lynaghk`there is no destructuring in there though, eh?
17:55ibdknoxyeah
17:56lynaghk`What I'm doing right now is actually just shoving all context into a url-encoded string
17:56gfrederickswhat is the fancy point-free way to go from x to (fn [y] (@x y))?
17:56gfredericks(partial deref x) is clearly wrong
17:57lynaghk`i.e., clientsideapp.com/state/{:my "cljs" :prn "datastructure}
17:57weavejestergfredericks: juxt, I think...
17:57pjstadig(partial apply (deref x))?
17:57pjstadigor maybe a comp in there?
17:57gfrederickspjstadig: I don't want to deref until the function is called though
17:57ibdknoxlynaghk`: haha interesting
17:58pjstadighmm
17:58emezeskeOkay, I just pushed out lein-cljsbuild 0.1.4, which depends on the latest clojurescript release (0.0-1006) as well as closes a few other cases.
17:58weavejesterOhh, I didn't notice the derefing
17:58gfredericksweavejester: I was really hoping you were wrong :)
17:58weavejesterI don't think there's a built in function for that.
17:58lynaghk`emezeske: high-five!
17:58pjstadig#(@x %)
17:58gfredericksweavejester: perhaps not one but a small combination...
17:58gfrederickspjstadig: that's shorter, not point-free
17:58pjstadigoh yeah
17:58pjstadigpoint free
17:59technomancypjstadig: that looks like a screenshot from nethack
17:59gfrederickspartial apply sounds promising though
17:59technomancynot saying that's a bad thing
18:00gfredericksI guess what you need is a call function
18:00TimMcthis is going to be something horrible with partial apply apply, isn't it
18:00gfredericksor invoke or whatever
18:00gfredericksTimMc: that's why you need call, it's cleaner
18:00hiredman((fn [y] (@x y)) 1) is just ((deref x) 1)
18:00gfrederickshiredman: certainly
18:00gfredericksbut I want an expression for the function
18:00gfredericksnot the result of calling it
18:00hiredmanso, uh, (deref x) is point free
18:01gfrederickshiredman: but that derefs immediately rather than when the function is called
18:01gfredericks(def my-fn (deref x)) is no good
18:01gfredericksyeah I think it will have to be really ugly
18:01gfredericksat least without a call function
18:02gfredericksprobably even ugly with that
18:02TimMctrampoline :-P
18:02gfredericksooh
18:02lynaghk`ibdknox: Why did you decide to write a deftrans construct for Waltz? All I'm doing with them is defining transitions that set the machine to the state with the same name (am I missing something?)
18:03ibdknoxlynaghk`: it's non-deterministic, so a transition (or input, or event) can cause multiple states to flip
18:03ibdknoxlynaghk`: transitions should be verbs, states should be nouns/adjectives
18:03lynaghk`ibdknox: ahhhh, got it.
18:04ibdknoxtransition: load -> state: loading
18:04ibdknoxas an example
18:05lynaghk`ibdknox: so the machine can be "in" any subset of the total number of states?
18:06ibdknoxyes
18:06ibdknoxit's up to you to define exclusions
18:06ibdknoxbuuut, like I said, I want to add a deterministic version too. In that case, all states are mutually exclusive
18:07lynaghk`ibdknox: any plans to do something hiearchical?
18:07lynaghk`emezeske: these undeclared var warnings are pretty hot, thanks.
18:07ibdknoxyou can accomplish that with what's there
18:08lynaghk`ibdknox: But I demand synatactic sugar!
18:08ibdknoxbut it depends on what you mean
18:08lynaghk`=P
18:08ibdknoxhaha
18:08lynaghk`Nah, all I have in mind would be to have different SMs for different screens, but with a deterministic version it wouldn't be difficult to implement that
18:09lynaghk`I'll have to make a large app with these things, and then log the transitions and make some cool visualizations.
18:09ibdknoxyeah
18:09ibdknox:)
18:09ibdknoxthe ability trace everything is pretty neat
18:10muhoofliebel: i've used ols, which uses purejavacomm
18:11emezeskelynaghk`: yeah, thanks go to jenan wise for that feature, and dnolen for suggesting it!
18:11TimMcibdknox: Did you see my question about reloading arbitrary resources?
18:11muhooRaynes: what template engine did you end up settling on for refheap?
18:11emezeskelynaghk`: I have wanted that for a while
18:11Raynesmuhoo: Mustache.
18:11muhooRaynes: thanks
18:11lynaghk`emezeske: man, cljs really is taking all of the runtime fun out of clientside development.
18:11Raynesmuhoo: Via https://github.com/davidsantiago/stencil
18:12muhoooh yes, thanks. i do remember you talking abotu that now.
18:16ibdknoxTimMc: missed it
18:18ipostelnikis there a way to figure out what's holding the head of lazy-seq and why?
18:19TimMcibdknox: How hard would it be to hook into noir's view reloading to provide an atom that kept getting refreshed with the contents of some resource?
18:20TimMcI guess it wouldn't have to be noir-specific -- it would just be a nice feature when editing SQL or SPARQL query files.
18:25FrozenlockAny advice on whether I should use Noir or compojure/hiccup?
18:26vijaykiranNoir uses compojure/hiccup AFAIK and you get some extra sugar as well.
18:28dnolennice lein-cljsbuild now gives declaration warnings
18:28technomancyFrozenlock: if you know how all the pieces fit together you might try compojure itself first, but noir makes a lot of choices for you that you may not care to bother with
18:33Frozenlocktechnomancy: thanks. As a neophyte, I'll give a try to Noir.
18:34simardis there a way to force the termination of a future when future-cancel fails ?
18:36ivan___in cljs how do you access the window object? i seem to get a namespaced window object, but that doesnt seem like the 'real' one
18:38ivan___nvm
18:40weavejesterFrozenlock: Does it use that library in particular?
18:41FrozenlockI think it does; it's in the lib folder.
18:42weavejesterFrozenlock: Ah, it looks like it uses the more up-to-date ring.middleware.reload in the upcoming version 1.3.0
18:43FrozenlockWill it use your new version of compojure/hiccup too? I saw both were in beta.
18:44Frozenlocknvm: [hiccup "1.0.0-beta1"] [compojure "1.0.1"]
18:44weavejesterFrozenlock: The master branch of Noir has those deps
18:44weavejesterI'll probably release Hiccup 1.0.0-RC1 tomorrow
18:44weavejesterAnd Ring 1.1.0-RC1 sometime this weekend, too.
18:51lynaghk`emezeske: auto compilation with fetch seems to work fine in the new cljsbuild.
18:54lynaghk`weavejester: would you still be open to a pull request for an :allow-symlink option for (wrap-file) middleware? I ran into that problem yesterday and saw you had a discussion about it with someone last summer and said you'd welcome a patch.
19:08arohnersimard: not really. there are ways to terminate threads in java, but they're very unsafe
19:09simardarohner: hum then I'll have to find a way to kill that swank gracefully.. say send it a message.
19:09simardsomehow.
19:09arohnersimard: your goal is to stop the swank server?
19:09simardyes
19:09simardwell..
19:09simardI tried (swank.swank/stop-server)
19:09simardand it seems to work.
19:10simardit fact I'm not sure which thread is preventing my software from stopping.
19:10simards/it/in
19:10simardwhen I asked the question about futures I thought it was swank
19:11arohnersimard: (Thread/getAllStackTraces) will return a list of all threads
19:11arohnersimard: then call .getName and .isDaemon on all of them
19:11arohnersorry (-> (Thread/getAllStackTraces) (keys))
19:12arohnersimard: the non-daemon threads keep the app alive
19:12arohnerthough if you wait 60s for the app, and it shuts down on its own, that's probably the clojure agents keeping it up
19:13simard60s eh. I'll try that
19:14simardarohner: oh it did shut down after 1s this time..
19:14arohnerif it shuts down after 60s, you need to call (shutdown-agents) when you're ready to shut down
19:15simardarohner: yup it definitely shuts down after a while
19:15simardI'll add this call then, thanks :)
19:16arohnernp
19:21arohnerdoes anyone have experience w/ cron4j or a similar library?
19:25jhicknerclojurescript question. I'm trying to set a js propertty - camera.position.z = 1000. Is there a nicer way to do it than this? (set! (.-z (.-position camera)) 1000)
19:27ideally_worldis it possible to assert something in a midje after wrapper?
19:32oakwisejhickner: (set! (.. camera -position -z) 1000)
19:32jhicknerhotness. thanks!
19:33oakwisenp
19:34simardjhickner: are you working on a game ?
19:36jhicknersome work with three.js
19:36jhicknernot a game, just messing around really
19:38aperiodicjhickner: is the source available anywhere?
19:39ibdknoxTimMc: yeah, I don't think I would tie it to noir :)
19:39jhicknernot yet, I just started this morning
19:40aperiodicjhickner: i've entertained the idea of doing that myself, but haven't gotten around to it yet. hopefully i can just steal your code ;)
19:40eggsbyis there a canonical clojure redis client?
19:41eggsbyor is it a free-for-all
19:41jhicknersure, the hardest part so far was making an externs file
19:41eggsbyIs anyone itc familiar with using redis with clojure?
19:41aperiodiceggsby: yeah; we use our own fork of clj-redis at work (it has pipelining, woo)
19:42eggsbyhttps://github.com/tavisrudd/redis-clojure this is what google returns, but I don't know that it's a full client... it doesn't even seem to have pubsub
19:42aperiodicjhickner: are you the jhickner on gh?
19:42ibdknoxeggsby: there's a new one that abedra is working on, one sec
19:43ibdknoxeggsby: https://github.com/abedra/accession
19:43technomancyI think clj-redis has pubsub
19:43eggsbythank ibdknox
19:43aperiodicclj-redis does have pubsub
19:43FrozenlockIs there a way to automatically add functions name in Emacs syntax highlighting?
19:43aperiodicwell, pub, for sure, can't vouch for sub
19:44eggsbyWe're working on a project at work that I think redis would be an extremely elegant solution for (right now we're doing intense polling across several systems) but it's kind of hard to argue in favor for it when I can't even show a good client :p
19:44jhickneryeah jhickner on gh
19:44ibdknoxeggsby: that should be a good one
19:44technomancyeggsby: oh man you're in luck; there are like a bazillion redis clients; that's even better, right?
19:44eggsbyanyhow thank you ibdknox/technomancy/aperiodic, I'll look into redis-clj and accession
19:44eggsbyhaha technomancy :(
19:44ibdknoxeggsby: just look who contributes :)
19:45aperiodicaccession looks like it's actively developed, though; i'd go with that, unless you need multi/exec
19:45eggsbya commit by fogus :o
19:46eggsbyaccession looks nice
19:46eggsbywill have to dig into it
19:54ideally_worldwhat's the right way to add a key-value pair to a map reference? I'm trying (dosync (alter my-ref assoc :key :value)) and getting a "clojure.lang.Keyword cannot be cast to clojure.lang.Associative" :/
19:55ideally_worldno idea what the means
19:55technomancyit means your ref doesn't contain a map
19:55ideally_world(ref {}) ??!
19:56technomancyyou must have changed it somewhere else
19:56ideally_worldI did
19:56ideally_worldjust checked it
19:56ideally_worlddynamic typing for the bitting in the arse :)
20:00simardsay I have a list (of symbols) ('KEY_0 'KEY_1 ...) that would actually be members of some class (org.lwjgl.input.Keyboard). Is there a special form to convert that list to a list of member access like this: (org.lwjgl.input.Keyboard/KEY_0 org.lwjgl.input.Keyboard/KEY_1 ...) ?
20:13simardorg.lwjgl.input.Keyboard/KEY_0 is 11, (resolve (symbol (str "org.lwjgl.input.Keyboard/" "KEY_0"))) is nil, why ?
20:14amalloybecause that's not a var
20:14amalloyand resolve looks up vars
20:14simardis there a way to do "what I want" then ?
20:15amalloyreflection
20:16amalloy$javadoc Class getFields
20:16lazybothttp://docs.oracle.com/javase/6/docs/api/java/lang/Class.html#getFields()
20:16simardaw. emacs macro it will be.
20:38muhooi am totally baffled by #'
20:41muhoohmm ##(let [foo "bar"] (class #'foo))
20:41lazybotjava.lang.RuntimeException: Unable to resolve var: foo in this context
20:42muhoo&(let [foo "bar"] (class foo))
20:42lazybot⇒ java.lang.String
20:42muhoo&(let [foo "bar"] (class #'foo))
20:42lazybotjava.lang.RuntimeException: Unable to resolve var: foo in this context
20:42ibdknox,(doc var)
20:42muhoowell on mine it says clojure.lang.Var, so i guess that's what it is
20:42clojurebotExcuse me?
20:42RaynesA name created by let is not a var.
20:42muhooah
20:43muhoowell, my repl says it is :-)
20:43RaynesYour repl is incorrect.
20:43amalloymuhoo: you have a global def named foo
20:43RaynesIndeed.
20:43muhooah
20:43ataggartAnyone know of a straight-forward way to have a defrecord class so that it's available to java code?
20:43muhooright
20:47muhoooic, it looks like it's a reference basically.
21:03simardhow would I create a new map by exchanging keys and values of a map ? (assume the map is bijective)
21:04simardI have this.. (apply hash-map (flatten (map list (vals keymap) (keys keymap))))
21:04muhooin server.clj in noir, why this "force runtime resolution of jetty"?
21:05muhoowhy is it necessary to force it? it's required above that, and why wouldn't calling it with ring.adapter.jetty/run-jetty work?
21:05ibdknoxmuhoo: so that it can be excluded
21:06ibdknoxmuhoo: some people don't want to bring down the jetty dependency
21:07muhoooh, for the compiler not to puke on it, got it, thanks
21:07muhooif the compiler ain't happy, ain't nobody happy.
21:08muhoothanks. noir is awesome, btw.
21:11ibdknox:)
21:12gfrederickssimard: (zipmap (vals keymap) (keys keymap))
21:13gfredericks((comp (partial apply zipmap) (juxt vals keys)) keymap) also of course
21:14simardzipmap.. I had been looking at zip/ instead :S
21:14simardthank you
21:16FrozenlockIs wrap-multipart-params required to upload a file using Noir?
21:17FrozenlockI'm using this as the sending page:
21:17Frozenlock(defpage "/file" []
21:17Frozenlock (common/site-layout
21:17Frozenlock (form-to [:post "/file"]
21:17Frozenlock (file-upload "file")
21:17Frozenlock (submit-button "Send file"))))
21:17Frozenlock
21:17FrozenlockBut I'm a little confused by how my POST page is supposed to be...
21:22ibdknoxFrozenlock: it'll be just like all your other posts :)
21:23ibdknoxthere will just be a key with the file information in it
21:23ibdknoxin the params
21:24FrozenlockI have this so far:
21:24Frozenlock(defpage [:post "/file"] {file :file}
21:24Frozenlock (let [filename (upload-file file)]
21:24Frozenlock (common/site-layout
21:24Frozenlock [:p (str "File " filename" added!")])))
21:24ibdknoxFrozenlock: you should use gists instead of pasting in here :)
21:25johnkpaulis there more to getting leinigen to use clojure 1.3.0 instead of 1.2.1 than just changing the dpendency in project.clj?
21:25ibdknoxFrozenlock: that looks fine
21:25ibdknoxFrozenlock: I don't know what upload-file does
21:25johnkpaulI keep getting an error with lein-cljsbuild that is supposed to be solved by using clojure 1.3.0
21:25FrozenlockOh? So it's my upload-file function the problem...
21:25johnkpaulbut the project.clj file has :dependencies [[org.clojure/clojure "1.3.0"]
21:26ibdknoxFrozenlock: well a simple test would be to do {:as params} and (println params)
21:26ibdknoxFrozenlock: ah
21:26ibdknoxFrozenlock: nm, you didn't set the enc type on your form
21:26Frozenlock:enctype "multipart/form-data" ?
21:26ibdknoxFrozenlock: http://stackoverflow.com/questions/1695246/why-file-upload-didnt-work-without-enctype
21:26ibdknoxyep
21:27ibdknox(form-to {:enctype ...} [:post "/file"] ...)
21:27FrozenlockYeah I had it in my old compojure model, but didn't know how to add it in the new form-to.
21:27FrozenlockOh!
21:27FrozenlockThanks!
21:28ibdknoxall hiccup functions can take a map of attributes as the first args :)
21:28FrozenlockIt makes sense... I was finding them quite limiting :P
21:31Frozenlockibdknox: Worked!
21:31FrozenlockThank you very much for this (and noir) :D
21:31ibdknoxnp
21:39amalloysimard: (into {} (for [[k v] m] [v k]))
21:45gfredericksamalloy: mine's shorter and syntactically simpler
21:46simardbut is amalloy's one more efficient ?
21:46simardor are they equivalent ?
21:46gfredericksI can't imagine why but it will probably turn out to be so just because I'm being arrogant
21:46amalloysyntactically simpler?
21:46gfredericksamalloy: nodes in parse tree
21:47amalloyi guess so
21:47gfredericksor (comp length flatten)
21:47gfrederickswhich I guess is the same thing
21:47amalloyi'm sure gfredericks's is faster, but who on earth would worry about that
21:48amalloyi prefer the for version because it's trivial to adapt for "oh and i need to make some changes to the keys or values too", whereas the zipmap only really works for specifically this case
21:48gfrederickswell one could conceivable be assymptotically faster, which is worth worrying about; but obviously not the case here
22:04amalloyassymptotically? this sounds like the symptoms of some ass disease
22:06gfrederickswe'd better hope it is
22:15johnkpaulI am experiencing this issue in lein-cljsbuild - https://github.com/emezeske/lein-cljsbuild/issues/53
22:16johnkpaulit explains that the issue is with having the incorrect version of clojurescript
22:16johnkpaulbut I'm confused about how that should be resolved in the project.clj file
22:17johnkpaulsorry, clojure* not clojurescript
22:20oakwisejohnkpaul: what does your :dependencies in project.clj look like?
22:20johnkpauloakwise: http://pastebin.com/aCwptEX7
22:20johnkpaulportion that I think is relevant...
22:20johnkpaul:dependencies [[org.clojure/clojure "1.3.0"]
22:21oakwisedo you get the error for every task or just certain ones?
22:21oakwisewhat about just `lein cljsbuild` with no subtask?
22:22johnkpaulhm, so that just gives me a list of subtasks
22:22johnkpaulbut what I was trying to run was lein ring server-headless 3000
22:23oakwisejohnkpaul: sounds like it's a lein-ring issue then, no?
22:24johnkpaulhm, potentially, to be honest, I don't really know
22:24oakwiseand it looks like lein-ring 0.5.4 uses 1.2.1: https://github.com/weavejester/lein-ring/blob/0.5.4/project.clj
22:24johnkpauloh
22:25weavejesterThat doesn't matter too much. Lein-ring is compatible with 1.2 and 1.3
22:25johnkpaulcan you have a project split between two versions?
22:25johnkpauloh ok
22:25johnkpaulso the reason that I think that it's cljsbuild is because that's what I'm trying to setup now
22:25weavejesterBut you should be using lein-ring 0.6 or above with Lein 1.7+
22:25johnkpaulI'm attempting to run their example project
22:25johnkpauloh, let me try that
22:25weavejesterIf you can use :plugins you shouldn't be using :dev-dependencies
22:26weavejesterTry adding in a :plugin for [lein-ring "0.6.2"]
22:26johnkpaulok
22:27johnkpaul:/ same error
22:27johnkpaulafter downloading ne wclojars
22:27johnkpaulnew clojars*
22:29oakwisecan you paste the full traceback somewhere? or is it exactly the same as that cljsbuild one that you linked?
22:29weavejesterWhat's the error?
22:29johnkpaulException in thread "main" java.lang.IllegalArgumentException: Wrong number of args (3) passed to: cljsbuild$run-compiler (NO_SOURCE_FILE:0)
22:29johnkpauloakwise: I'll paste it, it's exactly the same except for the line numbers
22:29weavejesterOh, that's a cljsbuild problem then
22:30johnkpaulhttp://pastebin.com/5KiTxPaE
22:31johnkpaulweavejester: yeah, probably. I am attempting to run the example lein-cljsbuild application
22:31johnkpaulbut they have an issue about this..
22:31johnkpaulhttps://github.com/emezeske/lein-cljsbuild/issues/53
22:31oakwisehm that tracebook looks different
22:31johnkpaulthat says "just use clojure 1.3.0"
22:32johnkpauloh really?
22:32johnkpauloh
22:32johnkpaulit is
22:32johnkpaul:/ that was not the case
22:33johnkpaulor maybe I wasn't paying enough attention, but I think it changed after I removed dev-dependncies
22:33weavejesterI wonder if the lein-cljsbuild plugin is injecting the wrong version of cljsbuild
22:34johnkpaulhm, I don' tknow
22:35oakwiseyou deleted the project.clj?
22:35weavejesterjohnkpaul: Which version are you using?
22:35johnkpaulweavejester: of cljsbuild? I have the master branch of the git repo and project.clj says 0.1.4
22:35johnkpauloakwise: you mean the original one? no, I dind't
22:36johnkpaulI just removed the dev dependencies line and added [lein-ring "0.6.2"] to the plugin lst
22:36johnkpaullist*
22:36weavejesterjohnkpaul: Try clearing the cljsbuild and lein-cljsbuild folders in ~/.m2/repository/
22:37simardcan a clojure function return Void ? (I'm exporting static functions from a class generated with gen-class)
22:37simardie.. not return the last form
22:37johnkpaulweavejester: ok, trying that now
22:38johnkpaulweavejester: same problem
22:38weavejesterHmm...
22:38weavejestertry 0.1.3?
22:38oakwiseweavejester: johnkpaul: looks like a legit bug with the compile hook
22:39johnkpauloh really? are you able to reproduce this oakwise?
22:39johnkpaulweavejester: 0.1.3 causes the same error
22:40oakwisehttps://github.com/emezeske/lein-cljsbuild/commit/65a074facf98f235fe6305573a4b7d5f07420e18 changed the signature of run-compiler but didn't change the reference in compile-hook
22:41oakwisejohnkpaul: 0.1.3 should work? try cleaning project/libs, ~/.m2, and project/.lein*?
22:42johnkpauloh ok, trying now
22:43solussd_could anyone tell me how to get the base-url in a Noir website?
22:43ibdknoxnoir.request/ring-request
22:44johnkpaulhm, now iffernt error oakwise
22:44johnkpaulException in thread "main" java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.MapEntry cannot be cast to clojure.lang.IPersistentMap (NO_SOURCE_FILE:0)
22:44oakwisejohnkpaul: I see the same issue. looking...
22:44johnkpaulanyway, I need to close my eyes, I've been trying to get this to work for too long
22:44johnkpaulthank you so much for your help oakwise and weavejester
22:44johnkpaulI'll be back
22:44oakwisejohnkpaul: I'll file the bug or patch if I can track it down
22:44johnkpaulok great, thank you again
22:45solussd_ibdknox: I'm building a restful webservice and I have a 'links' entity that contains an 'href' keyval that should reference the absolute path for the linked resource… can't use the ring-request at that point in the code
22:47ibdknoxsolussd_: not sure I understand
22:47solussd_guess that doesn't make sense, I either hard-code it, or I look in the request.
22:47solussd_nevermind, I'm being dumb. :)
22:47ibdknoxhaha :)
22:47solussd_love Noir, btw, thanks!
22:48ibdknox:)
22:55muhoowow that's freaky. if i pass a function or a reference to a function, they seem equivalent
22:57muhoolike this: https://refheap.com/paste/1600
22:57muhooy dat?
22:58ibdknox,#'str
22:58clojurebot#'clojure.core/str
22:58ibdknox,(#'str "foo")
22:58clojurebot"foo"
22:59muhooright, bit if i pass a referecne to the STRING in, it doesn't work
22:59muhoobut if i pass a reference to a function that returns something, then it does
22:59ibdknoxhm?
23:00ibdknoxinvoking a var invokes it as a function
23:00FrozenlockYou are evaluating the function: (x)
23:00ibdknoxstrings aren't functions
23:00ibdknox,("woot")
23:00clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn>
23:00muhoook, so references work differently on functions than on other data types
23:00muhoothat's what surprised me
23:01muhoovars, i should use the proper terms
23:01ibdknoxthey don't work differently, they're still being invoked like other things :) It's just that invoke for them means deref
23:01ibdknoxand then invoke
23:01ibdknox,#'str
23:01clojurebot#'clojure.core/str
23:01ibdknox,@#'str
23:01clojurebot#<core$str clojure.core$str@1c6f8a9>
23:01ibdknox,(@#'str "foo")
23:01clojurebot"foo"
23:02autodidaktoamalloy: wakeful have a githubs?
23:02muhoothat's a great example, thanks
23:02ibdknoxautodidakto: https://github.com/flatland/wakeful
23:03solussd_ibdknox: how do you grab querystring args in a defpage?
23:03ibdknoxsolussd_: same as any args, they all go into the params thing
23:03autodidaktoibdknox: thanks :)
23:03ibdknoxthat you destructure
23:03solussd_ibdknox: excellent
23:06autodidaktoibdknox: I saw a recent blog post/example of a one page noir/client side cljs app, and they used slurp to get the html template...
23:07autodidaktoI'll find the code... but my question is, What is the best practice for using .html files in your views?
23:07ibdknoxautodidakto: depends, are they just static?
23:07ibdknoxif they are, you shouldn't have jetty serve them at all, let nginx do its magic :)
23:08ibdknoxbut just for locally, slurping on startup is ok
23:08autodidaktoibdknox: no not static. as a layout or partial
23:08ibdknox\oh
23:08ibdknoxhuh?
23:08ibdknoxfor something like mustache?
23:09ibdknoxI meant static as in are you modifying the html at all, or is it just getting slurped and sent over the wire?
23:09autodidaktoibdknox: I guess my question isn't well thought out. If I do everything in hiccup, it's not a prob...
23:09ibdknoxyeah :)
23:09autodidaktobut what if I have html files already ready to go, by a designer, or previously done...
23:09ibdknoxyou can actually use stencil to handle this too
23:10autodidaktoin the blog post, they slurp and send it, then use cljs and your client side tools to modify the dom
23:10ibdknoxright
23:10ibdknoxthat's reasonabl-ish
23:10ibdknoxyou would want to cache it first
23:11ibdknoxthough honestly, there's likely to be so little markup there I'm not sure why you wouldn't just do it with hiccup
23:11ibdknoxbut slurping it at load time and then serving it from there is fine
23:11ibdknoxstencil will cache the asts and such that it generates, in that case the ast would be just a giant text node, but it would also accomplish the same thing
23:11autodidaktothe code is here -> https://github.com/eakron/wishlistd ... still looking for the blog post where they talk about it. it was a 'learning noir' kind of post..
23:12autodidaktoibdknox: I haven't checked out stencil yet. I'll do that now
23:12muhooso it seems like invoking a function is an implicit deref?
23:13autodidaktoah here we go -> http://variadic.me/posts/2012-03-29-building-wishlisted.html
23:13muhoohmm, an implicit OPTIONAL deref. because it doesn't try to deref something if it isn't a var
23:13ibdknoxmuhoo: no, think of it in terms of polymorphism, vars have their own implementation of invoke
23:14ibdknoxand that implementation says deref me and then call invoke on that
23:14ibdknoxfunctions don't need to be deref'd
23:14ibdknoxthey're directly invokable
23:14muhoook, thanks, that makes more sense.
23:15muhooall of this , for me to understand why (run-jetty #'greeting-handler ...) works
23:15ibdknoxautodidakto: it's reasonable to do that, I would just do (def layout (slurp ...)) instead of (defn ..) because it's not going to change
23:15autodidaktoin the post, they get hung up on the routes/views issue, but essentially, the site is one route that calls -> (slurp "resources/public/index.html")
23:15ibdknoxautodidakto: mhm
23:15ibdknoxautodidakto: I do something similar in my overtone controller example, though with hiccup
23:16autodidaktosimilar? as in slurp? or one page? or?
23:16ibdknoxone page
23:17autodidaktoAnd uses remotes? I'm trying to get my head around where everything fits in. that is, remotes, jaqy, client-side cljs, pinot, etc
23:18ibdknoxautodidakto: http://www.chris-granger.com/2012/02/20/overtone-and-clojurescript/
23:18autodidaktoi'll check it out
23:18ibdknoxadding the middleware for fetch is now unnecessary
23:18ibdknoxbut the rest is accurate
23:19FrozenlockIs there pre-made functions to print to file?
23:20ibdknox,(doc spit)
23:20clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
23:22FrozenlockThanks :)
23:24autodidakto,(doc slurp)
23:24clojurebot"([f & opts]); Opens a reader on f and reads all its contents, returning a string. See clojure.java.io/reader for a complete list of supported arguments."
23:24muhooi do love the clojure way of doing web dev stuff, it's very unix-y: lots of little libraries and programs stitched together flexibly.
23:24autodidaktoI'm afraid to lookup the history behind those functional names
23:25muhooit's got a steeper learning curve though
23:25Frozenlockautodidakto: I must admit I would have never found it with my 'save' 'print' 'export' searched. Spit and slurp is.. somehow unique :P
23:25Frozenlock*searches
23:26autodidaktomuhoo: one way to look at the learning curve is that there is more to learn upfront. You can't get as far in 5 minutes by editting a generated files...
23:26muhooFrozenlock: spit/slurp is funky, but it could be worse, could be ruby, and you'd be dealing with libraries with names like "texticle"
23:27muhooautodidakto: oh, i'm very comfortable wiht this. been a linux guy for a long time
23:27autodidaktomuhoo: lol, texticle, that's not a far analogy hehe
23:27muhooso i'm fine with up-front investment to save pain later
23:28autodidaktomuhoo: i agreed. in the end, you gotta learn everything to do nontrivial stuff... and this way you can build the system you want without making tough choices between monolithic frameworks
23:29autodidaktoFrozenlock: my guess is that it's a long-standing lisp thing..
23:30muhoono, i think spit/slurp is an rhickey-ism
23:30muhooi don't remember seeing it in other lisps
23:30Frozenlockwith-open is lipsy, but spit... ?
23:31muhooi still think it should have been spit and swallow, but that'd have been too over-the-top
23:31muhooas it is, it's kinda on the edge a bit.
23:31FrozenlockNo, once you spitted, you must slurp. :P
23:33FrozenlockNow that I've saved a map into a file, how can I -read- it back? I've tried (read (slurp "test.txt")) but it throws an error. In addition, is there a safe way to read back data?
23:33autodidaktoFrozenlock: a map? are you trying to serialize data to a file?
23:33FrozenlockYes.
23:34autodidaktoFrozenlock: I'm new to clojure, so I can't speak of best practices... but have you considered yaml?
23:35autodidaktohttps://github.com/lancepantz/clj-yaml
23:36autodidaktomuhoo: the fundamental concept/question is, Where is the natural home or center of that which is slurped/spat... The stomach or the mouth?
23:36tomojRaynes: is refheap.el really not usable?
23:36FrozenlockWhat would be the advantage over clojure's maps?
23:36tomojI mean, who's the general public? :)
23:36xeqiFrozenlock: try read-string
23:37autodidaktoFrozenlock: Serialization is putting your datastructures in a file to save them, and reading them back in later. Yaml lets you do that cleanly..
23:37autodidakto,(doc read-string)
23:37clojurebot"([s]); Reads one object from the string s"
23:37amalloymuhoo: paredit uses slurp/barf
23:37autodidaktoIf it's quick and dirty, you might not need it. up to you
23:37amalloyparedit-forward-slurp-sexp, etc
23:38Frozenlockxeqi: worked! thanks :)
23:38autodidaktoamalloy: slurp -> outside world to your stomach. barf -> stomach to outside world. I like the symmetry
23:38Frozenlockautodidakto: So it would protect from arbitrary code hidden in a file?
23:38amalloywhutttt. slurp is clearly a mouth-ism. you slurp soup with your lips, not your esophogas
23:39autodidaktoFrozenlock: right. The file itself is secondary, an implementation detail
23:39amalloywow, that's a word that i just realized i can't spell at all. the vowels are all total guesses
23:39autodidaktoamalloy: i think there's a u somewhere in there. English is consonant-centric anyway :)
23:40Frozenlockamalloy: M-$ --> esophagus
23:40FrozenlockI would be sooooo worse without Emacs :p
23:41xeqiFrozenlock: as far as doing it safely you might check out clojail
23:41xeqinot sure if it is applicable here though
23:41amalloyM-$? i rebound that one cause i never use whatever the default is. spell check, i guess?
23:42FrozenlockYup!
23:43Frozenlockxeqi: I just tested read-string on a function and it didn't seem to evaluate it. Unless I use an eval on it, am I safe?
23:43Frozenlockclojail: A control freak's best friend. -- Love the description
23:43autodidaktoFrozenlock: where are you files coming from?
23:43autodidakto,(doc sandbox)
23:43clojurebotCool story bro.
23:44autodidakto&(doc sandbox)
23:44lazybotjava.lang.RuntimeException: Unable to resolve var: sandbox in this context
23:44FrozenlockMy own machine, but eventually it could come from anywhere.
23:44xeqihmm, I would think so
23:44xeqibut this is out of my knowledge area
23:45xeqi&(read-string "{:x (#(+ 1 2))}")
23:45lazybot⇒ {:x ((fn* [] (+ 1 2)))}
23:45autodidaktoMy assumption is that if you're going to eval code from unknown sources, don't assume safety
23:46FrozenlockI don't eval, I simply read.
23:47FrozenlockWorse case scenario I suppose my functions could choke on malformed maps.
23:47autodidakto&(read-string "((fn [num] (str num)) 42)")
23:47ibdknoxmalformed maps will throw exceptions
23:47lazybot⇒ ((fn [num] (str num)) 42)
23:47ibdknoxthe only bad thing that can happen during reading is reader macros
23:47ibdknoxwhich is easy enough to stop
23:47Frozenlockibdknox: Yes, I should make sure I put some try/catch in there.
23:47ibdknox(binding [*read-eval* false] (read-string ...))
23:48oakwisejohnkpaul-afk: someone posted the same issue here https://github.com/emezeske/lein-cljsbuild/issues/68 and I submitted a fix. Hopefully it gets merged soon.
23:48xeqiohh, I forgot about those
23:48Frozenlock,readier-macro
23:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: readier-macro in this context, compiling:(NO_SOURCE_PATH:0)>
23:48xeqithink lazybot stops them
23:48Frozenlock,reader-marcro
23:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reader-marcro in this context, compiling:(NO_SOURCE_PATH:0)>
23:48FrozenlockGOD
23:48ibdknoxhttps://github.com/ibdknox/fetch/blob/master/src/noir/fetch/remotes.clj#L12
23:48xeqi&(read-string "{:x #=(+ 1 2)}")
23:48lazybotjava.lang.RuntimeException: EvalReader not allowed when *read-eval* is false.
23:48autodidakto,(doc *read-eval*)
23:48clojurebot"; When set to logical false, the EvalReader (#=(...)) is disabled in the read/load in the thread-local binding. Example: (binding [*read-eval* false] (read-string \"#=(eval (def x 3))\")) Defaults to true"
23:49FrozenlockI can't write, I won't even try ....
23:51autodidakto&(eval 42)
23:51lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
23:52autodidakto&(eval (read-string "((fn [num] num) 42)"))
23:52lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
23:59autodidaktoibdknox: what do you think of the ClojureScript One project?