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 8794381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:14:37+00:00 2026-06-13T23:14:37+00:00

While defrecord is the preferred form -for the general case- in Clojure for defining

  • 0

While defrecord is the preferred form -for the general case- in Clojure for defining an “entity”, in ClojureScript one can find far more references to deftype, as reflected in various documentation.

What is the difference between both forms? Which should one prefer?

  • 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-06-13T23:14:37+00:00Added an answer on June 13, 2026 at 11:14 pm

    deftype creates a bare-bones object which implements a protocol.

    defrecord creates an immutable persistent map which implements a protocol.

    Which to use depends on what you want. Do you want a full ClojureScript data structure? Then use a record. Do you just want a bare-bones thing that does nothing but satisfy a protocol? Then use a type.

    The two bits of documentation you reference use types because they’re trying to illustrate protocols at the most basic level, and types have less “going on” than records, so to speak.

    However, most real-world uses of object-like things in Clojure/ClojureScript need to store fields of data along with the object, and for that you should emphatically use a record, for the same reason you should use any of Clojure’s immutable collections.

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

Sidebar

Related Questions

While Ive seen plenty of examples in PHP, can't seem to find one in
While I can normally do commits and also push to other remote repositories (eg.
While looking at various options for making dropdowns more user-friendly I came across this
While working in a project written by some one else ,there's a Function which
While working on the Clojure Koans, I had to calculate the factorial of a
While trying to open an excel using ApachePOI I get org.apache.poi.openxml4j.exceptions.InvalidOperationException: Can't open the
While looking into Can you have a incrementor and a decrementor on the same
While most of the time I'd just use file_get_contents and CURL, I can't get
While googling I could find only feistel ciphers and didn't find any relevant information
While I can get a list of pages within a specific category using 'categorymembers',

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.