Fork me on GitHub
Flash Hu10:02:30

Could we leverage historical Slack messages to train ChatGPT and enable it to provide quick responses to frequently asked questions, provide links to referenced message threads, or even identify the most active users?


Chatgpt can already answer clojure questions. It probably already has been trained with this slack messages, as they're archived on a website automatically. Now, whether it gives an accurate answer is another problem, but just more training won't solve that one.


There are a lot opinions posted on slack, including my own, so I would question the validity of output from a tool such as ChatGpt. If it gets too much noise as input then the signal it produces will be of lower quality. Also quantity doesn't equal quality of answer in slack or other discussion platforms. An active user may have very little experience of a particular topic (although still proffer up some opinions)


And it seems there is a way to go before ChatGPT is reliable and addresses some of it's noticable limitations. It's simpler just doing a search on slack for the moment until we have traversed the ChatGpt hype curve

👍 6

Someone on comp.lang.lisp, my former feeding ground, once asked about an "forward-referenced class error" on (defclass my-class (object)...). He got a lot of help from humans assuring him that all would be well once he defined object. I asked him if he thought a top-level class had to inherit from some built-in "object" class. He said, yeah. I told him the class was standard-object, and that defclass supplied that automatically. Someone want to ask ChatGPT about CLOS?


Inter alia...

In this case, object is likely intended to be a parent class of the foo class, but it has not yet been defined. Therefore, Common Lisp cannot determine the complete structure of the foo class until the object class is defined.


With Microsoft adding the OpenAI stuff to Bing recently, I decided to finally give in and go check out ChatGPT... Let's just say that it did not go well. I asked it about English language opera -- because I figured there was a lot of factual material out there it could have been trained on -- and it provided detailed, plausible, and factually incorrect results over and over again. So far, every "conversation" I've had with it has produced similar results: they sound authoritative but they're wrong. Someone posted the result here of asking it a question about Malli and schema-checking: syntactically correct code that all looked very reasonable but used a completely fictitious namespace (supposedly from Malli) to do something the library didn't provide. I definitely would not trust any answer I got from ChatGPT -- and I'm not sure that it saves you much time after you do all your own fact-checking on it!


Instead of "training ChatGPT", we could, instead: • parse the Slack logs for each question-and-answer thread • use vector embeddings to perform semantic search Basically, a good search on top of the archives. (Although, TBD if it would be better than google + site:https://whatever-the-url-of-the-clojureians-archive-is )

Danilo Oliveira15:02:20

What happens when I dereference a future or promise inside a go block? Will it be parked or it will hang a thread from the pool?

Alex Miller (Clojure team)15:02:40

nothing different than outside a go block (ie, it will hang a thread)

Danilo Oliveira15:02:01

I see, looks like my future should write something in a channel when it is done in order to park a go block. Thanks!

James Amberger23:02:44

any way to see the methods on a js or java object ?


for java objects yes, there is this thing called reflection and there are entire books written on the subject, one of which happens to be on the clojure bookshelf


js is more complex because the object system is more loosey goosey , you can interate over an obejcts properties, but what is a method? what is a field containing a function? and then you get to start interating over the prototype 😕


A starting point could be to call datafy on your class and see what you get 🙂

(require '[clojure.datafy :refer [datafy]])
(datafy java.util.Date)
;; =>
{:bases #{java.lang.Object java.lang.Cloneable java.lang.Comparable},
 :flags #{:public},
  [{:name UTC,
    :return-type long,
    :declaring-class java.util.Date,
    :parameter-types [int int int int int int],
    :exception-types [],
    :flags #{:public :static}}],
;; ... about 300 more lines of data describing java.util.Date


That looks like it's indirectly calling clojure.reflect/reflect


correct. I found datafy a bit easier to use, you call it, it gives you data.


Right, but datafy might have specializations for particular classes that don't let you see the methods.


in this case datafy is being called on an instance of java.lang.Class

☝️ 2
👍 2

(please put us back on track if we're derailing your question, @U032EFN0T33!)


i use clojure.reflect/reflect a ton but i always forget about datafy


(thanks for the reminder)


Untested and haven't written CLJS lately (or even much JS), so please forgive if my interop isn't quite right or parens unbalanced. A "method" in JS is really just a property that is a function. So something looking roughly like

(defn own-methods [o]
  (filter #(= "function" (.- type %))
    (. Object.keys o)))
will give you a result that is likely what you want. Sub in Object.getOwnPropertyName instead of Object.keys if you also want non-enumerable properties. If your Object is using any of us own inheritance, or if you also want to know methods inherited from the built-in Objects, (e.g. "what are the methods available on a String“) then you have to recurse down the prototype chain, reading the props from each Object in the chain. Something like this, I think should give you all enumerable methods down the prototype.
; Using own-methods from above
(defn all-methods [o]
  (let [proto (. Object.getPrototypeOf o)]
  (if proto
    (concat (own-methods o)
            (all-methods proto))
    (own-methods o))))
Everything in JS inherits from Object, so you can expect a lot of noise in the result.