workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
any parser will have that information
2017-11-17T19:47:20.000043
Rebeca
clojurians
clojure
it just depends on if you can get at it
2017-11-17T19:47:32.000042
Rebeca
clojurians
clojure
grammars tend to be thought of as recognizers of languages, but they are also recipes that can be used to generate strings that are members of a language
2017-11-17T19:48:16.000218
Rebeca
clojurians
clojure
the parsing with derivatives stuff spec's parser is based on seems like it would be really good for that stuff, but spec doesn't do partial parses, and finding some protocol for communicating where you want the parse to stop, and how you when to generate possible completions of the parse might be tricky
2017-11-17T19:49:45.000138
Rebeca
clojurians
clojure
<@Rebeca>: really? I thought for most parsers, on incomplete strings, it's okay to just barf and say "this fails somewhere"
2017-11-17T19:52:04.000198
Berry
clojurians
clojure
sure
2017-11-17T19:52:24.000195
Rebeca
clojurians
clojure
Earley one of the few parsers I know of where the algorithm makes it blatantly clare what values are valid for next token give current prefix
2017-11-17T19:52:37.000145
Berry
clojurians
clojure
In particular, I believe this is one of the main advantages of Earley over CYK or Packrat for parsing CFGs.
2017-11-17T19:52:56.000184
Berry
clojurians
clojure
that is just because most other parser libraries don't provide meta information about the structure of the grammar they represent
2017-11-17T19:53:47.000062
Rebeca
clojurians
clojure
the information is encoded in the structure of the parser, but it is hard to get at it
2017-11-17T19:54:04.000144
Rebeca
clojurians
clojure
I'm not convinced that is true, but I can't disprove it either.
2017-11-17T19:54:25.000060
Berry
clojurians
clojure
Is there a way to *get* the validator function of an atom ? I'm trying to create a spec that asserts: this atom has the following validator functikon.
2017-11-17T19:55:58.000124
Berry
clojurians
clojure
<https://clojuredocs.org/clojure.core/get-validator>
2017-11-17T20:01:28.000147
Berry
clojurians
clojure
why is `atom` in core, but `atom?` in clojure.inspector ? <https://clojuredocs.org/clojure.inspector/atom_q> Is there some other way I should be checking if an object is an atom ?
2017-11-17T20:07:11.000017
Berry
clojurians
clojure
`#(instance? clojure.lang.Atom %)` ?
2017-11-17T20:08:14.000005
Raul
clojurians
clojure
anybody use clojure or clojurescript to write iOS apps that use the audio engine? I'm interested to see if I can port one of my apps to clj/cljs
2017-11-17T21:27:08.000050
Magda
clojurians
clojure
``` (defn atom? [obj] (instance? clojure.lang.Atom obj)) ``` works for clojure. In cljs, how do I check if an object is an atom ?
2017-11-17T22:57:18.000064
Berry
clojurians
clojure
<@Berry> A guess but I would imagine it'll be a protocol and you can use `satisfies?` on it...
2017-11-17T23:21:43.000077
Daniell
clojurians
clojure
Hmm, no, apparently `(instance? Atom obj)` -- `cljs.core.Atom` according to the Replete iOS app.
2017-11-17T23:25:08.000004
Daniell
clojurians
clojure
there's an "IAtom" somewhere in the source, but I wasn't sure how to include it
2017-11-17T23:35:32.000077
Berry
clojurians
clojure
the full, appearing to work code, in case anyone else wants it, is: ``` (defn atom? [obj] (instance? #?(:clj clojure.lang.Atom :cljs cljs.core.Atom) obj)) ```
2017-11-17T23:39:39.000086
Berry
clojurians
clojure
hello all, I'm storing some information on a atom and, in the end, I have this atom *data* `(type data) =&gt; clojure.lang.Atom` that, when I put @ become `(type @data) =&gt; clojure.lang.PersistentVector`. I need to convert this PersistentVector(ou the original atom) into a json array. Is there a built-in way of doing this?
2017-11-18T00:59:22.000059
Bettyann
clojurians
clojure
there are two popular json libraries - cheshire and clojure.data.json
2017-11-18T01:00:13.000073
Margaret
clojurians
clojure
there's nothing built in
2017-11-18T01:00:19.000023
Margaret
clojurians
clojure
nothing canonical I could do to avoid add any lib? any loop specific strucutre or somethig?
2017-11-18T01:01:14.000071
Bettyann
clojurians
clojure
neither the jvm nor clojure itself comes with a json generator, you need a library (even if you write that library yourself, which I don't recommend)
2017-11-18T01:02:11.000010
Margaret
clojurians
clojure
json is not the problem as I'm using a ring middleware to convert, the problem is that PersistentVector doesn't provide a valid json array, due to the lack of comma or something
2017-11-18T01:04:21.000004
Bettyann
clojurians
clojure
this is my real problem
2017-11-18T01:04:40.000066
Bettyann
clojurians
clojure
you are using the middleware wrong then
2017-11-18T01:05:30.000007
Margaret
clojurians
clojure
is there any built-in convertion instruction for persistentVector?
2017-11-18T01:05:32.000002
Bettyann
clojurians
clojure
the vector is not the problem
2017-11-18T01:05:34.000044
Margaret
clojurians
clojure
if commas aren't coming out, you aren't generating json
2017-11-18T01:05:55.000016
Margaret
clojurians
clojure
if a write { :structures "like that" } a valid json comes out. But { :information *any-persistentVector* } not
2017-11-18T01:06:59.000038
Bettyann
clojurians
clojure
that's not my experience of wrap-json at all
2017-11-18T01:07:22.000012
Margaret
clojurians
clojure
something else is wrong here
2017-11-18T01:07:28.000081
Margaret
clojurians
clojure
(unless there's been a regression and you are somehow the first one to see it)
2017-11-18T01:08:05.000033
Margaret
clojurians
clojure
well, when I do what I wrote, I got something like `{"information": [{:index 0, :data 1} {:index 1, :data 100}] }` the problem of commas are related only to vector elements, not every element internally
2017-11-18T01:10:31.000074
Bettyann
clojurians
clojure
I've been trying a lot of conversions the whole day but nothing worked
2017-11-18T01:10:49.000014
Bettyann
clojurians
clojure
the only way I could see getting that result is if somebody called str on the vector before it was passed to the middleware
2017-11-18T01:11:52.000021
Margaret
clojurians
clojure
because the middleware uses a proper json generator that wouldn't do that
2017-11-18T01:12:11.000016
Margaret
clojurians
clojure
``` (str @block) =&gt; "[{:index 0, :data 100} {:index 1, :data 500 }]" ```
2017-11-18T01:14:20.000013
Bettyann
clojurians
clojure
<@Bettyann> here's a REPL session showing that `ring-json/wrap-json-response` works as expected: ```boot.user=&gt; (require '[ring.middleware.json :as json]) nil boot.user=&gt; (defn handler [req] {:body [1 2 3 4] :status 200 :headers {}}) #'boot.user/handler boot.user=&gt; (defn app (json/wrap-json- json/wrap-json-body json/wrap-json-params json/wrap-json-response boot.user=&gt; (app {}) {:body "[1,2,3,4]", :status 200, :headers {"Content-Type" "application/json; charset=utf-8"}}``` Note that the response -- the `:body` -- needs to be a _vector_ *not* `(str some-vector)`
2017-11-18T01:14:59.000061
Daniell
clojurians
clojure
Don't call `str` on the vector.
2017-11-18T01:15:16.000010
Daniell
clojurians
clojure
Here's another example (using `ring.util.response/resp`): ```boot.user=&gt; (require '[ring.util.response :as resp]) nil boot.user=&gt; (defn handler [req] (-&gt; (resp/response {:my-vector ["I" "am" "a" "vector"]}) (resp/status 200))) #'boot.user/handler boot.user=&gt; (def app (json/wrap-json-response handler)) #'boot.user/app boot.user=&gt; (app {}) {:status 200, :headers {"Content-Type" "application/json; charset=utf-8"}, :body "{\"my-vector\":[\"I\",\"am\",\"a\",\"vector\"]}"}```
2017-11-18T01:17:02.000007
Daniell
clojurians
clojure
I'm doing something like that: ``` (defn output-json [information] {:status 200 :headers {"Content-Type" "application/json"} :body information }) (defn show-data [] (output-json {:length (count @core/data) :chain (str @core/data)} )) ```
2017-11-18T01:17:02.000056
Bettyann
clojurians
clojure
_Don't call `str`!_
2017-11-18T01:17:13.000035
Daniell
clojurians
clojure
ok, let me try
2017-11-18T01:17:24.000094
Bettyann
clojurians
clojure
<@Bettyann> you are doing exactly the thing I said would cause your bug
2017-11-18T01:17:30.000033
Margaret
clojurians
clojure
yup, the str. That damn str was driving me crazy
2017-11-18T01:20:45.000046
Bettyann
clojurians
clojure
thank you
2017-11-18T01:20:53.000037
Bettyann
clojurians
clojure
<@Bettyann> BTW, welcome to Clojurians! I saw you just joined half an hour ago.
2017-11-18T01:21:54.000051
Daniell
clojurians
clojure
Are you new to Clojure? Or did you just find out about us?
2017-11-18T01:22:14.000047
Daniell
clojurians
clojure
Thank you! And yes, I just found about this slack
2017-11-18T01:22:32.000053
Bettyann
clojurians
clojure
I'm actually from erlang
2017-11-18T01:22:46.000060
Bettyann
clojurians
clojure
joining a clojure project on my work
2017-11-18T01:23:01.000004
Bettyann
clojurians
clojure
Oh cool. The Functional Prolog LOL :laughing:
2017-11-18T01:23:01.000042
Daniell
clojurians
clojure
lol
2017-11-18T01:23:06.000005
Bettyann
clojurians
clojure
clojure is awesome
2017-11-18T01:23:18.000062
Bettyann
clojurians
clojure
I'm just having some small issues to get used
2017-11-18T01:23:37.000003
Bettyann
clojurians
clojure
I did a lot of Prolog back in the day, and I did an Erlang workshop at Lambda Jam a few years ago. Interesting language.
2017-11-18T01:23:37.000011
Daniell
clojurians
clojure
I work with payment processing in erlang
2017-11-18T01:24:08.000006
Bettyann
clojurians
clojure
is nice, works well and I write new things in LFE(lisp flavored erlang). This led us to start some clojure experiments
2017-11-18T01:24:51.000009
Bettyann
clojurians
clojure
and, well, JVM got my boss heart
2017-11-18T01:25:05.000006
Bettyann
clojurians
clojure
and we are rewriting somethings in clojure, to check if we can go with this
2017-11-18T01:26:03.000039
Bettyann
clojurians
clojure
I rather go with clojure than elixir
2017-11-18T01:26:14.000027
Bettyann
clojurians
clojure
Pure erlang is no longer an option as is not too easy to find programmers
2017-11-18T01:27:02.000030
Bettyann
clojurians
clojure
And BEAM is an island. The JVM opens a lot more doors.
2017-11-18T01:27:23.000082
Daniell
clojurians
clojure
yup, this is the main point
2017-11-18T01:27:45.000030
Bettyann
clojurians
clojure
and clojure is nice to code with, you feel productive
2017-11-18T01:28:08.000011
Bettyann
clojurians
clojure
(don't get me wrong: BEAM is a _great_ island, but I don't know how broad that "church" will ever be... Erlang, LFE, Elixir)
2017-11-18T01:28:23.000049
Daniell
clojurians
clojure
yup, this is true. BEAM is great, but JVM is a world
2017-11-18T01:28:49.000038
Bettyann
clojurians
clojure
I've been on the JVM since '97... Java, Groovy, Scala, Clojure... and, would you believe, among all of that: CFML on the JVM too :slightly_smiling_face:
2017-11-18T01:29:14.000012
Daniell
clojurians
clojure
ColdFusion or the open source engine Lucee
2017-11-18T01:29:25.000059
Daniell
clojurians
clojure
lol didn't even know there was cfml on jvm
2017-11-18T01:29:56.000033
Bettyann
clojurians
clojure
Most people don't.
2017-11-18T01:30:23.000037
Daniell
clojurians
clojure
JVM is battle tested, the banks that we have to interface with use it, so is just natural
2017-11-18T01:30:51.000064
Bettyann
clojurians
clojure
BEAM is good, really really good
2017-11-18T01:31:15.000046
Bettyann
clojurians
clojure
and we have a lot of lobby for elixir here
2017-11-18T01:31:25.000064
Bettyann
clojurians
clojure
as the creator, jose valim, is from here
2017-11-18T01:31:35.000003
Bettyann
clojurians
clojure
I'm from Brazil, btw
2017-11-18T01:31:45.000033
Bettyann
clojurians
clojure
and his company, plataformatec, try to make people use elixir
2017-11-18T01:32:06.000012
Bettyann
clojurians
clojure
I guess there's always <https://github.com/trifork/erjang/wiki> and JRuby :slightly_smiling_face:
2017-11-18T01:32:16.000006
Daniell
clojurians
clojure
lol
2017-11-18T01:32:36.000037
Bettyann
clojurians
clojure
It's late for you in Brazil (or early, depending on how you look at it)
2017-11-18T01:32:46.000048
Daniell
clojurians
clojure
3:32am
2017-11-18T01:32:56.000034
Bettyann
clojurians
clojure
10:23pm here in San Francisco
2017-11-18T01:33:09.000060
Daniell
clojurians
clojure
haha nice
2017-11-18T01:33:17.000052
Bettyann
clojurians
clojure
but is common for us to be online this time at friday/saturday. We grab some beers, go code in a beach or any pool, and this hour we start to fell human again
2017-11-18T01:34:51.000048
Bettyann
clojurians
clojure
:beers:
2017-11-18T01:35:20.000009
Daniell
clojurians
clojure
I was trying to get some pictires but I'm too drunk lol
2017-11-18T01:41:00.000068
Bettyann
clojurians
clojure
well, thank you guys, see you later. You are awesome
2017-11-18T01:41:22.000032
Bettyann
clojurians
clojure
Hello developers, i have now been using spacemacs for my clojure development since last 4 months but there is one feature which i am still not able to configure. That is auto-complete for inbuilt library functions, eg. when i type fil then it should already suggest me filter or any other functions available for it Currently i have installed auto-completion layer in my spacemacs and set (global-company-mode t) which enables dumb auto-complete everywhere that is now when i type anything if that function or variable name is used previously only then it will suggest me, its not smart. I have did alot of research and read ac-cider gives it but it shows now its depricated and i am not able to configure it in my spacemacs. I have been stuggling for this since long now and i am pretty sure someone might have configured this in there setup can anyone help me out.??
2017-11-18T02:09:08.000020
Jenee
clojurians
clojure
How you guys manage `Errors` and `Failures` in `Clojure`. of course in `functional way`.
2017-11-18T09:22:10.000048
Olen
clojurians
clojure
Anyone in Hong Kong?
2017-11-18T09:27:31.000052
Tien
clojurians
clojure
Hmm, why does Clojure accept doubles as array indices? `(aget (into-array [1 2 3]) 0.1)`
2017-11-18T10:26:38.000060
Johana
clojurians
clojure
<@Johana> Not an answer to your question, but this is the one last difference that we could ideally patch up in ClojureScript in order to make behavior be consistent. (We can't round down right now without breaking code that is misusing `aget` by passing property names.)
2017-11-18T10:28:22.000050
Dirk
clojurians
clojure
That’s exactly where my question comes from (reacting on your twitter announcement)
2017-11-18T10:28:46.000046
Johana
clojurians
clojure
I would rather have `aget` accept strings than doubles :joy:
2017-11-18T10:29:09.000025
Johana
clojurians
clojure
Yeah, if the entire ClojureScript community used `:checked-access` then we could conceivably safely fix things by adding an inexpensive operation to round down.
2017-11-18T10:29:38.000036
Dirk
clojurians
clojure
It’s no big deal switching to `goog.object`. But why on earth would you pass doubles when you want ints. It seems a bug to me.
2017-11-18T10:30:09.000176
Johana