HN user

rads

689 karma

Radford Smith (contact@radsmith.com)

Posts45
Comments109
View on HN
www.vanityfair.com 2y ago

Why Tim Cook Is Going All In on the Apple Vision Pro

rads
1pts0
gist.github.com 8y ago

A δ-CRDT Multi-Value Register in less than 100 lines of Clojure/Script

rads
2pts0
github.com 9y ago

Datomish: A Persistent, Embedded DB Inspired by Datomic, Created by Mozilla

rads
2pts0
www.nytimes.com 12y ago

Alan Turing, Enigma Code-Breaker and Computer Pioneer, Wins Royal Pardon

rads
5pts0
www.nytimes.com 12y ago

Twitter Prices Its Initial Offering at $26 Per Share

rads
1pts0
www.tingodb.com 12y ago

TingoDB: An embedded MongoDB clone for Node.js and node-webkit apps

rads
3pts0
thoraxjs.org 13y ago

Thorax: Backbone + Handlebars framework from Walmart Labs

rads
5pts0
tjholowaychuk.com 13y ago

Modular CSS preprocessing with rework

rads
4pts0
bost.ocks.org 13y ago

Towards Reusable Charts

rads
1pts0
www.iamconcise.com 14y ago

The Reason for the iPad Mini

rads
1pts0
www.eerolanguage.org 14y ago

Eero: Objective-C, evolved.

rads
2pts0
www.theatlantic.com 14y ago

Here Are 10 GIFs That Will Restore Your Faith in GIFs

rads
2pts0
www.theatlantic.com 14y ago

Study: Patent Trolls Cost Companies $29 Billion Last Year

rads
25pts2
www.theverge.com 14y ago

Nexus 7 review: Can a true Android tablet finally make a dent?

rads
1pts0
chaosinyourtown.com 14y ago

Create a State of Chaos in Your Town

rads
1pts0
www.economist.com 14y ago

Facebook and photo-sharing: Instariches

rads
1pts0
pages.cs.wisc.edu 14y ago

Free Book: Operating Systems: Four Easy Pieces

rads
4pts1
daringfireball.net 14y ago

Separating the Baby From the Bath Water

rads
13pts0
www.pcworld.com 14y ago

Google's Valentine's Day Doodle is All Heart — and Some Politics

rads
2pts0
www.engadget.com 14y ago

Carrier IQ: What it is, what it isn't, and what you need to know

rads
34pts1
github.com 14y ago

Trail: ClojureScript Model-View-Presenter application library

rads
2pts0
derbyjs.com 14y ago

Derby: JS MVC framework aims to unite client- and server-side code

rads
12pts1
www.apple.com 14y ago

IPhone 4S: A5 chip, 8MP camera, and Siri voice recognition

rads
66pts127
www.amazon.com 14y ago

Amazon Refreshes Its Design

rads
2pts0
blog.wolfram.com 15y ago

Flag Analysis with Mathematica

rads
1pts0
www.barebones.com 15y ago

BBEdit 9.6 Released

rads
1pts0
groups.google.com 16y ago

Compojure 0.4.0 released

rads
52pts12
www.apple.com 16y ago

Safari 5 — Reader, HTML5, and blue location bar

rads
1pts0
www.flickr.com 16y ago

Moscone West, Decorated for WWDC 2010 (via DF)

rads
1pts0
github.com 16y ago

Efficient, Immutable, Thread-Safe Collection classes for Ruby

rads
1pts0
Clojure MCP 1 year ago

I'm skeptical because I don't think generating the Clojure code is the hard part. These ideas seem more like wishful thinking than actual productivity improvements with the current state of tech.

Developer guided: For the projects I'm currently working on, the understanding is the most difficult part, and writing the code is a way for me to check my understanding as I go. I do use LLMs to generate code when I feel like it can save me time, such as setting up a new project or scaffolding tests, but I think there are diminishing returns the larger and/or more complex the project is. Furthermore, I work on code that other people (or LLMs) are meant to understand, so I value code that is consistent and concise.

Product guided: Even with meat-based agents (i.e humans), there's a limit to how many Jira tickets I can write and junior engineers I can babysit, and this is one of the worst parts of the job to begin with. Furthermore, junior engineers often make mistakes which means I need to have my own understanding to fix the issues. That said, getting feedback from experienced colleagues is invaluable, and that's what I'm currently simulating with LLMs.

Clojure MCP 1 year ago

I use the REPL as lightweight form of testing while I'm in the flow state, which is complementary to TDD. If there's too much code in the comment block, that's a good signal to move it into a formal test like you're saying, or at least move the code into a reusable function so the comment block can be shorter and focused on usage examples instead of implementation details.

Clojure MCP 1 year ago

There is often a misunderstanding that “REPL driven development” means typing things into the REPL prompt interactively and accumulating state that’s not easy to reproduce. Writing code down in comment blocks as you go is the solution to that, as you mentioned. With that technique I have no fear of restarting my REPL and getting back to where I was.

Clojure MCP 1 year ago

You might see this and think, "great, another hyped up vibe coding tool". If Clojure is about simplicity and understanding your code deeply (with the end goals of long-term maintenance and reliability), why would you need this?

When working with Clojure, I've been using LLMs primarily for two use cases:

    1. Search
    2. Design feedback
The first case is obvious to anyone who's used an LLM chat interface: it's often easier to ask an LLM for the answer than a traditional search engine.

The second case is more interesting. I believe the design of a system is more important than the language being used. I'd rather inherit a well-designed codebase in some other language over a poorly designed Clojure codebase any day. Due to the values of Clojure embedded in the language itself and the community that surrounds it, Clojure programmers are naturally encouraged to think first, code second.

The problem I've run into with the second case is that it often takes too much effort for me to get the context into the LLM for it to answer my questions in detail. As a result, I tend to reach for LLMs when I have a general design question that I can then translate into Clojure. Asking it specific questions about my existing Clojure code has felt like more effort than it's worth, so I've actually trained myself to make things more generic when I talk to the LLM.

This MCP with Claude Code seems like the tipping point where I can start asking questions about my code, not just asking for general design feedback. I hooked this up to a project of mine where I recently added multi-tenancy support (via an :app-id key), which required low-level changes across the codebase. I asked the following question with Claude Code and the Clojure MCP linked here:

given that :app-id is required after setup, are there any places where :app-id should be checked that is missing?

It actually gave me some good feedback on specific files and locations in my code for about 10 seconds of effort. That said, it also cost me $0.48. This might be the thing that gets me to subscribe to a Claude Max plan...

What will be required from users of the existing Litestream version to upgrade to the new one? Is it a matter of bumping the version when it comes out or is there more to it?

What was the tipping point where you decided you got everything you could from learning Clojure and it was time to move on?

Such a low quality article. The whole comment thread is just going to be about the flamebait of "I bet Rich was just really bored". Instead, the author could have listed the reasons they actually "loved it, and by the end I hated it", which would have led to an interesting discussion.

Why Clojure? 1 year ago

I'm curious, how did you form this opinion? Did you have a bad experience with Clojure yourself?

WP Engine Reprieve 2 years ago

Hey Matt, ex-Automattician here. I don't have any comment on the issues themselves (haven't touched PHP or WP since I left) but please consider that the fallout of these actions may hurt your own employees in ways you can't see.

This has turned into a legal situation and I'd have to guess it's making people very uncomfortable. From the outside, it seems to have happened so suddenly that anyone employed at Automattic wouldn't have time to consider their options beforehand. Some people I really respect and enjoyed working with are in a tough spot right now and there's no way they can be fully honest with you given the circumstances.

Claude 3.5 Sonnet 2 years ago

From my experience, GPT-4 works well with both Clojure and Zig. A lot of it depends on the way you prompt though. For example, asking to start with a C or C++ example and converting to Zig often works better than starting straight with Zig. The same strategy works with Java and Clojure too.

Try Clojure 2 years ago

Check out Babashka. It's a single binary that runs Clojure without a JVM. It also starts up really fast and has a much lower base memory requirement: https://github.com/babashka/babashka

It's pretty easy to switch to writing JVM Clojure if you're familiar with Babashka. Most of the libraries written for Babashka are designed to work in either environment.

That said, there are reasons you may want to use the Clojure on the JVM later on. It might be interesting to read the replies to another poster with similar concerns about the JVM: https://news.ycombinator.com/item?id=40445415

Try Clojure 2 years ago

I think the writing style is too fluffy, but I realize some people like that. The true sin of this book is that it actually starts by teaching the reader Emacs, not Clojure. That's a huge distraction for a beginner who is probably coming from VSCode these days.

Try Clojure 2 years ago

Here is where I'd start for the path of least resistance while still using the most modern libraries:

- Dependency management: https://clojure.org/guides/deps_and_cli

- Clojure->JS compiler: https://github.com/thheller/shadow-cljs

- React integration: https://github.com/reagent-project/reagent

- Global state management (optional): https://github.com/day8/re-frame

You might also want a CSS framework. There are some options to write CSS in ClojureScript, but I prefer TailwindCSS which isn't a Clojure-specific thing and it works fine out-of-the-box with `.cljs` files.

You can swap out Reagent for Helix, which is a lower-level and faster wrapper for React. That said, Reagent does work with React 18 just fine and there's tons of docs for it, so jumping to Helix first is a premature optimization IMO, especially if you're new to Clojure.

Try Clojure 2 years ago

The key thing is experienced Clojure programmers often see a lack of ORM as a feature rather than an oversight. There were some more ORM-like libraries years ago (see Korma) but my impression is that people ultimately didn't want this and moved on to lower-level JDBC wrappers combined with HoneySQL. I found a more detailed discussion on Reddit about Clojure and ORMs back in 2020 if you want to get more info: https://reddit.com/r/Clojure/comments/g7qyoy/why_does_orm_ha...

Note that I'm not making a value judgement about Python/Django or any other library/framework combination. It's obviously a valid path, but Clojure is a different path. I can assure you there are straightforward solutions to create readable APIs like the Django example with minimal boilerplate, but the approach is fundamentally different from Python/Django.

If you do decide to build something in Clojure and think, "I already know how to do this in Django, why is it missing?", don't hesitate to join the Clojurians Slack and hop into the #beginners channel. There are plenty of people who can help you there.

Try Clojure 2 years ago

It's a tradeoff. The startup time of Clojure on the JVM is slower than most, but the runtime is faster than most. It also needs a lot of memory to get going. This means it's optimized toward long-running programs like web servers. During development, you use the REPL interactively which makes this a non-issue, but it does take some getting used to at first.

That said, there are alternative runtimes that have different tradeoffs. For example, Babashka is a runtime for Clojure that uses GraalVM instead of the JVM as the foundation. Babashka scripts have about a 10ms startup time on my M1 MacBook Air.

Try Clojure 2 years ago

In practice I do wrap `jdbc/execute!` with my own `execute!` function to set some default options. However, there is no ORM layer. What makes you think the code above is terribly unproductive?

Edit: Not trying to dismiss your concerns, by the way. In Clojure you can often get away with doing less than you might think so I'm genuinely curious about the critique.

Try Clojure 2 years ago

Here's a quick example of how DB access generally looks in production:

    (ns rads.sql-example
      (:require [next.jdbc :as jdbc]
                [honey.sql :as sql]
                [clojure.string :as str]))

    ;; DB Table: posts
    ;; +----+-------+
    ;; | id | title |
    ;; +----+-------+
    ;; |  1 | hello |
    ;; +----+-------+

    (def ds (jdbc/get-datasource (System/getenv "DATABASE_URL")))

    (defn row->post [row]
      ;; This is your optional mapping layer (a plain function that takes a map).
      ;; You can hide DB details here.
      (update row :title str/capitalize))

    (defn get-posts [ds]
      ;; Write a SQL query using Clojure data structures.
      (let [query {:select [:*] :from [:posts]}]
        ;; Run the query.
        (->> (jdbc/execute! ds (sql/format query))
             ;; Convert each raw DB map to a "post" map
             (map row->post))))

    (println (get-posts ds))
    ;; => [{:id 1, :title "Hello"}]
Try Clojure 2 years ago

This is a good starting point if you want to get a web app going quickly: https://biffweb.com

It uses XTDB by default but you can switch to Postgres: https://biffweb.com/p/how-to-use-postgres-with-biff/

People don't really use ORMs in Clojure, they just write SQL directly and abstract the details from consumers using functions. That said, HoneySQL is a common alternative to writing SQL that makes it a lot less painful (and composable!): https://github.com/seancorfield/honeysql

Try Clojure 2 years ago

Hmm, maybe we could come up with a standard syntax? We could call it “Standard-expressions”, or perhaps “S-expressions”? That way an entire family of languages could use the same syntax. Now how do we get people to follow this standard?

- Incredibly slow

Huh? Clojure is one of the fastest dynamic languages. It's not intended to replace C++ or Rust.

- Hosted on the JVM, so you're going to be dealing with Java eventually

In the real world this is a blessing since there are a lot of useful Java libraries out there.

- No automatic tail call optimization because of the limitations of the JVM, so it feels like you're writing a mess of macros rather than real functional code

How did you come to this conclusion? Lack of automatic TCO doesn't mean you have to write macros, and most people in the Clojure community will tell you to prefer functions over macros unless it's absolutely necessary.

I had to Grok Integrant again because I wouldn't understand my project otherwise.

You can use plain functions and `reduce` for system composition if you want. Take a look at how Biff does it: https://biffweb.com/p/thinking-about-system-composition/

DI should be used sparingly for the top-level, stateful pieces of your system. If you can't understand your program without it, is this a problem with Clojure itself or the design of the program?

And when it comes to best practices around unit testing, it's another one of those things where no one in the community seems to be sharing much about it.

The `clojure.test` API has stayed the same for the last decade and that's what you'll see in most projects. Is the concern about how to run tests? Both of the following libraries work well:

- Minimal test runner: https://github.com/cognitect-labs/test-runner

- Full-featured test runner: https://github.com/lambdaisland/kaocha

If you install neil (https://github.com/babashka/neil), you can do `neil add test` which will automatically set up cognitect-labs/test-runner in your project. Then you can run tests with `neil test` (just an alias, you don't have to use it).

I used Kit to bootstrap this project and the way it set up tests doesn't even work, but this was what most people recommended to me for starting a Clojure project

I don't really like the approach that Kit takes and prefer something more opinionated like Biff. I'd love to hear your feedback if you do end up trying out Biff.

This, to me, is the equivalent of placing console.logs everywhere and running the request. Which isn't a terrible thing. Yes, I know Clojure is immutable and I can eval the function in a comment with `tap>`, and run it over and over again without affecting my system. But if I'm just using my site and all of a sudden something happens unexpectedly, I have no idea what function is the problem and what arguments were passed to it. It's often a nil that got passed 5 functions down. I have tried setting it up in a way that I can easily find where the problem is, and I have failed. So in reality, the debugging experience for webapps doesn't feel unlike what it would be for using react and a random backend.

For me, there are many ways to approach the problem of "I'm just using my site and all of a sudden something happens unexpectedly" which are not necessarily specific to Clojure. That said, one unique feature of Clojure is that you can literally inspect data and change the code as its running in production, which is not possible in most other languages. Once you're connected to a prod REPL, you can redefine functions to include `tap>` if you want.

I'll have to try IDEA. Not pumped about the subscription. My personal experience with Calva, just asking multiple times over multiple weeks for help with a fullstack setup, is that people don't use it and don't care to use it. I got several "I don't use Calva" and "just use emacs" from prominent people in the community.

I know that some people on the core Clojure team use IntelliJ for development. I feel your pain about the subscription cost.

I got my wires crossed on this one and was confusing it with something else, I apologize.

All good, thanks for clarifying.

In general, the claim that a library doesn't need to be updated as it wraps around another library is dubious to me. But on my end, Secretary is a very popular client side routing library that was recommended in a lot of places. I wrote a lot of code for it before finding out a key piece of it was broken and nobody seemed to care.

I think stability as a cultural value is the most important thing about this, but yeah, it's more of a goal than a rule. I'd suggest using reitit these days. It's well-maintained in 2023 and we use it in production for our Ring apps with no issues. It has a CLJS namespace (`reitit.frontend.easy`) which would replace secretary for you. Plus you get the benefit of routes-as-data and the same interface for both server and browser. I think the chance of this library falling by the wayside any time soon is unlikely.

I'm interested in Biff, but after trying it a bit, it seemed like I would benefit from it more if I had a grasp on fullstack Clojure development first.

If you need help with Biff, post on the #biff channel. I think people (including myself) would appreciate the fresh perspective. If you don't want to use a framework, try creating a Ring app from scratch with Reitit and Hiccup. Use HTMX to start if you want interactivity. If you can do that first, you'll have a solid foundation to build a full-stack Reagent/Re-frame app on top it because you won't have to change routing libraries or templating languages.

In general, the Clojure slack has been a mixed bag. People are very helpful and nice, but sometimes it seems like I'm asking something simple like "What should I be using for client side routing" and nobody has an answer.

Just use Reitit. I think you'll see it becoming more common as time goes on.

I've been working professionally with Clojure/Script for about six years now and I don't regret it. I also work on TypeScript when I have to. Here are a few suggestions I have:

- The debugger sucks

In my experience, Cursive/IntelliJ is the most mature editor setup for Clojure. It includes a step-by-step debugger but I don't really use it. Not because it doesn't work, but because there are other ways of debugging that also work, as explained below.

- There are other tools for debugging like Portal and Flowstorm, but they involve already knowing what the problem was so you can instrument the function and call it with the same arguments - Java stack traces make the above very hard to do.

If I don't know where the problem is, I'll look at the Java stack trace and start adding `tap>` calls to see the flow of data. Since Clojure programs are data-oriented, inspecting the state that's flowing through the function arguments is usually all that's needed. It's a bit different process, though. Can you elaborate on your issues with the Java stack traces?

Here's a relevant comment from Alex Miller: https://www.reddit.com/r/Clojure/comments/80al23/how_do_i_do...

- You're a second class citizen if you don't use emacs. [...]

This doesn't really ring true for me even if a lot of docs are written for emacs. At work people use vim, emacs, VSCode, and IntelliJ. As I alluded to earlier, I think IntelliJ is the one that "just works". If you haven't tried it, I recommend giving it a shot. Personally, I've never been a fan of the "Clojure for the Brave and True" book because learning Clojure and emacs at the same time is a BAD IDEA, and it gives a false impression that emacs is somehow necessary when it isn't.

- Complaining about Javascript and React and then having your whole ecosystem wrap around Javascript and React is really obnoxious. Reagent is falling behind in React versions and it's missing out on performance enhancements. If you need to do niche React things, it's a pain in the ass.

Reagent works with React 18, function components, Suspense, React.lazy, hydrateRoot, etc... Honest question: what do you feel like you're missing out on right now by using Reagent? IMO, concerns about Reagent's performance are overblown. I don't think most apps suffer from this issue, they suffer from complexity. The Reagent/Re-frame API is the same as it was when I built my first app with it six years ago and the core model is still solid. One critical thing I do think is missing is SSR integration. I recently started a library to work on this: https://github.com/rads/rain

Here are some thoughts from the creator of Helix (successor to Reagent): https://www.reddit.com/r/Clojure/comments/11uluj4/comment/jc...

- This might just be me, but I used Citrus with Rum and I found it to be the most over abstracted thing I've ever seen in my life. I know it was inspired by re-frame, so maybe re-frame is the same. But it's like Redux X10 in terms of verbosity.

I haven't used Citrus with Rum, but I think Reagent/Re-frame is worth checking out. You're probably going to have a better experience because it's a more mature stack. If you find Re-frame too much, the Reagent ratoms still work and are as simple as it gets for state management.

- Call me crazy, but the Java/Script interop is worse than other guest languages because there's huge impedance mismatch between functional and OOP.

- There are very popular broken libraries. People say "It's okay if a library hasn't been updated in 6 years, because Clojure is so stable!." This is a total myth, there have been several flat out broken libraries being recommended in tutorials.

Can you share what libraries you're talking about and/or what issues you ran into?

- While people are working on frameworks (Biff, Fulcro), there are no "best choices" for a lot of problems yet and it leads to frustration just trying to make a simple crud app.

In my opinion, Biff is the future for server-side apps. It works really well out-of-the-box and the pieces are there to improve it over time. After using om.next and getting burned by it, I haven't had much interest in Fulcro.

The community hasn't been unfriendly or unhelpful, but sometimes it feels like I'm speaking to aliens.

I'd recommend the Clojurians Slack for support. Hit me up there (@rads) if you decide to give Clojure another shot and want some help working through some of the issues you mentioned.

The issue is with consuming the tweets. Publishing the data somewhere else has the same problems as publishing on Twitter.

1. The Twitter ToS prevents scraping the content in section 4.iii.

https://twitter.com/tos?lang=en

2. If you use the API instead, they have this rule:

Only surface Twitter activity as it surfaced on Twitter. For example, your Service should execute the unlike and delete actions by removing all relevant Content, not by publicly displaying to other users that the Tweet is no longer liked or has been deleted.

https://dev.twitter.com/overview/terms/agreement-and-policy#...