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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:54:17+00:00 2026-05-25T15:54:17+00:00

Part of what’s so powerful about Clojure is that all the core data-types implement

  • 0

Part of what’s so powerful about Clojure is that all the core data-types implement the same sequence abstraction: clojure.lang.ISeq.

This means that functions like “first”, “concat”, “cons”, “map”, “rest”, etc work generically on all of those data-types.

My question is this: how can I add my own custom function into the mix, and have it work for all the types that extend from ISeq?

One first attempt was to define my own protocol, then “(extend-type clojure.lang.ISeq …”, but that doesn’t work (it compiles but doesn’t add the behavior to the actual types). Another idea was to write a macro that does an “extend-type” explicitly on all the Clojure types (PersistentHashMap, PersistentList, etc), but that seems kludgey.

Is there any elegant/idiomatic way to do this? Multimethods perhaps?

  • 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-25T15:54:18+00:00Added an answer on May 25, 2026 at 3:54 pm

    What exactly are you trying to do?

    If you’re trying to add behaviour to existing types: either write normal functions that deal with seqs or use multimethods or extend to do what you want.

    Also, something to note is that most Clojure “sequence” types (vectors, sets, maps) are not in themselves sequences (they do not implement clojure.lang.ISeq), so you have to do more than just add to clojure.lang.ISeq if you wish to support them.

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

Sidebar

Related Questions

Part of our java application needs to run javascript that is written by non-developers.
Part of this app is a Scream button that plays random screams from cast
Part of our core product is a website CMS which makes use of various
Part 1: Which MySQL data type to use for scheduling? In Part 1 of
Part of an application is inside a local html file that contains a java
Part of My Item Model: Ext.define('DnD.model.Item', { extend: 'Ext.data.Model', idProperty:'item_number', associations: [{ type: 'belongsTo',
Part of my project requires that we maintain stats of our customers products. More
Part of the application we are developing is about to be provided to the
Part of my project wrote all their code in C#. Our web application is
part of my code for downloading financial data: library(quantmod) tickers <- c(XOM, DIS) stock1

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.