Skip to content

Instantly share code, notes, and snippets.

View jumarko's full-sized avatar

Juraj Martinka jumarko

View GitHub Profile
@didibus
didibus / clojure-right-tool.md
Last active July 10, 2024 04:30
When is Clojure "the right tool for the job"?

My answer to: https://www.reddit.com/r/Clojure/comments/pcwypb/us_engineers_love_to_say_the_right_tool_for_the/ which asked to know when and at what is Clojure "the right tool for the job"?

My take is that in general, the right tool for the job actually doesn't matter that much when it comes to programming language.

There are only a few cases where the options of tools that can do a sufficiently good job at the task become limited.

That's why they are called: General-purpose programming languages, because they can be used generally for most use cases without issues.

Let's look at some of the dimensions that make a difference and what I think of Clojure for them:

Medication contraindications

You probably know this, but here's some background so we're all on the same page. Some medicines shouldn't be taken in combination. When two medications shouldn't be taken together, it's called a contraindication.

(def patient-medications [{:name "Blythenal"
                           :rxNorm "blyth"}
                          {:name "Masbutol"
                           :rxNorm "masbut"}
                          {:name "Welbutril"
@yogthos
yogthos / clojure-beginner.md
Last active July 15, 2024 20:45
Clojure beginner resources

Introductory resources

This is a bit of a thought exercise. I doubt it’s perfect and I’m hoping for opinions and corrections with the goal of a well reasoned practical approach.

Motivation...

One way to look at type declarations in a static language is as a test which picks up potential incompatible code paths. E.g. data passed is incompatible with code.

In static languages the effort to write the test is reduced by virtue of being declared inline with the code and inference allows a few annotations to permeate - having said that we can achieve a similar results in Clojure.

Quick scan of tools at hand...

@jyukutyo
jyukutyo / CMakeLists.txt
Last active May 13, 2022 17:11
Build OpenJDK on CLion
cmake_minimum_required(VERSION 3.7)
project(hotspot)
include_directories(
src/hotspot/cpu
src/hotspot/os
src/hotspot/os_cpu
src/hotspot/share
src/hotspot/share/precompiled
src/hotspot/share/include
src/java.base/unix/native/include
(require '[clojure.set :as set])
(def info
[{:year 2017
:month 4
:data "x"}
{:year 2017
:month 4
:data "y"}

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@jackrusher
jackrusher / giraffe.el
Created April 28, 2017 14:25
An example elisp function presented at Emacs Berlin
(defun giraffe ()
"Passes a the active region (highlighted text in non-emacs
speak) to an external command that produces an SVG graph of the
data, which is then placed in a buffer called *giraffe* and
viewed as an image."
;; Declare that this is an interactive command. Whenever a function
;; starts this way emacs will make it available to be called with
;; M-x or bound to a key.
(interactive)
@didibus
didibus / abstract-factory.clj
Created April 13, 2017 09:54
My attempt at what the abstract factory pattern would look like in Clojure
(defn draw-ui [{:keys [label casing content]}]
(let [pad (Math/floor (/ (- (Math/max (count label) (count (or (:label content) "")))
(+ 2 (Math/min (count label) (count (or (:label content) "")))))
2))]
(println (str "|" (if (= :upper casing)
(.toUpperCase label)
(.toLowerCase label)) "|" \newline
"|" (reduce (fn [a b] (str a " ")) "" label) "|" \newline
(when content
(str "|" (apply str (repeat pad \space))
@reborg
reborg / rich-already-answered-that.md
Last active July 11, 2024 09:54
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content