#clojure logs

2011-01-18

00:11mabes,(def foo (Foo. 4 5)) (.newInstance Foo)
00:11clojurebotDENIED
00:11mabeshrmm.. does clojurebot not like defrecord?
00:12mabesanyways, the above is not working for me. I get a java.lang.InstantiationException
00:12tonylnot def
00:12mabesoh
00:12mabesopps, wrong line of code
00:12mabes,(defrecord Foo [x y]) (.newInstance Foo)
00:12clojurebotDENIED
00:13mabesanyways, that line errors out with a.lang.InstantiationException.. any ideas on how I can get a new instance of Foo using newInstance or similar? In my case I have a 'type' that I want to create a new instance of
00:14tonyl(Foo. 4 5)
00:14mabesrigth, but Foo could be any class in a var called type
00:15tonylyou can use (new Foo 4 5)
00:15tonyl(new #'type 4 5)
00:17tonylI don't think I understood your question, is that what you meant?
00:18mabes,(defrecord Foo [x y]) (let [type (class (Foo. 4 5))] (new #'type 3 2))
00:18clojurebotDENIED
00:19mabesyeah, although now I get "Unable to resolve classname: (var type)"
00:20mabesalso, I don't seem to be able to init Foo with no args.. I thought defrecord allowed you to do that...
00:20mabes,(defrecord Foo [x y]) (new Foo)
00:20clojurebotDENIED
00:20mabessigh
00:22mabes,(defrecord Foo [x y]) (seq (.getConstructors Foo))
00:22clojurebotDENIED
00:23mabesI thought defrecord gave you a constructor with no args, but that doesn't seem to be the case...
00:23tonylit doesn't seem so
00:23tonylI am new to records too
00:23tonylmaybe somebody else would step up
00:25mabesthis SO post hits on what I'm wondering about: http://stackoverflow.com/questions/4520319/clojure-assigning-defrecord-fields-from-map
00:26mabestonyl: thanks anyways, that was helpful
00:29tonylmaybe this might help (defmacro instantiate [klass values] `(new ~klass ~@values))
00:29tonylfrom this link http://stackoverflow.com/questions/4514196/how-to-make-a-record-from-a-sequence-of-values
00:41amalloymabes: records have a constructor that takes one argument for each field
00:42amalloywhat would be the value of creating a record with fields missing? they're immutable anyway, and you lose any performance gain if you fill them up chunk-at-a-time
00:54tomojnot quite any, right?
00:57tomojhuh, I thought keyword access on records was supposed to be really fast?
00:58tomojit looks slower even that hashmap access
01:15amalloytomoj: it should be fast, yes
01:21tomojamalloy: https://gist.github.com/5a4b5b4846b702f2266a
01:24amalloytomoj: hiredman was trying to explain to me earlier today that the first time you call (:x some-rec) it looks up the .x element and caches it for faster access (as in your third test)
01:24amalloythat doesn't seem to be happening here but my understanding is that it should be
01:24tomojah, hmm
01:25tomojdoes it depend on AOT, I wonder?
01:25amalloytomoj: it's silly, i know, but what if you put a type-hint on foo? (:x ^Foo foo)?
01:25tomojtried it
01:25tomojin both the let binding and at the callsite
08:08shortlordtechnomancy: how do you access the "rooms" ref in your Mire server? I have been trying to set up some simple server and run a repl on it, but I always end up in a different namespace than the server and so can't access any variables on the server through the client
09:02SomelauwIs there a difference with scheme when using reduce? I am trying (reduce cons () (range 5)) and it says it can't create ISEQ from Integer.
09:04SomelauwOh, I see the parameters in the update function are reversed: (reduce (fn [x y] (cons y x)) (list) (range 5))
09:04AWizzArdSomelauw: conj
09:04AWizzArdinstead of cons
09:04raekyes. you can also use 'conj' here
09:04AWizzArd,(reduce conj () (range 5))
09:04clojurebot(4 3 2 1 0)
09:05AWizzArd,(reduce #(cons %2 %1) () (range 5))
09:05clojurebot(4 3 2 1 0)
09:06RaynesIs there any particular reason you're doing that in the first place?
09:07SomelauwI like to reverse lists in a geeky way.
09:07AWizzArd(:
09:09shortlordhow can I change in a thread to another namespace? using (ns namespace-name) results in an error
09:09shortlordException in thread "Thread-3" java.lang.RuntimeException: java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set
09:10AWizzArdshortlord: in-ns
09:11AWizzArdBut it is not likely that you really want to do that.
09:11AWizzArdPerhaps you want to call a function in NS1 from a thread.
09:11AWizzArdin that case you can (NS1/your-fn arg1 arg2)
09:14shortlordAWizzArd: well, the situation is this: I want to write a very simple remote repl, that lets me inspect the server. Just using the normal repl or read-string does not work, because these launch in the clojure.core namespace
09:15shortlordI have written an execute function in the server namespace that executes an input string using load-string, but even calling servernamespace.core/execute still won't find the symbols in the server namespace
09:28shortlordAWizzArd: do you have any idea how evaluating forms in the current namespace without switching to it could be done?
09:28tomoj,(doc require)
09:28clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, ...
09:29AWizzArdshortlord: you most likely want, as tomoj indicated, require a ns.
09:31AWizzArdshortlord: for example, when you have Clojure-Contrib in your classpath and do (require 'clojure.contrib.string) or even better (require '[clojure.contrib.string :as string]) then you can do (string/join ...)
09:34raekthat still won't make 'foo' resolve to 'servernamespace/foo'
09:36raek,parse
09:36clojurebotjava.lang.Exception: Unable to resolve symbol: parse in this context
09:36raek,(binding [*ns* (the-ns 'clojure.xml)] parse)
09:36clojurebotjava.lang.Exception: Unable to resolve symbol: parse in this context
09:37raek,(require 'clojure.xml)
09:37clojurebotnil
09:37raek,(binding [*ns* (the-ns 'clojure.xml)] parse)
09:37clojurebotjava.lang.Exception: Unable to resolve symbol: parse in this context
09:37AWizzArd,(ns-resolve 'clojure.xml 'parse)
09:37clojurebot#'clojure.xml/parse
09:38raek(binding [*ns* (the-ns 'clojure.xml)] (eval 'parse)) => #<xml$parse clojure.xml$parse@322bce>
09:39AWizzArdYou can also call the result of (ns-resolve 'clojure.xml 'parse).
09:42SomelauwAlso, what happened to foldright?
09:42raekyeah, (resolve 'parse) in that position will yield the same result too
09:43raekthere was a thread re foldright on the google group
09:43AWizzArdSomelauw: (reduce f (reverse coll))
09:44AWizzArdI think vectors can be reversed in O(1)
09:44SomelauwDoes reverse have exactly the same performance as reduceLeft?
09:44Somelauwfix: Does reverse have exactly the same performance as reduceRight?
09:45raekreverse will force all elements of the seq to be in memory at the same time
09:45raekreduce will not
09:45raekso reduce is more lazy-seq friendly
09:46SomelauwAWizzArd, so it won't actually reverse anything?
09:46shortlordraek, AWizzArd: thx a lot. it works with a *ns* rebinding :)
09:48SomelauwBut would (reverseRight fun seq) perform faster than (reduce fun (reverse seq)) when used on linked lists?
09:49SomelauwOr consume less memory?
09:49raekshortlord: how is reverseRight defined?
09:50raekalso, reverse is always O(n). vectors have the rseq funcion, which is O(1).
09:50raek,(doc reverse)
09:50clojurebot"([coll]); Returns a seq of the items in coll in reverse order. Not lazy."
09:50raek,(doc rseq)
09:50clojurebot"([rev]); Returns, in constant time, a seq of the items in rev (which can be a vector or sorted-map), in reverse order. If rev is empty returns nil"
09:51raekehrm.. I meant Somelauw...
09:52Somelauwraek, I meant reduceRight (or foldRight)
09:54raekclojure has no reduceRight/foldRight
09:56raek(reduce fun coll) = (reduce fun (seq coll)) would have the same performance characteristics as (reduce fun (rseq coll))
09:56raek...and memory characteristics
09:57pdk`grown ups are always reducing the fun
10:14AWizzArdraek: yes, rseq I meant, good point
10:53LauJensenfogus`: Hows Marginalia coming along ?
10:54fogus`LauJensen: I think trunk will fix your protocol doc problem. But I haven't tried it on your source yet.
10:54LauJensentrunk?
10:54Raynesfogus`: Get your mind out of the subversion gutter.
10:54LauJensenoh my - I was afraid that was what he meant
10:54fogus`doh! occupational hazard
10:55Raynesfogus`: doccupational hazard, more like.
10:55LauJensenfogus`: I just have one question http://images.nonexiste.net/irc/2008/10/13/git_two.jpg
10:58raekupcomming suport for extrating the dosctrings from defprotocol forms?
10:59LauJensenHopefully - ClojureQL documentation looked very scarce seen through Marginalia
10:59fogus`raek: Yes. It always worked (defprotocol Foo "for this" (bar [this] "but not for this")
10:59raekah, ok
11:00raekI remember trying it and something did not work
11:00fogus`raek: We pushed the regex impl as far as possible and it broke us
11:00LauJensenfogus`: Feel free to test on CQL before you release :)
11:01LauJensenWe have stuff like multiple arities in the protocol
11:02fogus`Understood
11:05raekis this allowed in regular mardown? "one `two<newline>three` four"
11:06LauJensenraek: You need two newlines for an actual newline I think
11:06LauJensenraek: but consulting the daring fireball
11:07LauJensens/consulting/consult/
11:07sexpbot<LauJensen> raek: but consult the daring fireball
11:07raekI don't want a new paragraph. I just want to keep my lines less than 80 chars wide
11:08Raynesraek: If you need to newline in the middle of code, you probably don't want ``.
11:08raekso I use M-q in emacs, which sometimes splits up `two three` into two lines
11:08raeksingle newline is like a space in non-github markdown
11:09raek;; Take a look at this arbitrary map: `{:a 1,
11:10raek;; :b 2}`. Blah blah
11:12raekanyway, I have to fight emacs to not break those up, since marginalia does not currently handle this as I expected it
11:12fogus`raek: I always test Markdown at http://attacklab.net/showdown/
11:13fogus`That page seems to do what you want.
11:13raekfogus`: thanks!
11:14RaynesI'm only somewhat well-versed in markdown of the pandoc variety.
11:14fogus`raek: Caveat being that there is no official standard and different parsers tend to do slightly different things
11:15LauJensenIs there some special syntax specific for Marginalia, I mean for doing examples or some such thng?
11:15raekfogus`: would it be a good idea to make marginalia handle ";; blah `foo\n;; bar` blah" in the same way as the parser you linked handles "blah `foo\nbar` blah"
11:16fogus`LauJensen: The only current extension that we have is the support for Latex and MathML equations
11:17fogus`raek: Does it not handle it properly now?
11:18raekfogus`: no, it outputs "blah `foo bar` blah" rather than "blah <tt>foo bar</tt> blah"
11:18shortlordafter I've put a core.jar file with java classes in it into a directory on the classpath, how can I import it in clojure? :import core.* does not work, neither does :import processing.core.* (the latter would be the correct line in eclipse after adding it to the build path)
11:19tonylshortlord: you can only import classes
11:20tonylnot classes inside packages
11:20lpetitping ! "Lost in translations lpetit" looking for a little bit humanity, humility and sympathy
11:20fogus`raek: Maybe there is something that we can do, but if it's in the markdownj lib I'm not sure we'll get around to fixing that
11:21Raynesshortlord: To translate what tonyl just said to English, there is no way to import all of the classes in a package at the same time. You have to import the ones you want individually.
11:21raekfogus`: ok. I might look into it.
11:21Raynes(:import (processing.core SomeClass AnotherClass MoreClasses ...))
11:22RaynesIt may seem tedious at first, but readers of your code will thank you.
11:23shortlordRaynes: ah, that works! Thanks a lot :)
11:25raekfogus`: should I create an issue for this?
11:26fogus`Raynes: We wrote JoC in and extended Markdown. We didn't implement all of it in Clojure though, only the extended bits.
11:26Raynesfogus`: I'm using Pandoc's extended markdown for my book. It's pleasant.
11:26fogus`raek: Please. BTW, I think that Gruber wrote a reference Markdown parser that serves as the "standard"
11:29fogus`Raynes: Looking forward to reading it. :-)
11:29Raynes:>
12:00bhenrywhy does every example i can find of ring-session use sandbar's wrap-stateful-session?
12:00bhenry*ring's wrap-session rather
12:03_na_ka_na_hey guys which web server do you recommend for a Clojure web app in production to be run as a windows service
12:05_na_ka_na_tomcat doesn't work nicely if I deploy my app as a Servlet
12:07_na_ka_na_gives errors like: SEVERE: The web application [/] appears to have started a thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak.
12:16Licenseraloa
12:16Scriptordoes anyone know if the jdk 7 is going to support tail calls? From the features list they only seem to have gone as far as dynamic invocation
12:16Licenserit got quiet in the channel or is it me?
12:17Scriptorit often gets quiet here
12:17amalloyScriptor: i think the answer is no
12:17Scriptordammit
12:50gtrak_na_ka_na_ application servers get fussy about threads, that's one of the reasons they exist, to manage all that for you
12:50tonylwhy do vars have private meta and what is it for? just for the compiler?
13:10amalloytonyl: it stops it from being imported when someone :refers your namespace
13:11shortlordis there any equivalent to map for functions that cause side effects?
13:12shortlorddotimes seems to allow only a binding of 1 variable
13:12Raynes&(doseq [x [1 2 3]] (println x))
13:12sexpbot⟹ 1 2 3 nil
13:12shortlordRaynes: but doseq would cause a different behaviour using 3 variables
13:13amalloydoseq is more like for than map, but yeah. if you prefer the map "style", you can ##(dorun (map println [1 2] [3 4]))
13:13sexpbot⟹ 1 3 2 4 nil
13:14amalloyshortlord: is good?
13:15shortlordamalloy: have to test it, but that sounds like it could work
13:20shortlordamalloy: yep, works. great, thx :)
14:10LauJensenNow thats a pretty blue line :|
14:10LauJensenhttp://www.google.com/trends?q=clojure%2Cphp%2Cruby%2Cscala&amp;ctab=0&amp;geo=all&amp;date=all&amp;sort=1
14:10tonylamalloy: just came back. thanks for the explanation
14:11nachtalpalso a nice example of text mining gone wrong: "Berlusconi: Gov't will last despite Ruby scandal"
14:11tonylLauJensen: I don't see a blue line at all
14:11LauJensentonyl: Thats right
14:12LauJensennachtalp: Yea its hard to get around
14:12nachtalpLauJensen: most of the time i'm thankful it's not that easy to get right :)
14:14amalloyalso entertaining is the sharp drop in searches for php around christmas every year, while the other languages stay about the same
14:14nachtalp:)
14:15LauJensenamalloy: You mean because their parents dont allow them to go online during the holidays?
14:15nachtalpthis doesn't look a whole lot better either: http://www.google.com/trends?q=clojure,+scala&amp;ctab=0&amp;geo=all&amp;date=all&amp;sort=1
14:16LauJensenYes, we must find a more level playingfield, like
14:16LauJensenhttp://www.google.com/trends?q=clojure%2C+algol&amp;ctab=0&amp;geo=all&amp;date=all&amp;sort=1
14:16nachtalpbut i guess with scala there's also a lot of noise involved...
14:16fdaoudyeah, but did you notice it all has to do with Italian Opera? ;-)
14:17amalloyLauJensen: algol is surprisingly popular in finland
14:17LauJensenamalloy: The rule is: Whatever the Finns do with IT, respect it
14:17LauJensenI still remember in 96 when the rest of us barely could do shaded rotating 3d cube... then FutureCrew showed up at The Party ... ouch
14:27Luyt_hmmm, 'clorine' sounds noxious ;-)
14:28pjstadigat least its not clorjine or clorinjure or clojurinistic
14:28amalloyjlorine
14:28Luyt_cluorine, clotastic, clorgasm, cloffensive
14:29Luyt_clot
14:31jjidosanta clos
14:53gtrakcloroform
15:19ossarehmorning all
15:21tonylafternoon ossareh
16:01jweiss_can someone suggest a good way to do this in emacs: I have a piece of code within a defn that I want to test, but it refers to a function argument, so I can't just C-x C-e it. Copying it to the repl doesn't work either bc it's in a different ns.
16:01jweiss_i want to bind the function argument to a value and evaluate the sexp
16:02amalloyjweiss_: kill the code segment, then yank it into a C-c C-e (let [arg foo] ...)?
16:02amalloyhardly elegant, but...
16:05raekjweiss_: C-c M-p <ret> in the source buffer to change namespace of the repl to the one of the buffer
16:05jweiss_raek: aha
16:05jweiss_ok that is the direction i was going (manually)
16:05raeksame as (in-ns 'the.name.space)
16:06amalloyraek: which reminds me, that doesn't work if the ns has any metadata
16:06raekjweiss_: github.com/technomancy/swank-clojure lists some really useful commands
16:07raekamalloy: I usually enter the metadata as a docstring and an "attribute map"
16:07amalloyie (ns ^{:doc "my awesome project"} awesome.project ...) causes a lot of things in slime to not work
16:07raek,(doc ns)
16:07clojurebot"([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use...
16:07raek(ns foo.bar "foo docs" {:meta-key "meta val"})
16:08amalloyraek: agreed that's better but sometimes i have to work on libs someone wrote using the ^ style
16:11raekthen I'd like to present a snipped technomancy showed me: (doto 'foo.bar require in-ns)
16:26chouserthat's cute
16:28bhenryi always forget how to undef something.
16:28bhenryto avoid restarting swank
16:28chouserns-unmap, I think
16:30bhenryyep found it. thanks chouser
16:30hiredmanthere is always remove-ns
16:30hiredmanI wonder if swank should try that before compiling a file
16:30bhenryhiredman: depending on how remove-ns works you might be onto something
16:31bhenryyou can delete all your (:use) lines and recompile in swank and it won't complain.
16:36S11001001hiredman: dangling ns references elsewhere
16:36S11001001and defeating defonce
16:44hiredmanS11001001: *shrug*
16:47puredangerdo protocols functions support varargs?
16:48hiredmannope
16:50puredangerhiredman: darn, oh well
16:54kumarshantanutonyl: PHP doesn't have threads
16:54hiredmanphp would just benefit from decent collections period
16:55tonylyeah, that is what i was thinking, maybe a strong parallel programming system first
16:57tonyli like php arrays
16:57kumarshantanuis php6 going to address any of these?
16:57tonylthey were easy to use when i first starting programming
16:58tonylthe only thing I know about php6 is unicode strings
17:02kumarshantanuI remember somebody prototyped PHP-like syntax for Clojure
17:02tonylhiccup?
17:02tonylno i don't think is that one
17:02kumarshantanuBlah <? (println "hello") ?> blah
17:03hiredmantonyl: php arrays are pretty much garbage
17:04hiredmanand there is no proper associative datastructure
17:05nickiki just wrote a array library for VB
17:06nickikbecause VB proviedes nothing !!!!!
17:06nickik(VB classic)
17:07nickikThe library is modle after clojure seq functions. The stuff is slow but it works and we don't really ned speed.
17:08brehautnickik: i think every (decent) VB or VBA developer rolled their own datastructure classes
17:09nickikmy firm didn't for 20 years :(
17:10brehauti feel your pain
17:10nickikI didn't even have a function to print a array
17:11nickikwe have ASP that VB-- you don't have optional arguments for example
17:11nickikwe cant use any types and there are other restrictions too
17:11brehautnickik: my last job involved maintaining a platform with around 2mil lines of VBA
17:12nickikoohh
17:13kumarshantanuhttps://github.com/Flamefork/fleet
17:13nickikbrehaut: a big word macro :)
17:13brehauthahaha
17:13brehautthankfully it wasnt that evil
17:14nickikbrehaut: are there any good open source array librarys? I asked on Stackoverflow but knowbody answerd.
17:14tonylkumarshantanu: I see, interesting
17:15brehautnickik: not that i found
17:17nickikbrehaut: im pretty happy with mine. Atm im implementing RecordSet to Array conversions but I not sure how to do it. You could make a 2d array but those are stupid to work with. I think my way will be a 1d array and then partition that thing.
17:17brehautnickik: the thing i found most useful was implementing a bunch of iterators for building pipelines
17:19nickikbrehaut: What do you meen be that. pipelines?
17:19kumarshantanutonyl: if you can parse a file content at <? and ?> boundaries and re-write it as pure clojure code, then you easily eval it as (apply str ....) and probably that'll be something close to the PHP model
17:20brehautnickik: are you familiar with unix ?
17:20nickikbrehaut: ah ok
17:21tonylwonder if it uses a the mod_proxy to parse the template through clojure then output the html
17:22kumarshantanutonyl: fleet just evals them i guess
17:23nickikbrehaut: could you explain a little bit how you did that and provide a use case? I'm having trouple imagening it.
17:23nickikprivat chat maybe?
17:23tonylkumarshantanu: i like your simple approach of html parsing
17:24kumarshantanutonyl: posting questions about fleet on the group will likely get fleet author's attention, and hopefully accurate replies :)
17:25tonylyeah, thanks for sharing kumarshantanu
17:26amalloyhiredman: php isn't my favorite, but its "arrays" are a perfectly fine associative structure. they're all k/v maps
17:26amalloyarray('data' => 10)
17:27kumarshantanuarray(array("key" => 50) => 100)
17:28amalloykumarshantanu: well yeah, the keys have to be strings or ints, which is gross for sure
17:28amalloyso not a very spirited defense of php from me :)
17:28zakwilsonTrying to improve PHP is like putting lipstick on a pig.
17:29kumarshantanuzakwilson: +1 (i use php at work)
17:29zakwilsonIt is so flawed, to its very core that you'd waste time doing anything but scrapping the whole thing.
17:30amalloyzakwilson: c'mon, so cliche. maybe it's more like making twinkies healthy by using whole grains
17:30zakwilsonAnd the culture is fundamentally aligned against improving it. Ask them to do the Right Thing and they argue against it.
17:30zakwilsonWhole grains would actually make them more healthy... it's more like organic twinkies.
17:31hiredmanamalloy: they only allow strings or numbers as keys
17:31amalloyhiredman: yeah, see above where i give up on defending php
17:32kumarshantanustring and int can be unambiguously hash-keyed, maybe that's why
17:33kumarshantanuint is the straight index though, not a hash
17:35hiredmanI would be surprised if php "arrays" did use any hashing
17:35hiredmanTesting safe.test.elasticsearch
17:35hiredmanFAIL in (test-rollover-play-dead-good-dog) (AFn.java:163)
17:35hiredmanwith a sufficent shard size, split between two indices
17:35hiredmanwhoops
17:35hiredmanwrong buffer, a thousand pardons
17:36amalloyhiredman: they do hash; lookup by key is O(1)
17:36hiredmanamalloy: I bet
17:41kumarshantanubye all
20:08hiredman,(double 3663/2)
20:08clojurebot1831.5
21:17akhudek_I've just experienced a StackOverflowError in the clojure compiler.
21:18akhudek_I understand this can be caused by recursive macros, although in this case, I can't see that happening.
21:18akhudek_Here is a stack trace of the problem, with two relevant functions: https://gist.github.com/785569
21:19akhudek_I'm at somewhat of a loss on how to track the problem down further.
21:23tonylhave you try running it without the macro
21:23tonylit seems that the macro doesn't need to be there
21:23tonylsince all of its args are evaluated
21:23tonylstill looking where that SOE might be happening, but that was just a thought
21:23akhudek_let me try that
21:31akhudek_yep, still happens without the update-in-meta macro
21:32akhudek_It must be something to do with the larger structure of the program, although the main loop is a recur loop, and I'm not seeing how a stack can be built up during it.
21:33tonylit can if it is realized
21:34tonylbut i don't think that can happen is there is no data to store but just computation
21:36akhudek_Well, it does store data as it goes. The context is that this is a backtracking theorem prover. I'm using delay to store a stack of backtrack points. That particular stack is implemented using a vector.
21:40amalloyakhudek_: yeah, this update-in-meta thing looks fine
21:42amalloyand indeed update-in-meta by itself works fine. it has to be something in the calling context
21:43akhudek_hmm, ok, that helps, I think I may have found it.
21:43akhudek_Main loop has a pair of functions that call each other, this is likely the source of the deepening stack.
21:48dnolenakhudek_: what are you using the theorem prover for?
21:48akhudek_query rewriting
21:49akhudek_we'll be released it as open source at some point, assuming we can iron out all the research issues
21:49dnolenakhudek_: for databases?
21:50akhudek_initially, yes, although it should actually be flexible enough to do compilation in other contexts too
21:51dnolenakhudek_: interesting. I've been messing around with backtracking a unification a lot lately, been writing my own implementation of a logic engine based on miniKanren (a Prolog variation)
21:52dnolenakhudek_: the way I way avoided stack overflow in my project was to express mutually recursive functions as lazy sequences.
21:53akhudek_hm, kanren looks pretty interesting
21:53akhudek_we decided to roll our own prover because we need a lot of alternative proofs
21:53akhudek_and alternate proofs in a specific way
21:54akhudek_each proof corresponds to some translation of one fol sentence to another
21:55dnolenakhudek_: https://github.com/swannodette/logos, is my project. would love to see how you're tackling similar problems when you guys open it up.
22:00akhudek_Neat, I'll take a look at it. Briefly looking at your examples suggest that your overall structure is very different than ours.
22:02akhudek_I'm not sure when we'll be putting code up, although we may have a paper out sometime this year.
22:03dnolenakhudek_: looking forward to that. any particular reason you picked Clojure for your research?
22:04akhudek_We felt it would help us prototype things quickly.
22:05akhudek_In particular, we make extremely heavy use of clojures versioning data structures both for backtracking and simplicity of implementation.
22:06dnolenakhudek_: yeah, for backtracking it's a beautiful match, I'm using PersistentHashMaps to hold the logic var bindings.
22:08akhudek_Same design here. We also use it for our tableau structure. When we extend a branch, we simply copy the entire world and make the necessary change in the new one.
22:09akhudek_Although that may come back to haunt us, since one technique we are considering requires going back and modifying the tableau in the middle of the tree.
22:09akhudek_That is now difficult since we'd have to somehow propagate the changes down the branches.
22:13cobol_expertis there a way to create a defrecord instance with named arguments?
22:13cobol_expertuseful for big arg lists
22:13akhudek_cobol_expert: no, you'll have to roll a macro for it
22:14cobol_expertthnx, good idea
22:14akhudek_I think there may be a few on the web if you look
22:14dnolenakhudek_: cobol_expert: or a function, in 1.2.0 you can have keyword args to functions.
22:16cobol_expertactually, i'm not sure what good either of those would do
22:16cobol_expertif you have a (defrecord Point [x y])
22:16dnolencobol_expert: you write a constructor fn.
22:16cobol_expertand want something like (Point. :x 1 :y 2)
22:17cobol_expertyou'd have to throw away the argument names
22:17dnolen(defn make-point [& rest] ...)
22:17dnolen(make-point :x 1 :y 2)
22:18dnolencobol_expert: you'll want to do something like that anyway, as otherwise consumers will need to import the Java class that is your defrecord.
22:19akhudek_to elaborate, something like https://gist.github.com/785627
22:19akhudek_I keep forgetting keyword args were introduced.
22:20cobol_experthm, i'm a little behind on destructuring, so i can't tell what that does
22:20cobol_expertactually a lot behind
22:21amalloyakhudek_: they weren't, really. what was introduced was the ability to destructure maps in a & arg
22:21cobol_experti see, so the x,y in the gist example just map to the appropriate fields
22:21akhudek_cobol_expert: the & means that what follows is a collection of the remaining arguements
22:21cobol_experter.. so to speak
22:22akhudek_in that case, all the arguments since I specified none
22:22akhudek_the brackets destructure that collection as a map
22:22cobol_experti got that part
22:22akhudek_defining keys x and y
22:22akhudek_the or is the default parameters
22:23cobol_expertah, cool
22:23cobol_expertthx! i'll play around with that a bit
22:27amalloycobol_expert: you might also be interested in defrecord2, which automatically does this stuff
22:27amalloy$google defrecord2
22:27sexpbotFirst out of 12 results is: david-mcneil/defrecord2 - GitHub
22:27sexpbothttps://github.com/david-mcneil/defrecord2
22:30cobol_expertthanks, that looks useful
22:30amalloy(standard disclaimers apply: i haven't used it, don't know if that's the canonical repository, etc etc)
23:01dnolennice, 1.5X speed boost for logos.minikanren unification. protocols FTW.