2013-02-09
| 00:00 | egghead | http://stackoverflow.com/a/3409568 is this anywhere in core? |
| 00:01 | egghead | the code reads as something like 'when seq-able lazily seq the sequence s' |
| 00:22 | dxeh | whats a nice clojure tutorial for someone who knows other languages but has not tried _anything_ like clojure syntax wise |
| 00:23 | egghead | I can recommend https://leanpub.com/fp-oo but it's not freely available |
| 00:24 | dxeh | everything is free on the internet if you look xd |
| 00:34 | dxeh | whats the big difference between clojure & scala? |
| 00:35 | nightfly | Ones a lisp ones not? |
| 00:37 | dxeh | i havent actually seen any scala code i dont think i was just assuming it was similar to lisp as well |
| 00:37 | dxeh | guess not |
| 00:37 | nightfly | similar to a lisp != a lisp |
| 00:38 | nightfly | ..er (not (eql a-lisp similar-to-a-lisp)) |
| 00:39 | drewc | the type system? |
| 00:41 | Frozenlock | you mean (not= a-lisp similar-to-a-lisp) :P |
| 00:42 | dxeh | is there an eql keyword? |
| 00:42 | dxeh | havent delved into the language much yet just researching it a bit xd |
| 00:42 | Frozenlock | identical? ? |
| 00:43 | Frozenlock | Note the second question mark... |
| 00:43 | dxeh | ah |
| 00:53 | yedi | can someone who knows korma help me out with this: https://gist.github.com/yedi/4743886 |
| 00:53 | yedi | it's a very simple starter program and i've included my postgres log |
| 00:55 | amalloy | dxeh: i advise trying out 4clojure.com |
| 00:56 | amalloy | but no, scala is not much like clojure. in attempting to improve on java, the languages went in basically opposite directions |
| 00:56 | amalloy | (though really, while i'm not sure about scala, clojure wasn't an attempt to improve java) |
| 00:58 | egghead | scala is a mix of stuff like haskell/ml/eiffel/java |
| 01:00 | amalloy | yeah, to me scala looks like haskell and java mushed together. but i'm sure there are folks in here with more experience to comment on that |
| 01:02 | Raynes | amalloy: It looks like Haskell, Java, C, Erlang, Python, Ruby, Brainfuck, and every other language mushed together to me. |
| 01:03 | amalloy | that's because you're a prejudiced youngster, Raynes |
| 01:03 | egghead | clojure reminds me of erlang, lisp, ruby, and java |
| 01:03 | egghead | erlang just for concurrency semantics tho... |
| 01:03 | Raynes | It's true. |
| 01:03 | Raynes | The concurrency has nothing to do with Erlang though. |
| 01:03 | egghead | thought I like clojure best when it *doesn't* remind me of java |
| 01:04 | Raynes | I mean, you can do actors in Clojure. |
| 01:04 | Raynes | And stuff. |
| 01:04 | egghead | s/ght/gh |
| 01:06 | egghead | erlang has mnesia for in memory store + transactions, kind of like concurrency semantics :) |
| 01:06 | qz | about scala: pretty old, but it mostly turned out to be true for me - https://gist.github.com/anonymous/1406238 |
| 01:06 | qz | especially sbt rant |
| 01:08 | dxeh | my motivation to learn clojure is so i don't have to write java-like syntax all the time to achieve the same solution xD |
| 01:08 | dxeh | the lisp is a nice change |
| 01:10 | dxeh | lol i just got that joke on the 4clojure website amalloy |
| 01:10 | dxeh | took me a couple seconds |
| 01:12 | callenbot | Raynes: Scala has no brainfuck, only INTERCAL |
| 01:12 | callenbot | Raynes: DAT COMEFROM |
| 01:12 | callenbot | Raynes: https://www.youtube.com/watch?v=UX0ue7brUfk |
| 01:13 | Raynes | callenbot: It's really hard to watch Doug Stanhope full screen when you keep pinging me. |
| 01:13 | Raynes | I assure you, your videos of 20 minute long songs are not as amusing as this person. |
| 01:13 | Raynes | :P |
| 01:13 | yedi | any korma users think they can help me out: http://stackoverflow.com/questions/14785500/relation-doesnt-exist-error-when-querying-postgresql-with-korma |
| 01:14 | dxeh | (= (list __) '(:a :b :c)) what would the solution be to this? (how are lists formatted in clojure) |
| 01:14 | Raynes | :a :b :c |
| 01:14 | Raynes | &(list :a :b :c) |
| 01:14 | lazybot | ⇒ (:a :b :c) |
| 01:19 | dxeh | &((conj '(2 3 4) 1)) |
| 01:19 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn |
| 01:19 | dxeh | ok then |
| 01:19 | dxeh | &(conj '(2 3 4) 1) |
| 01:19 | lazybot | ⇒ (1 2 3 4) |
| 01:19 | dxeh | so is the front of a list in clojure the rightmost element |
| 01:24 | tomoj | the front? |
| 01:24 | Sgeo | The head of a list is the first element |
| 01:24 | Sgeo | ,(cons 1 '(2 3 4)) |
| 01:25 | clojurebot | (1 2 3 4) |
| 01:25 | Sgeo | You can think of a list as being made of entirely conses |
| 01:25 | jonasen | I can't get checkouts to work with lein-cljsbuild. Has anyone had problems with this? |
| 01:25 | Sgeo | And the empty list |
| 01:25 | Sgeo | ,() |
| 01:25 | clojurebot | () |
| 01:25 | Sgeo | ,(cons 1 (cons 2 (cons 3 (cons 4 ())))) |
| 01:25 | clojurebot | (1 2 3 4) |
| 01:26 | Sgeo | That's what a list physically looks like, in theory |
| 01:26 | dxeh | what is cons a short form of (like the word it represents?) construct? |
| 01:26 | dxeh | or consist |
| 01:27 | Sgeo | constructs, I think |
| 01:27 | Sgeo | http://en.wikipedia.org/wiki/Cons |
| 01:30 | callenbot | Sgeo: caddur hurr hurr |
| 01:30 | Sgeo | ? |
| 01:30 | callenbot | Sgeo: that's how I pronounce CDR in my head. |
| 01:31 | callenbot | Sgeo: caddur |
| 01:31 | Sgeo | Ah |
| 01:31 | dxeh | ,(conj [1 2 3] 4) |
| 01:31 | clojurebot | [1 2 3 4] |
| 01:32 | dxeh | so basically ... since those are the same, it would be just bad practice to do (conj [1 2 3 4]) for example |
| 01:32 | dxeh | you could get the same result compiling [1 2 3 4] |
| 01:34 | Raynes | callenbot: I just realized what I said earlier didn't sound like a joke. Just a heads up I was totally kidding. It's fine for you to ping me as much as you like. |
| 01:35 | yedi | what are the common database wrapper libs in clojure? |
| 01:37 | Raynes | monger or congomongo for mongodb, clutch for couchdb, korma and/or clojure.java.jdbc or whatever for SQL... |
| 01:38 | dxeh | for networking in clojure do people often just use java libs? |
| 01:38 | dxeh | like nio etc |
| 01:39 | callenbot | Raynes: I hate you. |
| 01:39 | callenbot | Raynes: monger |
| 01:39 | callenbot | Raynes: just don't fuck up updates. If you use something else, report back about it. |
| 01:39 | Raynes | wat |
| 01:39 | callenbot | kidding |
| 01:39 | Raynes | I have no idea what you're saying :P |
| 01:39 | callenbot | Raynes: vodka, sorry. |
| 01:39 | Raynes | lol |
| 01:41 | dxeh | http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Lazy_Fibonacci the code here, 'lazy-cons', what exactly is the lazy representing in the jvm |
| 01:46 | technomancy | Raynes: probably http://hackingdistributed.com/2013/01/29/mongo-ft/ ? |
| 01:49 | yedi | does anyone know if it's possible to create tables in korma |
| 01:49 | callenbot | yedi: don't. |
| 01:49 | callenbot | yedi: use a migration library or write your own scripts. |
| 01:50 | yedi | like lobos or something? |
| 01:50 | callenbot | yedi: I'm sure you can find better, but if you like it. |
| 01:50 | yedi | i'll look for better |
| 01:54 | yedi | drift seems like the only other optino |
| 01:55 | callenbot | yedi: wrongo |
| 01:55 | yedi | theres migratus and ragtime but they seemed kinda janky |
| 02:05 | callenbot | yedi: all the migration libraries suck, you should write a new one. |
| 02:06 | yedi | if only i weren't a complete newb to javascript and managing sql dbs |
| 02:06 | yedi | clojure* |
| 02:06 | callenbot | yedi: that's a bad place to be in. Write plain SQL scripts to keep it simple. |
| 02:46 | yedi | callenbot: i guess there's no harm in finding a non clojure migration library |
| 03:13 | callenbot | yedi: use plain SQL scripts |
| 04:05 | alex_baranosky | anybody there? |
| 04:06 | ChongLi | hi |
| 04:07 | alex_baranosky | hi Chongli |
| 04:07 | alex_baranosky | are any o fyou planning to be at Clojure/West? |
| 04:08 | ChongLi | I wish, unfortunately not :( |
| 04:08 | babilen | no, way too expensive to fly to the US for that |
| 04:08 | alex_baranosky | oh, I bet. I'd never fly here for a conference |
| 04:09 | alex_baranosky | it stinks how US-centric conferences are |
| 04:09 | babilen | Well, Clojure ones at least :) |
| 04:09 | babilen | (apart from euroclojure) |
| 04:09 | kryft | That would be great if euroclojure were us centric :) |
| 04:10 | babilen | No it wouldn't -- It would be slightly amusing but at the end of the day increadibly depressing :) |
| 04:10 | kryft | Heh |
| 04:13 | babilen | Will Clojurewest stream sessions? (haven't checked so far) |
| 04:13 | alex_baranosky | doubt it. I don't think streaming sessions is standard practice |
| 04:14 | alex_baranosky | usually they show them some months later |
| 04:15 | babilen | *sigh* |
| 04:15 | babilen | Something that could be learned from conferences such as Fosdem :) |
| 04:17 | babilen | But then somebody is probably making money with Clojure/West and giving the content away for free is not in the interest. *shrug* |
| 04:17 | babilen | *their interest |
| 04:17 | alex_baranosky | of course! |
| 04:18 | alex_baranosky | you give the content away months after as advertisement for thenext conference |
| 04:18 | alex_baranosky | can't blame them for that - a lot of money goes into making a conference happen |
| 04:19 | kryft | If only conferences could be copied and distributed like software ;) |
| 04:19 | AtKaaZ | is there a function that already does this? https://www.refheap.com/paste/11115 insert a list of elements inside a (str "prefix" _here_ "suffix") |
| 04:21 | babilen | alex_baranosky, kryft: Well, it really depends on how you organise a conference. There /are/ quite a bunch of conferences that provide live streaming + vivid discussions on IRC during the even (FOSDEM, GUADEC, XYc3, …) -- It looks as if there is no interest in making this happen within the Clojure community though. |
| 04:21 | babilen | (I have no idea who organises Clojure/West and what the intentions for organising it are) |
| 04:22 | babilen | *during the event |
| 04:23 | alex_baranosky | AtKaaZ: no built-in for that, but there are cleaner implementations than your refheap |
| 04:23 | AtKaaZ | alex_baranosky: i agree, thanks; already got rid of partial for starters :D |
| 04:26 | alex_baranosky | AtKaaZ: does this work? Untested - https://www.refheap.com/paste/11117 |
| 04:26 | alex_baranosky | ok tested. works |
| 04:27 | alex_baranosky | oh, I see you want no spaces in between |
| 04:28 | alex_baranosky | AtKaaZ: revised to match your requirements: https://www.refheap.com/paste/11118 |
| 04:36 | amalloy | ~flatten |
| 04:36 | clojurebot | flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with. |
| 04:37 | amalloy | just, you know, for reference. if you solve anything with flatten ever, throw it away and start over or ask alex_baranosky :P |
| 04:37 | alex_baranosky | flatten is your arch-nemesis! hehe |
| 04:42 | amalloy | flatten is everyone's arch-nemesis. he's the villain out to destroy the world just for fun |
| 05:25 | AtKaaZ | hey sorry I was afk, thanks amalloy and alex_baranosky, I'll check the code |
| 05:28 | AtKaaZ | I'm happy to learn about join and concat, didn't use them before |
| 05:42 | alex_baranosky | AtKaaZ: no problem, glad to help |
| 05:59 | dada | ciao |
| 06:00 | dada | !list |
| 06:31 | manuelp | Hi everyone! There is someone here that uses cemerick/friend with enlive? |
| 06:35 | manuelp | I'm reading the source code of friend but I haven't found a way to do what I need, yet. |
| 07:56 | Guest66432 | what is the deps.js file that my cljs is requesting (get a 404)? |
| 08:05 | abp | Guest66432: https://groups.google.com/forum/#!topic/clojure/_WkdBGPhI-Q/discussion |
| 08:06 | abp | Guest66432: But seems like that should be fixed |
| 08:14 | Guest66432 | abp: i saw that, it looked like it shouldnt apply since im using advanced compilation |
| 08:14 | Guest66432 | in whitespace i didnt have this issue |
| 08:19 | Guest66432 | i dont see the code being minified either which may be part of the issue |
| 08:20 | hyPiRion | Github down for maintenance? boo |
| 08:21 | Guest66432 | trying to use marginalia to generate some docs from my code as well, anyone run into this error java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol ? |
| 08:21 | Guest66432 | "lein marg *" is the command im running |
| 08:22 | Guest66432 | looks like its coming from hiccup |
| 09:51 | serpent213 | hi |
| 09:51 | serpent213 | any idea on how to code this more succinctly? |
| 09:51 | serpent213 | http://pastebin.com/QQBjG0L8 |
| 10:00 | Lajjla | Raynes, do you still love me the most? |
| 10:01 | ds300 | Anyone ever have trouble compiling a lein project when overriding a clojure.core func in some other ns? I get a weird nullpointerexception during compilation that goes away when I change the name of the offending function. |
| 10:09 | xeqi | manuelp: did you get enlive + friend working? |
| 10:17 | abp` | serpent213: If you do like this better: https://www.refheap.com/paste/11120 |
| 10:26 | serpent213 | abp`: good inspiration, thanks! :) |
| 10:38 | manuelp | @xeqi: authentication works, but now I need a way to render some enlive templates differently based on authorization roles. For example: append this link if the logged user has the ::admin role. |
| 10:39 | manuelp | xeqi: I've found the 'authorized?' and 'current-authenticated' fns, but I haven't managed to make them work for me |
| 10:41 | manuelp | xeqi: something like (if (authorized? ::admin (current-authentication)) ...) but I'm having difficulties testing these functions in the repl |
| 10:41 | manuelp | xeqi: thank you FYI |
| 10:43 | xeqi | manuelp: if yo uwant to fake the identiy while playing in a repl you can do something like: (binding [cemerick.friend/*identity* {:username "joe" :roles #{:admin :user}}] ...) |
| 10:44 | xeqi | it sounds like you're headed the right direction with (authorized? role (current-authentication)) |
| 10:45 | tmciver | A little off topic but what do people use to validate their markdown before pushing to github? |
| 10:45 | tmciver | \ |
| 10:45 | xeqi | manuelp: blah, that bindings not right, hold on |
| 10:46 | hyPiRion | tmciver: I force push until I get it right. |
| 10:46 | hyPiRion | That's the stupidest way of doing it, btw. |
| 10:46 | tmciver | Ha! Yeah, that's what I've been doing. :/ |
| 10:47 | manuelp | xeqi: In fact I've already tried something along those lines but without success (friend's 'auth?' fn checks the type) |
| 10:47 | tmciver | I used to use pandoc (http://johnmacfarlane.net/pandoc/try/) but it looks like it's change recently and doesn't display the html. |
| 10:48 | manuelp | tmciver: http://jrham.es/instantmark/ ? |
| 10:49 | manuelp | tmciver: another one: http://dillinger.io/ |
| 10:49 | tmciver | manuelp: Nice. <3 |
| 10:55 | tmciver | manuelp: Thanks. Seems like the first one (instantmark) doesn't support bulleted lists. |
| 10:56 | tmciver | wait, I take it back. I needed a blank line before the list. |
| 10:57 | manuelp | tmciver: you are welcome :) |
| 10:59 | manuelp | xeqi: ok, I'm reading friend's source code and the authentication map is a record. |
| 10:59 | xeqi | manuelp: https://www.refheap.com/paste/11121 ; that binding with provide a identity in the same way workflows do. Then you can test things out in a repl |
| 10:59 | xeqi | blah, I can't type today |
| 11:00 | tmciver | I also just found http://tmpvar.com/markdown.html for markdown preview |
| 11:01 | manuelp | xeqi: You were faster than me :) thank you very much, I appreciate that. I think I'll write a friend mini-guide. Documentation is good for everyone: I consolidate my understanding and at the same time maybe I can spare some newcomer's time. |
| 11:02 | manuelp | tmciver: I think nowadays there are a lot of online markdown editors. It's just a matter of finding one that you like. Thank you for the additional link however :) |
| 12:48 | Frozenlock | Is it me or #clojure is becoming more and more quiet in the weekends? |
| 12:50 | hyPiRion | Frozenlock: It's usually like that |
| 12:50 | hyPiRion | People aren't at work etc. |
| 12:58 | AtKaaZ | hi, is there some function that would return a new map of the same type as the passed map type but empty ? |
| 12:59 | AtKaaZ | or is there a function that would empty a map? like (empty thismap) ;returns empty map of same type |
| 12:59 | jeremyheiler | Yes |
| 12:59 | jeremyheiler | ,(doc empty) |
| 12:59 | clojurebot | "([coll]); Returns an empty collection of the same category as coll, or nil" |
| 13:00 | AtKaaZ | oh cool |
| 13:00 | jeremyheiler | ,(empty {1 2 3 4}) |
| 13:00 | clojurebot | {} |
| 13:00 | AtKaaZ | ,(sorted? (empty (sorted-map :b 1 :a 1))) |
| 13:00 | clojurebot | true |
| 13:00 | AtKaaZ | excellent, thanks jeremyheiler |
| 13:01 | jeremyheiler | No problem. Also, you generally shouldn't concern yourself with the type of map you're using. For example, small maps are array based, but once they get big enough, they become hash maps. |
| 13:02 | AtKaaZ | I understand, it's just that I had some check/:pre/assert somewhere that the map be sorted, and I didn't want to place code that returned sorted map in two places |
| 13:02 | jeremyheiler | ahihi, ok |
| 13:03 | jeremyheiler | ahihi, ok* |
| 13:03 | jeremyheiler | damn autocomplete... sorry ahihi |
| 13:03 | AtKaaZ | =) |
| 13:13 | mdeboard | I've got a proprietary, 3d-party SDK that I'd like to integrate with a Clojure project. The SDK is all C source with Java wrapper. How would I go about adding this as a dependency to my project? |
| 13:13 | jeremyheiler | mdeboard, Is the Java wrapper in a Maven repository? |
| 13:14 | mdeboard | No, not as far as I know. I'm using the demo version of the SDK at the moment (evaluating for purchase of license) |
| 13:14 | mdeboard | @ jeremyheiler |
| 13:16 | jeremyheiler | Well, you could install that into your local repository (on your machine) and depend on it from there. Although, I'm not sure what to do about the C code/binary. |
| 13:21 | mdeboard | jeremyheiler: Yeah, thanks anyway though |
| 13:24 | mdeboard | jeremyheiler: I guess my real question is, there's the foo.jar file with all the classes in it. What would I add to project.clj to be able to access those classes? |
| 13:25 | mdeboard | lein relies strictly on maven/clojars eh |
| 13:25 | modulus | hmm, maybe this is a stupid question, but i have a .jar file i want to use (it's a java lib). where do i put it so i can access those classes when using line repl? |
| 13:25 | AtKaaZ | this might be relevant to c++ stuff https://github.com/bagucode/clj-native |
| 13:26 | jeremyheiler | mdeboard, You could create a .lein-classpath file at the root of your directory, which points to the directory that your jar is in, It hink. |
| 13:26 | jeremyheiler | root of your project* |
| 13:27 | mdeboard | modulus: lol, I'm in the midst of that exact question :) |
| 13:27 | mdeboard | jeremyheiler: Thanks, that's a good start point for research |
| 13:27 | mdeboard | modulus: See jeremyheiler's most recent response to me |
| 13:28 | modulus | yes, i will look around on this |
| 13:31 | jeremyheiler | mdeboard, modulus, disclaimer, I've only used .lein-classpath for source files. I don't know if it will work for jar files. I imagine it would, since it's adding to the classpath. |
| 13:31 | mdeboard | yeah makes sense |
| 13:32 | mdeboard | the contents of the .lein-classpath file is just a path per line? Or should it be a clojure data structure with string members? e.g. '("/path/to/jarfile" "/other/path/to/jarfile") |
| 13:33 | jeremyheiler | Path per line |
| 13:33 | mdeboard | ok |
| 13:33 | modulus | hmm, but the jar file i'm using is already on one of the dirs on the classpath |
| 13:33 | modulus | but i do (import 'jcurses) and it doesn't work... i'm probably doing something wrong but i don't know what |
| 13:35 | mdeboard | Does (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) include the path you specified? |
| 13:35 | modulus | the .jar is on the src/project dir which is printed by lein classpath but i'll try that |
| 13:37 | modulus | the dir where the .jar is gets printed by that form, yes |
| 13:37 | modulus | though not the .jar itself |
| 13:37 | AtKaaZ | should be the .jar i think, try? |
| 13:38 | modulus | right |
| 13:39 | mdeboard | modulus: Add `:source-paths ["/path/one/1.jar" "/path/two/2.jar"]` to project.clj |
| 13:39 | mdeboard | that just worked for me |
| 13:39 | mdeboard | if you're using lein2 |
| 13:41 | modulus | thanks, i will try that now |
| 13:41 | mdeboard | and I had to import the class name like it was listed in the jar contents, `(import 'com.callassoftware.pdfEngine.Constants$Transition)` for example |
| 13:42 | mdeboard | well, by "had to" I mean that it was the first time that worked |
| 13:42 | modulus | i assume the ` is not to be added, right? |
| 13:42 | mdeboard | right |
| 13:42 | mdeboard | I just use that to demarcate source |
| 13:42 | modulus | right |
| 13:42 | modulus | thx |
| 13:46 | modulus | ooh shiney, it worked at last. |
| 13:47 | modulus | thanks all for help |
| 13:48 | mdeboard | :D |
| 13:50 | yedi | in paredit/emacs is there a keybinding for highlighting the entire form you're currently in, or the form that starts where your cursor is? |
| 13:51 | yedi | i don't want to have to C-space and move cursor everytime i want to wrap parentheses around a form |
| 13:52 | Frozenlock | yedi: I really like expand-region.el for this |
| 13:52 | Frozenlock | http://emacsrocks.com/e09.html |
| 13:52 | yedi | oh sweet, thanks |
| 13:53 | pimeys | I've tried to learn emacs now |
| 13:53 | pimeys | if I turn off evil mode, I'm lost |
| 13:53 | jeremyheiler | yedi, M-( wraps parents around the form |
| 13:53 | jeremyheiler | parens* |
| 13:53 | pimeys | still waiting the one big thing in emacs that converts me, slime might be one but I don't know |
| 13:53 | jeremyheiler | with paredit, that is |
| 13:54 | yedi | jeremyheiler: oh cool, thanks aswell |
| 13:54 | jeremyheiler | pimeys, nrepl was what did it for me |
| 13:54 | pimeys | I'm still very fast with vim and a bit lost even with evil mode in emacs |
| 13:54 | Frozenlock | pimeys: org-mode :) |
| 13:54 | jeremyheiler | I also never tried evil mode, forcing myself to really learn it |
| 13:54 | pimeys | I just cannot live without the command mode |
| 13:55 | pimeys | It's so superior way to edit text |
| 13:56 | jeremyheiler | yedi, i refer to this a lot: http://mumble.net/~campbell/emacs/paredit.html |
| 13:56 | modulus | so, when running lein repl does the cor.clj get run? |
| 13:56 | jeremyheiler | modulus, no |
| 13:56 | Frozenlock | jeremyheiler: I should take this day to finally learn paredit |
| 13:57 | jeremyheiler | Frozenlock, it is so worth it |
| 13:57 | Frozenlock | Does it work in the repl too? |
| 13:57 | octagon | hello! in cljs + is a macro: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L221. how is it possible to do (apply + [1 2])? i thought it was not possible to take the value of a macro? |
| 13:57 | Frozenlock | (no mode clash, anything?) |
| 13:58 | jeremyheiler | Frozenlock, not by deafult at least. I haven't tried, though. still learning |
| 13:58 | octagon | (the expression (apply + [1 2]) does evaluate to 3, correctly) |
| 14:00 | yedi | (ns skateproj.routes :require [skateproj.db :as db]) |
| 14:00 | yedi | is there something wrong with this form? |
| 14:01 | yedi | i get: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword |
| 14:01 | yedi | when trying to execute it |
| 14:01 | Frozenlock | (ns skateproj.routes (:require [skateproj.db :as db])) Missing a paren? |
| 14:01 | yedi | oh right |
| 14:03 | jeremyheiler | modulus, you can specify a namespace to load in :repl-options, though |
| 14:03 | jeremyheiler | see: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L115 |
| 14:16 | mdeboard | Hm, though I have imported a class successfully I can't access any of the class methods; static fields yes but not methods |
| 14:16 | jeremyheiler | How are you doing it? |
| 14:18 | mdeboard | `(import '(com.callassoftware.pdfEngine PDFEngine))` then `PDFengine/compare` just to see if it exists. But I also tried (PDFEngine/compare "a" "b") and (. (new PDFEngine) compare), always says field not found |
| 14:18 | mdeboard | The error I get with (new PDFEngine) is InstantiationError com.callassoftware.pdfEngine.PDFEngine user/eval893 (NO_SOURCE_FILE:1) ... which makes me wonder if it's having issues finding the C source around which that class is wrapped |
| 14:19 | yedi | how do i delete parentheses in paredit? (i couldn't find it in the cheat sheet) |
| 14:19 | jeremyheiler | mdeboard, possibly. it's definitely a no-arg constructor? |
| 14:19 | mdeboard | Yeah |
| 14:19 | mdeboard | @ noarg |
| 14:20 | mdeboard | from Javadocs: "Constructor Detail: PDFEngine\npublic PDFEngine()" |
| 14:20 | jeremyheiler | yedi, you can highlight it and C-w it |
| 14:21 | jeremyheiler | yedi, but i only do that if they somehow get unbalanced. |
| 14:22 | yedi | ok, but i can't even delete both parens when deleting just the first paren |
| 14:22 | yedi | which i though was the normal behavior |
| 14:22 | jeremyheiler | mdeboard, not sure where to take it. i assume the binary is on the PATH? |
| 14:22 | mdeboard | No, it's not, that's my next step |
| 14:23 | modulus | hmm, how do i need to organise my code so lien run will run it? i thought i just needed to write it on core.clj? |
| 14:23 | jeremyheiler | yedi, so when you delete the open paren, the close paren sticks around? (assuming they are together) |
| 14:24 | yedi | well it won't let me backspace the open paren |
| 14:24 | jeremyheiler | modulus, take a look here: https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L103 |
| 14:24 | modulus | right, thx |
| 14:24 | jeremyheiler | modulus, np |
| 14:25 | jeremyheiler | yedi, it should work if they're right next to each other. even if there is a space between them, it wont let you delete it. |
| 14:25 | yedi | i'm sure this a really nooby problem, but i don't get why :name returns null: https://gist.github.com/yedi/4746687 |
| 14:26 | yedi | jeremyheiler: ah i see, hmm, i guess i just haven't gotten used to the paredit way yet. tanks |
| 14:26 | jeremyheiler | yedi, as for your gist, it looks like your function is returning a vector, not a map. |
| 14:26 | mdeboard | Hm, I wonder if :native-path could be used to specify location of C binary |
| 14:26 | yedi | ohh |
| 14:28 | jeremyheiler | mdeboard, I just thought that the overtone project might be a good place to look, since I think it uses a native dependency. |
| 14:30 | mdeboard | jeremyheiler: Ah, looks like it wraps the C libs directly with Clj? https://github.com/overtone/overtone/blob/master/src/overtone/sc/machinery/server/native.clj |
| 14:31 | jeremyheiler | interesting |
| 14:37 | modulus | so i'm too dumb for this language i think ;-) |
| 14:38 | mdeboard | lol |
| 14:38 | mdeboard | It's an abstraction of another language which is an abstraction of another language |
| 14:38 | pimeys | modulus: don't say that :D |
| 14:38 | pimeys | just put more years into programming |
| 14:38 | modulus | classpath includes c:\clojure\plaything\src - in taht dir there's plaything\core.clj - in project.clj there's :main plaything.core |
| 14:38 | modulus | lein repl tells me plaything\core.clj not on classpath .... confused |
| 14:39 | Frozenlock | modulus: I prefer to think that I'm too dumb to use any other language... arrays, memory allocation, classes, methods... I can't understand all this stuff. |
| 14:39 | pimeys | although I have the same feeling when I start doing something with haskell |
| 14:40 | pimeys | there's stuff, like functors, for which I cannot find any use |
| 14:40 | modulus | Frozenlock: i can more or less deal with the language, but all the deployment stuff around it is really screwing with my head |
| 14:40 | pimeys | then I read somebody else's code and they use lots of functors and monads |
| 14:40 | pimeys | although I understand what monad is, I have no clue how to use them |
| 14:40 | Frozenlock | modulus: Yeah. I wonder how everyone did it before leiningen. |
| 14:40 | modulus | pimeys: monad is just way to specify sequential computation or whatever |
| 14:41 | mdeboard | pimeys: Much the same way you'd use a burrito |
| 14:41 | pimeys | of course |
| 14:41 | pimeys | but then readin some monadic code |
| 14:41 | pimeys | +g |
| 14:41 | modulus | anyway, any clue why lein is lying to me? ;-) |
| 14:41 | pimeys | just, it's so different |
| 14:41 | pimeys | and then clojure was so easy to start with |
| 14:41 | jeremyheiler | modulus, can you gist your project.clj and main namespace? |
| 14:42 | jeremyheiler | (or refheap ;-) |
| 14:42 | modulus | yeah sure |
| 14:42 | Frozenlock | jeremyheiler: refheap using refheap.el :) |
| 14:42 | jeremyheiler | Frozenlock, oooh, gotta install that |
| 14:43 | octagon | so in cljs, both + and case are macros. however, + in the cljs repl is an actual function and case is not. how does this work? |
| 14:43 | pimeys | though it has helped me that I use xmonad, so all configuring means to be able to write some haskell |
| 14:43 | Frozenlock | Yes you do. You can paste on refheap without ever leaving emacs. |
| 14:44 | AtKaaZ | octagon: you mean clojure with the second cljs |
| 14:44 | Frozenlock | octagon: Is '+' redefined as a function in another namespace? The macro could have been used locally to bootstrap or something. |
| 14:44 | Frozenlock | Kinda like list* |
| 14:44 | octagon | AtKaaZ: i was using himera, but there is a leiningen thing for cljs repl via ajax to the browser too |
| 14:45 | modulus | oh joy, pastebin thinks my code is spam |
| 14:45 | AtKaaZ | octagon: in clojure, + is a fn and case is macro, do you mean that in cljs repl + is a fn also? even though it seems like it's defined as a macro when you linked to it before |
| 14:46 | octagon | AtKaaZ: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1226 |
| 14:46 | octagon | yes it's definitely a macro |
| 14:46 | modulus | jeremyheiler: https://www.refheap.com/paste/11125 |
| 14:46 | Frozenlock | octagon: you just linked to a function |
| 14:48 | octagon | Frozenlock: whoa, you're right, so many tabs. that's interesting: it's defined as a macro here: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L221 and then as a function https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1226, problem solved! |
| 14:48 | AtKaaZ | octagon: in core.cljs + is a fn and in core.clj + is a macro :O |
| 14:48 | octagon | now it makes perfect sense! |
| 14:48 | jeremyheiler | modulus, if you have a dumb -main that does nothing, do you get the same error? |
| 14:49 | AtKaaZ | cool, cause I don't get it=) |
| 14:49 | modulus | jeremyheiler: trying, sec |
| 14:50 | AtKaaZ | octagon: but in clojure (not cljs) repl it's a fn as well |
| 14:50 | octagon | AtKaaZ: i think the answer is here: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1231 |
| 14:50 | octagon | the first + in the reduce expr is the macro, the other is the function |
| 14:50 | modulus | correct, same error |
| 14:50 | modulus | main defines as (defn -main []) |
| 14:50 | octagon | err i mean the other way round |
| 14:51 | AtKaaZ | octagon: ok that makes sense |
| 14:51 | octagon | trixty lil thing there |
| 15:28 | Bodil | Ooh look, I got a Clojurescript REPL working on Nashorn: https://github.com/bodil/cljs-nashorn |
| 15:29 | ivan | cool |
| 16:00 | fredyr | i found myself wanting to do this a couple of times: https://www.refheap.com/paste/11126 |
| 16:00 | fredyr | any ideas would be much appreciated |
| 16:01 | yedi | callenbot: what do you have against monger? |
| 16:08 | fredyr | oh nvm, reduce does the trick obviously |
| 16:12 | callenbot | yedi: absolutely nothing |
| 16:19 | borkdude | how do I get the body of document in clojurescript? |
| 16:21 | Frozenlock | borkdude: you can make a direct JS call, or use a library like domina |
| 16:21 | hyPiRion | fredyr: do what? add in spaces? |
| 16:21 | hyPiRion | ,(let [v [\a \b \c \d]] (assoc v 1 \space 4 \space)) |
| 16:21 | clojurebot | [\a \space \c \d \space] |
| 16:22 | borkdude | Frozenlock I'm trying this (def b (-.body js/document)), what's wrong with it? |
| 16:24 | yedi | is enlive the go to for clojure html templating? or are there other contenders? |
| 16:24 | Frozenlock | borkdude: I don't have my repl running, but try typing js/document.body in yours. |
| 16:24 | borkdude | Frozenlock I'm trying it on himera |
| 16:24 | hyPiRion | ,(let [v [\a \b \c \d] poses [1 4]] (apply assoc v (interleave poses (repeat \space)))) |
| 16:24 | cshell | yedi: I use enlive, but there's also hiccup |
| 16:24 | clojurebot | [\a \space \c \d \space] |
| 16:24 | borkdude | http://himera.herokuapp.com/index.html |
| 16:25 | borkdude | Frozenlock hmm, yes that works |
| 16:25 | borkdude | Frozenlock I'm a bit confused then how property access works |
| 16:25 | cemerick | Bodil: What's the perf like? I've been using phantomjs exclusively b/c rhino is just _so_ slow. |
| 16:26 | Frozenlock | borkdude: it's .-body, not -.body |
| 16:27 | fredyr | hyPiRion: i fixed it with a reduce |
| 16:27 | borkdude | ah |
| 16:27 | fredyr | (reduce #(assoc %1 %2 \space) my-vec indices) |
| 16:28 | Bodil | cemerick: Haven't really benchmarked it, but it should be closer to Node than Rhino. Startup time is bad, though, but the Nashorn devs promised me that should be fixed in a few weeks. If you want performance, cljs-noderepl is probably a better choice than phantomjs. |
| 16:33 | cemerick | Bodil: Is that attributable to the difference between v8 and JavascriptCore? |
| 16:36 | Bodil | cemerick: I only have experience with running JS on other Qt apps, where it's a fair bit slower than V8. Phantom's still on Qt, right? |
| 16:36 | AtKaaZ | hi, what does it mean when [f & [silently]] those [] are around silently parameter? |
| 16:37 | cemerick | Bodil: no idea |
| 16:37 | Frozenlock | AtKaaZ: Everything after & will be put inside a list. So [silenty] will take the first item from that list. |
| 16:38 | Bodil | cemerick: It was last time I checked, which was admittedly quite a while ago. :) |
| 16:38 | ordnungswidrig | lein deps :verify => bad-signature [org.clojure/clojure "1.4.0"] |
| 16:38 | ordnungswidrig | should I worry? |
| 16:38 | AtKaaZ | Frozenlock: that's what I thought first, but it didn't seem to be the case :O I'll retest |
| 16:38 | Frozenlock | ,(let [[a & [b]] [1 2]] b) |
| 16:38 | clojurebot | 2 |
| 16:38 | yedi | enlive vs hiccup... ugh choice paralysis will be the death of me |
| 16:39 | metellus | ,(let [[a & [b]] [1 2 3 4 5]] b) |
| 16:39 | clojurebot | 2 |
| 16:39 | Frozenlock | AtKaaZ: However I recently learned that the clojure way is to rather use multiple arities function. |
| 16:39 | cemerick | Bodil: based on their build instructions, it does use qt |
| 16:39 | gfredericks | AtKaaZ: it is effectively the same as [f silently] except that the function is relaxed to allow one or more arguments |
| 16:40 | Frozenlock | Hrphm... can't find the reference... anyone here have the 'clojure best practice' github wiki? |
| 16:40 | Bodil | cemerick: Then, at a guess, Node would be faster than Phantom. Unless your code needs a DOM... |
| 16:40 | AtKaaZ | gfredericks: ohh i see now, it really does get the first element from the rest (after &) so all others are ignored |
| 16:41 | AtKaaZ | i take it that's idiomatic clojure to not throw when extra params are in fact ignored |
| 16:42 | Frozenlock | https://github.com/bbatsov/clojure-style-guide |
| 16:42 | AtKaaZ | thanks |
| 16:42 | TimMc | yedi: They're very different. I'm surprised you're ambivalent. |
| 16:42 | andyfingerhut | I'm taking a stab at writing up some documentation for people new to the read/read-string vulnerabilities, and what they can do about it in Clojure 1.5 and earlier versions. |
| 16:43 | Frozenlock | AtKaaZ: Well it will throw an error if you don't use &. |
| 16:43 | TimMc | andyfingerhut: You want readers? |
| 16:43 | cemerick | Bodil: it's mix across different projects. At the moment, I'm just basking in the rhino -> phantom improvement. :-) |
| 16:43 | andyfingerhut | TimMc: Definitely, and correcters when I have something, because I'm sure I'll get some of it wrong. |
| 16:43 | AtKaaZ | Frozenlock: true, i was only saying for things like [ f & [silently]] anything other than first after f is ignored silently :D |
| 16:44 | cemerick | rhino + *headed* browser REPL for DOM-related tests :-x |
| 16:44 | metellus | ,((fn [&] :a) 1 2 3) |
| 16:44 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox$eval87$fn> |
| 16:44 | Frozenlock | andyfingerhut: how about "and the read-string will not just read, it will also eval, even if you have a seperate eval function. Be careful not to be #=ed." |
| 16:45 | cemerick | andyfingerhut: you have a paste/gist/etc somewhere? |
| 16:45 | AtKaaZ | ,(quote 1 2 3) |
| 16:45 | clojurebot | 1 |
| 16:45 | AtKaaZ | that's an example :)) |
| 16:45 | andyfingerhut | I was going over some of the #clojure IRC logs from a couple of days ago, and learned there about a potential security vulnerability in Clojure 1.4 even if you use read/read-string while *read-eval* is false. It was something involving record literals not being governed by *read-eval*. |
| 16:45 | AtKaaZ | ,(var defn 2 3) |
| 16:45 | clojurebot | #'clojure.core/defn |
| 16:45 | andyfingerhut | I'd like to include an example of what kinds of malicious things people could do with that, if they are relatively short, so more people can be aware of it. |
| 16:46 | hiredman | ,(type (read-string "`String")) |
| 16:46 | clojurebot | clojure.lang.Cons |
| 16:46 | andyfingerhut | Frozenlock: I'm hoping for something more detailed than that :) |
| 16:46 | andyfingerhut | cemerick: Not yet. Will send out a draft when I have one. |
| 16:47 | hiredman | ,(type (read-string "#java.lang.String[Foo]")) |
| 16:47 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching ctor found for class java.lang.String> |
| 16:47 | hiredman | causes arbitrary class loading |
| 16:47 | Frozenlock | I still find it mindbogglingly confusing that a 'read' function doesn't just read. (And I don't care if it was how it was done in the CL world) |
| 16:47 | hiredman | which causes static inits to run |
| 16:48 | TimMc | Frozenlock: It feels like there should be a reader, an X-er, and an evaluator. (For some term "X" which I haven't figured out yet.) |
| 16:48 | ordnungswidrig | TimMc: X-er ist not that bad for a name |
| 16:48 | Frozenlock | x-er? |
| 16:48 | andyfingerhut | hiredman: Is there a short example that would make it blindlingly obvious to the slowest observers (e.g. me) how that could be leveraged into a very bad thing like removing files or opening a socket to an arbitrary machine? |
| 16:50 | TimMc | Frozenlock: I have't figured out what the word would be, therefore "X". |
| 16:50 | andyfingerhut | hiredman: assuming a JVM like Oracle 1.6 or 1.7, for example? |
| 16:50 | TimMc | I hope that doesn't stick. |
| 16:50 | hiredman | andyfingerhut: aot compiled namespaces are class files with a a big static init |
| 16:51 | TimMc | hiredman: So you could load a namespace that has side-effecting defs? |
| 16:51 | TimMc | What are the consequences? |
| 16:51 | hiredman | andyfingerhut: I'd have to think about it, it is tricky because you cannot really run code besides static inits and constructors |
| 16:51 | Frozenlock | I understand 'read' and 'eval'. I'm under the impression that there's some kind of 3rd functionality that was included to facilitate interop with he jvm, am I mistaken? |
| 16:52 | hiredman | you might be able to do some kind of ddos of file handles? |
| 16:52 | hiredman | ,#java.net.Socket["google.com" 80] |
| 16:52 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.SecurityException: denied> |
| 16:52 | ordnungswidrig | hiredman: nice |
| 16:53 | TimMc | Giant allocations, maybe> |
| 16:53 | hiredman | well that would work if it was not being read inside clojurebot's sandbox |
| 16:53 | hiredman | (the socket thing) |
| 16:53 | TimMc | ,#java.util.ArrayList[1e10] |
| 16:53 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: No matching ctor found for class java.util.ArrayList> |
| 16:54 | xeqi | I hear FileOutputStream makes files blank |
| 16:54 | Frozenlock | hiredman: even with *read-eval* to false? |
| 16:54 | hiredman | there is that |
| 16:55 | TimMc | I'd like to see read-edn split out as a separate library that old code can bring in as backporting. |
| 16:55 | TimMc | s/old code/code reliant on 1.4/ |
| 16:55 | xeqi | +1 TimMc |
| 16:55 | ordnungswidrig | TimMc: try 1e9 |
| 16:55 | andyfingerhut | hiredman: Confirmed that with Clojure 1.4 your example causes the socket to open even when *read-eval* is bound to false. Thanks. I also like the ArrayList one. |
| 16:56 | TimMc | ordnungswidrig: Oh, was that a Long? |
| 16:56 | ordnungswidrig | a digit to moch |
| 16:56 | andyfingerhut | I also tried it on Clojure 1.5 latest master as of an hour ago, and it throws an exception about "Record construction syntax can only be used when *read-eval* == true", so that is an improvement. |
| 16:57 | TimMc | Oh, good to hear! |
| 16:58 | andyfingerhut | I'm not sure which commit changed that, but I may try to track it down. |
| 16:59 | xeqi | andyfingerhut: there is an email disclosing this by Cosmin Stejerean in the read-eval thread |
| 16:59 | xeqi | I think rhickey mentioned when he fixed it |
| 17:00 | TimMc | OMG, Integer/getInteger -- I hate that so much. |
| 17:00 | andyfingerhut | Does anyone know off-hand what settings of the various *print-<foo>* vars, and which print-related Clojure functions, will restrict themselves to output that clojure.edn/read can handle? |
| 17:01 | TimMc | andyfingerhut: None, I think, since regexes aren't in EDN. |
| 17:02 | andyfingerhut | TimMc: So regexes are an exception which I will list. I'd like to list others, but if the "good data types" list is much shorter than the "bad data types" list, I'd like to give the shorter list. |
| 17:05 | TimMc | &(apropos "*print-") |
| 17:05 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: apropos in this context |
| 17:05 | TimMc | &(use 'clojure.repl) |
| 17:05 | lazybot | ⇒ nil |
| 17:05 | TimMc | &(apropos "*print-") |
| 17:05 | lazybot | ⇒ (*print-radix* *print-miser-width* *print-pprint-dispatch* *print-suppress-namespaces* *print-right-margin* *print-pretty* *print-base* *print-level* *print-length* *print-dup* *print-readably* *print-meta*) |
| 17:05 | TimMc | I think only *print-dup* and *print-readably* are relevant here. |
| 17:07 | andyfingerhut | *print-level* should be nil, or large enough to avoid taking effect. |
| 17:07 | andyfingerhut | For many Clojure data types, one can have *print-dup* false and still round-trip via print then clojure.edn/read, correct? |
| 17:12 | hiredman | andyfingerhut: prn, yes |
| 17:26 | jodaro | so |
| 17:26 | jodaro | i'm a windows idiot |
| 17:27 | jodaro | i'm trying to read a directory thats a .lnk |
| 17:27 | jodaro | with clojure.java.io/file |
| 17:27 | jodaro | but |
| 17:27 | jodaro | no bueno |
| 17:54 | yedi | how can i reload project.clj from emacs/nrepl? |
| 17:54 | yedi | i keep getting defproject doesn't exist errors |
| 17:55 | aaelony | A call like (clojure.xml/parse "http://search.twitter.com/search.atom?&q=clojure") will parse an xml web service, but what if I first need to stuff an api-key into the Header. Is this possible to do with clojure.xml/parse ? How can I add a header? |
| 17:55 | yedi | i've been restarting emacs to get around it |
| 17:56 | ivan | jodaro: .lnk-following is really an explorer.exe feature, though it can be done if you really want it |
| 17:56 | ivan | you can also have real symlinks on Windows if you really want them |
| 17:57 | jodaro | ivan: thanks. i'll look into that |
| 17:57 | amalloy | yedi: don't restart emacs, restart your nrepl session |
| 17:57 | amalloy | changes to project.clj can't impact already-running processes |
| 17:57 | ordnungswidrig | does lein.el work? |
| 17:57 | ivan | default settings require elevation to create a symlink, and you can't change the destination's folderness without recreating it |
| 17:58 | amalloy | ordnungswidrig: probably not; i've never heard of it |
| 17:58 | ordnungswidrig | https://github.com/technomancy/lein.el.git |
| 18:00 | amalloy | neat |
| 18:01 | jodaro | ooohh |
| 18:01 | jodaro | i need that |
| 18:02 | AtKaaZ | ,'``````'1 |
| 18:02 | AtKaaZ | &```````'1 |
| 18:02 | clojurebot | Execution Timed Out |
| 18:03 | AtKaaZ | should be stack overflow:) |
| 18:03 | ivan | I get "Invalid method Code length 594054 in class file user$eval3047" after a few seconds |
| 18:03 | AtKaaZ | on the first one |
| 18:04 | ivan | ah, yes |
| 18:05 | ivan | the output of this makes Emacs' word-wrapping unhappy |
| 18:05 | AtKaaZ | I could use some word-wrapping in ccw repl |
| 18:08 | Frozenlock | Can a clojure program add files itself into the resources directory once it has been uberjared? |
| 18:08 | warz | is there a way to specify a string without having to escape back slashes? like, in C# for example you can do @"c:\users\foo" |
| 18:09 | AtKaaZ | Frozenlock: probably would work if the .jar wouldn't be locked when running |
| 18:09 | Frozenlock | Hmm... well then, I'll just spit it in the (System/getProperty "user.home") directory |
| 18:10 | amalloy | Frozenlock: the resources *directory*, of course. but not the entry in the jar file; java runs with jars opened read-only |
| 18:10 | AtKaaZ | ah, I assumed that is inside the .jar for some reason |
| 18:11 | Frozenlock | amalloy: bummer. Yet I'm sure there's a whole lot of reason why it's better this way. |
| 18:12 | amalloy | yes |
| 18:15 | yedi | am i getting this error because templates/hello-dress.html can't be found? https://gist.github.com/yedi/4747527 |
| 18:16 | AtKaaZ | i blame idiomatic clojure coding :) |
| 18:21 | holo | hi |
| 18:21 | cshell | hi |
| 18:23 | holo | is there some lein plugin to scan for unused forms declared in the ns? |
| 18:24 | holo | i'm doing some heavy refactoring, and it is time consuming to manually scan them |
| 18:25 | cshell | holo: if you use require :as you can see them pretty easily |
| 18:27 | hyPiRion | holo: There's always Slamhound |
| 18:27 | hyPiRion | https://github.com/technomancy/slamhound |
| 18:27 | holo | cshell hi! as referenced in http://dev.clojure.org/display/design/Library+Coding+Standards -> "Be explicit and minimalist about dependencies on other packages. (Prefer the :only option to use and require)" which i agree with, except that for this situation is not being an advantage |
| 18:29 | holo | "Slamhound rips your ns form apart and reconstructs it. No Dutch surgeon required." haha .. thanks hyPiRion |
| 18:29 | yedi | any help: https://gist.github.com/yedi/4747527#file-gistfile1-txt-L10 |
| 18:32 | holo | yedi, are you getting the database env? |
| 18:33 | yedi | holo: huh? |
| 18:35 | holo | yedi, aren't you using a db? usually i get nullpointerexception when i forget to load the environment variable. just a wild guess |
| 18:36 | yedi | holo: ah, i don't believe that is it. the call to the deftemplate macro doesn't touch the db |
| 18:37 | tomoj | why don't symbols resolve at read time? |
| 18:37 | Frozenlock | ,(quote [1 2] [3 4]) |
| 18:37 | clojurebot | [1 2] |
| 18:38 | tomoj | so that macro writers can do crazy stuff? |
| 18:38 | tomoj | oh, no |
| 18:39 | tomoj | there would just be no way not to get resolution like there is for keywords |
| 18:40 | holo | yedi, skateproj.routes really has that name in the filesystem? |
| 18:41 | holo | i mean skateproj/routes |
| 18:41 | yedi | src/skateproj/routes.clj |
| 18:42 | yedi | oh |
| 18:42 | yedi | the templates/dress-page-html is stored in top level directory |
| 18:43 | yedi | so templates is on the same level as project.clj |
| 18:43 | holo | oh.. |
| 18:43 | yedi | i updated the gist: https://gist.github.com/yedi/4747527 |
| 18:44 | yedi | so... the file is being found yet i still get the NPE (and research shows that generally NPE means enlive can't find the resource html file) |
| 18:45 | holo | yedi, i think you should store it in the path for the resources |
| 18:47 | yedi | is there an easy way to add directories to the class path |
| 18:48 | yedi | i'm using lein |
| 18:48 | yedi | looks like resource-path might do it |
| 18:51 | holo | yedi, if you put inside the existing resources path, can't you use a relative path for the file? |
| 18:52 | yedi | holo: sorry i don't follow |
| 18:54 | holo | yedi, don't worry, it's probably my english. if say, your resources path is /resources/ and you put the file in /resources/templates/ , then you can try (html/deftemplate dress-page "templates/dress-page.html" |
| 18:55 | yedi | holo: ah right, that's what imma attempt to do |
| 18:57 | yedi | amalloy: so i tried your tip of reloading nrepl instead of restarting emacs, but then i just started getting namespace not found errors after nrepl restarted |
| 18:57 | yedi | this occurs even when evaluating the ns form... |
| 19:18 | Frozenlock | Is there a way to make sure a namespace has some functions already loaded? Something like (with-refer some-ns (load-file "my-clj-file")) |
| 19:19 | arohner | Frozenlock: you mean like require? |
| 19:21 | Frozenlock | Yes, but from outside the file loaded. Load this file, and make sure those functions are available for it. |
| 19:22 | Frozenlock | Hmm.. I could make a with-require macro... (with-require (load-file)) |
| 19:27 | callenbot | alright, I've made a huge mistake |
| 19:27 | callenbot | I switched away from noir cookies and it's not working. |
| 19:27 | callenbot | I'm trying to use vanilla Ring sessions with an encrypted cookie store.. |
| 19:28 | Frozenlock | You moved away from noir or noir-lib? |
| 19:28 | callenbot | lib-noir |
| 19:28 | Frozenlock | er, lib-noir :p |
| 19:28 | callenbot | I haven't completely moved way, but I'm trying to. |
| 19:28 | callenbot | I can't get these stateless sessions working though |
| 19:28 | abp` | callenbot: How so? |
| 19:29 | callenbot | I don't think the sessions are surviving across a redirect. I'm not sure though. |
| 19:29 | callenbot | I'm using Ring redirect an assoc'ing the :session though |
| 19:30 | callenbot | does anyone know of a particularly good example of how to use Ring sessions? |
| 19:30 | callenbot | I didn't find anything compelling or that seems to work. |
| 19:34 | abp` | callenbot: When do you assoc on :session? |
| 19:35 | callenbot | I'll just pasta. |
| 19:35 | abp` | callenbot: Sure |
| 19:36 | callenbot | abp`: https://www.refheap.com/paste/11133 |
| 19:36 | callenbot | abp`: what am I fucking up? |
| 19:40 | abp` | callenbot: compojure.handler/site already does wrap-session. Try passing {:session options} to site |
| 19:40 | callenbot | abp`: thanks |
| 19:41 | technomancy | ordnungswidrig, amalloy: lein.el doesn't really work yet unless the emacs instance doesn't have a project-level nrepl session |
| 19:41 | technomancy | I haven't adapted it to support a lein nrepl session and a regular one at the same time |
| 19:41 | callenbot | abp`: made the change, still not working. |
| 19:41 | abp` | callenbot: Don't know if that's all, but first thing standing out. |
| 19:44 | abp` | callenbot: Everything else looks good I think. Is your session-data in resp when printing from login-page handler? |
| 19:45 | sritchie | hey -- are any of you guys running multi-module projects with leiningen? |
| 19:46 | callenbot | abp`: I just got it working now |
| 19:46 | abp` | callenbot: Ok. What was the problem? |
| 19:46 | callenbot | abp`: I had to put (site ...) after some user middleware. |
| 19:48 | abp` | callenbot: Oh sure.. To have access to the session. |
| 19:54 | yedi | how exactly would i go about composing templates in enlive? |
| 19:55 | callenbot | yedi: a few points of order |
| 19:55 | callenbot | yedi: 1. don't |
| 19:56 | callenbot | yedi: 2. use something else |
| 19:56 | callenbot | yedi: 3. reserve enlive for scraping |
| 19:56 | abp` | Rescue him! |
| 19:56 | Raynes | yedi: A few points of order |
| 19:57 | Raynes | yedi: 1. Ignore callenbot. |
| 19:57 | Raynes | yedi: 2. Use laser because I wrote it and I'm pretty great. |
| 19:57 | callenbot | yedi: 1. laser is cool, clabango is better. |
| 19:57 | callenbot | yedi: 2. I'm a bot, don't listen to me |
| 19:57 | callenbot | yedi: 3. Black metal is awesome. |
| 19:57 | Raynes | yedi: 3. Use fragments, pass them to other fragments, and pass it to a document. Etc. They're just functions. They compose normally. |
| 19:57 | yedi | callenbot: i like the idea of having my designer have access to the html |
| 19:57 | Raynes | :p |
| 19:57 | yedi | Raynes: i'll check out laser |
| 19:57 | callenbot | yedi: good thing Clabango lets you do that. |
| 19:58 | callenbot | yedi: look at Clabango. Give it a shot. |
| 19:58 | callenbot | yedi: https://github.com/bitemyapp/neubite/blob/master/src/neubite/templates/base.html |
| 19:58 | callenbot | yedi: https://github.com/bitemyapp/neubite/blob/master/src/neubite/templates/index.html |
| 20:00 | yedi | looks like what django uses |
| 20:00 | yedi | and that's not exactly the html... though it might be good enough |
| 20:02 | callenbot | Raynes: bot: 1 Raynes: 0 |
| 20:03 | abp` | *clapclap* |
| 20:03 | yedi | haven't chosen clabango yet =p |
| 20:04 | abp` | I just use hiccup. |
| 20:04 | yedi | but thanks guys, adding clabango and laser to my list of templating options will have a profound effect on the choice paralysis i was feeling earlier |
| 20:04 | callenbot | yedi: it's okay, you will. |
| 20:04 | S11001001 | (inc Raynes: bot: 1 Raynes:) |
| 20:04 | lazybot | ⇒ 1 |
| 20:04 | abp` | Bootstrap is my designer. |
| 20:04 | abp` | Formative builds my forms. |
| 20:04 | callenbot | abp`: he needs to work with a designer, like I do. |
| 20:04 | callenbot | yedi: I can make it easy. Just use clabango. |
| 20:07 | yedi | raynes: |
| 20:07 | Raynes | yedi: |
| 20:09 | yedi | raynes: this line: "But darn it, we don't want all of our p to be omg. Let's only change the ones with the meow class!" possibly doesn't fit the code: (laser/document (laser/parse html) (laser/class= "meow") (laser/content "omg")) |
| 20:09 | yedi | won't that make all elements with the class meow have "omg" |
| 20:09 | yedi | and not just <p> |
| 20:11 | gfredericks | whistling (partition 5 1 (cycle major-scale)) is more difficult than I thought it was |
| 20:45 | callenbot | yedi: hey |
| 20:45 | yedi | sup |
| 20:46 | callenbot | yedi: use Clabango. |
| 21:00 | Raynes | callenbot: hey |
| 21:00 | Raynes | callenbot: Walk off a balcony. |
| 21:01 | callenbot | Raynes: bots can't walk |
| 21:01 | callenbot | Raynes: I'll take a flying leap with you in LA though :D |
| 21:02 | Raynes | :p |
| 21:06 | amalloy | yedi: presumably Raynes's tutorial is assuming that you haven't written non-p elements with class=meow |
| 21:08 | Raynes | yedi: amalloy is correct. |
| 21:09 | yedi | ok |
| 21:11 | cshell | If I have a vector that has alternating key and value (ie. [:a "a" :b "b]) what would be the right function to use to update the :b key? So I'd return [:a "a" :b "c"] |
| 21:11 | cshell | ? |
| 21:14 | callenbot | when does Clojure 1.5 go stable? |
| 21:14 | callenbot | I'd like to stop using my dissoc-in shim. |
| 21:17 | amalloy | cshell: use a better data structure than that :P |
| 21:17 | cshell | amalloy: that's actually a good idea |
| 21:17 | cshell | amalloy: I must be tired |
| 21:18 | cshell | amalloy: thanks :) |
| 21:33 | gfredericks | clojure.java.jdbc/with-connection is deprecated? |
| 21:34 | amalloy | callenbot: your statement seems to imply that clojure 1.5 contains dissoc-in |
| 21:36 | callenbot | amalloy: wait wait, it doesn't? |
| 21:37 | amalloy | the function is just as confusing as it would have been in 1.0; i can't think why you thought it was being added |
| 21:37 | amalloy | what does (dissoc-in {} [:a :b :c]) return? |
| 21:37 | callenbot | an empty map |
| 21:38 | callenbot | an untouched empty map. |
| 21:38 | amalloy | and why not {:a {:b {}}}? |
| 21:38 | callenbot | because the original assumption was invalid. |
| 21:38 | callenbot | so best to leave it untouched. |
| 21:38 | callenbot | the key path is speculative. |
| 21:38 | callenbot | it's just saying, "remove if it's there, but don't sweat it if it's not" |
| 21:39 | callenbot | amalloy: I see nothing confusing about that. |
| 21:46 | ivan | &(clojure.pprint/pprint 1) |
| 21:46 | lazybot | ⇒ 1 nil |
| 21:46 | ivan | &(clojure.pprint/pprint (range 40)) |
| 21:46 | lazybot | java.security.AccessControlException: access denied (java.util.PropertyPermission line.separator read) |
| 22:07 | mdeboard | What does the last part of this error message correlate to? PDFEngineException com.callassoftware.pdfEngine.PDFEngine.throwIfError (:-1) |
| 22:07 | mdeboard | The (:-1) |
| 22:07 | mdeboard | I caught the exception, the actual error message is an empty string. Is it the exit code of the fn or what |
| 22:13 | TimMc | Line number? :-P |
| 22:13 | mdeboard | That's as reasonable as anything I could think of (nothing) |
| 22:14 | lynaghk | dnolen: ping |
| 22:15 | mdeboard | I'm kind of at my rope's end trying to implement this JNI wrapper class |
| 22:17 | TimMc | &:-1 |
| 22:17 | lazybot | ⇒ :-1 |
| 22:18 | TimMc | Maybe it's an emoticon. |
| 22:18 | mdeboard | lol. |
| 22:18 | mdeboard | "Just got out of the shower and smirking"? |
| 22:18 | TimMc | Impudent stack traces. |
| 22:19 | mdeboard | The stack trace == nil |
| 22:24 | TimMc | Right, it's failing to wrap the exception. |
| 22:25 | TimMc | I hate that so much. |
| 22:25 | TimMc | I mean, with event-driven programming, there's at least an excuse to lose the trace. |
| 22:25 | mdeboard | At least this way I get to laugh about it https://gist.github.com/mattdeboard/c1f11be5e11f096a6840 |
| 22:26 | mdeboard | When you say "it's failing", what's "it" |
| 22:26 | TimMc | Whatever is catching and then throwing. |
| 22:27 | TimMc | "throwIfError" |
| 22:27 | mdeboard | Failing to wrap the exception how? I'm not good with computer |
| 22:27 | TimMc | .printStackTrace always returns nil, by the way |
| 22:27 | amalloy | TimMc, mdeboard: (:-1) is a nil source file, line -1 |
| 22:27 | mdeboard | oh, really |
| 22:27 | mdeboard | weird. |
| 22:27 | mdeboard | I have no idea what that means. |
| 22:27 | TimMc | mdeboard: Is this in the repl? Try (pst). |
| 22:27 | mdeboard | I mean, I know what nil means, but. |
| 22:28 | TimMc | Throwable.printStackTrace has a return type of void == returns null == nil |
| 22:28 | mdeboard | That did return some stack trace, cool |
| 22:28 | mdeboard | also, oh. |
| 22:29 | TimMc | I thought you meant that it was catching some error, discarding it, and throwing a new one in its place. |
| 22:30 | callenbot | is there a way to show private contribution activity on github? |
| 22:30 | mdeboard | ps is a proxy so maybe that's why it's saying (:-1) |
| 22:30 | mdeboard | callenbot: No |
| 22:31 | callenbot | mdeboard: balls. |
| 22:31 | mdeboard | yeah |
| 22:32 | callenbot | mdeboard: I'm up there with isaacs if you include my private activity. How disappointing. |
| 23:03 | dnolen | lynaghk: pong |
| 23:05 | lynaghk | dnolen: hey dude |
| 23:05 | dnolen | lynaghk: wassup? |
| 23:05 | lynaghk | I'm looking through the new unifier stuff, it's pretty rad |
| 23:05 | dnolen | lynaghk: yay! |
| 23:05 | lynaghk | had a few questions for you, but I think I've resolved most of them |
| 23:06 | dnolen | lynaghk: cool, I'm pretty happy w/ the changes |
| 23:06 | lynaghk | dnolen: one I haven't, though: if two records use unify-with-pmap* as their implementation for IUnifyWithRecord, then they should behave symmetrically |
| 23:06 | lynaghk | right? |
| 23:06 | clojurebot | to be fair I dunno that I've ever had code out right rejected, it just sits in jira or assembla or where ever, or if I ask if there is any interest (before writing any code) I get told to go write alioth benchmarks |
| 23:07 | dnolen | lynaghk: hrm, that seems weird that a record would use unify-with-pmap* for their implementation of IUnifyWithRecord |
| 23:07 | lynaghk | dnolen: I'm doing it to ensure that things only unify with records of the same class |
| 23:09 | lynaghk | dnolen: but my question is: (unify [#my.A{:a 1} #my.A{:a '?a :b 2}]) should give the same result with the vector reversed, no? |
| 23:09 | dnolen | lynaghk: well it should fail |
| 23:09 | dnolen | regardless of order |
| 23:10 | dnolen | that different records should not unify isn't something I had considered - it should probably be handled |
| 23:10 | dnolen | "had not considered" |
| 23:10 | lynaghk | why should it fail? |
| 23:11 | dnolen | lynaghk: those records have different key value pairs |
| 23:12 | lynaghk | dnolen: but if they're implementing unify-with-pmap? |
| 23:12 | dnolen | lynaghk: not a good idea IMO |
| 23:12 | dnolen | lynaghk: partial map unification breaks associativity of unification |
| 23:12 | dnolen | er |
| 23:12 | dnolen | sorry |
| 23:12 | dnolen | transitivity |
| 23:13 | lynaghk | dnolen: yeah, that has been my biggest concern. |
| 23:13 | dnolen | lynaghk: not worth it |
| 23:13 | dnolen | lynaghk: partial map unification is only ok if the the thing that allows partial map unification is not "storable" |
| 23:14 | dnolen | records are "storable" |
| 23:14 | dnolen | it's for this reason that partial maps can no longer be bound to logic vars |
| 23:15 | lynaghk | dnolen: hmm. I'll see if I can figure out a nice way to do my rewrites without having all of the classes act like partial maps. |
| 23:16 | dnolen | lynaghk: so featurec is a constraint, so perhaps you can move those kinds of things into :when? |
| 23:16 | lynaghk | dnolen: yeah, that's exactly what I'm thinking |
| 23:16 | trof | guys, a small question, now that i've only started learning clojure, when i finish with the 4clojure tasks, do any of you have any projects where the additional pair of coding hands would be useful? i've been programming java for somewhile |
| 23:17 | dnolen | lynaghk: one issue, pointed out by hiredman, is that featurec should allow nested maps which it currently does not |
| 23:17 | trof | i mean, for free, for fun |
| 23:17 | lynaghk | dnolen: oh shit, I hadn't actually seen featurec. |
| 23:18 | lynaghk | dnolen: it looks like exactly what I'm trying to put together myself. |
| 23:18 | dnolen | lynaghk: yes featurec does what partial map unification did, but more sanely. |
| 23:18 | amalloy | trof: the usual answer to that question is: instead of asking for anyone who wants something, find a project *you* want to see improved, and improve it |
| 23:18 | trof | uhm, ok |
| 23:19 | amalloy | everyone turns out happier that way, generally |
| 23:20 | amalloy | for example, if you've been enjoying 4clojure: what's a cool feature we could add? you could use that to learn web programming in clojure, if you're into that |
| 23:20 | lynaghk | dnolen: is it possible to use featurec with the simple unifier? |
| 23:20 | amalloy | but currently nobody works on it for months at a time, so it's not like we're in need of an extra pair of hands; it would just be if you find it fun |
| 23:21 | lynaghk | dnolen: it doesn't look like it. |
| 23:21 | dnolen | lynaghk: #(featurec % ...) doesn't work? |
| 23:21 | trof | i understand, thank you |
| 23:22 | lynaghk | dnolen: doh. |
| 23:23 | lynaghk | dnolen: yeah, that works. |
| 23:24 | lynaghk | dnolen: I'm going to need some time to stew on all of this and try my hand at some complex matches/rewrites. It all looks very promising, though---I'm jazzed =) |
| 23:25 | dnolen | lynaghk: sweet, let me know how it goes - more than happy to improve it |
| 23:26 | lynaghk | dnolen: cool, thanks. I'll update https://gist.github.com/lynaghk/4004131, hopefully making it a ton shorter. |
| 23:28 | lynaghk | dnolen: would you mind if I factored out the implementation of IUnifyTerms for maps into a unify-with-map* fn? |
| 23:29 | dnolen | lynaghk: go for it - send me a link to the changes so I can review before you push |
| 23:29 | lynaghk | dnolen: that way I can make records that only unify with other records of the same type without copy/pasting the implementation |
| 23:29 | dnolen | lynaghk: yes |
| 23:29 | lynaghk | okay. I'll put'em on my fork. |
| 23:30 | dnolen | lynaghk: sounds good |
| 23:34 | lynaghk | dnolen: https://github.com/lynaghk/core.logic/commit/388bcd865b4abe5837b96ba741c960c1a80bd3fe |
| 23:41 | zerokarmaleft | steev: just noticed you're in #nixos |
| 23:41 | zerokarmaleft | yes, the package manager |
| 23:56 | yedi | is there really no way to reuse forms across different templates in enlive? how could people use it for templating then? |