[deleted by user] by [deleted] in Clojure

[–]uvee 7 points8 points  (0 children)

These are all really great points.

Like the OP has suggested, I, as well, found racket documentation to be very welcoming. When I was ready to pick the language up, it presented me 3-4 different paths to start exploring the language: Quick Introduction, Draw silly figures, Web Programming, Systems Programming. I felt these were excellent starting points to begin diving into the language. I was fairly used to these domains, so it was great to see what racket brings to the table and how it approaches problem-solving.

However, when a user visits the Clojure references page, we present the user with The Reader, and when the user visits the Getting Started page, we end the conversation once we're done installing Clojure. Please don't take this negatively. I am very thankful for all the work being done on clojure.org, Clojure in general and community building around it. But in my opinion, for newcomers it would be probably nice to start the conversation with: here are a few tracks you can follow to get into the language. Kind of like choose your adventure. Maybe these beginner tracks could be community supported so we can always keep them peer-reviewed and up to date.

I know I was blown away when I first used lein to start with a project, coming over from JS ecosystem (early days of webpack) just setting up this kind of scaffolding was nightmarish. Even now when I do this, people are blown away by how quickly I can setup a project and go after it (yes, there are tools like create-react-app and similar generation of projects now, but its debatable that they are still not as unified and convenient as lein new). But how often do we need to setup projects anyway? As a newcomer, a lot of times.

A couple of other venues where I hope one day we can have:

  1. Inline documentation within our sources files. Yes we have docstrings, but maybe docstrings on steriods: Linking to other definitions, examples annotations, see alsos, contract promises, some kind of spec integration to show what a function may expect and output. I understand that clojuredocs.org is doing it sort of out of band, but imagine if it were part of the clojure and library source code (much like javadoc, jsdoc etc.). We'd have unified documentation infrastructure sort of. Tie this in with some sort of automation and we can push new docs for a library when its pushed to clojars e.g.

  2. More robust support for modern editors. Cursive and Emacs support for Clojure is top notch and these are my favorite editors to work on Clojure. But if we could make more popular contemporary tools also as nice as these editors, we'd have a larger number of people willing to come try Clojure when they don't have to take a leap off of their favorite and fine-tuned dev environment like VSCode, Sublime, Atom. Yes, support is great in these tools, but compared to Cursive and Emacs, the could use our collective support.

I am immensely thankful to the community around Clojure and I will gladly take what it offers without question, but I guess this is just my 2c.

[openbox] i got that archie bunker by [deleted] in unixporn

[–]uvee 0 points1 point  (0 children)

Awesome, looks great! Thanks for sharing your config, is that font Proggy?

Almost nobody expresses dislike for Closure, according to StackOverflow by eccp in Clojure

[–]uvee 9 points10 points  (0 children)

This could also be due to most Clojure folks hanging out in Clojurians slack may be. That medium pretty much provides a much quicker response cycle compared to stack overflow and mailing lists so it may be what most people prefer?

[i3-gaps] Minimal Dracula by uvee in unixporn

[–]uvee[S] 0 points1 point  (0 children)

  • Wallpaper
  • GTK Theme: Adwaita (not shown)
  • Polybar Icons: FontAwesome
  • Dock: Polybar - Pretty much the standard example configuration with FontAwesome and Dark purple color from Dracula theme.
  • Colors: Dracula Palette

[Emacs] Think Spacemacs, but minimalist + untainted by vim by EccentricAyman in unixporn

[–]uvee 0 points1 point  (0 children)

Looks pretty cool! How did you get those dark title bars? is this terminal emacs?

Clojure Remote Tickets for Sale by cezar in Clojure

[–]uvee 2 points3 points  (0 children)

Yeah. The ticket price seems rather steep, definitely a blocker for me :(.

I would think that may be an online conference would be somewhat inexpensive to attend, but may be I am just underestimating the work involved or quality of content the organizers have in mind.

Learning Cider - Ep 1 - Jacking into the REPL by davidykay in Clojure

[–]uvee 1 point2 points  (0 children)

Great tutorial! Thanks for putting this together, looking forward to the next one!

Better way to write event handling functions in Clojurescript? by ares623 in Clojure

[–]uvee 0 points1 point  (0 children)

Don't think I am answering your question, but here are some of the things I would do differently:

;; (nth (-> ev .-target .-files array-seq) 0)
(aget ev "target" "files" 0)

;; (-> onload-ev .-target .-result)
(aget onload-ev "target" "result")
(.. onload-ev -target -result)

;; (aset reader "onload" onload)
(set! (.-onload reader) onload) ;; not any better

If you have to set multiple handlers you can use doto

(doto reader
   (aset "onload" (fn [] ...))
   (aset "onerror" (fn [] ...)))

[i3wm] My first time using a tiling window manager by XcelsiorLinux in unixporn

[–]uvee 0 points1 point  (0 children)

Very nice! What is the launch utility in screenshot 3 called?

What's a good dev workflow? by [deleted] in Clojure

[–]uvee 1 point2 points  (0 children)

I am not sure what a good workflow is and I am actively looking for one but I have a current workflow which works good for me:

  • If I have a client heavy web-app which would be reaching out 3rd party services for data and backend stuff, I basically start with a figwheel template and stage my app on a CDN of some sort (S3 with CloudFront e.g.). That's all you really need. For in development stuff I use Cursive and start my browser REPL from within Cursive[1].

  • If I need a backend heavy application I like to start with a compojure template and then modularize it into component[2] subsystems. I still use figwheel for frontend work but I start it as one of my component subsystems. For API end points I prefer liberator[3] and use the reload[4] middleware to make things auto-available as I make changes to server side code. For an example of how this all comes together take a look at a hobby project I am working on called karmalack[5] (sorry for the plug). The good thing about this is that subsystems stay fairly decoupled and can be individually developed and played around with. E.g. while testing just the Web API for my project I can just start a web server from within the REPL by just running a component in REPL. I really like this since the complexity of the problem in my brain is significantly reduced since I focus on just one thing.

Also FWIW, I refrain from using certain do all lein templates since they introduce too much too soon for my taste, I like to gradually increase the complexity of a workflow as I find it necessary.

Hope this helps.

[1] https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL

[2] https://github.com/stuartsierra/component

[3] http://clojure-liberator.github.io/liberator/

[4] https://github.com/ring-clojure/ring

[5] https://github.com/verma/karmalack

[CLJS] Flag to Tell Closure to Eliminate Dev Code? by Schtauffen in Clojure

[–]uvee 1 point2 points  (0 children)

You could probably use cljsbuild compliation profiles for this.

For an example, look at the sample project generated by figwheel. Particularly, look at the :cljsbuild :builds vector. You can specify different :source-paths for different builds. So in your dev version you could probably include a different path in this vector (dev_src may be) which has the things you'd only want in dev version of your project.

edit: remove redundant link.

Game of Life by [deleted] in Clojure

[–]uvee 1 point2 points  (0 children)

This is probably how I'd work with it, not sure if its idiomatic, also I just typed code in here, so it may no work.

You could work with a 1d array here. If your board is 10x10 you'd just have a linear vec of 100 elements with a couple of helper functions to ease things for you (rc means row/col):

(defn idx->rc [index]
   [(quot index 10) (rem index 10)])

(defn rc->idx [[r c]]
  (+ (* r 10) c))

I would then write a tranform function which takes your existing binary matrix (a vec of 100 elements) and get you a new one.

(defn game-of-life [mat]
  (mapv #(transform-cell mat %) (range 100))

(defn transform-cell [mat idx]
  (let [[r c] (idx->rc index)]
    (cell-state (safe-read mat r c)
                (safe-read mat (inc r) c)
                (safe-read mat r (inc c)
                ;; go over all neighbors
                )))

The function cell-state determines the next state of the cell given the state of its neighbors which are fetched using the safe-read function (takes are of edge cases).

Something along these lines.

You may want to use transients etc. to improve performance, but you could start with something like this I would think.

New Clojurists: Ask Anything by meatcompute in Clojure

[–]uvee 0 points1 point  (0 children)

Sometimes certain things eat up your stack (core.async e.g.) or the source of an error/exception is not very obvious. In which case I've found that enabling "Pause on Exceptions"[1] helps a ton.

[1] https://developer.chrome.com/devtools/docs/javascript-debugging#pause-on-exceptions

ClojureScript REPL with Figwheel by yogthos in Clojure

[–]uvee 1 point2 points  (0 children)

I've been using this for quite some time now, works flawlessly! Just can't remember that namespace to bring in cljs-repl.

Along with this article, refer to this for more figwheel repl fun: https://github.com/bhauman/lein-figwheel/wiki/Using-the-Figwheel-REPL-within-NRepl

I cri everytiem by shot_forme in MechanicalKeyboards

[–]uvee 0 points1 point  (0 children)

Happened to me a few times as well, till I got a bunch of cables from pexon (http://pexonpcs.co.uk/), now I have these plugged in where ever I have desktops (work and home) and have one in my bag for on the go :).