workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
that's my point - I don't care about symbols - I want to parse maps and vectors and take everything else as strings
2017-10-25T21:18:38.000200
Clementina
clojurians
clojure
write your own parser then
2017-10-25T21:19:02.000299
Rebeca
clojurians
clojure
<https://github.com/Engelberg/instaparse>
2017-10-25T21:19:12.000158
Rebeca
clojurians
clojure
look, the request wraps params like this, ``` {"customer-account-id" "f8f2b6b3-39b8-4e76-a9f0-fa4a65ee225a", "filter" "{:date {:from nil, :to nil}, :search nil}", "sort" "[:settled-at :desc]"} ``` on the server side I need to turn it into "normal' hash map a) need to keywordize keys - that's easy b) need to uwrap maps and vectors - what's the easiest way of doing that?
2017-10-25T21:21:39.000028
Clementina
clojurians
clojure
I suspect you could `(try (let [v (edn/read-string s)] (if (or (vector? v) (map? v)) v s)) (catch Throwable _ s))`
2017-10-25T21:23:30.000101
Daniell
clojurians
clojure
That would leave you with maps/vectors where the strings actually were EDN maps/vectors and leave you with the raw string everywhere else.
2017-10-25T21:24:11.000016
Daniell
clojurians
clojure
yeah, that is entirely different then what you first described
2017-10-25T21:24:13.000109
Rebeca
clojurians
clojure
that is well formed edn, strings are quoted, you can process it with edn/read-string then walk it making whatever changes you want
2017-10-25T21:24:47.000064
Rebeca
clojurians
clojure
anyone have a go-to way of debouncing? in cljs i just use the google closure debounce fn, but i can't find anything for clj
2017-10-25T21:39:42.000009
Judy
clojurians
clojure
I think I got slightly better idea. ``` (defn read-string* "reads-string by parsing only maps, vectors, keywords and leaving everything else as-is. Because `(type (clojure.edn/read-string \"foo\"))` =&gt; clojure.lang.Symbol" [v] (let [r (s/conform (s/or :r map? :r vector? :r keyword?) (read-string v))] (if (= r ::s/invalid) v (second r)))) ```
2017-10-25T21:52:50.000103
Clementina
clojurians
clojure
Bear in mind that if `read-string` throws an exception, you won't get back the original string -- in case `v` is not valid EDN.
2017-10-25T22:14:41.000144
Daniell
clojurians
clojure
daammmn...
2017-10-25T22:15:47.000025
Clementina
clojurians
clojure
Never got a fix unfortunately :disappointed:
2017-10-26T00:47:22.000030
Leota
clojurians
clojure
even after downgrading leiningen?
2017-10-26T09:25:30.000651
Candace
clojurians
clojure
haven’t tried that yet
2017-10-26T09:41:02.000154
Leota
clojurians
clojure
i recommend trying it… `lein downgrade 2.6.1` i think works
2017-10-26T09:42:36.000771
Candace
clojurians
clojure
that solved the leing ring issue for me at least
2017-10-26T09:42:43.000298
Candace
clojurians
clojure
Yeah, problem is I have lein instlled through brew
2017-10-26T09:54:01.000477
Leota
clojurians
clojure
and have no idea how to downgrade then :smile:
2017-10-26T09:54:07.000802
Leota
clojurians
clojure
yeah, downgrading fixed the issue
2017-10-26T10:03:53.000089
Leota
clojurians
clojure
thanks :slightly_smiling_face:
2017-10-26T10:03:55.000084
Leota
clojurians
clojure
is it an unofficial law in clojure that the first argument, if possible, be a collection? in order that things work nicely with swap!, update, update-in
2017-10-26T11:15:02.000648
Berry
clojurians
clojure
first in some contexts, last in others
2017-10-26T11:21:55.000263
Myles
clojurians
clojure
map/filter et al have it last
2017-10-26T11:22:10.000540
Myles
clojurians
clojure
<@Berry> Rich answered this here <https://groups.google.com/forum/#!topic/clojure/iyyNyWs53dc>
2017-10-26T11:25:56.000153
Evan
clojurians
clojure
ah, so it's "seq functions take seq last; collection funcs take collection first" ?
2017-10-26T11:30:25.000044
Berry
clojurians
clojure
that'd explain the filter/map case too
2017-10-26T11:30:34.000082
Berry
clojurians
clojure
I tend to almost always order my arguments from least to most variable
2017-10-26T11:31:09.000336
Hugo
clojurians
clojure
why does that make sense given: 1. clojure doesn't have nice partial application and 2. ppl generally optimzie for -&gt;, -&gt;&gt;, update, swap, ...
2017-10-26T11:32:05.000042
Berry
clojurians
clojure
i `partial` a lot
2017-10-26T11:32:19.000554
Willow
clojurians
clojure
I’m that weirdo that really like `partial` but mostly it’s just because I can keep track of my args cognitively easily with that heuristic
2017-10-26T11:32:37.000605
Hugo
clojurians
clojure
weird; I don't think there's a single partial code in my code, I tend to use #(... %1 ... ), maybe I need to learn how to use 'partial' in clojure
2017-10-26T11:33:13.000183
Berry
clojurians
clojure
For whatever reason my visual parser hangs on that literal lambda syntax. I’ll always either reach for partial or fn unless I’m writing throwaway
2017-10-26T11:34:51.000792
Hugo
clojurians
clojure
``` update-display (partial display-error-in-zone errorzone) show-user (comp update-display alert-box auth/unify-response) ``` from a let binding. Then i can just call `show-user` on all of the callbacks. I unify the repsonses, turn them into the alert box map required and then update-display
2017-10-26T11:41:11.000074
Willow
clojurians
clojure
Did anyone bring `re-natal` with hot reloading to run? It all seems to work except the hot reloading
2017-10-26T12:33:36.000481
Jon
clojurians
clojure
<@Jon> you need to disable the hot reloading feature in the react-native devtools; figwheel comes with its own hot reloading
2017-10-26T12:57:32.000604
Fe
clojurians
clojure
all the RN packager sees is a stub that includes the JS requires; figwheel does the rest
2017-10-26T12:58:01.000359
Fe
clojurians
clojure
<@Fe> ah alright, i’ll give it a try, thanks! I’m using intellij now and i’m not quite sure with what command i best start it. With the `react-native` task? Thats the only one which opens the app in my simulator.
2017-10-26T12:59:02.000266
Jon
clojurians
clojure
<https://github.com/drapanjanas/re-natal#development-with-figwheel>
2017-10-26T12:59:44.000073
Fe
clojurians
clojure
`lein figwheel` and `react-native run-ios` or `... run-android` should do the job
2017-10-26T13:00:14.000438
Fe
clojurians
clojure
Hmm since i’m working with intellij tasks and not the command line - i guess i’ll have to run both tasks - a leiningen task and a react-native one
2017-10-26T13:00:37.000644
Jon
clojurians
clojure
don't forget to run `re-natal use-figwheel` once before that
2017-10-26T13:00:41.000576
Fe
clojurians
clojure
forget about intellij for a minute and do it from the command line
2017-10-26T13:01:01.000032
Fe
clojurians
clojure
you can build shortcuts for your IDE when you know it works
2017-10-26T13:01:19.000609
Fe
clojurians
clojure
an IDE is only sugar for the command line
2017-10-26T13:01:43.000880
Fe
clojurians
clojure
<@Fe> That i know, i’m usually more of a command line guy :slightly_smiling_face:
2017-10-26T13:02:04.000393
Jon
clojurians
clojure
I’ll give it a try
2017-10-26T13:02:09.000565
Jon
clojurians
clojure
intellij will work fine as an editor though
2017-10-26T13:03:42.000540
Fe
clojurians
clojure
You should look at Spacemacs. <http://spacemacs.org> — Terminal based or GUI. But powerfull. --end of commercials--
2017-10-26T13:05:27.000476
Olen
clojurians
clojure
<@Olen> I just moved to intellij from spacemacs - for the good for that everyone working on the coming project can use the same environment
2017-10-26T13:09:12.000242
Jon
clojurians
clojure
We will have people which are not able to handle emacs right
2017-10-26T13:09:21.000076
Jon
clojurians
clojure
But thanks for the ad :smile:
2017-10-26T13:09:30.000314
Jon
clojurians
clojure
No problem. :sunglasses:
2017-10-26T13:09:43.000230
Olen
clojurians
clojure
Sorry for these guys, BTW.
2017-10-26T13:09:59.000011
Olen
clojurians
clojure
Well, older people have a hard time to learn a very new environment with less GUI than they are used to :smile: but yea, emacs is great
2017-10-26T13:11:00.000154
Jon
clojurians
clojure
awesome!!!
2017-10-26T13:12:27.000073
Candace
clojurians
clojure
great news :slightly_smiling_face:
2017-10-26T13:12:29.000470
Candace
clojurians
clojure
Emacs is older than me. Maybe, older than you too. March 20, 1985 It’s birtdate. But, no problem if you return us back. Your real home. :joy:
2017-10-26T13:13:02.000119
Olen
clojurians
clojure
Good luck with your project.
2017-10-26T13:13:46.000207
Olen
clojurians
clojure
<@Olen> Thanks :slightly_smiling_face:
2017-10-26T13:13:53.000606
Jon
clojurians
clojure
&gt;&gt;&gt; The original EMACS was written in 1976 by David A. Moon and Guy L. Steele Jr. as a set of Editor MACroS for the TECO editor.
2017-10-26T13:14:44.000357
Fe
clojurians
clojure
I’m very new to the clojure environment, so i hope i won’t struggle too much. I want to take a go with react-native and fulcro. Hope I won’t run into too many problems :smile:
2017-10-26T13:14:49.000245
Jon
clojurians
clojure
OMG. Sorry, my fault.
2017-10-26T13:15:03.000632
Olen
clojurians
clojure
Hey, hot-reload works! :smile: bit slow, but it works!
2017-10-26T13:18:44.000130
Jon
clojurians
clojure
<@Fe> thank you :slightly_smiling_face:
2017-10-26T13:18:56.000723
Jon
clojurians
clojure
np
2017-10-26T13:19:23.000501
Fe
clojurians
clojure
emacs was the first real program to use windows - which is why emacs terminology for windows and frames and such is totally different from all the apps that came later (and closer to how windows actually work in the real world)
2017-10-26T13:47:11.000238
Margaret
clojurians
clojure
<#C099W16KZ|emacs> is probably a better place for this discussion
2017-10-26T13:58:38.000623
Mia
clojurians
clojure
I have a piece of clojure data, representing hiccup. I need to go through the hiccup, andechange every ocurance of: :on-click :foo1 ==&gt; :on-click (get kw-&gt;func-map :foo1) :on-click :handler2 ==&gt; :on-click (get kw-func-map :handler2) Is there a standard way to do this ?
2017-10-26T14:21:17.000683
Berry
clojurians
clojure
this is the best I have so far: ``` (def kw-&gt;func {}) (def sample-data [:div [:svg {:on-click :foobar}]]) (defn conv-function [x] (if (and (map? x) (:on-click x)) (assoc x :on-click [:lookup (:on-click x)]) x)) (clojure.walk/postwalk conv-function sample-data) ```
2017-10-26T14:30:27.000359
Berry
clojurians
clojure
<@Berry> I understand if the `map?` check is there for clarity, but it’s redundant - `:on-click` will only return non-nil if it can be looked up (I guess there’s a corner case of sets, but there’s nothing in hiccup that knows what to do with a set containing a keyword that I know of)
2017-10-26T14:53:33.000470
Margaret
clojurians
clojure
also, for that general flavor of thing I have when-pred `(defn when-pred [p? x] (when (p? x) x))`
2017-10-26T14:55:06.000374
Margaret
clojurians
clojure
(:on-click (when-pred map? x))
2017-10-26T14:55:30.000018
Margaret
clojurians
clojure
good call on the map? // I may keep it for stylistic reasons as a "type sig" of "this is a map", but I agree with you that it's redundant
2017-10-26T14:56:12.000430
Berry
clojurians
clojure
<@Berry> you can do that transformation much more precisely and efficiently with specter
2017-10-26T15:00:13.000822
Owen
clojurians
clojure
<@Owen>: I agree. The problem I have with specter is that: 1. I can implement postwalk from scratch [so I understand it] 2. to this day, I haven't managed to implement a mini-specter from scratch, so it's still very magical to me
2017-10-26T15:01:50.000674
Berry
clojurians
clojure
<@Berry> did you look at <https://github.com/nathanmarz/basic-specter> ?
2017-10-26T15:03:06.000495
Owen
clojurians
clojure
that's basically the original implementation without any of the optimizations that came later
2017-10-26T15:03:55.000525
Owen
clojurians
clojure
<@Owen>: not until now; 30 lines is impressive; will look into it
2017-10-26T15:04:02.000414
Berry
clojurians
clojure
essentially still how it works, especially transformation
2017-10-26T15:04:13.000141
Owen
clojurians
clojure
what are the complex transforms that makes it faster (and this version slower) ?
2017-10-26T15:04:52.000140
Berry
clojurians
clojure
the transform implementations are still the same for the most part
2017-10-26T15:05:31.000546
Owen
clojurians
clojure
`ALL` uses protocols to dispatch on each type, and esp. for maps uses a different implementation per map type
2017-10-26T15:05:53.000559
Owen
clojurians
clojure
and then there's the inline compilation / caching system that removes most of the navigator composition overhead
2017-10-26T15:07:27.000647
Owen
clojurians
clojure
that stuff doesn't matter when it comes to what's actually going on when you do transform – basic-specter captures that aspect
2017-10-26T15:08:16.000055
Owen
clojurians
clojure
right, I realize it doesn't change semnatics, I'm just curious what issues you ran into and how you overcame them
2017-10-26T15:09:07.000657
Berry
clojurians
clojure
the inline compilation / caching stuff was extremely hard, optimizing the individual navigators was just a lot of digging into esoteric details of Clojure
2017-10-26T15:10:48.000274
Owen
clojurians
clojure
`ALL`, `MAP-VALS`, `MAP-KEYS` were the most work to optimize
2017-10-26T15:11:33.000364
Owen
clojurians
clojure
when specter outperforms idiomatic clojure code it's usually due to those navigators
2017-10-26T15:12:07.000405
Owen
clojurians
clojure
I'm seeing a weird problem with reading the new namespaced maps in a repl. I get this error in both a bare `lein repl` and `boot repl`: ``` user=&gt; (defn foo [] #:a{:b 1}) #_=&gt; #'user/foo user=&gt; (defn foo [] #:a{:b 1} ) #_=&gt; user=&gt; java.lang.RuntimeException: EOF while reading, starting at line 1 clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: EOF while reading, starting at line 1 java.lang.RuntimeException: Unmatched delimiter: ) clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: Unmatched delimiter: ) ```
2017-10-26T16:02:15.000124
Shaunda
clojurians
clojure
it's the same exact code except the second version has a newline after the namespaced map. Can I bother someone else to try this code in their repl and see what they get? I'm on clojure 1.9.0-beta3
2017-10-26T16:03:48.000257
Shaunda
clojurians
clojure
I would like to try it in a bare (non lein/boot) clojure repl, but I'm on ubuntu and the installer only works for macos right now
2017-10-26T16:04:29.000377
Shaunda
clojurians
clojure
ok, so I tracked ^this down to being a problem with how the text is being read from the terminal
2017-10-26T16:18:05.000454
Shaunda
clojurians
clojure
it’s in the reply / nrepl layer right?
2017-10-26T17:00:46.000137
Margaret
clojurians
clojure
you can use a bare repl by downloading the jar and running it with java, you don’t need deps to reproduce
2017-10-26T17:01:12.000534
Margaret
clojurians
clojure
(oh - wait - the latest jars need deps, never mind)
2017-10-26T17:01:23.000340
Margaret
clojurians
clojure
yeah <@Margaret> I just followed the new instructions to get a bare clojure repl on linux and I do not see the problem there, only in lein/boot
2017-10-26T17:02:19.000117
Shaunda
clojurians
clojure
you can also make a project with only clojure.core as a dep and no code, and make and run an uberjar
2017-10-26T17:02:25.000386
Margaret
clojurians
clojure
or `lein trampoline repl`
2017-10-26T17:02:31.000425
Margaret
clojurians
clojure
so either in the reply/nrepl layer or it's a terminal thing?
2017-10-26T17:03:34.000123
Shaunda