#clojure logs

2012-07-05

00:00wingyso whatever expression returns it can be stored in a file to be read by the reader?
00:01wingy(pr-str (assoc {:name "foo"} :age 20)) returns a string that is readable
00:01wingyor rather it prints a string that is readable
00:02xeqi&(read-string (pr-str (Object.)))
00:02lazybotjava.lang.RuntimeException: Unreadable form
00:02taliosToxicFrog - I assume sanDbox :)
00:02ToxicFrogtalios: yeah, me too, but that's not what it actually says :P
00:02wingydo all expressions return a value that could be stored as string?
00:03wingyand what would the use case be?
00:03wingystore our values in a file/database?
00:03wingyto be resumed later on or in a data crash?
00:05xeqiwingy: no, some expressions are not, but most data is
00:05xeqiand its useful as a cljs <-> clojure server serialization
00:06wingyi see
00:06xeqirather then trying to put something like sets into a json representation
00:06wingyjust like json but for clojure values
00:06wingycool
00:06wingydoes this mean we don't need json anylonger between clojure server and clojurescript client?
00:08xeqiI get that impression
00:08wingywow only clj between server and client
00:08wingyand only clj between server and database
00:08wingythis is heaven
00:09wingyseems to be the power when the lang is to manipulate data
00:10dnolenwingy: you already don't need json between server & client if you're using CLJ + CLJS
00:11dnolenwingy: one ambitious improvement would be to make clojure data a JSON superset.
00:12wingycool
00:13wingythe more i work with clj the more i think cljs will make a perfect fit in frontend
00:13cmajor7dnolen: do you know if there a way to memoize remote calls in cljs? e.g. using a "defremote" from ibdknox's "fetch", and it would really save a lot of time and server RAM if I can memoize a "defremote" macro
00:13wingyclj is a good lang targeting various platforms (java, clr and js)
00:15wingyi mean jvm
00:16dnolencmajor7: I don't see any challenges there. either the value is cached and you invoke the callback immediately or not.
00:19cmajor7dnolen: it makes perfect sense theoretically, but it seems I am hitting the wall with memoizing a macro (e.g. "defremote")
00:20cmajor7(def funn-memo (memoize funn)), where "funn" is "(defremote funn [req] (some-server-fun req))"
00:20dnolencmajor7: memoizing a macro probably won't work. I don't know anything about fetch, but you'll probably need to memoize at the level below the sugar.
00:21cmajor7that what I was afraid off :0
00:22dnolencmajor7: doesn't sound very challenging. in the end it's probably just functions after all.
00:22dnolencmajor7: if it's not, it's broken.
00:22cmajor7(this is what I am talking about memoizing: http://bit.ly/M7iKGh)
00:23dnolencmajor7: it's greek to me.
00:24cmajor7my clojurefu is not yet strong (although it is getting better, so it is hard to take it apart)
00:24cmajor7oh.. ok, so it is not just me.. good to know :)
00:25dnolencmajor7: all I mean is that I don't really care decipher what's going on. Ask the maintainer.
00:26amalloyspeaking of asking the maintainer, dnolen, did you see my $mail about dynamic bindings of logic variables?
00:27dnolenamalloy: I did not. dynamic binding of logic variables sounds like trouble.
00:27amalloywell, here's a re-paste: i tried binding a dynamic variable to a fresh logic variable, to make it easily accessible throughout my program (we discussed this and decided it probably ought to work). but from https://gist.github.com/3049645 it looks like that binding just creates a snapshot of the logic variable, which can't be unified with anything anymore
00:28amalloyi discussed it with you before and you thought it would be fine, but it sounds like we misunderstood each other
00:30dnolenamalloy: I probably misunderstood, I don't understand what you're trying to accomplish
00:32amalloydnolen: at the start of my program i set up a few lists of the relevant things. like there's a list of all the doors, all the people, etc. then inside dooro and related functions, i want to also specify "by the way, this door object is a member of the 'global' list of doors"
00:33amalloyotherwise the unifier will try just making up a new door for me rather than unifying with the existing ones
00:33augustlaway away
00:33augustl#fail
00:33amalloyup up
00:34dnolenamalloy: still not following. probably because I don't understand what dynamic binding solves here.
00:35amalloydnolen: it doesn't solve much; i'm not going to be rebinding it during run*. i just want a global value that i can set once, and then refer to inside my logic functions without needing them to be lexically scoped
00:35dnolenamalloy: so why not define a global thing? global logic vars will be global.
00:36amalloydnolen: how?
00:36dnolen(def x (lar 'x))
00:36dnolenoops
00:36dnolen(def x (lvar 'x))
00:36dnolenin a run that may be bound only once.
00:37wingyin OOP one have class that is instantiated to an object
00:37wingyclass equivalents to record in clojure .. what does one call the "instantiated" record?
00:38amalloyso i would do that outside of run*, before all my function definitions, and then inside of run* it would be treated like any other fresh variable?
00:38dnolenamalloy: maybe I see what you're getting at - you want an initial set of bindings to be in place.
00:38dnolenby "bindings" i mean logic var bindings.
00:39dnolenamalloy: yes to your last question.
00:39amalloyyes. but i don't know what those initial bindings are when "setting up" my logico functions, only when i have a specific problem before me
00:39amalloythanks, i'll try again with lvar
00:40dnolenamalloy: eventually I gotta do a deep dive talk about this stuff - it's really not hard to interact with core.logic minus sugar.
00:45wingy"instance of the record
00:45wingy"
00:46dnolenwingy: instance of the type/record works.
00:57wingyis the meaning of data type and class/record interchangable? eg. if you wanna know what data type a value is of, then what you wanna know is the class of the value (class value). is that right?
00:59amalloythat's a pretty narrow definition of a data type. [2012 7 4] is a vector of numbers, not just a vector. or maybe it's a date, if you're storing those as YMD tuples. and {:name "steve" :age 10} isn't just a map, it's a person
01:02wingyamalloy: so one value can have multiple data types?
01:02dnolenwingy: class is an loaded word - inheritance usually a factor
01:02wingyyeah
01:03wingywhereas data type is not
01:04dnolenwingy: deftype is pretty simple, you've got some fields and the protocols it implements - that's it
01:05dnolenwingy: defrecord is there so that people can write map-centric code w/o having to write boilerplate
01:08wingyive seen patterns where you first create a protocol and defines the method signatures .. then you implement that interface in a record
01:08wingybut also where you first define a protocol then you extend it with extend-protocol where you also implement that interface
01:09wingywhat's the diff between the last step in those two scenarios
01:09dnolenwingy: protocols are design, types/record may implement them - but you can also extend types you do not control to the protocols you care about.
01:10wingyah that makes sense
01:11wingyexplains why they are extending a vector with extend-protocol
01:12wingycan't anyone write a http://headfirstlabs.com/ book for clojure
01:12wingythat series is kick ass
01:13dnolenwingy: do you have the O'Reilly book?
01:13wingyyeah Clojure Programming
01:14dnolenwingy: I'm sure it's covered.
01:14wingyit is .. im reading it atm .. but often it's explained without you getting the pic
01:15dnolenwingy: IME ... patience and re-reading helps.
01:15wingyyeah and having to complement with asking questions here or googling/reading doc examples/doing clojure koans :)
01:16dnolenwingy: definitely.
01:17wingyand clojuredocs rocks .. good examples .. should be made the default one
01:18dnolenwingy: when it's good, clojuredocs has quality control issues.
01:19wingyi c
01:26frioI don't actually use clojure much (yet - have had a couple of prototypes turn out very well!), but: is there some way to enforce a degree of compile-time type-checking?
01:26frioI know static typing isn't a very lisp-y thing to do, and I know clojure is dynamically typed
01:27dnolenfrio: ambrosebs is working on Typed Clojure
01:27frio(I ask because it sounds like this kind of info could easily be derived from protocols :))
01:28frioooh
01:28wingyisn't it mandatory for a type/record to implement all methods of the interface?
01:28friothanks dnolen :)
01:28friofound the gsoc for it
01:28dnolenfrio: even so I suspect experiments with the CLJS analyzer, datomic, core.contracts, & core.logic will eventually deliver more interesting forms of verification than just types.
01:28wingyi tried to omit some methods but it still worked
01:29dnolenwingy: not enforced, but definitely broken if you don't, IFn perhaps the exception
01:29wingydnolen: but then what is the purpose of protocol?
01:29wingyif you are not forced to implement them
01:29dnolenwingy: think about it for a couple days.
01:29dnolencouple of days
01:30wingyim afraid i wont get the answer
01:30dnolenwingy: you will.
01:30wingyi will!
01:30friothat's cool dnolen :)
01:31frio(ever since playing with Haskell, there's a Thing in my head that constantly tells me off when I notice problems that could be caught at compile-time happening at runtime)
01:31dnolenfrio: I think so. verification is important, having it *not* be baked into the languages means we're free to figure out what works best for idiomatic Clojure code!
01:33friodefinitely. the one thing i've really liked about playing in clojure so far is that it *feels* modern to use (as does the tooling). it'd be nice if that continued
01:35dnolenfrio: I'm confident that interesting verification tools will arise. Also I think Light Table's approach will be able to aid debugging in pretty novel ways.
01:36frioyeah dnolen, im really, really looking forward to light table
01:37frioi get myself caught in a tizz; on the one hand, i *love* haskell's enforced referential transparency, functional purity, and static typing
01:37frioon the other hand: a simple app took me 2 hours in clojure, having never used it before
01:38friothe haskell version took me a week or so to get done, having been learning it in my spare time for quite a while now
01:38frioso, i guess the point is, the theoretical part of me loves and wants that stuff; the practical part of me accepts that doing so can destroy your productivity (without climbing a steep curve, anyway)
01:39dnolenfrio: Clojure is pretty productive. Haskell seems pretty sweet - but personally I'm not big on types. static analysis yes, Haskell's approach to types ... no.
01:39dnolenfrio: also I'm not sold on monads at all.
01:40friothe jury's still semi-out for me on monads, but it's slowly coming in positive as i understand them better
01:40frioalthough that could be stockholm syndrome kicking in ;)
01:40aduclojure is my favority
01:43dnolenfrio: people like to talk about monads like they are unequivocally awesome. Yet when you understand them you realize they are opaque wrappers - very questionable from an engineering perspective (I could be quite wrong here, I'm not a monad expert)
01:43clojurebot|monads| is monads
01:44frioso far dnolen, the monad i've used the most is probably the Maybe monad... which im deeply in love with. having worked in corporate java for too long, it's nice to have a way of never actually having a NullPointerException ever ;)
01:44dnolenfrio: yes Maybe is pretty much the monad that makes me think the whole notion is terrible.
01:44friothey're a decent abstraction for controlling execution in certain ways. i've not found them that opaque, but im no expert either
01:44friohow come?
01:44dnolenfrio: it's a wrapper.
01:45nicholasfwhich client are peeps using for mongodb integration?
01:45frioim probably going to need more elaboration than that :p
01:46dnolenfrio: wrapper types in generally are very yucky. You can use them in some code, but they become a hassle eleswhere.
01:46frioi suppose from the debugging pov, it's frustrating not know which execution inside a Maybe monad chain failed
01:46dnolenfrio: there's also an implicit cost w/o a "sufficently smart compiler" - which is hogwash IMO.
01:48friono doubt - but is that cost higher than, for instance, unwinding your stack when an exception is thrown?
01:48dnolenfrio: null pointer exceptions suck hard ... no argument ... but usually that maps to something primitive in the language you're weilding. so you can reason about the costs.
01:48dnolenfrio: just depends on the code being written.
01:49hiredmandnolen: I think I am seeing a bug in clojurescript where setting an atom's value to nil causes an error "TypeError: a is null", sound familiar?
01:49dnolenfrio: for graphics stuff, may be too much.
01:49frioyeah dnolen
01:50dnolenhiredman: it does not, ticket welcome.
01:50frioill have to have a think about this :). like i said, so far ive quite liked the concept, and have enjoyed making use of it... but the flipside is, ive not done anything particularly complex either
01:52dnolenhiredman: hmm, did you test that against master?
01:54hiredmandnolen: no, just against whatever version session pulls in
01:54hiredmanit looks like the bug might not exist in master?
01:54dnolenhiredman: (reset! some-atom nil) works for me on master.
01:54hiredmanthe issue seems be the result of calling type on nil, and I cannot find a definition of type on master
01:55dnolenhiredman: (type nil) definitely works on master - returns nil.
01:55hiredmangood to know
01:56dnolenhiredman: yeah looks like session is on lein-cljsbuild 0.1.8, very old in CLJS world, 0.2.2 is the latest.
01:56wingyso i thought that records remind about classes in oop and that was what we didn't want .. methods and data in one structure .. but that's not exactly the same thing as classes since the records don't have mutable state?
01:57hiredmanI see
01:57dnolenwingy: nothing wrong with methods + data.
01:57wingyits the changing state that is bad in oop?
01:58dnolenwingy: statefulness & inheritance are problematic yes.
01:58wingyok
01:59hiredmanwell, bleh, session cannot upgrade the version of clojurescript without breaking the version of noir it is using, and I really don't want to touch noir
01:59dnolenhiredman: ah right ...
01:59borkdudednolen can I ask a stupid question, why exactly is inheritance bad, can you give an example?
01:59hiredmanbut doesn't seem to use noir-cljs?
02:00dnolenborkdude: read up on why C++ video games have abandoned it.
02:00friothe term "fragile base class" or something to that effect is tickling my memory from uni
02:00borkdudednolen where
02:00dnolenborkdude: google C++ component video games.
02:01friohttp://en.wikipedia.org/wiki/Fragile_base_class
02:01friowhich links to http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html (which i havent read, so might be completely bogus ;))
02:02dnolenhiredman: not sure why session needs noir, I guess the remoting bits are convenient. I imagine wouldn't be hard to separate.
02:07brainproxyborkdude: found this http://en.wikipedia.org/wiki/Composition_over_inheritance
02:08brainproxyreading it reminded me of some of the interesting features of perl's Moose, which I haven't used in a while but which was pretty nice
02:10brainproxyyou could build up some interesting classes with has relationships, and those `has` rels can be declared with `isa` rels, which can in turn be composite things built up w/ `has` and `isa`
02:10brainproxyit's not static typing, but you got some type-checking like benefits
02:11borkdudebrainproxy tnx, it begs for the question that if this is better, why isn't everybody doing it like this?
02:12brainproxyand it's dynamic so can be manipulated at runtime, and instances can even override rels declared on the parent classes
02:12hiredmandnolen: looks like just some convenience for calling the compiler
02:12brainproxysorry, i meant you could declaratively override the rels w/ instance specific rels
02:13brainproxyborkdude: well.. people do what they're use to doing
02:13brainproxyand people tend to teach other people what they're used to, and so on
02:16borkdudebrainproxy I agree, inheritance feels counter-intuitive to me anyway
02:16dnolenborkdude: brainproxy: http://www.gamasutra.com/blogs/MeganFox/20101208/88590/Game_Engines_101_The_EntityComponent_Model.php
02:16borkdudemaybe there should be a rule like with macros: don't use inheritance unless you absolutely need it?
02:17dnolenborkdude: 'cept ... you never need it.
02:17borkdudednolen great, I will read it later, have to go soon
02:18dnolenborkdude: brainproxy: http://gamearchitect.net/Articles/GameObjects1.html
02:19brainproxydnolen: what's interesting is that when I was actively playing with Moose and actively using Joose (a port of Moose to JavaScript), I tended to favor `has` and Roles (which were interfaces in Java parlance) and rarely used subclassing
02:19borkdudednolen noted
02:20brainproxywhich kind of makes sense now looking back on it... the inheritance stuff just wasn't all that useful
02:20dnolenbrainproxy: same princple applies to my experience w/ Cocoa.
02:21dnolenbrainproxy: inheritance is simply looked down upon.
02:21brainproxythis is all bringing back interesting memories of me really wanting and trying to like "modern" perl
02:21brainproxyread a couple of books, eventually gave up on it
02:21dnolenborkdude: funny enough, macros ease the tension around *not* having inheritance.
02:21brainproxybut Moose was the best part
02:22borkdudeI think clojure is a modern enough language to try
02:22brainproxyborkdude: agreed... this was a couple years ago, was unaware of clojure at that time
02:22brainproxydnolen: thanks for the links
02:23borkdudednolen why does clojure use inheritance in its implementation? ;-P
02:23brainproxystill, if you ever want to read some interesting javascript, try groking the interals of Joose3
02:23brainproxythe meta object protocol implemented on top of prototypal inheritance is really cool stuff
02:24brainproxythe Russian programmer behind it is quite the whiz
02:27wingycomposition is where you add behavior to something else? is protocols/records used for composition in clj?
02:27dnolenborkdude: where? in the interfaces?
02:27wingyis it possible to add multiple protocols (behaviors) to a record?
02:27borkdudednolen AFunction, APersistentVector, etc
02:28dnolenborkdude: because it's convenient, doesn't matter much if you have protocols.
02:29borkdudednolen so the inheritance thing only goes against a deep inheritance tree, or what?
02:30dnolenbroquaint: I'm not following ...
02:30dnolenoops
02:30dnolenborkdude: I'm not following
02:30wingyok its possible
02:31borkdudenm, I gtg!
02:35friolike everything in computer science, inheritance (and all that goes with it) has it's pros and cons
02:35friothere's no silver bullet, or 100% right way of doing stuff (yet), basically
02:37dnolenfrio: disagree ... inheritance is like mutablity ... the cons outweight the pros.
02:37friosounds like we disagree on a lot dnolen :p
02:38dnolenfrio: disagreement is ok. but I've also got a lot of industry experience reports on my side.
02:38friodon't get me wrong - i avoid inheritance (hell; i avoid OOP altogether) when i can
02:39friobut, for instance, it's nice that in java i can declare exceptions which extend other exceptions, to give me a more or less granular control of how i deal with them when they bubble up the chain
02:39dnolenfrio: as I said earlier, tensions arise w/o inheritance - so the language must fill the gaps in some way.
02:40dnolenfrio: there are variety of Clojure specific solutions - macros, default cases, etc.
02:40frioyeah; im talking more about my day job with that anecdote (where clojure is a distant twinkle in a BA's eye ;))
02:41friospeaking of which, hometime!
02:53jon___Hi I keep doing this. I have a variable like foo, and I want to conditionally do something to it, or simple return foo. I tend to write it like this: (if condition (dosomething foo) foo). feels a bit clunky
03:02aduhi jon___
03:02jon___hey
03:11amalloyjon___: so write a function that captures that common pattern for you. (defn maybe-do [action pred x] (if pred (action x) x))
03:12jon___ok
03:12amalloypersonally i like useful.utils/fix, since i wrote it, but it's not exactly the same. it may or may not be useful to you
03:12jon___just did it so often it felt I'm missing something else
03:12jon___I'll have a look - thanks
03:12amalloyer, useful.fn/fix. silly me
03:12amalloy&(require 'useful.fn)
03:12lazybot⇒ nil
03:13amalloy&(useful.fn/fix 10 even? inc)
03:13lazybot⇒ 11
03:13amalloy&(useful.fn/fix 10 odd? inc)
03:13lazybot⇒ 10
03:19ro_stanyone using emacs have a thing that automatically highlights occurences of the symbol under the point?
03:19ro_stkinda like when you i-search
03:20ro_stbut with awareness of clojure's lexical scope
03:25cljs_newb_293878within clojurescript, how do I set a global javascript variable?
03:25augustlwingy: you happen to know if/how dynamic attributes are supported in datomic?
03:25cljs_newb_293878i.e.e, I'd like to set js/foo.bar , which would be the same as "foo.bar" in the js console
03:25augustlI'm currently using a document database, because my data is schemaless documents. Datomic seems like a great fit except for that part
03:26cljs_newb_293878what is the closest open source alternative to datomic? fleetdb?
03:27augustlcljs_newb_293878: didn't know about that one, nice
03:28augustlseems like it never persists?
03:28augustl(to disk)
03:30si14what can I do if my (github and whatnot) nickname was written with a mistake on http://clojure.org/contributing ?
03:30wingyfleedb seems abandoned?
03:31cljs_newb_293878it doesnt' seem very active
03:31cljs_newb_293878but it seems like an interesting project to work on for learning about databases
03:31cljs_newb_293878and I love the name
03:31wingyaugustl: no idea .. just started with datomic
03:31wingyi love the word datom :)
03:31augustlwingy: everyone in #datomic seems to be in the wrong time zone :)
03:31wingyaugustl: doesn't seem to be a very active channel
03:32wingythe google group is answering questions though
03:32wingythe Clojure Programming is giving a lot of too detailed examples imo
03:32wingythere is no way you wanna get into those kind of details and LOC
03:33augustlI would very much like to know if I can use datomic before a meeting 4 hours from now :)
03:33wingyaugustl: its possible
03:33wingytakes like 5 min to set it up
03:33wingydownload the zip folder and read README
03:34wingyand you are ready to go with it in a lein project
03:35wingyand then you read samples/seattle/getting-started.clj
03:35wingyand the data files its using and you will get the pic while you are reading the reference pages in the doc
03:35wingyDatalog is so sweet
03:36augustlwingy: I have it installed now
03:37augustlmy problem is whether I can write my schemaless data to it somehow
03:38wingyaugustl: what is your use case?
03:38augustlwingy: schemaless data :)
03:38augustlI'm storing events as my main ever-growing entity, and an event has attendants
03:39augustlthe fields for the attendants vary from event to event
03:39augustlthe data is always limited to one event, so I could always "shard" manually by using partitions and eventually multiple databases
03:40wingyin the schema of datomic you only have to define the attributes any entity can use .. not relations between entities, not how an entity should look like (what attributes they will have etc)
03:40augustlright, but there's still a schema
03:41wingyyeah .. i think it's mandatory since you wanna specify what attributes are indexable and not
03:42wingyor what type it is etc .. i dont know if you can add an attribute that is not predefined .. ask in google group
03:42wingyor let me just check :)
03:43ivaraasenaugustl: excuse my newbieness, but sharding is basically splitting the table by rows to reduce the size of the index, right?
03:44augustlivaraasen: haha if you ask me, I ask you!
03:44augustlwhat I meant with sharding was that there are ways to naturally split the data. For example, events are owned by "customers", so we could shard so 50% of the customers used one db, and 50% another, for example
03:45augustlin relational DBs, sharding is usually splitting one single table I think, for example sharding on a foreign key
03:45wingyaugustl: nope didnt work
03:45augustlanyways, I'll roll with datomic. It has everything I need. And by the time I end up having too many partitions, datomic probably has support for dynamic schemas, _or_ I can shard my data :)
03:46wingyi had to have it the attribute defiend in the schema or i got an error
03:46ivaraasenaugustl: ah, thanks. datomic looks really nice, BTW
03:47augustlyeah, and it's a _perfect_ fit for this project
03:48ro_sti'm getting a java.lang.NullPointerException when compiling in swank. no location. lein2 compile produces no exceptions. where do i look for more?
03:48wingyaugustl: i also need to add attributes i can not be aware of .. they should be created in runtime by users
03:48wingyaugustl: but i think what we really want is to have a way to define new attributes in the schema in runtime
03:48wingyperhaps that is possible
03:48wingyso we can specify if those should be indexable or not, if they are strings or booleans etc
03:49augustlwingy: I don't need that either
03:50augustlusing one schema foreverything wouldn't make sense
03:51wingywhy not
03:52wingyyour attributes are namespaced
03:52augustlit's impossible to shard :)
03:52augustlso when I eventually hit the limit of the number of attributes in a schema, I'd need to re-do everything
03:54wingyi think datomic can handle many many attributes
03:55wingyisnt the point with sharding that data should shard
03:55wingynot the schema itself?
03:56augustlI wonder how people typically manage their schema.. Is it common to have a schema.dtm that you need to run once?
03:57wingythe data has to follow the same schema no matter in which server it is .. and if you dont want that then that server would be for something else .. with a new schema and data set
03:58wingyseems like it
03:58wingyand then we need to lookup if you can dynamically add attributes, which seem likely since they are all just entities in the db
04:03ro_stis there a way to list all the environment variables and their values?
04:03ro_sti know i can use System/getenv to read a particular value
04:04augustlro_st: (System/getenv) :)
04:04ro_stdoh
04:04ro_stof course.
04:05ro_stok. so how do i get the swank/slime repl to see env vars i've set in my user profile? failing that, how do i set env vars for the slime repl?
04:24ro_stno one? :-(
04:24augustlhave you tried accessing env vars?
04:24clojurebothttp://www.slideshare.net/mudphone/fun-with-vars
04:25augustlI can't imagine they manage to screw that up
04:26ro_sti can read env vars just fine
04:26ro_stbut i've set some in my .zshrc and i'm not seeing them from within the repl that swank starts up
04:27augustlare you seeing them in zsh itself?
04:27ro_stabsolutely
04:27ro_stand from a lein2 repl
04:27ro_stjust not from the repl in clojure-jack-in
04:28ro_stwhich kinda sucks because we're following this http://www.12factor.net/config
04:30ro_stthere's probably some really simple thing that i need to do
04:30ro_stif i can just find the documentation
04:31ro_stwould my swank command be the problem? it's currently: echo "/Users/robert/bin/lein2 jack-in %s" | $SHELL -l
04:38ro_sttechnomancy: how do i set env vars for a slime-repl?
04:52clgvro_st: you can modify the java object returned by (System/getenv) if you want to add or change value for something that is accessing those variables in the following
04:52ro_stinteresting :-) it says it's an UnmodifiableMap instance
04:53ro_stdo you perhaps have a code sample, clgv?
04:53clgvoh. but I remember having seen something like that. maybe there is a System/setenv ?
04:54ro_stunfortunately not :-(
04:54ro_stit's ok. i'll work around this issue another way
04:56clgvoh maybe I confuse it with System Properties
05:07wingywhy is it called tag and not child in http://clojuredocs.org/clojure_core/clojure.core/derive
05:07wingywhat is the meaning of it being called tag
05:47ro_stwhat work factor are you all using to encrypt passwords with bcrypt?
06:10clgvwingy: you want explanations for all namings - may they be important or not, don't you? :P
06:22wingyclgv: no i want to get what tag is
06:23wingywhy "tag"
06:23clgvwingy: thats described in the docstring
06:23clgvtag is the child part of the relation but it can be an ns-qualified symbol, keyword or class
06:24clgva parent is not allowed to be a class
06:25wingyyeah i knew that .. was just curious about why not use "child"
06:26clgv"child" would be very generic
06:26clgvbut it is limited to the three types mentioned above
06:27clgvthats my guess on it
06:27clgvand it doesnt really matter at all, since the docstring clearly states what that function does and what roles are assigned to the parameters
07:07mystiiqI am writing one library in clojure and I have another project where I'd want to use it. how can that be achieved?
07:08mystiiqI dont want to compile the library to .jar or something right now because I am still working on it
07:12clgvmystiiq: you want leiningen's checkouts feature
07:12clgvmystiiq: do you use Eclipse+CCW by any chance?
07:13mystiiqclgv: naah, Sublime text and terminal
07:14clgvok so you work leiningen based. create a checkouts folder that contains a symlink to the dependency project's directory
07:14wingyisn't repeat returning a sequence: (= [:a :a :a :a :a :a :a :a :a :a ] (repeat 10 :a)) => true
07:15wingyis vector converted into a seq?
07:15clgvwingy: clojure's equal comparison are by value. you should read on that
07:15wingyah
07:17clgvwingy: seriously, continue reading that book you bought. ;) you will have to ask less basic questions then ...
07:17wingyi _am_ reading it
07:19clgvgood :)
07:22mstrluDoes someone have a link at hand for an online reference on equality? vector ~ seq does not seem obvious `by-value' equality
07:24clgvmstrlu: there are the equality partitions: sequentials, maps, sets - within a partition it is only compared by value
07:25clgvmstrlu: vector, sequence, list, cons are all sequential...
07:25mstrluclgv: got it.. thanks
07:34mstrluby the way.. is there any reason <= is only works for numbers (and not for Comparable)?
07:39clgvmstrlu: there is `compare` for everything comparable
07:42mstrluclgv: yeah but compare is only binary and not boolean... and numbers have it too. Why do only numbers have <= then
07:44clgvmstrlu: well since compare has 3 different outcomes, a bigger arity would probably make not much sense
07:44mstrluclgv: sure.. but for <= it would
07:44clgvmstrlu: the source shows that <= is optimized for numbers
07:45clgvso the reason is performance
07:45mstrluclgv: ok, fair enough
07:45mstrluthx
07:45clgv$findfn "abc" "bcd" "cde" true
07:45lazybot[clojure.core/not= clojure.core/distinct?]
07:46clgvmstrlu: but you can write yourself a less-or-equal function that behaves like <= for more than two arguments
07:47mstrlusure
07:48clgvin fact you can take the code of <= and replace (<= A B) with (neg? (compare A B))
08:02wingya good one: http://www.lurklurk.org/clj_repl/clj_repl.html#start
08:16clgvwingy: lol. didnt know that one ^^
08:24mystiiqI need to build a small REST API in clojure, what tools should I look for? currently I am trying it with Noir
08:26cmiles74I wrote a Webmachine-like library for Clojure called Bishop that I like a lot. :P https://github.com/tnr-global/bishop
08:27mfexmystiiq, also see this list at the clojure-rest google group: https://groups.google.com/forum/#!topic/clojure-rest/lPTHMI4M2bM
08:30clgvmystiiq: something base on ring or pure ring
08:32clgvmystiiq: I don't know whether there is a downside using noir - certainly it is intended for more than just REST ;)
09:09cemerickSo, for those of you using heroku or elastic beanstalk or any of the other services that like to be piped through on a CNAME: how are you redirecting your top-level requests to that CNAME's domain?
09:10wmealing (with-data-line [source line fmt] .... ) <- what are the square brackets here.. ?
09:10cemerickI just discovered that the redirection service I've been using sends out its own disallow-all /robots.txt. — of course, definitely what you want. :-)
09:10solussd_cemerick: is it possible to have friend's http-basic present an authentication challenge?
09:11cemericksolussd_: like?
09:12wmealinghttps://github.com/wmealing/clj-audio/blob/master/src/clj_audio/core.clj#L175 <-- like this for example
09:14wmealingvectors...
09:14solussd_like a 401 unauthorized (i'm not an expert by any means) and whatever fancy stuff needs to be in the header for the challenge
09:15cemericksolussd_: it's entirely up to the user agent how to display the credential request for HTTP Basic. Most browsers use a plain dialog. There's no way to customize it.
09:15solussd_hmm.
09:16cemerickThe only thing you can do is set the `realm` parameter for the HTTP Basic workflow, which is usually passed along within some text in the dialog.
09:16cemerickThis is why most sites use a combination of (for example) form authentication for interactive use, and HTTP Basic for API access, etc.
09:17solussd_i thought the client would make an http request, the server would respond w/ a 401, if not authorized, then the client would provide basic auth credentials. right now i can only access resources using workflows/http-basic if I provide credentials up front, i'm not getting the 401 challenge back
09:18solussd_sure, in my case it's a restful web service using basic auth, so the client (an ios app, in this case) waits for the basic auth challenge before supplying credentials
09:29ToxicFrogclojure.contrib.server-socket doesn't appear to be maintained anymore :(
09:44clgvToxicFrog: clojure.contrib itself is deprecated since clojure 1.3
09:44clgv~contrib
09:44clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
09:46ToxicFrogclgv: yeah, what I mean is, server-socket never made it out of monolithic.
09:47clgvToxicFrog: maybe there were other better libs for its purpose?
09:48ToxicFrogIf so, I can't find them.
09:48solussd_cemerick: shouldnt workflows/http-basic call http-basic-deny also in the case that no credentials were supplied so the client can respond to the challenge (status 401 w/ a www-authenticate header) ? My understanding is, if the response is a 401+www-authenicate header and credentials werent provided the first time the client should perform the request again with credentials. Then, the second time, if the credentials are invalid, that's the end of it
09:48solussd_(http://www.w3.org/Protocols/HTTP/1.0/draft-ietf-http-spec.html#Code401) --At least that seems to be the sequence of events CuRL and the apple NSURLConnection api expect. :/
09:48zawzeyHi I have a library whose I/O to a db has to be synchronized (or transaction locked). This library would be used by different clojure processes (not threads) concurrently, how do i achieve synchronization so that different processes are synchronized?
09:49zawzeyIf it's a single process, I guess a combination of ref and agent would work, but since it's across processes, would I need an external locking mechanism?
09:50zawzeyso would i need to use an external device like Avout, or some system-level locking to achieve that?
09:51solussd_zawzey: are transactions alone inadequate?
09:51jsabeaudryzawzey, One way to do it is to have one process dedicated to db access (and the synch is done there) and other processes make their request on that process
09:52zawzeyjsabeaudry: well, that is possible, in that case it's a classic IPC mechanism
09:53solussd_e.g. if using jdbc transactions, throwing an exception anywhere in the transaction will trigger a rollback, so you could perform whatever queries you need to in the transaction to make sure you're good to go, and throw if you're not.
09:53zawzeysolussd_ Well, there isn't any transactions, it's redis i'm interfacing with, and redis doesn't work with nested "watch" operations
09:53zawzeysolussd_ Redis has transactions, but it can't nest multiple transactions
09:54solussd_zawzey: ah.. I'm not terribly familiar with key/val stores
09:55zawzeysolussd_ Yes, in JDBC, it's easier since there's row-level locking, in redis' case i have to do app-level synchronization for certain use cases
09:56nDuffHrm.
09:57cemericksolussd_: you may be right. Can you open an issue?
09:57solussd_cemerick: certainly. thanks!
09:58nDuffWhile trying to initialize the clojurescript REPL, it looks like goog.string.StringBuffer is being loaded before goog.string, leading goog.isDefAndNotNull (called by goog.getObjectByName, called by goog.isProvided_) to claim that goog.string is already loaded, preventing its load from happening.
09:58cemerickMy experience with HTTP Basic has always been in conjunction with headless API access, etc., so that may be borked for interactive stuffs.
09:58cemericksolussd_: ^^
10:03solussd_cemerick: I've actually been testing with the REST client Rested (from the osx appstore). It has a checkbox under http auth called "Present before challenge", which is off by default
10:04solussd_makes it act like some frameworks I use, e.g. nsurlconnection
10:10XPheriorDoes anyone know if it's possible to use Korma without an actual database? Problem I'm trying to solve is to generate raw queries for multiple database vendors, not actually execute the queries.
10:11cemericksolussd_: and you said there's a mode in curl for this as well?
10:13solussd_cemerick: yeah, I believe passing the '--anyauth' option will force it to wait for the first response before providing credentials
10:15rkzXPherior: https://github.com/ibdknox/Korma/blob/master/src/korma/db.clj hack do-query to print it out instead of actually grabbing a connection and running it
10:17cemericksolussd_: got it, thanks. Please do still open that ticket.
10:19solussd_cemerick: will do, as soon as I get to work. :)
10:20dajeroI am wondering what the idiomatic way is to return a value directly from a function (this will allow me to later implement it. Right now I am writing code like this (defn stub-implementation [_] (identity false))
10:23llasram&(doc constantly)
10:23lazybot⇒ "([x]); Returns a function that takes any number of arguments and returns x."
10:23llasramdajero: ^^
10:24llasramdajero: Oh, or maybe you just want: (defn example [& _] false), if you're stubbing things for future filling-in
10:25XPheriorrkz: Thanks!
10:26dajerollasram: Thank you for your help, both seem to work. Funnily enough I previously tried the latter but then got an error. I was probably trying to figure out too much at one
10:34clgvdajero: you should write (defn stub-implementation [_] false)
10:44mystiiqhow can I use routing with ring?
10:46iwilligmystiiq: not sure what you mean.. but you might want to look at compojure
10:46cemerickmystiiq: Ring is routing-agnostic. Check out compojure for one approach to layering routing on top.
11:42rplevycemerick: do you know of any ring apps demonstrating use of friend to implement OAuth authentication?
11:59cemerickrplevy: None that are public. I'm going to have to go down that road myself this month, so the results of that will find their way out if nothing else does from others that have hacked it together.
12:05rplevygreat! thanks
12:49hugodrplevy, cemerick: this is what I ended up with https://gist.github.com/2839891
13:07nDuffhugod: Are there any public projects using zi-cljs?
13:10hugodnDuff: not as far as I know - I haven't touched it in a long while
13:11hugodnDuff: do you still have your zi issue? I couldn't repro locally
13:12nDuffhugod: lack of line numbers in error messages, even on Maven 3.0.4? Yes, still getting that -- and on zi-cljs also.
13:12nDuffhugod: ...the other issue was resolved by moving to Maven 3.
13:14hugodnDuff: ok, see the missing line numbers now
13:22elliottwanyone using noir-blog on heroku?
14:01amalloydnolen: i see that (str (lvar 'x)) prints as "<lvar:x_3118>", as does pr-str. this seems like a bad choice, because that reads back in as a symbol
14:15locojayhi what library should i use to generate html with clojurescript (hickup for cljs) : crate? or is there something better. I m new to cljs so might not know all the goodies out there...
14:16gfrederickslocojay: I haven't heard of anything besides crate
14:16gfredericksI've used crate and it works fine
14:17locojaymaybe c2?
14:17locojayk thanks
14:17rplevylocojay: enfocus might be useful to you
14:17amalloy(also, def'ing an lvar seems to work perfectly to solve the problem i was trying to solve with dynamic bindings. thanks for the nudge)
14:19locojayrplevy : thanks will have a look
14:31nDuffIf I'm binding ClojureScript functions to events, I notice that redefinitions don't take effect (ie. the events still refer to the old versions). Is there a better approach to avoiding this than building proxy functions for event handlers?
14:34dnolennDuff: wouldn't work in Clojure either w/o passing the var.
14:34dnolenamalloy: np. glad that works for you.
14:35ohpauleeznDuff: You might want to take a look at how CLJS:One is doing their events, that might provide some insight
14:35hugodnDuff: line numbers fixed for clojure in zi-0.5.2
14:35ohpauleezYou can also avoid explicit events and use a pubsub system, as found in Shoreleave, or a binding system like some other projects have been promoting
14:47ro_stohpauleez: so i'm very keen to get stuck into cljs, and i'd love to do so with shoreleave as one of my guides. how's your demo stuff coming along?
14:47ro_stin particular, i'm interested in seeing how the remotes and pubsub stuff interact
14:48dnolenamalloy: patches to printing welcome.
14:48amalloycool. i'll put together a ticket/patch, probably this afternoon
14:48ohpauleezro_st: I just pushed the early demo to the shoreleave org - it uses SOLR, JSONP (remotes), and pubsub
14:49ohpauleezI'm going to make another demo of a pdf reading app
14:49ohpauleezthat lets you look up terms
14:49ohpauleez(the demo app also uses the google maps decode service packaged in Shoreleave's services
14:49dnolenamalloy: I agree w/ fixing pr-str behavior, but you're saying str should change as well? I use str for debugging.
14:49ohpauleez)
14:50amalloydnolen: str is probably fine
14:50ro_stooooh
14:50dnolenamalloy: k, so patches should focus on correcting oversights around pr-str.
14:50amalloyi don't see what harm putting a # in front of str would do, but i'll look into what other folks usually do for str before i patch that
14:52ro_stohpauleez: awesome!
15:18jkkrameris pushing to clojars timing out for anyone else?
15:20jkkramernevermind
15:48mmarczykdnolen: I've looked at the double doseqs in the "missing spaces" patch; I thought that's actually a pretty sane approach? I mean, at first glance it's easily avoidable at the cost of something ugly (checking a flag at each iteration to avoid 3 duplicated lines) or by introducing a macro (again, maybe not worth it?)
15:54amalloymmarczyk: mind giving me a link? sounds like it's probably an issue that doesn't need much domain-specific knowledge so maybe i have useful input
15:54mmarczykamalloy: sure, just a sec
15:54dnolenmmarczyk: seems like it would slow down printing considerably ... could be wrong about that.
15:54mmarczykamalloy: http://dev.clojure.org/jira/browse/CLJS-319
15:54cmajor7is there a clojure (wrapper?) user/ account management lib (e.g. http://bit.ly/Pfssdp, http://janrain.com/, etc.. ) you can recommend? thx
15:55mmarczykdnolen: really? hm, that's unfortunate
15:55mmarczykdnolen: it would be correct though :-P
15:55mmarczykdnolen: but yeah, that needs to be profiled
15:55ro_stcmajor7: there's github.com/cemerick/friend
15:56dnolenmmarczyk: reading / printing in CLJS has been without much consideration for perf. I think any new work even corrections should be perf conscious.
15:56dnolen"has been done"
15:56mmarczykdnolen: I'm hoping to wrap up some loose ends on cljs stuff this weekend... the new version of the bitmask patch for proto methods, splitting the :import patch into a "saner parse 'ns" patch and a separate :import patch based off that etc.
15:57mmarczykdnolen: so I'll be happy to look into the printing stuff too
15:57dnolenmmarczyk: cool!
15:57dnolenmmarczyk: thx
15:57mmarczykmight be delayed a little, but not by more then a couple days (and I'm hoping I won't be)
15:57mmarczykso anyway, I generally agree about printing perf, it needs to be inquired into
15:58mmarczykbut this could fix a bug and if we're possibly going to get a new release...
15:58amalloyit doesn't look to me like the patch at http://dev.clojure.org/jira/secure/attachment/11341/cljs-319.patch could make things any slower than they are now, did i miss something?
15:58dnolenmmarczyk: people like kovasb working on session have already into issues even when dealing with what looks like small amounts of data
15:59mmarczykdnolen: true, though kovasb was still on 1011 fairly recently (last Saturday)
15:59dnolenamalloy: extra pr-seq call, pr-seq doesn't very seem fast to me.
16:00cmajor7ro_st: "friend" looks great. thank you. started reading the docs. I see that "Individual authentication methods (e.g., form-based auth, HTTP Basic, OpenID, oAuth, etc.) are implemented as workflows in Friend". do you know how easy it is to integrate popular kids/login methods (e.g. google, twitter, etc..)
16:00mmarczykdnolen: so he should already experience a speedup just by moving to any recent version
16:00dnolenmmarczyk: oh haha
16:00ro_stcmajor7: unfortunately not. it's on my own to-do list
16:00dnolenmmarczyk: wow yeah.
16:00mmarczykincidentally, session looks soooo aaawwweeesome 8-D
16:00dnolenmmarczyk: right, he's reliant on noir cljs version
16:00dnolenmmarczyk: it does!
16:01amalloydnolen: it's the same number of runtime pr-seq calls, right? one for each object in objs. it's just that the old way did N in a single place, while the new one does 1 in one place, and N-1 in another
16:01cmajor7ro_st: I see. that's still solves a lot of man hours :) thx for the reference
16:02mmarczykdnolen: right... for which reason I'll be looking into patching noir-cljs so it's usable with fresh cljs if noone beats me to it -- anything to remove obstacles to session's progress basically :-)
16:03mmarczykdnolen: plus his talk was generally inspiring, so many things to dig into...
16:03dnolenamalloy: true, the hit is probably negligible. delaying applying that patch means that I can get a couple to look at it :)
16:03mmarczykdnolen: incidentally -- you think your talk got recorded too? I got me hopes up again a bit :-)
16:03dnolenamalloy: mmarczyk: well if you all see no obvious improvements I'll apply it.
16:04amalloyi think the hit is actually negative - it should be marginally faster now
16:04mmarczykdnolen: I'll definitely look into it again, but might not be able to before a release if it gets cut before the weekend
16:04dnolenmmarczyk: maybe, though my talk was very fast and kind of low-level :)
16:04mmarczykbut generally, yeah, I think amalloy's right
16:04mmarczykdnolen: sounds good to me :-)
16:05mmarczykwould be cooler actually to be there, but still
16:05dnolenmmarczyk: yeah, kovasb prez was great as was hearing about reducers from rhickey
16:06mmarczykdnolen: re: session's move to newer cljs, I've created cljs-334 (which I think is definitely a "no rush" thing) after talking to kovasb; dunno what the right approach is there
16:06mmarczykdnolen: yeah :-)
16:06amalloyquick, post the video so i can just play that instead of presenting on reducers myself tonight
16:06mmarczykamalloy: :-D
16:07mmarczykrhickey also talked about reducers @ EuroClojure in an extra slot (one of the other speakers couldn't make it)
16:07mmarczykwhat a great talk :-)
16:07dnolenoh cool!
16:07dnolen319 applied to master
16:08mmarczyk"we need to make it so you can make programs go faster just by buying a new computer again" (from memory, might be imprecise)
16:08mmarczykdnolen: great, thanks!
16:08mmarczykI think someone tweeted the actual quote
16:09hiredmangiving each expr -> result pair an identity ala session's loop is something I hadn't thought about before, very interesting
16:09dnolenmmarczyk: edmund jackson's core.logic presentation was very good, watched that a couple nights ago.
16:10rplevyhugod: cool, I just saw your gist link, thanks!
16:10mmarczykdnolen: it was! glad it's up, it's a great intro to core.logic
16:15lynaghkemezeske: ping
16:16emezeskelynaghk: pong
16:17lynaghkemezeske: looks like you're using hiccup in cljs a fair bit (based on github issues activity)
16:17emezeskelynaghk: I am.
16:17lynaghkhave you tried Singult out at all?
16:17emezeskeHaven't heard of it, reading...
16:18lynaghkAlso, I'd be interested to hear your thoughts on extending for convenience. I think weavejester has closed a few hiccup issues on comlpexity grounds, but I'm leaning towards a bit more sugar.
16:18emezeskeAre you shooting for pretty high compat with hiccup?
16:18lynaghke.g., the :style key in an attribute map should accept a map value.
16:19lynaghkemezeske: no, more featureful and some additional semantics that only make sense on the clientside
16:19lynaghk(e.g., the unify construct)
16:19weavejesterlynaghk: I don't think I closed that issue, but maybe I'm not remembering correctly.
16:19emezeskelynaghk: Hmm, I use hiccup a lot on the server side, am I going to be confused by switching between hiccup and singult template code?
16:19lynaghkweavejester: I was thinking of this one: https://github.com/weavejester/hiccup/pull/53
16:20ro_stweavejester! i've been struggling with org.mortbay.logger class not found exceptions when using your ring-serve library with leiningen 2 and swank-clojure. how do i resolve that issue when i encounter it?
16:20lynaghkemezeske: no, Singult should be a superset.
16:20weavejesterlynaghk: Yeah, I don't think nested data attributes are worth it.
16:20emezeskelynaghk: Oh, okay, that's what I meant by compat -- I guess forward compat is what I meant?
16:20emezeskelynaghk: As long as it's a superset, that's cool
16:20weavejesterlynaghk: Especially if you then use a map for stylesheets
16:21lynaghkweavejester: special handling of stylesheets is something you don't want in Hiccup?
16:21lynaghkweavejester: (er, the :style attribute)
16:22weavejesterro_st: I haven't tested ring-serve with Lein2. I'm deprecating the library as soon as I can replace it with ring-server
16:22ro_stah :-) thank you
16:22weavejesterlynaghk: Special handling of stylesheets is a possibility, but if you have that *and* embedded data maps, you lose consistency
16:23lynaghkweavejester: how do you mean?
16:23weavejesterlynaghk: e.g. {:data {:url "foo"}} = {:data-url "foo"}, but {:style {:color "red"}} != {:style-color "red"}
16:24ro_stgah. so much to learn
16:24lynaghkweavejester: yeah, but that's just a reflecting of the underlying semantics of the browser
16:25weavejesterro_st: I'll try and get ring-serve an equivalent working with Lein2
16:25ro_sti could just use ring-server instead?
16:25weavejesterlynaghk: It's not really anything to do with th browser; it's sugar that depends on the attribute name, which feels complex.
16:26ro_sti just want to easily be able to start up ring from inside my emacs repl. ring-serve seemed to be the way to do it
16:26lynaghkemezeske, weavejester: My philosophy for Singult is that you should be able to represent all view state using real data structures. Since things like styles or properties (checked/unchecked) are part of the view, they should get first class representation in the data structure so you don't have to always be munging strings or whatever.
16:27weavejesterro_st: Yep. So I planned on replacing ring-serve with a more complete library. ring-server has a standalone Ring adapter runner, and one designed to be run by Lein. I'm also going to add one for REPL/Swank usage, but I haven't done that yet.
16:27lynaghkweavejester: yeah, I'm not saying it should be in Hiccup---I take it there are folks using Hiccup to do rendering of other XML things where you don't want to be caring about attribute names at all. Singult is targeting a different, more specific use case.
16:27emezeskelynaghk: So no more [:blah {:style "a bunch of text here"}] ?
16:27weavejesterro_st: Usually, "lein ring server" is sufficient for me so far, as it reloads source files automatically.
16:27lynaghkyeah. C2 has had special style handling since the beginning. It makes a lot more sense (to me) to say [:div {:style {:width (my-fn ...) :background-color (another-fn ...)}]
16:28emezeskelynaghk: that is tasty!
16:28ro_stweavejester: if i use lein ring server, then how do i repl into that process?
16:28lynaghklikewise, {:properties {:checked? true}} for checkboxes. I'm also thinking about having :class accept sets
16:28lynaghksince that's semantically what classes are about anyway.
16:28emezeskenice.
16:29emezeskewell, I will definitely try switching my project to singult as an experiment
16:29weavejesterro_st: You can't, so it isn't as good, but sometimes it's good enough. :)
16:29emezeskeduring my next library-investigation phase :)
16:30lynaghkMy only concern is that it'll be tricker to share the same view code between the client and the server (e.g., render visualizations using hiccup). Then again, since the whole idea is that it's just data structures I guess I just need to write something to walk the element and flatten out all of the sugar.
16:30ro_stweavejester: ah :-) ok. i'll stick to the in-repl way then because i use midje-mode to code and the browser to verify and test from the client-side codebase (which isn't clojure or clojurescript based)
16:30lynaghkemezeske: definitely let me know if you run into any issues or have suggestions/concerns with sugar syntax.
16:31weavejesterlynaghk: Maybe you just need a "macro-expand" equivalent that turns a data structure into pure Hiccup.
16:31emezeskelynaghk: Will do. Thanks for the heads up about singult!
16:32lynaghkweavejester: yeah, that's basically what it would be. Treating data as data is just so nice...
16:32weavejesterlynaghk: That sounds like a good idea, then :)
16:32lynaghkemezeske: sure thing; I'm all about self-promotion, bro =P
16:32ro_sthow did all you clever chaps survive before clojure came along? :-)
16:33rplevyhugod: this is neat, just to see another example of cemerick/friend in use. what I am working on right now is figuring out a good solution for the "authentication server" side of the oauth transaction.
16:33weavejesterro_st: I'll try and get a ring.server.repl namespace up soon as a better replacement for ring-serve.
16:34ro_stthat'd rock :-)
16:34ro_stright now i have the (use 'ring.util.serve) and (start app 8080) in a (comment) in my main clj file which i just C-x C-e when i want a server up
16:35ro_strplevy: what example is that? i'm about to dive into friend, some example code would be most welcome
16:36rplevyro_st: hugod posted a gist link earlier, it was https://gist.github.com/2839891
16:36hugodrplevy: ah, misinterpreted what you were looking for...
16:36photexhello all, attempting to switch to leiningen 2.x
16:36photexexpected trouble, but I'm not sure how to debug a couple of issues
16:37photexfor starters, I'm not able to jack in, and when trying to 'lein search' it couldn't download the repo from clojars
16:37weavejesterro_st: Yeah, I was going to pull that into "ring-server". It would work the same way, but it would be consoladated with all the other server-starting code used by lein-ring and such.
16:37photexnot sure if these issues are related, because when trying to jack in, the error is that the artifact for lein-swank 1.4.4 couldn't be found
16:38ro_stweavejester: awesome. i'm watching both ring-serve and ring-server now
16:38photexoh snap, sorry, I meant to report this on #leiningen
16:38weavejesterphotex: Do you have lein-swank as a plugin in your profile.clj?
16:38photexI do
16:39photexok
16:40photexI just noticed that I hadn't removed 'swank-clojure' from profiles.clj
16:40photexso jack-in works!
16:40photexsearch does not though
16:40photexI'll move that to #leiningen
16:40rplevycurious if anyone who has used pelle/clauth knows if timestamp / nonce to prevent replay is implemented, or how that would be implemented. I don't see anything obvious in the source.
16:44rplevyactually I bet the "Expirable" stuff deals with this, need to read the code in more detail
16:54CheironHi, properly this is a stupid question but how to create a bitmap in clj?
17:00rimskyCheiron: you can create an image with (BufferedImage. 100 100 BufferedImage/TYPE_INT_ARGB)
17:02CheironI mean http://en.wikipedia.org/wiki/Bit_array , my bad
17:04gfredericksthe multi-arity version of <= is quite useful for testing sorts
17:05gfrederickselse you'd have to (every? #(<= (first %) (second %)) (partition 2 supposedly-sorted)) which is stupid
17:05rimskyCheiron: oh, no idea then :-)
17:06Cheironnp. appreciate your help :)
17:13cljs_newb_24598anyone know if apple is goign to release a future 17" laptop?
17:14cljs_newb_24598not sure if I want to buy an existing model .... or wait until a retina 17"
17:16brehautnobody *knows* anything about apples future releases, best you'll get is an educated guess
17:16cljs_newb_24598where can i get these educated guesses?
17:16brehautgruber et al
17:19brehauti think the summary is that the 17" MBP is one of the lowest volume units apple sell, lower even than the Mac Pro. The mac pro is getting an unspecified update in the coming year, so maybe they'll do something for the 17" too.
17:19brehautIf the 17" does get a retina screen it will probably be the very last mac to do so though
17:21amalloy/part #mac-rumors
17:21brehauthah sorry
17:22mich2so
17:23mich2so last time i needed to get a REPL runing on my mac , there where a lot of suggestions but finally this one worked for me: https://github.com/arthuredelstein/clooj
17:29yonataneIs there in clojure the ml style dispatching according to argument value?
17:30brehautyonatane: thats coming in core.match but its not ready for use just yet
17:31yonatanewill it just be part of defn?
17:31brehautno
17:31yonataneeventually, let's say?
17:31yonataneoh
17:32cgagisn't that what multimethods do?
17:32brehautnot quite
17:32brehautmultimethods are open for extension
17:33brehautml style algebraic type based pattern matching is resolved at compile time
17:35brehautand also allows for easier arbitrary destructuring in the match clause
17:37yonataneis there another way right now to avoid (if) for detecting stop conditions etc.?
17:39brehauti believe the answer is yes, but you'd probably need to be more specific about what you are trying to do for someone to give you a useful suggestiion
17:40nDuffyonatane: Do you mean error handling? Clojure *does* support exceptions.
17:41yonatanean example would be to handle an empty string one way and do some other thing if it's not empty, but not bothering the caller about it, and not using if.
17:42dnolenyonatane: not really, sounds like you want pattern matching. core.match mostly works if you're not doing anything serious. fns will never probably never get official pattern matching sugar, but easy to make work w/ core.match.
17:42zakwilsonI love it when I check to see if a project is stil active and see that the last commit is 8 minutes ago.
17:42xclitezakwilson: usually a reassuring feeling, I agree
17:43dnolenyonatane: predicate dispatch would get you everything that pattern matching does + open extension - but it's challenging to implement well.
17:43amalloypossibly worse: there's a commit every 8 minutes, and each one has the word "fix" in the commit message
17:43nDuffyonatane: "not using if" meaning _you_ not using if, or _the caller_ not using if?
17:43nDuffyonatane: ...I mean, you could certainly write a macro that implicitly wraps things in output checks and throws exceptions, or somesuch.
17:43yonatanenDuff: me not using if
17:44zakwilsonamalloy: it was actually "beta7", and you probably know what project I'm talking about now.
17:44amalloyhah
17:44yonatanenDuff: and of course the user shouldn't
17:44nDuffyonatane: ...but _the macro_ would be implicitly adding a conditional... I mean, *something* has to.
17:44amalloyzakwilson: i was at once hoping and worrying you might mean me
17:44nDuffyonatane: even Clojure's "and" and "or" macros turn into uses of "if"; it's not really something you can (or should try to!) get away from.
17:44amalloybecause i totally just pushed a rebased version on top of beta7 on account of forgetting something and figuring nobody ever uses it
17:44zakwilsonamalloy: heh. I have no idea at this point whether I should actually use jiraph, but it's nice to know it's active.
17:45hansengelHi, is there any way I can override the vals function for a record? From what
17:45hansengelI see the function is declared in RT.java rather than an interface
17:46amalloyhansengel: no. records are maps, and if you don't want their map-like behavior you have to use something else
17:47yonatanenDuff: Sure. I don't mind hiding it once in a macro
17:48amalloyzakwilson: jiraph is likely to be active for the forseeable future. it's an important part of the company's core product, so whenever we need new low-level features we open up jiraph
17:48yonatanednolen: by predicate dispatch you mean multimethods or what core.match does?
17:48hansengelamalloy: Okay, I think I'll try something with defmulti. Thanks.
17:49dnolenyonatane: multimethods are multimethods - not predicate dispatch.
17:49dnolenyonatane: core.match uses a OCaml algorithm to do ML style pattern matching, but the goal is to get predicate dispatch - think pattern matching + multimethods.
17:50zakwilsonamalloy: cool. What should I read to get an idea of whether it's appropriate for my project?
17:52rplevyis clauth the only lib implementing the authentication server side of the OAuth2 spec or am I just not finding the other one(s)?
17:53amalloyzakwilson: ninjudd sez: it's probably not useful for you unless you want to get involved at a development level and read the source - we haven't written a ton of documentation for it because it keeps changing
17:54ivaraasenamalloy: I read some of the jiraph code yesterday. great learning experience
17:55zakwilsonamalloy: I did a little of that a year ago, but didn't keep up with it because I didn't have something to use it for.
17:55amalloyit has pretty good docstrings, but no sort of "guiding README"
17:55zakwilsonamalloy: I suppose I'll read some source.
17:56amalloyhit us up in #flatland if you have questions
17:56ninjuddamalloy is going to write an amazing README eventually if someone else doesn't beat him to it
17:56amalloyi've only been working on it for a year, man. READMEs take at least a decade to simmer
17:56brehaut"RTFS"
17:56zakwilsonOh, I'm not in #flatland. I used to be, I think.
17:56brehautdone
17:57amalloybrehaut: "If you're reading this file, you're not hardcore enough to use this library"
17:57ninjuddif you notice, the current README is very old. "The easiest way to use Jiraph in your project is via Cake."
17:57zakwilsonYeah, I thought cake was dead.
17:57ninjuddit is
17:57brehautamalloy: lol
17:57amalloyunlike clojure/core, jiraph welcomes pull requests! someone fix that readme!
17:58ivaraasendidn't cake and leiningen merge?
17:58ninjuddnot quite merge
17:58rplevycompletely unrelated question: do you think it is helpful or annoying to issue a pull request that fixes whitespace, badly formatted parens, replace 'use's with 'require', move demo code to test path etc? these things are somewhat well established conventions and would probably be good for any lib in my opinion...
17:59ninjuddmore like cake was eaten by lein
17:59gerunddevAny chance someone currently in here attends the Seattle seajure group?
17:59zakwilsonHelpful, unless they ignore you the first couple times you do it. Then it becomes annoying.
17:59rplevyzakwilson: :)
17:59Raynestechnomancy: Yo
18:00ToxicFrogrplevy: I would consider it helpful
18:01Rayneszakwilson: I actually just upgraded jiraph to lein2 like an hour ago.
18:01RaynesSo we're definitely phasing cake out.
18:02RaynesIt has been hard because we have lots of other things to do and, well, cake works even if we don't maintain it anymore so it was hard to get motivation.
18:02rplevyToxicFrog: then I will do this for clauth because it looks to be useful, just very messy
18:02ToxicFrogHow hard is lein to use? Is it something I could reasonably use for a small command line project, or is it more like ant/maven where it's really meant to be the backend for an IDE and not something the user ever touches directly?
18:02amalloyrplevy: if my repos had any bad whitespace or paren errors i would appreciate a pull. if you turned use into require i'd decline the pull request
18:03rplevyamalloy: heh :)
18:03wmealinglein is easy imho
18:03amalloygerunddev: i'm willing to bet technomancy does
18:03arrdem+1 to lein being easy
18:03Raynesamalloy: That's why I pingeded him.
18:03dnolenToxicFrog: it's easy and will save you lots of time.
18:03RaynesLeiningen is the easiest build tool since build tools were invented by technomancy back in '06
18:04wmealingand has awesome plugins for when you need to do odd things
18:04rplevyI thought the persistent jvm in cake was nice (I didn't use cake, but I liked the idea), is that somehow finding its way int lein?
18:05amalloyrplevy: it was nicer in theory than in practice anyway
18:05zakwilsonYou should use lein for any Clojure project. It's almost always easier to use it than not use it.
18:05gerunddevamalloy: Thanks, has he been active recently?
18:05amalloyhe never sleeps
18:05hiredmantechnomancy generally leads the meetings
18:06Raynesrplevy: The hope is that jark would be suitable for integration with lein.
18:06ToxicFrogdnolen: I'll give it a shot for my next project, then!
18:07Raynesrplevy: As a user and developer of cake, I'm not the least bit interested in seeing any persistent JVM stuff in lein. My coworkers might feel differently, but it caused me nothing but issues when we used cake.
18:07hiredmangerunddev: I attend sporadically (will be missing today's)
18:07rplevyRaynes: oh right, and I guess no lein interactive mode in lein 2 either
18:07Raynesrplevy: technomancy has said that if we ever do actually get jark or something, it'd be optional and off by default which I would support.
18:07rplevyI just happenned to notice it was missing the other day
18:07gerunddevhiredman: I was hoping to confirm time / place and see if I needed to bring anything.
18:08rplevyRaynes: I guess they could use nailgun, jark would probably be better
18:08hiredmangerunddev: technomancy sent a message to the seajure mailing list yesterday or the day before
18:09hiredmanhttps://groups.google.com/forum/?fromgroups#!forum/seajure
18:09amalloyis today the SF meetup too? i don't know how all the west coast folks happened to settle on first thursday of the month
18:10brehautits the hamilton meetup today. im having a coffee myself
18:10hiredmangerunddev: I am not sure what he has planned, but generally you don't need to bring anything, maybe your laptop?
18:10gerunddevhiredman: perfect, thanks for the info!
18:10solussd_how can i "hold on" to all the current dynamic bindings when a lazy-cat's second arg is using (some) of them?
18:12dnolensolussd_: lazy seqs & dyn binding don't really work well together.
18:12solussd_im seeing that. :) i'm lazily generating ranges of revisions from a call out to the 'git' command, but I need to carry the binding of *sh-dir* with me
18:13amalloy&(doc bound-fn)
18:13lazybot⇒ "Macro ([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
18:18ivaraasenlife is pretty good right now. just me, Emacs, nicotine and some fresh coffee
18:20rplevyamalloy, Raynes, ninjudd: I've been sticking some bits of code into this lib https://github.com/drakerlabs/mostly-useful if you see anything you want to add to useful, let me know
18:20rplevyor just do it
18:20rplevyor let me know and I will open a pull request
18:20rplevyprobably nothing you want though
18:22amalloyrplevy: we already have within; it's called returning
18:22amalloyalso your docstring is a little misleading, because you say "first" in both places
18:22rplevyoh cool, I will get rid of that one
18:23rplevynot saying within is a great name but isn't "returning" a little non-lispish in its terminology?
18:23amalloyif you mean it's not specifically named prog1, then yes
18:23rplevyhaha
18:24amalloybut c'mon, (returning (the-result) (do some side effects)) - so self-documenting
18:24rplevyI guess I tend to think of consuming/producing or "evaluating to" but I guess we all know what return means when we hear it
18:25rplevyit's maybe too pedantic to avoid that word
18:25ToxicFrogI can't find (returning) in the API index?
18:25rplevyToxicFrog: it's in flatland/useful
18:26ToxicFrogAah.
18:26hiredmando1!
18:26amalloysay, what does scheme call it? does it exist?
18:26hiredmanhttp://www.cs.utexas.edu/~novak/schemevscl.html
18:27amalloyso, no?
18:27hiredmanmay depend on the scheme?
18:32nelson-good night everyone! I'm having a little issue with emacs and clojure and I am hoping you guys can help me
18:33nelson-everytime I use C-x C-e to eval an expression and that expression has some kind of error, my emacs crashes for a while and starts filling with sldb buffers
18:34nelson-I'm using emacs-prelude with clojure-mode and lein-swank
18:38solussd_amalloy: this pretty much goes through my entire thinking process… and ended with an elegant solution. :) I now have a bound-lazy-cat (most awesome name ever for a function!) thread-
18:38solussd_amalloy: http://kotka.de/blog/2009/11/Taming_the_Bound_Seq.html
18:42taufiqreading bytes from an array and converting to numbers - am I better sectioning off this functionality and doing it in java?
18:44hiredmantaufiq: wrapping the array in a ByteBuffer makes that easy if that is what you are looking for
18:45taufiqcould be, thanks hiredman
18:46taufiqi have a crude implementation in clojure, but i'm calling it in a tight loop and performance is underwhelming
18:47CheironHi, would you please have a look at: http://pastie.org/4207040 I'm look for the last destructuring
18:48Cheironwhat is the destruc of target-data should be?
18:57RaynesAnyone here that uses middle click paste and hates things that it doesn't work with?
18:59CheironRaynes: Thanks God you are hear. If you have a couple of seconds, would you please check my question?
18:59Cheiron*here
18:59RaynesHahahaha
18:59RaynesI've never had someone so happy to see me.
18:59Cheironwell, I'm :)
19:00Cheironkindly if you can help to destruct the last map http://pastie.org/4207040
19:00brehautCheiron: using symbols as map keys is a bit quirky. if you used :keywords, you wouldnt need to quote the map
19:00CheironI will switch to keywords, it is experiment now
19:01CheironI can't figure out how to destruct target-data
19:01brehaut{:keys [hits duration]}
19:02brehaut(once you switch to keywords. currently its {:syms [hits duration]} i think)
19:02Raynes&(let [{:syms [foo]} {'foo 0}] foo)
19:02lazybot⇒ 0
19:02Cheiron:syms isn't working , i'm getting nil
19:03hiredmanbecause you went too deep
19:03wmealinginception.
19:04hiredmanreplace target-data in [target-id target-data] with the destructure
19:04Rayneswmealing: Hahaha
19:05Cheironhiredman: replace it with {:syms [hits duration]} ?
19:05hiredmansure
19:06nDuff...bizarre... cljs.core.PersistentHashSet.fromArray isn't present in my ClojureScript REPL...
19:06nDuff(compiled with optimizations turned all the way off)
19:08Cheirondestructuring has performance penalties?
19:08hiredmancompared to what?
19:09wmealingnot having to destructure
19:09CheironI don't know really, just a question popped out of my head
19:10brehautdestructurings get compiled down to the same code to you would have written by hand
19:10hiredmanwmealing: you don't have to
19:10CheironOh, impressive!!
19:10hiredmanbrehaut: that is not strictly speaking true
19:11hiredmanthey get compiled to the most generic code you would write by hand
19:11brehautright
19:11Cheironit is working now!! thank you all . truly Inception xD
19:11hiredmanwhich in theory can be made faster, and in some cases the faster case is what you will most likely write by hand (:foo x) vs. (get x :foo) etc
19:12hiredmanif x is a record (:foo x) will be faster
19:12brehautah of course
19:12hiredmanbut it is all sort of corner case details
19:13brehauthiredman: would .foo be faster again for records?
19:13hiredmanI think it would only be noticeably faster if x was type hinted
19:13brehautthat makes sense
19:13brehautthanks
19:14hiredmanwithout the type hints :foo may end up being faster, because :foo has an ic, but .foo does not
19:14Cheironhow do you know all of this? :/
19:14brehautsorry, IC ?
19:14hiredmaninline cache
19:14brehautah of course
19:14hiredmanI read the compiler
19:14Cheiron:'|
19:15hiredman(and I have a branch somewhere that adds an inline cache for reflection)
19:17amalloylast time i tested this, (:foo record) was several hundred times faster than (.foo record), and (.foo ^Myrec record) was like 50% faster than (:foo record)
19:21hiredmanclojure/core seems to range from 0 interest for speeding up reflective calls to being actively hostile to it
19:23Cheiron"if x is a record (:foo x) will be faster" records lookup is faster than maps lookup?
19:23hiredmanif :foo is a field in the record
19:24wmealingamalloy, to a newbie like myself.. isnt one a keyword lookup and the other a class function ?
19:24hiredmanturns into jvm classfield access
19:25wmealingthe latter, ^ ... i dont know what that is.
19:25wmealingdynamic ?
19:25wmealingmetadata.. *thinks*
19:28ToxicFrogIf (.foo record) compiles into classfield access, I'd expect that to be quite fast
19:29hiredmanit will be reflective access unless the the record is type hinted
19:29ToxicFrogAah.
19:29ToxicFrogIt'd be nice if we could get some type inference going.
19:29hiredmanfor (:foo a-record) the compiler actually generates a little cache at the call site
19:30brehautthere is some type inference going on i think?
19:30amalloyToxicFrog: that already exists...?
19:30hiredmanto turn it in to a non-reflective (:foo a-record)
19:30brehautjust not as pervasive as HM
19:30hiredmaner
19:30ToxicFrogOh.
19:30hiredman(.foo a-record)
19:30ToxicFrogMore type inference, then~
19:30hiredmanand hopefully the jvm will inline the cache away
19:30amalloyit sounds like you might intend "type inference" to mean "guess what i'm thinking"
19:30clojurebotdeftype is see datatype
19:31brehaut~datatype
19:31clojurebotdatatype is see datatypes
19:31brehaut~datatypes
19:31clojurebothttp://www.assembla.com/wiki/show/clojure/Datatypes
19:31lazybotAssembla is deprecated. Use http://dev.clojure.org
19:31hiredman"guess what I am thinking" is the whole point of the inline cache at the callsite
19:31brehautwell thats a rat hole
19:32ToxicFrogamalloy: well, the impression I get from this discussion is that you'd need to ^tag every access site, you couldn't just ^tag a let surrounding the accesses
19:32amalloyi'm not sure what makes you think that
19:32amalloyit's certainly not true
19:32hiredmanor why you would tag instead of using :foo
19:33amalloyi think it's fine to use tags specifically in auto-generated code, but if you're writing it by hand hiredman is right that :foo is better. less visual noise, very little slowdown, and no chance of accidentally going really slow if you mess up the tag
19:34hiredmanand you should know what needs to be fast in your code and what doesn't, profile what needs to be fast, and based on that tune it to be fast
19:36hiredmanwhich in many cases is about the algorithmic complexity, allocation, and i/o patterns
19:37brehaut~scale
19:37clojurebotExcuse me?
19:38hiredmanif you're calling .getBytes on large strings in a tight loop, you're gonna have a bad time
19:45Cheiron"if you're calling .getBytes on large strings in a tight loop, you're gonna have a bad time" why?
19:46hiredmanstrings are immutable, .getBytes returns a mutable byte array, so a copy must be made
19:48Cheironeye c
19:52amalloytechnomancy: was there something wrong with clojars? it was acting like https://gist.github.com/b57c1ae0cf5e96f2c9ee for a few minutes, although now it seems to be fine
19:53amalloyoh, i see. i gave scp a bad filename, which...somehow caused it to send a message that the clojars scp daemon didn't understand?
19:55lpetitLook ma, textmate-style completion in Counterclockwise: http://t.co/LfTlP7zW , http://t.co/mphFqixS , http://t.co/9tOcVaIp !!
19:56FrozenlockIs the version we input in the project.clj ("1.0.0") available as a variable inside the other clj files?
19:56S11001001Frozenlock: yep
19:56S11001001Frozenlock: as a system property
19:56FrozenlockTell me more :)
19:57RaynesAny Clojurians with easy access to a development environment on Windows want to help me out with something Windows-specific?
19:58augustlthink I'll use mongodb instead of datomic.. The documentation for datomic is sparse, and it's 0.1 after all.
19:58augustl</randomobservation>
19:59hiredmandatomic hasn't had any headline grabbing horror stories...
19:59RaynesActually, never mind. brehaut just reminded me I don't care about Windows.
20:00taliosbrehaut++
20:01hiredmanhttps://twitter.com/hiredman_/status/218742772713267200
20:02hiredmanoh gawd, so good
20:02nDuffWhy doesn't the following return an empty set? (let [test (atom #{:a :b})] (swap! test disj @test) @test)
20:03arohnerdisj takes single values?
20:03FrozenlockS11001001: Got it, (System/getProperty "my-project-name.version") . Thanks!
20:03nDuffarohner: Doesn't swap have an implicit apply? ...ahh.
20:03augustlhiredman: haha
20:04arohner,(let [test (atom #{:a :b})] (swap! test #(apply disj % @test)) @test)
20:04clojurebot#{}
20:06brehaut,(use 'clojure.set) (let [t (atom #{:a :b})] (swap! t difference @t) @t)
20:06clojurebotnil
20:06brehaut,(do (use 'clojure.set) (let [t (atom #{:a :b})] (swap! t difference @t) @t))
20:06clojurebot#{}
20:15augustlisn't there a CLR version of Clojure? I recall hearing about that.
20:16augustljust found https://github.com/clojure/clojure-clr ;)
20:46FrozenlockHmm... When I uberjar one of my projects, System/getProperty seems to return nil as the project version. Normal?
20:48amalloydnolen: i'm poking around at my lvar patch. do you actually use str for debugging, or do you use pr-str (eg, by just evaluating it at the repl)? my dilemma is whether to make pr-str human-friendly, eg #<lvar:x_113>, or re-readable, eg #clojure.core.logic.LVar["x_113" 113701324 nil {:name x}]. the latter seems better if re-reading makes sense for lvars, and if you don't need that to look nice for your debugging style
20:49dnolenamalloy: I thought the point of pr-str was to re-readable
20:49dnolenamalloy: I use println + str for debugging
20:50amalloywelllll, pr-str should be readable, but it's okay to use #<...> to indicate "i don't intend this to be readable". for example ##(pr-str (java.util.ArrayList. [1 2 3]))
20:50lazybot⇒ "#<ArrayList [1, 2, 3]>"
20:50S11001001Frozenlock: that lein thing is not part of java, you don't get to keep it
20:51amalloyif you think reading lvars makes sense, i'll make them readable
20:51S11001001check your jar for a manifest file; it may contain the version
20:52FrozenlockS11001001: Can I simply use a macro for this? I think they evaluate at compile time...
20:52S11001001Frozenlock: you can, but if it breaks, you get to keep both pieces
20:52S11001001in other words, drop word "simply"
20:54dnolenamalloy: I don't see the problem ... but I should probably think about it some more.
20:55amalloyyeah, it seems to me like it's probably correct to be able to read them, but i haven't used them much and they seemed like they might be "internal" or "stateful" in some way
20:57nDuffShould dynamic bindings for functions work in clojurescript?
20:57dnolennDuff: it should.
20:58nDuffHmm.
21:00amalloydnolen: do you want a jira ticket with a patch, or a new branch in the core.logic repo, or...?
21:01dnolenamalloy: jira ticket, thx
21:01dnolenamalloy: I only really use branches for big changes, or changes that will take some serious free time to assess
21:04nDuffHmm; looks like what I'm seeing is a usage issue; doesn't work as I expect with upstream clojure either.
21:06amalloydnolen: looks like lvars aren't value-comparable with = at the moment; would you like me to add that as well? i found out when attempting to test that (= lv (read-string (pr-str lv)))
21:07dnolenamalloy: hmm, you can't compare lvars
21:08amalloyactually, it looks like you tried to implement .equals but did it in an inconsistent way
21:09dnolenamalloy: equals I think works the way it does after some consideration.
21:10amalloydnolen: you're asserting that x's name is identical? to y's name, which will only happen if x is identical to y; you might as well just use that identical test if that's the goal
21:10dnolenamalloy: no
21:10amalloyno, that's not true
21:10amalloyi'm curious why identical? rather than =, then, i suppose
21:10dnolenamalloy: yeah I thought about the possibily of reading.
21:11dnolenamalloy: just perf conscious I guess.
21:11Raynesdnolen: I think you should rename conso to gonzo. Sounds the same, but looks cooler.
21:11amalloy= short-circuits pretty fast if they are identical
21:11dnolenRaynes: noted ;)
21:12dnolenamalloy: maybe, but this is also used in hash lookups too.
21:12amalloy*nod*
21:12amalloyso you'd like me to leave .equals alone, and make some different assertion in the test?
21:13dnolenamalloy: don't this so that test should work.
21:13amalloy?
21:15dnolenamalloy: should probably just remove the print-method in this case ... since deftype have a default print rep that works.
21:15amalloydnolen: LVars are created like (LVar. (str foo bar) ...), so their names are not interned. when you read from a string, the strings that get returned are interned, so they're not identical? to the original object
21:16dnolenamalloy: so another argument for =
21:16amalloyand no, deftypes don't have a default print rep; that's only defrecords
21:17amalloyor rather, the default rep for deftypes isn't readable; it's #<LVar (str lv)>
21:17dnolenamalloy: sorry I'm a bit deep in some other core.logic stuff, can you open the ticket with the patch you have with these notes?
21:17amalloyokay
21:18dnolenamalloy: thx mch
21:21amalloyhttp://dev.clojure.org/jira/browse/LOGIC-43 opened, speculative patch attached
21:22dnolenamalloy: excellent
21:38gfredericksI just mashed together an undocumented lib called vcr-clj; was it a bad idea?
21:38gfredericksit's like the ruby lib, but without hardly any features
21:39wingywell documented libs are never a bad idea
21:46mdeboardWhat's the latest version of SLIME that is operable with clojure-mode? I'm having some interop issues between SLIME 20100404 and swank-js/slime-js
21:55scottjmdeboard: I don't think there's a version that works with swank-js and swank-clojure
21:56mdeboardscottj: Yeah I don't think so either. swank-js requires SLIME 2011112 or later, apparently. :\
21:56mdeboardwhat a shame
21:59zakwilsonSomebody should fix that.
22:00mdeboardYeah but in what direction do you fix :P
22:00zakwilsonUpdate swank-clojure to work with newer SLIME.
22:01mdeboardAh
22:01zakwilsonThe default should almost always be supporting new stuff.
22:01mdeboardThat would be smart because apparently package.el is maintaining 20100404 because of clojure-mode interop
22:02Rayneszakwilson: Convince the SLIME people to make real releases.
22:03brehautCVS isnt real releases?
22:03zakwilsonRaynes: I don't think they're going to do that, especially not to support Clojure.
22:03RaynesWhat does it have to do with Clojure?
22:04RaynesIt has to do with not being completely insane and making your software impossible to follow.
22:05zakwilsonOld-time CL people seem to be hard to sell on any new Lisp. SLIME works for its creators, so why should they want to improve?
22:06RaynesIsn't that the mindset I'm arguing?
22:06mdeboardWhat's blocking the road to updating swank-clojure?
22:06zakwilsonActually, SLIME issues have kept me from using CL much as it was too annoying to have working CL and clj at the same time.
22:06mdeboardWell, in a way this is somewhat a relief to hear because it means I'm not an idiot.
22:07zakwilsonAnyway, regardless of who's *right*, updating swank-clojure to work with newer SLIME seems like the only workable path forward.
22:07madsyApropos clj, how can I access properties from javascript objects?
22:07madsyfoo.bar can be a constant
22:08zakwilsonPerhaps lighttable will eventually save the day.
22:08madsy(. foo bar) is obviously a function call.
22:08brehaut(-foo bar)
22:09kovasbanyone tried using CCW lately?
22:09kovasbI haven't played with it in a long time but it seems to be getting new releases
22:09alandipertkovasb: i have. nice presentation re: mathematica btw!
22:09kovasbthanks!
22:09lynaghkkovasb: yeah dude, it was boss.
22:09kovasb:)
22:10kovasbits all about traveling to foreign computation lands and bringing stuff back
22:10alandipertkovasb: but yeah, it's updated pretty regularly. i have been using it to get people started at clojure training and it's been working well
22:10lynaghkI'm still pissed at my collegate self for not recognizing wtf was going on in Mathematica. Funny story though, writing a symbolic algebra system in Common LISP was my first large programming project. 90% motivated by Mathematica's terrible TeX output.
22:10alandipertkovasb: i'm too far gone in emacs land to ever want to switch to it, but as clojure IDEs go, it's pretty nice
22:11kovasbalandipert: cool. Im ok with emacs, but I just don't like the text editor (paredit aside)
22:11kovasbalandipert: just the way text selection works and stuff.. annoying
22:11brehautmadsy: sorry (.-foo bar)
22:11kovasblynaghk: thats a funny connection
22:11lynaghkalandipert: that seems to be a big problem. I've been too-far-gone in emacs to ever really think deeply about alternative IDEs/REPL environments (save YMacs, which is emacs in JavaScript).
22:11kovasblynaghk: most people think mathematica is a big calculator, so its understandable
22:12kovasblynaghk: I'm sure the instructors themselves had no idea
22:12lynaghkkovasb: yeah. Parsing symbolic algebra really hit home that whole "code is data" thing.
22:12kovasblynaghk: its also pretty nice to not have to quote symbols all the time
22:12alandiperti've been really obsessed with structural editors and storing code in datomic for awhile, but have nothing to show
22:12alandipertpart of my "data all the things" learning clj spiral
22:13zakwilsonI have not used datomic at all.
22:13lynaghkalandipert: I take it you saw that Microsoft research video from the 90's that twittered around a few weeks back?
22:13alandipertif i switched, it would be to something like that (or to whatever kovasb has cooking)
22:13kovasbI'm definitely keen on storing code in datomic as well
22:13kovasbhave yet to find time to play with datomic tho
22:13alandipertlynaghk: yeah
22:14zakwilsonIt seems like a cool idea, but I'm not sold on database-as-a-service.
22:14kovasbalandipert: https://github.com/jonase/scape
22:14alandipertkovasb: excellent!
22:14kovasbzakwilson: i'm not sold on database not as as service :)
22:15lynaghkalandipert: a lot of that stuff was over my head, but even on the parts I could grasp all I want is a semantics-aware git.
22:15kovasbzakwilson: one of the comforting things about datomic is that it won't overwrite data.. fewer ways to bork yourself
22:15zakwilsonkovasb: I'm not sold on a database.
22:15kovasblol
22:15zakwilsonSeriously. I hate everything.
22:15alandipertkovasb: me neither, but in my lifetime i want to work in an environment that doesn't involve files with strings
22:16alandipertkovasb: i suppose i could just switch to mathematica ;-)
22:16zakwilsonI think what I want is something like Mongo without the part where it sucks.
22:16kovasbalandipert: but it is its own platform!
22:16kovasb:0
22:16alandipertzakwilson: lol
22:16kovasbalandipert: mathematica is file based as well, which leads to problems
22:16zakwilsonMongo ate my data.
22:16kovasbalandipert: like, 100 mb files which are impossible to open
22:16alandipertmy dream is code in time-aware databases everywhere, stored as data and queryable, with a structural editor
22:16lynaghkkovasb: like powerpoint, but with more maths.
22:17kovasbalandipert: in session we will have references to s3 buckets etc for embedding data
22:17alandipert"clippy: that function you wrote is a 43% structural match for somethin in core.match, shall i substitute what you type with it and run your tests? [y/n]"
22:18kovasblynaghk: right. in mathematica you can open up the file and try to fix the syntax error/corruption at least, though I've cursed like hell during the entire operation it would work
22:18lynaghkalandipert: core.logic + generative testing and your program writes itself.
22:18kovasbalandipert: doable
22:18zakwilsonHaskell has a search-by-type-signature service.
22:18alandipertwell, i don't want this system to take my job... but it should be pretty good ;-)
22:19kovasbzakwilson: is it integrated into editors?
22:19alandipertkovasb: i think so too. also once we store code as real data, we can have lower-level dependencies. expressions or definitinos instead of files
22:19kovasbwe need a big datomic database of all the analyzed clojure code on github
22:19kovasbyup
22:20kovasbits also interesting to think of selling commercial packages in the same way
22:20kovasblike, the equivalent of adwords for function suggestions
22:20alandipertyeah
22:20kovasbonce you have an editor that understands pieces of your program
22:20kovasbother people can write services against that
22:20alandipert"your code would be 34% faster if you buy this lib from the lib store"
22:20kovasbexactly
22:20alandipertinteresting
22:21alandiperta cottage industry of clojure expression writing. like getting paid to 4clojure!
22:21kovasbor in a cloud based setting, literally execute the code for you
22:21lynaghkkovasb: I take it you've played around a bit with kibit? I've been thinking for a while of just doing statistical analysis of Clojure code on github as a kind of linter. E.g., look at histograms of forms-per-fn or form-depth between projects.
22:21kovasblynaghk: i haven't yet
22:21kovasblynaghk: I'm basically refusing to do data analysis until i can do it in session
22:21alandipertlynaghk: i've had similar thoughts around scanning for idioms, like something that identified the relationship between update-in and fnil
22:23lynaghkalandipert: whoa, I've never seen fnil.
22:23kovasbi discovered fnil a few weeks ago
22:23kovasbpretty useful when u need it
22:24lynaghkalandipert: that's more complex semantic stuff; I'd settle just for counting so I can have a linter that yells at me for having really long fns.
22:24lynaghkkovasb: what's a typical use case?
22:24kovasbfor fnil?
22:24lynaghkyeah
22:24alandipert(update-in {} [:x] (fnil + 0) 1)
22:24kovasbyeah
22:24kovasbexactly
22:24lynaghkah, sweet.
22:26kovasbhonestly what i really want is some refactoring tools
22:27alandipertthat's part of my motivation to data all the things
22:27madsybrehaut: Thanks. It's (.- bar foo) actually :-)
22:27alandiperti can write tools in clj that work with clj code-data as i go
22:27kovasbyeah
22:27alandipertvs. mucking around with jars and files
22:27kovasbi agree
22:27kovasbthough it would need good ui support as well
22:28kovasbat least for the things i want
22:28kovasbunit tests as data would also be excellent
22:29kovasbcould have a central repo where people can just contribute tests for various packages
22:29alandipertyeah
22:29kovasbespecially if all you need to do is flag it in the UI
22:29alandipertcould also continuously CI the dependency graph
22:30kovasbright
22:30kovasbthough that could potentially benefit more from logical analysis
22:30kovasbthan from testing
22:30alandiperttrue
22:30alandipertor at least a logic heuristic
22:31kovasbi mean, its stupid we have to find out the hard way that some library changed the namespace
22:31kovasband then its incompatible with your other library
22:31kovasblike when the analyzer moved to a new ns, a bunch of stuff broke
22:31kovasbwe should be able to find that out ahead of time
22:32kovasbdependency management is just a computational problem
22:33kovasbalandipert: what are you working on now?
22:34alandipertmostly been working on clj training related things, traveling around a bit this summer delivering courses
22:35alandipertis anyone gonna be at OSCON?
22:35kovasbhow many people are gonna be trained?
22:36alandipert20-30 a pop, and there 4 this summer, so hopefully around 100
22:37kovasbcool. is it mostly companies that decided to use clojure?
22:37kovasbor just random people
22:37alandipertit's a mix, i've done a few on-sites at companies that are in adoption process
22:38alandipertother companies send a few people to the public trainings. it's fun because people come with interesting problems
22:38kovasbcool. I'm curious about the adoption process at companues
22:38kovasbyeah
22:38kovasbthough i imagine its hard to avoid just solving their problem for them
22:39kovasbdo you ever make their day with a 1 liner?
22:39kovasb:)
22:39alandipertnot always, some of them are pretty tough :-) and code isn't always the answer. but yes, we try and hook people up with the tools to succeed
22:40alandiperti try to blow like 7 minds a day with 1-liners, kinda low today, only 5 - and they ran me out of the supermarket
22:40kovasblol
22:43alandipertwell, bedtime, g'night all
22:43alandipertwe must drink beers some day lynaghk and kovasb and plan the revolution
22:46TimMcHmm, 'deliver claims it will throw an exception if you call it twice on a promise, but that doesn't appear to happen.
22:47zakwilsonkovasb: yes. haskell-mode at least provides a function to query hoogle.
22:47kovasbcool
22:47kovasbthose haskell people have a lot of stuff
22:47kovasbtoo bad i don't understand the language
22:48wmealinggives me a headache
22:48kovasbi haven't tried to understand
22:48kovasbyet
22:48kovasbprobably need a good book
22:49kovasbbut besides clojure they are the main people doing sophisticated stuff
22:49zakwilsonI wrote a non-trivial thing in Haskell. Ended up porting it to Clojure.
22:49bfabryI can't fit both monads and an awkward binding-precedence based syntax in my head at the same time
22:50kovasbi wouldn't want to code in it
22:50zakwilsonThe way I see it, Haskell is a research language you can write practical stuff in. Clojure is a practical language that draws heavily on research.
22:50kovasbbut there are a lot of algorithms type papers published in haskell
22:50kovasbthats a good way of putting it
22:51kovasbbasically to be aware of whats going on, knowing haskell helps a lot
22:51zakwilsonI like Haskell though. If I was writing a non-trivial file format conversion tool, I might do it in Haskell.
22:53zakwilsonOf course, some of the research-heavy Haskell guys hate Parsec. I think it's awesome.
22:54kovasbwhy do they hate it?
22:54brehauthow dare you write something so practical in haskell!
22:54brehautcompute Pi again!
22:54kovasblol
22:54wkellyresearch-heavy people hate everything by nature
22:54wkellyhehe
22:54kovasbtrue
22:54wkellyit is what makes them good at coming up with things no one else has done before! ;p
22:54kovasbi think its just everything else is a threat
22:54kovasbagainst their special thing
22:55kovasbe.g., academia is a 0 sum game
22:55wkellyit seems like a lot of people came to clojure from haskell
22:55kovasbi see a number on irc
22:55zakwilsonkovasb: dunno. Parsec is somehow worse in a parser theory way than the complainant's favorite parser.
22:55brehauti can from haskell and python concurrently
22:56kovasbzakwilson: there are so many ways of parsing stuff that there will always be a better parser for some category of thing
22:56wkellyI use haskell to configure my window manager, and I played with it prior to clojure
22:56wmealinghaskell does have a serious advantage in speed and memory , compared to clojure.
22:56wkellyI do a lot more in python and ruby, but I am a sys admin, not a programmer
22:56wmealingbut of course, you lose all the java -interop
22:56kovasbits actually pretty wild how many parsing algorithms there are
22:57wkellyhaskell has the advantage of easily working with c for we sysadminy types who like to drop privs in our servers
22:58zakwilsonI didn't come from Haskell to Clojure. I came from Common Lisp to Clojure, and tried out Haskell after I was already regularly using Clojure.
22:58zakwilsonI still like CL in theory, but Clojure is usually easier to get stuff done in.
22:59kovasbi just think the mid-late 80s were a bad time in PL design
23:00kovasbCL is like the C++ of lisp
23:00wkellyhaha
23:00zakwilsonIt is.
23:00zakwilsonA much smaller and cleaner language just like CL would be awesome, but nobody would use it.
23:01kovasbyeah
23:01wkellyI would!
23:01zakwilsonThere was... T, I think.
23:01wkellycommon lisp is a bit intimidating for me
23:02kovasbits hard to separate the good from the bad
23:02wkellyI have poked at it, but I haven't really given it a try
23:02kovasbfrom my attempts to look at it
23:03kovasbbasically, i trust that rh already stole the good ideas
23:03kovasbso there is no point now
23:03zakwilsonIt's not that there's much bad. There's just too much TIMTOWTDI.
23:03sabegood evening. question:
23:03kovasbi guess what i mean is marginal versus non marginal
23:03sabegiven this: https://gist.github.com/3057818
23:03wkellyzakwilson: that is my experience. It is overwhelming to get into
23:04zakwilsonThere are good ideas in CL that aren't in Clojure. User-defined reader macros are nice. Symbol macros are nice.
23:04wkellyI like the reader macros in CL
23:04sabehow do I pass the received varargs to another function still as varargs instead of a list?
23:05kovasb(apply f list)
23:05kovasb,(apply #(vector 1 %%) [2 3])
23:05clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox$eval28$fn>
23:05kovasbo dear
23:06sabekovasb: (defn f2 [a & r] (apply (partial f a) r)) ?
23:06kovasb,(apply vector [1 2 3])
23:06clojurebot[1 2 3]
23:06zakwilsonVariables in CL that aren't created in a lexical scope are always dynamic (probably with some odd exceptions). Not so in Clojure.
23:07sabekovasb: it works but it looks kinda ugly. isn't there a better way? I thought ` would solve it for some reason :/
23:07kovasbanyway depending on if you want to pass additional arguments as well as the varargs, some form of apply should do the trick
23:07zakwilsonAnd that's a big deal if you really need a backdoor in to somebody else's code.
23:07mdeboardscottj: I somehow have swank-js working fine. Interacting with the browser live and all.
23:08kovasbsabe: probably is a better way but not coming up with it at the moment
23:08sabekovasb: well, that did the trick. thanks man :D
23:09kovasbcool
23:29ferdanybody knows why Korma's (select) doesn't return a lazy seq of the result set ?
23:30arohnerferd: my guess is, the DB has side effects when closing the connection, so you need to know when that happens. Lazy seqs would have to depend on GC, which isn't deterministic
23:30zakwilsonBecause the database doesn't work that way.
23:31kovasbmy vote is with zakwilson
23:31ferdzakwilson: why do you say so? A JDBC resultset may use a db cursor... it doesn't pull the whole DB in memory
23:32hiredmanjdbc has several object's with life cycles to manage
23:32kovasbin that case my vote is with arohner :)
23:32hiredmanconnection objects, statement objects, resultsets
23:32zakwilsonHere's an idea. Ask ibdknox instead.
23:33hiredmanibdknox has been asked and responder in this channel
23:33hiredmanarohner is correct
23:33hiredmanresponded
23:33zakwilsonThen arohner is correct.
23:34hiredmanby not returning a lazy-seq, korma can punt on the life cycle management
23:35kovasbhiredman: thanks for the input on session
23:35zakwilsonI've often wondered why SQL doesn't have declarative schemas.
23:35ferdI see... my only thought was around the same vain: that it's implicitly creating connections and transactions
23:35ferdso, we'd need a "with-transaction" kind of thing... inside of which I do my (select ) and any data processing "lazily"
23:36hiredmankovasb: oh sure, it's way cool, and I want a clojure notebook
23:37kovasbhiredman: any particular use case?
23:37hiredmanthe idea of giving each computation and result an identity (as a loop in session) is not something that had occured to me before, but it is just sort of "oh of course, and that's how you get x y and z working"
23:37kovasbcool
23:37ferd(confesion: I spent 10mins with Korma... I saw that it was returning a vector and that triggered my question)
23:37kovasbyeah, need 1st class entities to represent computations
23:38hiredmanin the sense of a document with embedeed clojure computations
23:38kovasbright
23:39kovasbwell I'm waiting for this hadoop job to finish before i can go back to debugging the new version
23:39hiredmanI've been doing a lot of sort of "one off" work recently, writing little scripts to shovel data around, and logically a notebook idea seems to fit that kind of thing better than emacs+git
23:39kovasbi think things will shape up in the next couple of weeks
23:40kovasbright
23:40tmciverHas anyone here read 'The Little Schemer'? I'm looking at a preview on Amazon. Is the entire book like this - a series of questions and answers?
23:41kovasband we're back
23:42inklesspenHello, I'm having a problem where 'lein repl' complains about a missing class org.codehaus.jackson.JsonFactory. Some googling turned up hints this could be caused by conflicting dependencies, but no clue on how to resolve this.
23:42inklesspenHere's the error and my 'lein deps :tree': https://gist.github.com/3057916#file_repl+with+error.txt
23:42inklesspenAny ideas?
23:42nonubyl
23:42ferdibdknox: Any strong reason why Korma's (select) doesn't return a lazy seq of the result set ?
23:43hiredmanand it would be sweet if, when someone asks "what is the status of x" you just email them a document that would be able to connect to a sql instance and generate a table
23:43kovasbhiredman: right. thats definitely a use case i have in mind as well
23:44kovasbhiredman: so much easier than setting up a webapp
23:44kovasbhiredman: though i imagine it as emailing a permalink… otherwise they need to have session installed
23:45hiredmankovasb: well, bundling with a javafx webview or whatever is the next step
23:45hiredmanand you can generate a double clickable app with javafx (I think?)
23:45kovasbwhy javafx over just svg
23:46kovasbi see
23:46kovasbactually it might be possible to solve the clicking problem in a number of ways
23:46kovasbi mean, if its just an html file with the js embedded in it, it would work
23:47hiredmanjavafx is really a whole bunch of things, not really comparable to a thing like svg
23:47kovasbyeah
23:47kovasbmaybe someone will write the tagged literal converter for it
23:48kovasbI'm mostly gonna work on svg based stuff
23:48hiredmanin the scenario I imagine, javafx provides the webview instead of a browser, but all of session would just run the webview
23:49kovasbwould be interesting, though i don't know javafx at all to see what it can do
23:50hiredmanI bought a book, played with writing a repl ui using javafx, it just another ui framework, but it brings more modern widgets (like the webview) to java
23:51hiredmanI think the webview is based on webkit
23:51kovasbi see
23:51kovasbyeah, web views are useful
23:51kovasbit was brought to my attenion that epub3 has js and html5 support
23:52kovasbalso an interesting platform
23:52hiredmanOh
23:52hiredmanyeah
23:52kovasbcreate interactive ebooks
23:54hiredmanI am biased towards clojure over clojurescript pretty heavily, hard to get excited about just having clojurescript (unless you have a session (nrepl?) server some place)
23:54kovasbi am also biase
23:54kovasbd
23:54kovasbbut for simple, common stuff, the abstractions shouldn't care
23:55kovasbthats why i'm so big on tagged literals
23:55kovasbyou can have the same graphics formats on all clojure platforms
23:55kovasband they can just get interpreted the right way
23:56kovasbyou can imagine extending it to database objects as well
23:58hiredmannow I have to google about making epubs
23:58kovasbhaha
23:58kovasbi just saw the high level summaries but hard to find good technical docs