beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
2021-01-07T00:02:49.363800Z

no, I doubt anyone is using logic programming for that, I don't think it is a good fit

2021-01-07T00:03:50.364600Z

it sounds like you want to model a process over time, which, I think the gold standard for is still a finite state machine

2021-01-07T00:05:06.365800Z

e.g. if you are in state S0 you can do E1, E2, or E3, if you do E1 or E2 you move to state S1 where you can do E4, and if you do E3 you move to S2 where you can do E5 or E6, etc

2021-01-07T00:06:59.366500Z

what are describing is very similar to something like session types as well, which are usually built on a fsm

2021-01-07T00:08:29.367900Z

one way to describe that kind of thing would be for each state give a set of valid json-schemas, and what state to transition to given a schema match

2021-01-07T00:09:40.369200Z

ubf's schema language is kind of an example of that, but doesn't use json schema (https://ubf.github.io/ubf/ubf-user-guide.en.html)

dgb23 2021-01-07T00:09:44.369400Z

Right. I’m half embarrassed that I never thought of this. I use FSMs for all sorts of things in GUIs already….

dgb23 2021-01-07T00:11:16.370600Z

A visualized FSM would be super easy to communicate with as well

2021-01-07T00:11:29.370700Z

I dunno, specifying process behavior vs. just specifying messages processes exchange still seems very bleeding edge.

2021-01-07T00:12:37.371700Z

it is an area of interest, but I haven't seen a lot of it used in practice

2021-01-07T00:13:09.372400Z

I think maybe because most exposed public apis tend to be "stateless" rest things

dgb23 2021-01-07T00:13:36.373100Z

fulcro has a story about state machines, but I didn’t find the time to study the framework in full so far

dgb23 2021-01-07T00:13:44.373300Z

(a UI framework for clojure)

2021-01-07T00:14:47.373800Z

https://gist.github.com/hiredman/60e5e6f0025cb38c8a7739d21f5a8ce6#file-scratch-clj-L124 is a ubf kind of schema built on top of spec

2021-01-07T00:15:31.374800Z

once you have a finite state machine as data, that is a kind of relational thing, so there might be interesting things you can do querying the fsm with something like core.logic

dgb23 2021-01-07T00:23:36.375400Z

Dammit I wanted so sleep early tonight. But thanks a lot @hiredman!❤️

zackteo 2021-01-07T01:14:21.379200Z

Hi Everyone, I've been trying to look for a good way to parse KML (XML for GIS) into dataframe format or to export as a CSV Am considering on making my own library for this. I understand there is data.zip and data.xml. Are there any good examples for the usage of these libraries? And does making my own library to do this make sense? Or is the best/own way to make use of data.xml/zip and modify it accordingly to parameters of the kml?

zackteo 2021-01-07T08:16:46.495900Z

Right the HTML is part of the specification https://docs.fileformat.com/gis/kml/

zackteo 2021-01-07T01:41:09.379300Z

@factorhengineering I use doom emacs and cider. If you are new to emacs and are doing clojurescript. You will likely find better leverage using vscode! It can be quite daunting trying to pick up both a new language and emacs at the same time. And cider can be improved for ClojureScript support - also because ClojureScript just generally has more moving parts

zackteo 2021-01-07T01:46:38.379600Z

I think you are referring to brew ? People mainly use it for apple. And while I personally don't use it. You can definitely use it in Linux and by extension wsl

zackteo 2021-01-07T01:49:29.379800Z

If you do want to stick to emacs (which I have a feeling you will 😅) and have doom emacs specific questions i can try to help (there also a very helpful discord channel with the creator and there's a small telegram group if you are interested) tho I understand your main problem is wrt setting up for ClojureScript.

raspasov 2021-01-07T02:23:14.380100Z

Converting XML to CSV is very straightforward in Clojure, you can definitely use existing libraries. About “dataframes”: in Clojure those are generally unnecessary as the language itself provides plenty of simple abstractions to process data that exceeds available memory. But if you need to interop with other tools that require them, then that’s another case. Curious to know more details and we can discuss further.

zackteo 2021-01-07T02:28:12.380300Z

Hmmm am doing a data science project with my friends. And for their sake am trying to convert KML into CSV so it is easily for them to manipulate it from there. (They are using python.) Usually people use a command line tool called ogr2ogr for this. But the description (one of the columns) is left as an xml string. Was trying to see if I can do the processing for them within clojyee

raspasov 2021-01-07T02:28:57.380500Z

Do you have an example of the XML you’re trying to convert to CSV? Is it 2 dimensional?

zackteo 2021-01-07T02:30:28.380700Z

Was using this as a test example https://data.gov.sg/dataset/dengue-cases it is a zip file with 5 datasets of the same format

zackteo 2021-01-07T02:37:42.381Z

I believe it is 2-dimensional(?)

raspasov 2021-01-07T02:40:03.381200Z

Ok 1 sec

FHE 2021-01-07T02:43:43.381400Z

@zackteo Great. I have haunted the Discord channel with a few painfully nooby questions, but I might reach out to you about it too. I must say, it should be made impossible for anyone to install Doom Emacs without coming across huge bold text stating that reflex hits of [Ctrl]-[z] and even [Ctrl]-[v] will gaslight you. I hit C-v to try to paste something, saw what looked like horrible mangling of my text (just a page-down, but looks a lot like deleting a page of text), then hit C-z to reverse the changes only to have that not work and instead break some shortcuts and/or enable others (no idea it switched between normal shortcuts and evil/vim shortcuts), then just quit the program and lose work and curl up into a ball in the corner just to escape the insanity.

zackteo 2021-01-07T02:47:14.381600Z

Yeahhhh ... thats why learning emacs and clojure might not be super ideal 😅 i use emacs bindings within doom emacs btw (non EVIL). I had a year of using emacs as my daily driver before, exploring clojure :x

seancorfield 2021-01-07T02:47:29.381800Z

@factorhengineering It's pretty fair to say that any Emacs distro in its default setup is going to have a very non-intuitive set of key bindings and that the "default, normal" key bindings people expect from every other editor in the (modern) world are going to do "Bad Things(tm)".

zackteo 2021-01-07T02:48:49.382Z

This is the doom emacs telegram group is @doomemacs btw

FHE 2021-01-07T02:49:04.382200Z

Oh, and I had to go through the process above multiple times before piecing together what exactly was going wrong---what 2 shortcut key combos that until Emacs had been universal and were at muscle-memory status were hijacked by Emacs/evil for other functions.

seancorfield 2021-01-07T02:51:40.382400Z

That's not really fair: Emacs has been around since long before modern editors standardized on different key bindings.

FHE 2021-01-07T02:52:49.382600Z

I did have a couple of 1- or 2-month bursts of using Emacs before, but never to do anything productive because the learning curve didn't allow for it.

FHE 2021-01-07T02:53:33.382800Z

@seancorfield Absolutely. I just mean they had been universal in my experience.

seancorfield 2021-01-07T02:54:55.383200Z

When Emacs appeared, there really were no conventions for copy/paste/etc. Emacs picked a set of keys and consistently kept them for many decades. I started using Emacs in the 17.x days in the mid-'80s. I stopped using it day-in, day-out in the 19.x days some time in the '90s. Then came back to it once I started doing Clojure (I think late 23.x days?).

raspasov 2021-01-07T02:55:26.383400Z

(ns scratch
  (:require [clojure.data.xml :refer :all :as x])
  (:import (<http://java.io|java.io> StringReader)))



(let [input-xml (StringReader. (slurp "/Users/raspasov/Downloads/dengue-cases/dengue-cases-central-kml.kml"))]
  (x/parse input-xml))
From here on, you can extract whatever you need from the XML data tree.

zackteo 2021-01-07T02:56:23.383600Z

The problem i guess was that emacs was consistent but keyboard layouts weren't 😅 thankfully i am using a split keyboard with thumb clusters

FHE 2021-01-07T02:56:49.383800Z

Also, Ctrl-v and Ctrl-z are baked right into the OS I'm using (Windows, and isn't that the case in at least most Linux distros too?), in addition to every program I'd ever used before, hence the 'hijacking' viewpoint, despite the history completely explaining it. 😉

raspasov 2021-01-07T02:57:16.384Z

Via regular Clojure functions like map, filter, get-in, etc

FHE 2021-01-07T02:58:18.384200Z

I'm not writing Emacs off for it of course. If its the best I'll work for it. I battled typing like a 2-year-old to learn the Dvorak keyboard layout and I'll battle through this.

FHE 2021-01-07T02:59:10.384400Z

Should I maybe go with winner-mode, though? I kind of want to give Doom Emacs a good long try before thinking about changing anything, but...

seancorfield 2021-01-07T02:59:48.384600Z

@factorhengineering As I've said, I experimented with a bunch of editors when I learned Clojure -- including Emacs -- but happily switched to Atom and now VS Code. I think if you have experience already with an editor you like, you should just stick with it (as long as it supports Clojure).

👍 1
zackteo 2021-01-07T02:59:51.384800Z

I did exactly that actually. Guess I need to manually explore the data hahaha. The hierarchical nature of the xml can be quite daunting

seancorfield 2021-01-07T03:00:17.385Z

I honestly don't see any compelling reasons for folks to switch from their current editor to Emacs, unless they actually want to learn Emacs.

FHE 2021-01-07T03:00:30.385200Z

I can see it being hard to learn something when every other piece of software is a force in the opposite direction.

zackteo 2021-01-07T03:01:00.385400Z

^ and in the learning emacs case oftentimes doing learning emacs and clojure simultaneously is a recipe for disaster 😅

👍 1
FHE 2021-01-07T03:01:02.385600Z

The only editors I've used have been Eclipse for Java and NotePad++ for HTML and CSS.

seancorfield 2021-01-07T03:01:49.385800Z

Ah, there used to be a pretty good plugin for Eclipse but sadly no more. IntelliJ/Cursive might be more familiar to you? (and more productive for learning)

zackteo 2021-01-07T03:02:03.386Z

Thanks for your help though :)

raspasov 2021-01-07T03:03:00.386200Z

Yea… I was just looking at it, it looks messy this one, if the xml has some sort of a data spec or fields listed, that can help

FHE 2021-01-07T03:03:24.386400Z

I'm OK with not knowing how to perform a function and having to look it up the first 10 or 100 times. Unexpected effects are the only real problem. Maybe winner-mode would prevent most or all of that. I'm just afraid it might break something about Emacs or Doom.

FHE 2021-01-07T03:06:22.386700Z

I also thought it might rob me of the opportunity to get on board with the better Emacs way (of 'yank' etc)...but now that I write out the problem and no I'm not going to stop using C-v and C-z as usual just about everywhere else, I think I'm ready to figure out how to make just that one tweak to Emacs/Doom.

seancorfield 2021-01-07T03:06:25.386900Z

I believe there are Emacs modes that install "sane" (modern) key bindings for at least cut/copy/paste/undo -- but I've never tried them.

zackteo 2021-01-07T03:06:28.387100Z

Are you getting confused about both vim and emacs keybindings? If you want to continue with emacs. Maybe spacemacs or emacs prelude (maintained by the creator of cider) might be better?

FHE 2021-01-07T03:06:46.387300Z

@seancorfield I think winner-mode does exactly that.

zackteo 2021-01-07T03:07:41.387500Z

Theres also a emacs "distribution" which does that. Believe that was what he is referring to

seancorfield 2021-01-07T03:08:03.387700Z

I like that I can go between almost any macOS app and my editor and have the "same" key bindings, and also between any Windows app and my editor. And that I have the exact same key bindings in my editor on macOS and Windows for all the Clojure-related stuff.

FHE 2021-01-07T03:08:35.387900Z

Correction: I just looked it up and it does nothing like that. My mistake. winner-mode instead makes includes window manipulation actions accessible by the undo and redo commands. Also neat.

zackteo 2021-01-07T03:08:56.388100Z

😅 yes ... I can be a pain when I leave emacs and keep trying to copy and paste with c-w and c-y

😂 1
FHE 2021-01-07T03:09:31.388300Z

@seancorfield What keybindings are you referring to?

FHE 2021-01-07T03:09:44.388500Z

Just the main 5? copy, cut, paste, undo, redo?

FHE 2021-01-07T03:09:57.388700Z

...and maybe select-all.

zackteo 2021-01-07T03:10:04.388900Z

I'm not sure if I just picked a horribly confusing dataset or if that's just kml specifications in general

zackteo 2021-01-07T03:10:27.389100Z

Thats why I was considering a wrapper to skip some of that

seancorfield 2021-01-07T03:10:36.389300Z

Since I stopped using Emacs four years ago, I no longer have to think about that :rolling_on_the_floor_laughing:

FHE 2021-01-07T03:10:59.389500Z

but are those the ones you were thinking about when you wrote that?

seancorfield 2021-01-07T03:11:44.389700Z

Pretty much all key bindings behave the same across all apps and my editor, on each platform (yes, those key bindings are different between macOS and Windows to some extent, but they are still "internally consistent").

seancorfield 2021-01-07T03:12:53.389900Z

ctrl-f = find (cmd-f on macOS). ctrl-g = find again (cmd-g on macOS), cut, copy, paste, undo, ctrl-s = save (cmd-s on macOS)... etc etc etc

seancorfield 2021-01-07T03:13:39.390200Z

Emacs throws that whole thing out the window... 😐 including terminology around "window" etc 🙂

seancorfield 2021-01-07T03:15:55.390400Z

Don't get me wrong: I totally understand the power of Emacs and its ecosystem -- it's pretty much an operating system all on its own, and it has an IRC package (which I used a lot in my early days with Clojure) and email and usenet (anyone remember that?) and org-mode (which I admit I never really "grokked") and so on.

seancorfield 2021-01-07T03:16:25.390600Z

And I might actually consider Emacs again if it had a decent socket REPL client for Clojure (it doesn't).

seancorfield 2021-01-07T03:17:14.390800Z

But I don't use/want CIDER or nREPL or any of that middleware etc. I want a plain socket REPL and I want sane key bindings for every action.

FHE 2021-01-07T03:17:30.391Z

Aha! Found it: cua-mode (https://www.emacswiki.org/emacs/CuaMode)

raspasov 2021-01-07T03:19:38.391200Z

Yea if there’s anything like that, perhaps worth a look; but it does look confusing (especially if it lacks explanation/specification)

raspasov 2021-01-07T03:19:57.391400Z

I even see HTML tables in there! Doesn’t look very clean 🙂

FHE 2021-01-07T03:20:16.391700Z

Then again, I guess I could take the plunge into vim bindings. I only tried out vim for a few hours once, but I heard it's so-o-o good eventually even though it's hard to begin with.

FHE 2021-01-07T03:20:56.391900Z

What's wrong with CIDER (he said, finally getting back on topic about Clojure/ClojureScript)?

FHE 2021-01-07T03:21:50.392100Z

I had heard Emacs+CIDER was the most popular and best choice for clj(s) development.

seancorfield 2021-01-07T03:21:53.392300Z

I used vi for years in "ancient times" but I never found it productive for anything beyond very simple text editing and I cannot use it for Clojure -- I tried (because it has a plain socket REPL integration via Conjure, at least for neovim).

seancorfield 2021-01-07T03:22:03.392500Z

Popular != best.

seancorfield 2021-01-07T03:23:00.392700Z

I think it's cargo-culting. A lot of early Clojure adopters used Emacs and slime and then cider became "a better slime" but foisting Emacs on new Clojure developers is actually holding Clojure back.

FHE 2021-01-07T03:23:22.392900Z

I fully agree that popular =/= best. I heard it was best and popular (and with the popularity comes easier-to-come-by help resources, I reasoned.

seancorfield 2021-01-07T03:23:55.393100Z

Over the years, Emacs usage has dropped in the Clojure community to 43% (from maybe 70% in the early days?)

seancorfield 2021-01-07T03:24:11.393300Z

IntelliJ/Cursive has grown to 32%

seancorfield 2021-01-07T03:24:27.393500Z

VS Code is next at 10%

FHE 2021-01-07T03:24:53.393700Z

Oh hey, I just stumbled upon one of your videos yesterday, I meant to mention! ...and in it you use Atom?

seancorfield 2021-01-07T03:26:03.393900Z

Yeah, those videos are Atom/Chlorine. I use VS Code/Clover now but it's pretty much identical.

seancorfield 2021-01-07T03:26:12.394100Z

I used REBL in those videos, I use Reveal now.

seancorfield 2021-01-07T03:27:15.394300Z

Looking back at State of Clojure over the years, back in 2014, Emacs was already down to 43%, but IntelliJ back then was only 14% with vim just behind it.

seancorfield 2021-01-07T03:27:48.394500Z

By 2020, vim had fallen behind VS Code.

seancorfield 2021-01-07T03:28:06.394700Z

(and Atom was only a few %)

FHE 2021-01-07T03:28:58.394900Z

Where is all this editor choice data from?

seancorfield 2021-01-07T03:29:59.395100Z

State of Clojure survey results through the years

seancorfield 2021-01-07T03:30:26.395300Z

https://clojure.org/news/2020/02/20/state-of-clojure-2020 (older ones linked at the bottom)

seancorfield 2021-01-07T03:31:23.395500Z

2013 and earlier seem to have disappeared after Chas Emerick reorganized his website.

FHE 2021-01-07T03:33:34.395700Z

I'm not seeing that info. If I search for 'editor' on that page, or even on the page for 2020 linked to at the bottom, I get no survey results.

FHE 2021-01-07T03:34:43.395900Z

Nevermind...they used 'development environment'. People don't think about searchability enough...

FHE 2021-01-07T03:37:50.396100Z

I might try Cursive, but only after I've put together a working project with Emacs or if I really hate it before that point. Actually I will try it (but not until then). I won't know what I'm missing if I don't.

seancorfield 2021-01-07T03:38:10.396300Z

I just searched for emacs 🙂

FHE 2021-01-07T03:38:36.396500Z

Yeah, searching for 'emacs' was my 2nd approach

seancorfield 2021-01-07T03:39:25.396700Z

I hate Cursive more than Emacs -- but it's IntelliJ I hate really. I always have. I tried many versions -- IntelliJ even gave me free licenses (as a vocal blogger, hoping I would review it favorably). I just hate it 😞

FHE 2021-01-07T03:39:55.396900Z

Oh wow. I retract my earlier statement.

FHE 2021-01-07T03:40:07.397100Z

I guess I could try VSCode

seancorfield 2021-01-07T03:40:18.397300Z

They gave me free licenses for three different versions I think, over the years. I never wrote a negative review tho'. I just don't think that's fair. Editors are so very subjective.

FHE 2021-01-07T03:40:25.397500Z

What do you think of LightTable and...the other one whose name escapes me.

FHE 2021-01-07T03:40:26.397700Z

?

FHE 2021-01-07T03:40:38.397900Z

NightCode

seancorfield 2021-01-07T03:40:50.398100Z

I quite liked Eclipse (but would never want to go back to it now). LightTable was great at the time but has been unmaintained for years.

FHE 2021-01-07T03:40:54.398300Z

Those are specifically for clojure, right?

seancorfield 2021-01-07T03:41:01.398500Z

NightCode is too simplistic to be useful for real projects.

seancorfield 2021-01-07T03:41:33.398700Z

I used LT for quite a while (switched from Emacs to LT but then switched back to Emacs).

FHE 2021-01-07T03:44:04.398900Z

I was thinking Emacs would be better because it can be used for more things, but maybe that's not how I should be thinking. I spend a long, long time trying to decide on the best language for me to learn (that could easily or at least plausibly run on desktop+mobile+web), and I've already committed to clojure(script), so I really should be open to clj(s)-centric editors.

FHE 2021-01-07T03:44:26.399100Z

*spent

seancorfield 2021-01-07T03:45:18.399300Z

I don't think there's any single "best" anything. It all depends on the trade offs you want to make.

👌 1
seancorfield 2021-01-07T03:46:13.399500Z

For me, in the context within which I work, VS Code is perfectly suitable (we're an Atlassian shop at work and the Jira/BitBucket extensions for VS Code are great; and git support in general is really good).

seancorfield 2021-01-07T03:46:49.399700Z

I'd like better parinfer/paredit support in VS Code (Atom was slightly better overall, but better in some areas and worse in others).

FHE 2021-01-07T03:46:56.399900Z

Not sure what adjective to use. I just wanted the best choice for me, my goals being to maybe program for all those platforms.

seancorfield 2021-01-07T03:47:21.400100Z

Magit in Emacs is pretty darn good. Paredit is obviously great in Emacs (but I don't know if there's a Parinfer package?)

FHE 2021-01-07T03:47:26.400300Z

So you went Emacs-LigtTable-Emacs-Atom-VSCode? Wow

FHE 2021-01-07T03:48:51.400500Z

Are paredit and parinfer in competition or would a person use both? I think the clojure...thing (not mode, but can't remember the term) for Doom Emacs has one of them by default...parinfer I think.

seancorfield 2021-01-07T03:48:58.400700Z

And I used several different things before that.

seancorfield 2021-01-07T03:49:17.400900Z

Lots of people use both parinfer and paredit

seancorfield 2021-01-07T03:50:37.401100Z

I change my editor setup quite often -- because I don't believe there is a single "best" and I think even the "best trade off" changes frequently over time.

FHE 2021-01-07T03:51:09.401300Z

Maybe I'll be tweaking Doom Emacs more than I thought, sooner than I thought. Sigh.

FHE 2021-01-07T03:51:54.401500Z

Trying to get back on track for now, though...I finally did get WSL2+Ubuntu working. It only took my spare time over almost a week. lol

seancorfield 2021-01-07T03:52:45.401700Z

Sorry 🙂 But at least that should only be a one-off task!

FHE 2021-01-07T03:55:13.401900Z

I'm trying to figure out how to install Clojure CLI tools, which I vaguely recall was to be the next step.

seancorfield 2021-01-07T03:55:55.402100Z

Have you installed linuxbrew on WSL2?

seancorfield 2021-01-07T03:56:21.402300Z

(type brew on Ubuntu and see what it says you should apt install)

FHE 2021-01-07T03:57:11.402500Z

Someone back in this thread mentioned that WSL2 instances of Ubuntu are persistent, so things can be installed there.

seancorfield 2021-01-07T03:57:24.402700Z

Absolutely, yes.

FHE 2021-01-07T03:57:34.402900Z

Is it persistent even through rebooting my laptop??

seancorfield 2021-01-07T03:57:42.403100Z

Almost everything on this Windows laptop is actually on WSL2.

seancorfield 2021-01-07T03:58:01.403300Z

Yes (I'm not sure what that is so surprising?).

seancorfield 2021-01-07T03:58:44.403500Z

Microsoft are very serious about bringing in developers by having WSL2 be really solid.

zackteo 2021-01-07T03:59:02.403700Z

Ahhhh okay thats html and not xml right right

zackteo 2021-01-07T03:59:28.403900Z

Yeahhhh ... the government datasets are not very clean ...

FHE 2021-01-07T03:59:29.404100Z

Well in the YouTube video I followed for installing WSL2, the person demonstrates the commands 'exit' and 'shutdown'. I thought for sure shutdown would wink the thing out of existence.

seancorfield 2021-01-07T03:59:41.404300Z

You might also want to install the new Microsoft Terminal (I think you can get preview builds from the Microsoft Store? I started with prerelease builds from GitHub)

FHE 2021-01-07T04:00:07.404500Z

You mean an updated cmd? or powershell?

seancorfield 2021-01-07T04:00:44.404700Z

It's a wrapper that provides a tabbed UI around any number of shells you want, including cmd, PS, and Ubuntu

seancorfield 2021-01-07T04:01:31.404900Z

The new tab menu in Microsoft Terminal:

zackteo 2021-01-07T04:04:01.405300Z

I use lispy. Makes things much easier if you sit down to learn it

zackteo 2021-01-07T04:05:00.405500Z

It is paraedit but with 1 key bindings

FHE 2021-01-07T04:09:09.405700Z

I'm stuck atm. Through this whole clojure set-up process I'm writing up the steps so I don't have to go through this pain again, and I'm doing it in Doom Emacs to learn it...but I can't figure out how to undo an accidental deletion of a bunch of my text

FHE 2021-01-07T04:10:20.405900Z

I'm even pressing the correct undo shortcut ('u'), but It just toggles between like latest state and the second-last state, like barebones Notepad!!!! This is crazy.

zackteo 2021-01-07T04:13:12.406100Z

How about you remove evil mode for now ... https://github.com/zackteo/.doom.d

FHE 2021-01-07T04:13:37.406400Z

I might resort to loading a previous version of the file to grab that chunk of text. Unbelievable.

FHE 2021-01-07T04:14:10.406600Z

I do know I just hit C-z to toggle evil-mode on and off.

zackteo 2021-01-07T04:14:28.406800Z

It might help to use undo tree ... you probably recursively undid stuff

FHE 2021-01-07T04:14:49.407Z

but if I switch out of evil-mode I have to look up what the undo command is in plain emacs, and it's not as intuitive as 'u'. It's something more annoping.

FHE 2021-01-07T04:15:10.407200Z

*annoying

zackteo 2021-01-07T04:15:33.407400Z

Errrrrr but are you familiar with vim

raspasov 2021-01-07T04:16:04.407600Z

It is XML, but there were some HTML strings I saw

zackteo 2021-01-07T04:16:22.407900Z

At this point you are learning a hybrid of vim and emacs ... as you navigate clojure ... not sure how to describe how bad i feel this endeavour is 😅

👍 1
FHE 2021-01-07T04:18:24.408100Z

I'm not familiar with vim other than dd and u. lol

FHE 2021-01-07T04:18:40.408300Z

I do know Doom Emacs uses undo-tree

FHE 2021-01-07T04:19:11.408500Z

I just looked up the undo-tree webpage and my brain melted after the 1st paragraph.

FHE 2021-01-07T04:20:53.408700Z

I guess I'm just supposed to hammer 'u' potentially many times, even if it looks like it's not doing anything, because eventually it will get me back to where I want to be??

zackteo 2021-01-07T04:21:13.408900Z

Yeahhh which I why i really suggest you pick either emacs or vim first 😅 and not both

FHE 2021-01-07T04:21:21.409100Z

Hey it worked! ...but I overshot the mark. Now to look up how to redo. Sigh.

FHE 2021-01-07T04:21:47.409300Z

Well I have used emacs in the past, just not a ton.

zackteo 2021-01-07T04:22:43.409500Z

And for emacs, it might be good to use either https://www.spacemacs.org/ or https://github.com/bbatsov/prelude

FHE 2021-01-07T04:23:58.409900Z

I hadn't heard of prelude, but I did seriously consider spacemacs until i heard doom emacs was basically the same but better

FHE 2021-01-07T04:24:35.410100Z

Oh, and I'm not seeing the tree graphic shown on the undo-tree page. maybe it's something else

FHE 2021-01-07T04:25:46.410300Z

@seancorfield I'm about to give up on undo-redo and just reload my notes, and just install Windows Terminal. Is it a replacement for cmd and powershell and the WSL prompt??

zackteo 2021-01-07T04:29:07.410500Z

Prelude is done by the creator of cider. It sticks with emacs defaults so it is less complicated

FHE 2021-01-07T04:29:16.410700Z

ARGH. I am following the directions here, but I can't get undo to reverse direction and redo. It just keeps eating away more of my text!!!!! http://ergoemacs.org/emacs/emacs_best_redo_mode.html

FHE 2021-01-07T04:33:27.410900Z

@zackteo Do you know how to redo?

zackteo 2021-01-07T04:34:42.411100Z

Look at my config

zackteo 2021-01-07T04:35:17.411300Z

My undo is C-/ and redo is C-/ with shift

seancorfield 2021-01-07T04:37:12.411500Z

@factorhengineering I answered that over half an hour ago: "It's a wrapper that provides a tabbed UI around any number of shells you want, including cmd, PS, and Ubuntu"

seancorfield 2021-01-07T04:37:53.411700Z

https://github.com/Microsoft/Terminal is the GitHub repo for the project.

seancorfield 2021-01-07T04:39:53.412Z

And that links to the Microsoft Store where you can install it (and the preview version).

FHE 2021-01-07T04:48:19.412200Z

@zackteo I found the 3rd or so answer here, which agrees with what you said: https://stackoverflow.com/questions/3527142/how-do-you-redo-changes-after-undo-with-emacs

FHE 2021-01-07T04:48:47.412500Z

BUT I just get the error message 'C-? is undefined'

FHE 2021-01-07T04:49:06.412700Z

Nothing is working to redo!

FHE 2021-01-07T04:49:47.412900Z

@seancorfield Sorry. I must have missed that older comment.

seancorfield 2021-01-07T04:54:35.413100Z

NP. It's a fast conversation 🙂

FHE 2021-01-07T05:06:12.413300Z

@zackteo Finally got rescued from my undo-redo fiasco thanks to a kind soul on the Doom Emacs Discord channel (and no thanks to answers on StackOverflow that did not work for Doom Emacs at least: https://stackoverflow.com/questions/3527142/how-do-you-redo-changes-after-undo-with-emacs

FHE 2021-01-07T05:09:20.413500Z

With Doom Emacs -- C-/ for undo works, but -- C-g C-/ for redo does not...it just undoes more! and -- S-C-/ (i.e. C-?) for redo, required for spacemacs and prelude apparently, also does not work...it just throws the error 'C-? is not defined'

FHE 2021-01-07T05:10:56.413700Z

With Doom Emacs, AFAICT you need to be in evil-mode (toggle in and out with 'C-z'), and then it's: -- 'u' for undo, and -- 'C-r' for redo ...pretty nice actually...once you know it!

zackteo 2021-01-07T05:11:39.413900Z

Yeah S-C-/ is my own key binding

FHE 2021-01-07T05:37:58.414100Z

@zackteo Ahhh. I finally accomplished a tiny something (though not in clojurescript yet). I dusted off my StackExchange account I haven't used in years and posted the answer for Doom Emacs users I could have used a couple of hours ago at https://stackoverflow.com/questions/3527142/how-do-you-redo-changes-after-undo-with-emacs

FHE 2021-01-07T05:46:42.414300Z

@seancorfield Following your question about linuxbrew... I get: $ brew Command 'brew' not found, did you mean: command 'qbrew' from deb qbrew (0.4.1-8build1) command 'brec' from deb bplay (0.991-10build1) Try: sudo apt install <deb name>

FHE 2021-01-07T05:46:59.414500Z

I have not done anything to the VM yet.

FHE 2021-01-07T05:49:51.414700Z

I guess I'll just follow the Linux installation instructions here: https://clojure.org/guides/getting_started

FHE 2021-01-07T05:50:44.414900Z

Oof. I guess I'm back to needing to install Java and everything, only a different installation procedure (for Linux) this time...

seancorfield 2021-01-07T05:51:48.415100Z

https://docs.brew.sh/Homebrew-on-Linux

FHE 2021-01-07T06:04:56.416Z

Actually since this thread is so long (and I've derailed it so many times), and to help make the info more findable, I think I'll start fresh. New post in main #beginners thread incoming...

FHE 2021-01-07T06:08:08.419Z

I'm trying to follow the guide for installing Clojure CLI tools on a WSL2 Ubuntu-20.04 VM (Linux within Windows): https://clojure.org/guides/getting_started Right away I'm seeing Java, but the command sudo apt-get install openjdk-8-jre specified here for Ubuntu does not work https://openjdk.java.net/install/ Not sure what's wrong with the suggested command. May also need help with the rest of the installations.

seancorfield 2021-01-07T06:11:12.419700Z

Well, Java 8 is ancient. Install 14 at least.

seancorfield 2021-01-07T06:11:20.419900Z

(11 if you must)

2021-01-07T06:12:18.420900Z

apt-get may not be there by default, newer ubuntu versions tend to use apt install

seancorfield 2021-01-07T06:12:31.421200Z

I posted a link in that long thread that basically said: sudo apt install default-jdk which I would assume would install a more modern version.

seancorfield 2021-01-07T06:13:36.422Z

(personally, I go to the Adopt OpenJDK site and install specific versions from there -- and I usually have three or four JDK versions installed)

2021-01-07T06:14:43.423Z

also you probably don't need a full jdk (a jvm works fine until you are writing java code) and the default jvm (at one point at least) is a headless one with no gui or image processing classes included, you might not want that either

seancorfield 2021-01-07T06:16:23.423700Z

Hmm, I hadn't even thought about that. I've always installed a JDK rather than a JRE for years... maybe even for decades...

2021-01-07T06:17:35.424200Z

once upon a time it was a popular way to make a server leaner, nowadays space is cheaper haha

2021-01-07T06:18:20.425Z

(both using a jre rather than jdk, and using a jre that doesn't include any gui or graphics code are in that category of "optimization" I think)

FHE 2021-01-07T06:19:50.425400Z

I'm sure I came across something about using Java 8. 😕

FHE 2021-01-07T06:19:58.425700Z

...but if 11 is LTS then maybe OK?

seancorfield 2021-01-07T06:20:21.426Z

LTS only matters for the Oracle JVM.

seancorfield 2021-01-07T06:20:52.426600Z

We use 11 on QA/production but 14 or 15 on dev. We're close to using 16 at thing point.

seancorfield 2021-01-07T06:21:08.426900Z

The next (Oracle) LTS is 17.

FHE 2021-01-07T06:22:01.427800Z

OK. I'll try sudo apt install default-jdk ...thought I just installed 8 on Windows a couple of weeks ago, before I knew I was going to do it all over again in Linux. lol

FHE 2021-01-07T06:22:46.428300Z

Wait...will that command install the open-jdk or the oracle one?

2021-01-07T06:23:10.428800Z

apt won't have any proprietary packages unless you configure / add them

seancorfield 2021-01-07T06:23:13.429Z

8 was EOL'd years ago, right?

FHE 2021-01-07T06:25:34.430700Z

I tried installing one of the other dependencies, rlwrap, using 'sudo apt install' earlier and it did not work, by the way.

FHE 2021-01-07T06:25:38.430900Z

$ rlwrap Command 'rlwrap' not found, but can be installed with: sudo apt install rlwrap $ sudo apt install rlwrap Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package rlwrap

seancorfield 2021-01-07T06:27:28.431400Z

@factorhengineering are you sure you are doing this on Ubuntu 20.x?

FHE 2021-01-07T06:27:33.431600Z

yes

seancorfield 2021-01-07T06:28:00.431800Z

seanc@DESKTOP-30ICA76:~/oss$ sudo apt install rlwrap
[sudo] password for seanc:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
  gvfs-bin
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  rlwrap
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 98.2 kB of archives.
After this operation, 309 kB of additional disk space will be used.
Get:1 <http://archive.ubuntu.com/ubuntu> focal/universe amd64 rlwrap amd64 0.43-1build3 [98.2 kB]
Fetched 98.2 kB in 1s (113 kB/s)
Selecting previously unselected package rlwrap.
(Reading database ... 80478 files and directories currently installed.)
Preparing to unpack .../rlwrap_0.43-1build3_amd64.deb ...
Unpacking rlwrap (0.43-1build3) ...
Setting up rlwrap (0.43-1build3) ...
update-alternatives: using /usr/bin/rlwrap to provide /usr/bin/readline-editor (readline-editor) in auto mode
Processing triggers for man-db (2.9.1-1) ...
seanc@DESKTOP-30ICA76:~/oss$

seancorfield 2021-01-07T06:28:29.432100Z

Have you done sudo apt update?

FHE 2021-01-07T06:29:19.432600Z

no. I had just tried running commands for each of the 4 dependencies listed.

FHE 2021-01-07T06:29:49.433300Z

Now I did that and it did a lot. 39 'Get' lines and it reports 154 things can be upgraded

FHE 2021-01-07T06:30:45.434200Z

....and this time the rlwrap installation worked. I'm not sure how I ever would have guessed that.

FHE 2021-01-07T06:31:06.434800Z

I mean not guessed, but found out about.

FHE 2021-01-07T06:31:22.435300Z

Thank you.

seancorfield 2021-01-07T06:31:27.435500Z

I dunno. It's hard to know what beginners don't know. I don't remember where I learned sudo apt update but it was a long time ago 😐

seancorfield 2021-01-07T06:32:24.437Z

I guess I thought the system told you to run that command sometimes...

FHE 2021-01-07T06:33:00.437800Z

I have minimal linux command line experience. I know it uses 'ls' instead of 'dir', and I made a script once for scraping all the filenames from each of a series of inserted optical disks and appending them to a file. That's about it.

seancorfield 2021-01-07T06:33:01.437900Z

At least now you should be able to install brew for Linux and then the Clojure CLI 🙂

FHE 2021-01-07T06:33:15.438300Z

I'm not there yet....

seancorfield 2021-01-07T06:33:21.438600Z

I started with Unix back in... 1979 I guess?

FHE 2021-01-07T06:33:43.439100Z

I aborted the java install because I want to double check. This looks a bit much: $ sudo apt install default-jdk Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: at-spi2-core ca-certificates-java default-jdk-headless default-jre default-jre-headless fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libgif7 libice-dev libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev Suggested packages: cups-common libice-doc liblcms2-utils pcscd libsm-doc libx11-doc libxcb-doc libxt-doc openjdk-11-demo openjdk-11-source visualvm libnss-mdns fonts-ipafont-gothic fonts-ipafont-mincho fonts-wqy-microhei | fonts-wqy-zenhei fonts-indic The following NEW packages will be installed: at-spi2-core ca-certificates-java default-jdk default-jdk-headless default-jre default-jre-headless fonts-dejavu-extra java-common libatk-bridge2.0-0 libatk-wrapper-java libatk-wrapper-java-jni libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libcups2 libgif7 libice-dev libjpeg-turbo8 libjpeg8 liblcms2-2 libnspr4 libnss3 libpcsclite1 libpthread-stubs0-dev libsm-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxt-dev openjdk-11-jdk openjdk-11-jdk-headless openjdk-11-jre openjdk-11-jre-headless x11proto-core-dev x11proto-dev xorg-sgml-doctools xtrans-dev 0 upgraded, 41 newly installed, 0 to remove and 0 not upgraded. Need to get 266 MB of archives. After this operation, 426 MB of additional disk space will be used. Do you want to continue? [Y/n] n Abort.

seancorfield 2021-01-07T06:34:10.439500Z

Huh? Looks fine to me.

seancorfield 2021-01-07T06:34:33.440200Z

You have a new system. It's missing a lot of stuff you need for development work.

FHE 2021-01-07T06:35:01.440700Z

OK. Something about having multiple 'jre' and multiple 'jdk' and multiple 'headless' looked fishy.

seancorfield 2021-01-07T06:35:07.440900Z

Why?

FHE 2021-01-07T06:35:45.441600Z

No great reason...just seemed excessive. Ha ha.

seancorfield 2021-01-07T06:35:50.441800Z

This all looks like perfectly reasonable dependencies to me...

FHE 2021-01-07T06:36:15.442300Z

I notice it's V11, by the way. Older than you were hoping for?

seancorfield 2021-01-07T06:36:28.442600Z

11 is fine.

seancorfield 2021-01-07T06:37:09.443100Z

You can install 14 or 15 later.

seancorfield 2021-01-07T06:39:47.443500Z

As long as you're past 9 you're mostly fine 🙂

FHE 2021-01-07T06:40:23.444Z

The installation guide only refers to 'brew' for mac, not linux.

FHE 2021-01-07T06:40:58.445Z

Under Linux the next step it lists is: To install with the Linux script installer: 1. Ensure that the following dependencies are installed: bash, curl, rlwrap, and Java. 2. Use the linux-install script to download and run the install, which will create the executables /usr/local/bin/clj, /usr/local/bin/clojure, and the directory /usr/local/lib/clojure:

curl -O <https://download.clojure.org/install/linux-install-1.10.1.763.sh>
chmod +x linux-install-1.10.1.763.sh
sudo ./linux-install-1.10.1.763.sh

seancorfield 2021-01-07T06:40:58.445100Z

So what? Once you have brew installed on Linux, you're golden.

FHE 2021-01-07T06:41:51.446600Z

Why would it list two different ways if the same way can be used for both OSs? Not disputing you, just wondering why they would complicate things like that.

seancorfield 2021-01-07T06:42:11.447Z

Because they didn't think to list brew as a way to do it on Linux.

FHE 2021-01-07T06:42:48.447900Z

$ sudo apt install brew Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package brew ;?

FHE 2021-01-07T06:42:54.448200Z

😕

seancorfield 2021-01-07T06:42:58.448300Z

The Linux instructions mean every single update is manual and you have to repeat the process for every new version.

seancorfield 2021-01-07T06:43:24.448700Z

I posted this link earlier https://docs.brew.sh/Homebrew-on-Linux

FHE 2021-01-07T06:43:53.449400Z

and I don't get what the text of step 2 means. Does it just mean run the 3 commands listed under it, or is it a separate command I'm supposed to know how to piece together from the text?

seancorfield 2021-01-07T06:44:11.449700Z

What are you talking about? What's "step 2"

FHE 2021-01-07T06:47:51.450700Z

"Use the linux-install script to download and run the install, which will create the executables.........

FHE 2021-01-07T06:48:02.451200Z

Just curious

seancorfield 2021-01-07T06:48:09.451500Z

Stop following those instructions. Read https://docs.brew.sh/Homebrew-on-Linux

FHE 2021-01-07T06:48:16.451800Z

So for the brew method, I need to run:

/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
?

seancorfield 2021-01-07T06:48:33.452100Z

What? That's not on the page I posted is it?

FHE 2021-01-07T06:49:02.452400Z

From that page: "Install Instructions for a supported install of Homebrew on Linux are on the https://brew.sh."

FHE 2021-01-07T06:49:42.452800Z

....then on that page: "Install Homebrew

/bin/bash -c "$(curl -fsSL <https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh>)"
Paste that in a macOS Terminal or Linux shell prompt."

seancorfield 2021-01-07T06:50:30.453400Z

I don't remember. I installed this stuff so long ago. Just do whatever it says.

seancorfield 2021-01-07T06:51:53.454Z

It's all a one-off. Once you're done with this, keeping stuff up to date is easy.

seancorfield 2021-01-07T06:52:21.454600Z

(which is why no one remembers exactly what steps are involved -- we do this once per system and forget it!)

👍 1
FHE 2021-01-07T06:54:50.456Z

While I wait for this to install, I'm marvelling again at the sheer number of steps it takes to get going with clojure/clojurescript. At this point I'm not even letting it bother me, and just laughing at it.

FHE 2021-01-07T06:56:02.456900Z

Now that the effort put into setting up the VM is getting higher, I should ask: What, if anything, would cause it to be wiped?

FHE 2021-01-07T06:56:22.457300Z

'exit' and 'shutdown' are safe, but is there anything to be wary of?

FHE 2021-01-07T06:57:54.458200Z

Wow this is a huge installation...5 minutes and counting I think.

caumond 2021-01-07T06:59:43.460900Z

Honestly I did 2 full install last month. From blank system to clojurescript reframe running. It was 2 hours on mac book. Full install with word and nas setup... dont feel it heavy

pavlosmelissinos 2021-01-07T06:59:55.461Z

It's not fair to clojure to conflate different things together. WSL, brew, emacs, the linux shell in general have nothing to do with clojure in particular, they're just tools that might make you more productive with it. After all, for most of us it all builds up organically. I don't think many try to do it all at once like you did. First you become accustomed to the linux shell Then you start playing with clojure Finally you consider switching to a different editor In no particular order. This process might even span years.

☝️ 1
lassemaatta 2021-01-07T07:00:59.461800Z

Let me tell you about that time when I tried installing Gentoo Linux on a 85 MHz Sparcstation 5. After 7 straight days (iirc) of compiling the bootstrap environment the hardware finally gave up 🙂

😂 1
1
FHE 2021-01-07T07:01:14.462200Z

brew installed. noticed this error: Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH.

seancorfield 2021-01-07T07:01:27.462300Z

Agreed. I started with a system that was already setup for Java development: Clojure was almost nothing on top of that.

👍 1
FHE 2021-01-07T07:01:52.462500Z

How does HW give up? Blue smoke?

lassemaatta 2021-01-07T07:02:24.463200Z

I think it was the SCSI controller on the motherboard that broke. Wouldn't access the disk anymore 😢

seancorfield 2021-01-07T07:02:39.463600Z

@factorhengineering right, follow the instructions on the link I provided to adjust your path based on whatever shell you're using.

seancorfield 2021-01-07T07:03:26.464200Z

Again, I don't remember this because it was a one-off ages ago and you never have to worry about it again.

seancorfield 2021-01-07T07:05:13.465500Z

I don't think this is a "sheer number of steps" because it's just getting a bare system to a baseline that you can do anything useful with it. Neither Windows, nor macOS, nor Linux come setup to do JVM-based development.

seancorfield 2021-01-07T07:06:04.466300Z

Systems aren't designed for developers, they're designed for consumers. Developers always have to go through a setup process.

FHE 2021-01-07T07:10:08.467600Z

I just got through the main installation and running all the suggested commands at the end of it. (4 more commands, for installing build-essential, for setting the path suggested, and for installing gcc)

seancorfield 2021-01-07T07:10:41.468200Z

When you can do clojure -Sdescribe you'll be done 🙂

FHE 2021-01-07T07:10:44.468400Z

And now I've finished running

brew install clojure/tools/clojure

FHE 2021-01-07T07:11:53.469800Z

I just ran 'clojure' expecting a short message describing options or something. Instead it did a bunch of downloads and I'm into what looks like a REPL

FHE 2021-01-07T07:12:35.470400Z

(+ 1 1)

FHE 2021-01-07T07:12:37.470700Z

2

FHE 2021-01-07T07:12:40.471Z

Yay!

seancorfield 2021-01-07T07:12:46.471100Z

Congrats!

FHE 2021-01-07T07:12:59.471500Z

Do I need to mess with the path, like you were mentioning?

seancorfield 2021-01-07T07:13:06.471900Z

(! 532)-&gt; clojure -Sdescribe
{:version "1.10.1.763"
 :config-files ["/usr/local/Cellar/clojure@1.10.1.763/1.10.1.763/deps.edn" "/Users/sean/.clojure/deps.edn" ]
 :config-user "/Users/sean/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/Cellar/clojure@1.10.1.763/1.10.1.763"
 :config-dir "/Users/sean/.clojure"
 :cache-dir "/Users/sean/.clojure/.cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}

FHE 2021-01-07T07:13:09.472300Z

...or I guess brew's defaults were fine?

seancorfield 2021-01-07T07:13:16.472800Z

If that works, apparently not.

FHE 2021-01-07T07:13:43.474200Z

How do I get out of the REPL? I'm sure 'exit' worked in Windows

seancorfield 2021-01-07T07:13:51.474500Z

control-d

FHE 2021-01-07T07:14:11.475300Z

That would have been my 117th guess. 😕

seancorfield 2021-01-07T07:14:15.475500Z

(that's end of file in everything -- except Windows where it is control-z for some bizarre reason)

seancorfield 2021-01-07T07:14:40.476300Z

Windows breaks everything 😞

FHE 2021-01-07T07:15:06.476900Z

I did try Ctrl-c

FHE 2021-01-07T07:15:28.477200Z

Here's my Sdescribe: $ clojure -Sdescribe {:version "1.10.1.763" :config-files ["/home/linuxbrew/.linuxbrew/Cellar/clojure/1.10.1.763/deps.edn" "/home/a/.clojure/deps.edn" ] :config-user "/home/a/.clojure/deps.edn" :config-project "deps.edn" :install-dir "/home/linuxbrew/.linuxbrew/Cellar/clojure/1.10.1.763" :config-dir "/home/a/.clojure" :cache-dir "/home/a/.clojure/.cpcache" :force false :repro false :main-aliases "" :repl-aliases ""}

seancorfield 2021-01-07T07:16:01.478Z

Welcome to Clojure!

FHE 2021-01-07T07:16:26.478500Z

Well, the kids will be up in 3 hours, so this seems like a good pausing point for a couple of reasons!

FHE 2021-01-07T07:16:38.478900Z

Thanks again for the help, Sean et al.

seancorfield 2021-01-07T07:16:56.479500Z

Glad to get you this far. Sorry it's been a painful process.

FHE 2021-01-07T07:17:07.479800Z

Oh...again. Anything that would make my VM forget all this installations? ...things I should avoid?

seancorfield 2021-01-07T07:17:19.480100Z

Don't worry about it.

FHE 2021-01-07T07:17:45.481Z

Ok. Will restart my computer with abandon going forward.

FHE 2021-01-07T07:17:57.481500Z

Have a good night!

seancorfield 2021-01-07T07:17:58.481600Z

Seriously, I've been developing this way for months, rebooting my laptop whenever it needs it. It's fine.

FHE 2021-01-07T07:18:25.482300Z

I always pictures VMs as ephemeral. Shows what I know...

seancorfield 2021-01-07T07:18:31.482600Z

I don't know where people get that idea?

FHE 2021-01-07T07:19:10.483500Z

I think I picture a RAMdisk actually.

seancorfield 2021-01-07T07:19:59.484Z

Really? That feels so... '90s... to me 🙂

seancorfield 2021-01-07T07:20:40.484500Z

(which is kinda weird since I've been doing "this" since the very early '80s)

FHE 2021-01-07T07:21:27.485400Z

Or virtual memory...which I guess is more permanent than normal memory. I don't know...

seancorfield 2021-01-07T07:21:53.486200Z

These days I just sort of expect the "cloud" to stay around until I delete it...

FHE 2021-01-07T07:22:11.486500Z

A virtual reality headset comes off easily?

seancorfield 2021-01-07T07:22:28.486900Z

I'm too old for VR 🙂

FHE 2021-01-07T07:23:11.487700Z

and I'm never continuing a game when I put it back on? I'm always starting a new one. It would feel kind of weird to 'pause' a VR game, but maybe that's just because all the ones I have are short-burst ones.

FHE 2021-01-07T07:23:20.488Z

No no no. Try it!

FHE 2021-01-07T07:24:37.489300Z

Beat Saber is amazing, fun, and good for you!! Not many other places in life you can get that deal.

seancorfield 2021-01-07T07:25:17.489800Z

I'm 58. I've never played video games or computer games. Except Myst for a while.

seancorfield 2021-01-07T07:25:50.490600Z

(I even bought Myst for my iPhone at one point -- such a beautiful game!)

FHE 2021-01-07T07:31:51.495600Z

We'll have to talk about that another time. I haven't seen that one. Goodnight!

roelof 2021-01-07T08:30:50.496500Z

then im not the oldest person here. IM 53 🙂

caumond 2021-01-07T08:52:55.498500Z

I feel clojurian are older than on other language. Do we have statistics ?

caumond 2021-01-07T08:53:24.498900Z

When I say older, I say wiser, experimented !!

Tim Robinson 2021-01-07T10:50:07.005900Z

I'm 54. I've just started clojure and I think I'm now a better programmer than I've ever been

👍 3
👏 1
roelof 2021-01-07T10:53:21.007900Z

LIke I said im 53 and tried several times clojure and I hope it will click this time

Tim Robinson 2021-01-07T10:55:20.008200Z

Anyway I came here to ask a real question: in c# or JavaScript if I want to say if (widget != null &amp;&amp; widget.InStock) I can abbreviate it to if (widget?.InStock. - c# calls it "null conditional" and js calls it "optional chaining". In clojure I'm doing (if (and widget (widget :in-stock))) . is there any shorter way of expressing that?

lispyclouds 2021-01-07T10:59:05.008400Z

Maybe can do (get widget :in-stock)? works with nil.

2021-01-07T11:00:46.008600Z

There's also some-&gt; and some-&gt;&gt; .

lispyclouds 2021-01-07T11:01:03.008800Z

or even (if-let [foo (get widget :in-stock)] foo-is-there foo-isnt-there)

alpox 2021-01-07T11:19:17.009200Z

I believe just (if (:in-stock widget) would work too? (widget :in-stock) throws when widget is nil but the other way round you get nil on a nil map (same as with get)

lispyclouds 2021-01-07T11:24:31.009400Z

yes if you just want to check the existence (:in-stock widget) would be the shortest, if you'd like to do something with the result, can use if-let. As you noticed, you cannot call a nil value, the other way is fine. using get just makes it consistent and safer 🙂

Tim Robinson 2021-01-07T11:28:42.009600Z

wow thanks. As always there are several different ways of expressing the same thing 🙂 As a beginner I find I usually start by writing something that works but is bulky using the methods I know, then learn new ways to express it better

lispyclouds 2021-01-07T11:31:00.009800Z

May the REPL be with you 🙏:skin-tone-3:

2021-01-07T16:13:10.011200Z

I am assuming that widget is suppose to be a map or nil. Then the following works:

(if (:in-stock widget)
 ...)

2021-01-07T16:13:43.011400Z

I am always using the form (:key m) instead of (m :key) since the latter fails when m is nil. But the former just returns nil.

2021-01-07T16:14:09.011600Z

Ok, actually posted above already 🙂 didn't notice before.

gibi 2021-01-07T17:37:35.014800Z

Hi, I come from Java and I have learnt a little bit of Clojure reading “Living Clojure” book. I would like to study the web stack now, in order to get chance to be hired as Clojure dev. I was thinking to buy this book, do you think it’s a good idea? Thanks https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/

👍 1
alexmiller 2021-01-07T17:39:29.015100Z

yes

Jorge Tovar 2021-01-07T17:55:07.016Z

Hello, there is a way un clojure to get the key looking up by the value?

alexmiller 2021-01-07T17:58:12.016900Z

quickly, no. you can walk through the map entries to find a match, or use something like https://clojuredocs.org/clojure.set/map-invert to invert the map then do the lookup (probably better if you're going to do that more than once)

👍 1
2021-01-07T18:06:03.017700Z

I bet somebody has a bimap implementation if you need to go both ways throughout the lifetime of the collection (if not guava has one https://guava.dev/releases/19.0/api/docs/com/google/common/collect/BiMap.html )

2021-01-07T18:06:49.018Z

this exists but I can't vouch for it https://gist.github.com/semperos/3835417

alexmiller 2021-01-07T18:07:56.018300Z

Guava's is of course mutable

Jorge Tovar 2021-01-07T18:08:46.018400Z

Thanks alex

2021-01-07T18:24:51.020100Z

a bimap is a sign you want a structure indexed by more than one field, less like a map, more like a database

ryan echternacht 2021-01-07T19:44:38.020800Z

If I have 2 lists, and want to combine them like below, what's the best way to do it?

(1 2) + (3 4) =&gt; (1 2 3 4)
The best I've found is (into (vec list-1) list-2) which seems convoluted. I don't really care about the final collection type (it's getting serialized to json) I guess I should add, for my use case, the ordering is important, and that's what Im trying to avoid spoiling

R.A. Porter 2021-01-07T19:46:34.021300Z

(concat l1 l2) should give you what you want.

2021-01-07T19:46:34.021500Z

concat

ryan echternacht 2021-01-07T19:46:59.021900Z

oh... duh...

ryan echternacht 2021-01-07T19:47:00.022200Z

thanks

ryan echternacht 2021-01-07T19:47:24.022400Z

forgot about concat

ryan echternacht 2021-01-07T19:57:08.022500Z

thanks. i can't believe i forgot about concat. i guess i've been playing with transducers and using into too much 😕

raspasov 2021-01-07T20:30:01.023Z

(into [1 2 3] [4 5 6])

raspasov 2021-01-07T20:30:10.023200Z

[1 2 3 4 5 6]

raspasov 2021-01-07T20:31:09.024Z

Into probably better than concat... assuming this still stands https://stuartsierra.com/2015/04/26/clojure-donts-concat

alexmiller 2021-01-07T20:31:59.024600Z

concat is totally fine for the original case (and what I would prefer there)

alexmiller 2021-01-07T20:35:58.025500Z

user=&gt; (time (dotimes [_ 10000] (concat '(1 2 3) '(4 5 6))))
"Elapsed time: 1.036309 msecs"
user=&gt; (time (dotimes [_ 10000] (into [1 2 3] [4 5 6])))
"Elapsed time: 5.810941 msecs"

yiorgos 2021-01-07T20:36:06.025700Z

Is there a way to print all the aliases that a project has, using Clojure cli?

Dimitar Uzunov 2021-01-07T20:42:46.030100Z

hi, this is probably trivial: Its more convenient for me to evaluate (clojure.repl/doc seq?) with C-c C-c from a file/buffer than to type it in the REPL, but I only get nil in the buffer with the file and I don’t want to keep another buffer open just for the outputs (I prefer to use a single small screen right). How do you do it? Are there other users that like repl driven development but not have an actual repl buffer open all the time?

alexmiller 2021-01-07T20:43:14.030200Z

this still stands, it's just contextual to how you're using concat. definitely something to be aware of in a loop but as a single thing, no worries

yiorgos 2021-01-07T20:44:34.031100Z

I use lispy with Emacs and it shows the result of the evaluation inline

dpsutton 2021-01-07T20:44:47.031400Z

if you eval (source source) you'll see that it prints the source. this causes a side effect of printing and returns nil

yiorgos 2021-01-07T20:45:11.031500Z

I think to make it work using C-c C-c you should wrap your form in a comment form

alexmiller 2021-01-07T20:45:38.031700Z

things to note - into uses conj and conj on lists prepends, so (into '(1 2 3) '(4 5 6)) is not the same. and secondly, the timings here depend on laziness of concat.

dpsutton 2021-01-07T20:47:41.033Z

(as an aside, i love recommending (source source) or (doc doc))

Dimitar Uzunov 2021-01-07T20:50:58.035100Z

hmm for me (comment (clojure.repl/doc seq?) )

Dimitar Uzunov 2021-01-07T20:51:05.035500Z

still => nil

Dimitar Uzunov 2021-01-07T20:51:54.036900Z

sure, but the side effect is not displayed inline in cider.. maybe I should have started with that

dpsutton 2021-01-07T20:51:57.037Z

C-c C-d d will bring up the docs

🦜 2
dpsutton 2021-01-07T20:53:08.039200Z

yes. output will end up in the repl. there are several commands inside the cider-doc menu. C-c C-d and then c for clojuredocs, d for the docstring, a for apropos, e for apropos documentation, j for javadoc

Ralph Greaves 2021-01-07T20:53:52.040100Z

Hey, gang--Ralph here! I just wanted to thank you all for providing this Slack as an avenue for those with only a few months' experience with Clojure under their belts (Me.). PS: This is my first time ever using Slack; I hope this is an alright spot to send along my personal introduction. 😅

👍 5
seancorfield 2021-01-07T20:54:25.040300Z

Since deps.edn is "just" an EDN file, you can slurp it in, run clojure.edn/read-string on it and get a hash map, and then select :aliases from that and print the keys of that.

Dimitar Uzunov 2021-01-07T20:55:07.040600Z

whoa I forgot how many features CIDER has

seancorfield 2021-01-07T20:55:22.040900Z

But bear in mind that any running program started from the CLI could actually have been started with any aliases from either the system deps.edn file or the user deps.edn file.

yiorgos 2021-01-07T20:55:22.041100Z

Sweet, thanks!

Dimitar Uzunov 2021-01-07T20:55:22.041300Z

thans

dpsutton 2021-01-07T20:55:24.041500Z

yeah there's a ton. and they are quite nice

dpsutton 2021-01-07T20:55:25.041700Z

of course

dpsutton 2021-01-07T20:55:33.041900Z

there's also #cider for cider specific questions in the future

Dimitar Uzunov 2021-01-07T20:55:35.042100Z

I really like the convert the thread-first

dpsutton 2021-01-07T20:55:40.042300Z

happy to help you explore the other features

🙏 1
Dimitar Uzunov 2021-01-07T20:55:49.042500Z

I have to check it out

Dimitar Uzunov 2021-01-07T20:55:53.042700Z

joining now

caumond 2021-01-07T20:56:50.043100Z

You're welcome here I guess. I am pretty new here and in clojure. But it seems to be a quiet place to discuss with polite people. I must confess I did not introduce as you did ! Welcome, guys are more than helpful here !

seancorfield 2021-01-07T20:57:36.043300Z

If you want to also get at the content of those, you're going to need to use tools.deps.alpha as a library to compute the full project basis. Take a look at how depstar does it: https://github.com/seancorfield/depstar/blob/develop/src/hf/depstar/uberjar.clj#L305-L328

seancorfield 2021-01-07T20:59:01.043600Z

(you would only need the t/find-edn-maps and t/merge-edns parts)

seancorfield 2021-01-07T21:00:47.043800Z

Nearly all editor integrations for Clojure provide a way to get the docs for the symbol your cursor is on, without needing to actually eval a clojure.repl/doc form.

👏 2
seancorfield 2021-01-07T21:01:22.044Z

Most editor integrations also have a similar way to get the source for a symbol.

yiorgos 2021-01-07T21:01:23.044200Z

Thank you very much for taking the time answering all these stuff!

yiorgos 2021-01-07T21:02:29.044400Z

Out of curiosity, what is the coma , on this line https://github.com/seancorfield/depstar/blob/develop/src/hf/depstar/uberjar.clj#L328

raspasov 2021-01-07T21:03:40.045Z

Welcome! 🙂

seancorfield 2021-01-07T21:09:46.045400Z

Commas are whitespace in Clojure and the comma here just causes my editor's paren management plugin to leave the ) on that line instead of "correcting" it to the end of the line above, which makes it easier to put the cursor at the end of the form on the previous line so it is easier to eval to the REPL.

seancorfield 2021-01-07T21:11:05.045600Z

Otherwise I'd have to either put my cursor at the start of the form or ensure it was placed correctly relative to what would be )) at the end of the form (to ensure the nested form was eval'd and not the enclosing comment form which would produce nil instead).

Dimitar Uzunov 2021-01-07T21:11:37.045800Z

just for reference I set Cider Prompt For Symbol to be dwim so I don’t have to confirm

yiorgos 2021-01-07T21:23:24.046200Z

Oh I see, that’s a good tip. Thanks!

2021-01-07T22:35:19.046700Z

Hi Ralph! I too have barely 3 months of time with Clojure, and what a fun few months it's been!

Claudio Ferreira 2021-01-07T23:00:03.049200Z

Hello everyone, Lets supose i have this var: (def m {:username "sally" :profile {:name "Sally Clojurian" :address {:city "Austin" :state "TX"}}}) Why when i try to evaluate the following function doesn't return "TX"? (:state (:adress (:profile m))) => nil Thanks

Claudio Ferreira 2021-01-08T14:08:14.118200Z

Thanks!! @caumond @iam626

👍 1
caumond 2021-01-07T23:01:56.049400Z

Hi Maybe the mispell of adress / address ?

👍 3
caumond 2021-01-07T23:16:08.050200Z

Yes I ve just copy paste in repl in case I miss something. But no, its working with good spelling

sP0re 2021-01-07T23:28:30.050400Z

Hi guys! I don't know if it's the right section to write this but, I d like to learn Clojure. I'm a Java developer and I'm going to try a functional language. I had to chose between elixir and Clojure and I think that as Java Dev could have sense to try Clojure. I will start to read "Clojure for the brave and true", is it a good book to start? And what about web development (frameworks, libraries...) and the future of clojure in the industry? Thank you very much

Rowan Barnard 2021-01-08T09:36:58.114400Z

I am a beginner with Clojure and have read Getting Clojure and am much of the way through Living Clojure - both great introductory books to Clojure. I think Getting Clojure does a great job of helping you understand the 'essence' of Clojure and each of it's individual 'features'. Living Clojure is a bit out of date now - the chapter on web dev with clojurescript doesn't really work any more - that was the only chapter that hasn't worked for me though - the rest all still works and it provides you with a training program to get better at clojure programming which I thought is interesting and cool, though if you are confident you can easily build your own training program.

seancorfield 2021-01-07T23:36:51.054Z

@mircoporetti Welcome! Lots of questions there so let's try to answer them all one at a time... since you're used to the JVM, Clojure makes sense: you can even use it from your existing Java apps (we introduced Clojure at work a decade ago and initially used it as a "library" and wrote lots of new code in Clojure but used it from our legacy apps -- and gradually Clojure has taken over). That said, the mental shift from Java's OOP model, based on mutable state, to Clojure's pure immutable data can be a long haul -- so expect to get frustrated and confused and be prepared to spend quite a long time learning "functional thinking" (or, perhaps, unlearning OOP thinking)...

👍 1
seancorfield 2021-01-07T23:38:04.055200Z

I think a lot of people start off with Brave/True but it may make sense for you to continue with your existing editor, if it has a good Clojure integration, rather than trying to learn Emacs (which is what Brave/True suggests). What editor/IDE are you using for Java?

sP0re 2021-01-08T08:52:55.113100Z

Thanks Sean for your suggestions 🙂. I have another question. I already bought the book Brave/true and I would try to read it because it's here on my desk. Can I do it using Intellij or does this book oblige you to use Emacs? If you tell me that this book is not good to start I will sell it and I will buy Living Clojure or another. Thanks

seancorfield 2021-01-08T18:17:37.150500Z

It's a perfectly good book and I'm sure you can just ignore the Emacs stuff and follow along and do the exercises in Cursive/IntelliJ. There's a #cursive channel if you need help with that.

sP0re 2021-01-08T19:20:19.165700Z

Thank you! I'll start soon

seancorfield 2021-01-07T23:39:19.056400Z

Clojure from the Ground Up is another online resource you might like. Good books to get started include Living Clojure and Getting Clojure. There are lots of good "second books" once you start to find your feet.

👍 1
yogidevbear 2021-01-08T08:19:26.112300Z

@mircoporetti here is the link to Clojure from the Ground Up: https://aphyr.com/tags/Clojure-from-the-ground-up

👍 1
seancorfield 2021-01-07T23:42:05.059300Z

As far as web development, Clojure mostly eschews frameworks in favor of composing libraries. Almost all server-side web apps are built, ultimately, on top of Ring. There are several options for routing libraries (mapping URLs to handler functions) with the most popular being Compojure and Reitit I think. For HTML page generation, folks mostly either go with Hiccup (you write your HTML as Clojure data structures and Hiccup transforms them to actual HTML text) or Selmer (you write your HTML as Django-style templates and Selmer substitutes variables and handles conditionals and loops in the templates).

👍 1
sP0re 2021-01-08T08:55:50.113400Z

I would prefer to start using it only server side returning JSON like I usually do with Spring. So I imagine that exists also a library like Jackson for java?

seancorfield 2021-01-08T18:16:29.150300Z

@mircoporetti org.clojure/data.json, Cheshire, jsonista are the three that come to mind. The former is pure Clojure, the latter two both wrap Jackson.

👍 1
seancorfield 2021-01-07T23:43:08.060100Z

I tend to point beginners at https://github.com/seancorfield/usermanager-example as an example of a handful of simple libraries composed together to produce a small web app that uses a database and generates HTML server-side.

👍 1
seancorfield 2021-01-07T23:43:57.061200Z

There's a whole separate world of front end development with ClojureScript (that I can't comment on much yet, but I'm started to learn that side now -- after using Clojure on the JVM for a decade 🙂 ).

seancorfield 2021-01-07T23:44:58.062400Z

As for Clojure's future, it is and will always be a niche language. But it has seen slow, steady growth ever since its introduction and it is extremely stable, and changes are made in a very conservative, careful fashion.

sP0re 2021-01-08T08:59:50.113700Z

and.. does Phoenix put Elixir on the map?

2021-01-08T17:28:13.147900Z

Elixir seems pretty niche to me.

2021-01-08T17:30:13.149300Z

StackOverFlow 2019 survey had Elixir and Clojure usage on par: Elixir 1.4% Clojure 1.4%

2021-01-08T17:34:00.149900Z

I don't know how much of that small usage is driven by Phoenix or not. And maybe Phoenix could push Elixir past Clojure in the future, that's really hard to predict

sP0re 2021-01-08T19:22:29.166300Z

Clear, I hope that clojure will grow on 2021, I'm waiting for official statistics

practicalli-john 2021-01-08T19:47:40.166600Z

Given that most of the Clojure community uses either Zulip or Slack instead of StackOverflow, you have to wonder how representative the Stack Overflow survey is for Clojure. It would be useful to get stats from Maven central and Clojars to see how often jars are downloaded. For myself, the question is never about popularity or usage, but is the language sustainable? As far as London is concerned, Clojure is certainly sustainable in terms of jobs and community. As we've all gone online then that easily extends to the whole of the UK. And there seems to be a regular stream of new companies advertising in the jobs channel. I started looking on Tuesday for a new job and found 6 Clojure roles straight away (I may have just been lucky). There seems to be more and more communities around the world too, especially over the last few years. So Clojure is still growing. We have also seen a big boost in numbers in the London Clojurians, over 2,000 members now. There are only 7,000 in the London Java Community, so there is certainly a lot of enthusiasm for Clojure.

👍 1
seancorfield 2021-01-08T20:59:19.174Z

That's a good point about the user groups -- I was surprised to see one pop up in Provo, Utah and it's pretty active (it's done well since we all went online and it can get speakers and attendees from all over the place). I've attended that a couple of times now, and the Los Angeles group. And both San Francisco and Seattle are trying to get themselves restarted as online meetups.

2021-01-08T21:29:25.188700Z

Jar downloads for clojure itself could be an interesting stat to plot. If somehow it could even unique over IPs 😅

2021-01-08T21:31:40.189900Z

As for me, I agree with others, I don't really need Clojure to be more popular as long as it continues to be well maintained and supported. The ecosystem is healthy now, there's nothing really that I'm "in need of" or "missing". I have all the tooling and libraries/framework I need. And the language already has more features then I even know what to do with haha.

2021-01-08T21:33:26.190200Z

The only exception I'd say is job prospects. I would like to see it grow there. The more opportunity to work in Clojure at more places on more varied applications the better chance I can use my favorite language at work for the foreseeable future.

sP0re 2021-01-09T09:18:25.196400Z

Thanks guys, I will start today to read something of Brain/True. I'm happy to see that all Clojurians are enthusiastic and positive about the growth of the language. I think that it will be for me a good experience to start programming with a different approach. About jobs, we will see 🙂 I believe in functional languages and their communities

practicalli-john 2021-01-09T09:22:49.196700Z

All the companies I taked to this week are looking to hire more Clojure engineers this year. Location is still somewhat a factor, although mostly due to the pandemic that location is now more about the same country or economic region rather than city. There are not the same numbers of jobs as say Java or JavaScript, but the jobs I have seen in Clojure tend to be more engaging and slightly better paid.

👍 1
seancorfield 2021-01-07T23:48:59.063Z

@mircoporetti You will also probably find this site very useful as a learning resource: https://practicalli.github.io/clojure/

seancorfield 2021-01-07T23:50:51.063600Z

I think @jr0cket is also developing material about web development but I don't have a link handy for that.

2021-01-07T23:55:52.063700Z

I heard good things about Getting Clojure, Programming Clojure and Elements of Clojure. I also think they complement each other, from what I heard. Getting Clojure is more introduction, Programming Clojure goes in more details, and Elements of Clojure is more phylosophical (design/structure of code). That said haven’t read them. I do personally recommend Clojure, The Essential Reference. It might not be best to learn Clojure at first, but once you know it somewhat, it’s great for deep diving further into every aspect of the core language. I also really recommend at some point you read through the official Clojure overview, reference and guides: https://clojure.org/about/rationale https://clojure.org/reference/reader https://clojure.org/guides/getting_started And as a super quick intro like I want to get going in 30 minutes, I recommend the following small blog series: https://aphyr.com/tags/Clojure-from-the-ground-up https://kimh.github.io/clojure-by-example/#about

👍 1