Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7685997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:22:47+00:00 2026-05-31T19:22:47+00:00

Is there an established pattern for implementing undo/redo functionality in clojure or in fp

  • 0

Is there an established pattern for implementing undo/redo functionality in clojure or in fp in general?

In an OO language I would go with the command pattern but as it is all about state I wonder if it is idiomatic doing it in clojure.

Are there any libraries that could be of help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:22:48+00:00Added an answer on May 31, 2026 at 7:22 pm

    As with many design patterns you can implement this one as a function in clojure. It depends a little on how you represent state in your program (refs, atoms, agents) through the process is very similar.

    You sould simply add a watcher function to your state agent/ref/atom that adds the state to the undo list every time there is an update. then your undo function is just looks it up in the undo list. This has the nice effect of adding your unto to the undo list, allowing for redo as well

    My first impression is that refs may be the correct tool for this because you will be able to restore them all in a coordinated fashion, unless of course you can reduce your programs state down to a single identity (in the Clojure sense of the word) then you would not need coordinated update and an agent would work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Templates are a pretty healthy business in established programming languages, but are there any
Is there an established algorithm for finding redundant edges in a graph? For example,
.NET's ProviderBase was established in the 2.0 release of the .NET Framework. Have there
I am looking for a general, reusable UI pattern I can use for editing
Are there any established exit code standards or reserved exit codes in Python (specifically,
Is there an established idiom for composing (chaining) meta-functions? This is my current solution:
Are there any well established criteria to help decide between building a universal iphone/ipad
Is there an established method to tell the SCM, mercurial in my case, that
There is a ManyToOne association defined between entities Pattern and Category (Pattern is an
Is there a better method to establish the positional offset of an object's data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.