clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
Vachi 2020-10-10T00:29:13.300100Z

I haven't used it, but here is a talk about it https://www.youtube.com/watch?v=uwdtTQ2ky5Q , maybe you find it interesting

seancorfield 2020-10-10T00:29:59.300300Z

Thank you -- added to my list.

vncz 2020-10-10T16:16:15.303600Z

I remember there was a function in Clojure that would be like if (cond) f(a) else a

vncz 2020-10-10T16:16:25.304100Z

but I can't find it anymore…anybody has that on top of his head?

teodorlu 2020-10-10T16:22:21.304800Z

@vincenz.chianese is cond-> what you want?

(cond-> 10
  true inc)
;; => 11

(cond-> 10
  false inc)
;; => 10

vncz 2020-10-10T16:22:44.305Z

Aha! I think so!

👍 1
Ivan Fedorov 2020-10-10T18:43:00.308300Z

moved to #leiningen

agilecreativity 2020-10-10T18:54:11.309400Z

Is there a library that parse the fixed with file in Clojure?

agilecreativity 2020-10-10T18:55:52.311100Z

Quick google gave me this article - http://www.lexicallyscoped.com/2015/01/05/parsing-flat-files-in-clojure.html but it seems to be overkill for me.

zilti 2020-10-10T18:56:19.311600Z

You'll probably have to do that yourself, and read each line's fields with subs

zilti 2020-10-10T18:56:27.311800Z

At least that's how I'd do it

zilti 2020-10-10T18:57:06.312100Z

Should be quite straightforward actually.

agilecreativity 2020-10-10T18:57:51.312300Z

Thanks will give that a try then.

craftybones 2020-10-10T18:59:14.312700Z

You could also get fancy with a spec and use conform

zilti 2020-10-10T18:59:30.312800Z

Yes, read in the file with slurp, then do a (str/split yourstring #"\n") so you have one array entry per line, then just use subs with whatever field length you have repeatedly over each line

agilecreativity 2020-10-10T19:00:19.313Z

I am reading in huge file, so will do that lazily

teodorlu 2020-10-10T19:59:30.313700Z

@agilecreativity line-seq lets you handle a line at a time lazily https://clojuredocs.org/clojure.core/line-seq

👍 1
borkdude 2020-10-10T21:42:23.315500Z

This technique can also be used: https://blog.michielborkent.nl/2018/01/17/transducing-text/

👍 1
Setzer22 2020-10-10T21:49:45.316200Z

Any way I can use REBL to develop on a remote machine?

seancorfield 2020-10-10T22:12:25.318Z

@setzer22 REBL works "in process" so you could use it on the remote machine if you can "project" the UI from that machine onto yours (say via X11 if it's a *nix machine or remote desktop if it's Windows/Mac)...

👍 1
Setzer22 2020-10-11T08:39:58.328700Z

thanks! I'll see if I can pull off X11 forwarding on this machine

seancorfield 2020-10-10T22:13:14.318900Z

When I'm on my Windows laptop, I use Xlaunch so that I can run X11 UIs from WSL2 and then appear under Windows. Similar concept but not really "remote".