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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:21:59+00:00 2026-05-26T06:21:59+00:00

In Clojure I am building a card game. Cards have a suit and a

  • 0

In Clojure I am building a card game. Cards have a suit and a score.

{:suit 1 :score 9}

The cards are created using ranges, e.g. (range suitTotal), so the class of the values of :suit and :score is Long.
Players send command strings, e.g. “discard1.9” is a discard request.
Using a regex to parse this:

(re-seq #"[0-9]+" command)

results in String items “1” and “9”. A card created with these results would be

{:suit "1" :score "9"}

I would like this to compare as equal with the original card. At the moment I am using (Integer/parseInt) to convert the strings.

The suit value could be built from a different type, such as a keyword, but the score value is used as a number elsewhere.

  • 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-26T06:21:59+00:00Added an answer on May 26, 2026 at 6:21 am

    A good approach would be to parse the strings as numbers and then use = to compare.

    user=> (Integer/parseInt "1")
    1
    

    The advantage of this over read-string is this is more restricted. This won’t parse strings that look like clojure data-structures.

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

Sidebar

Related Questions

I am building some software using Clojure as a backend, and I'd like to
I have been using ClojureBox with great success to learn both Clojure and emacs.
I have started building a system with clojure, mainly because I need to use
I have started building a system with clojure, mainly because I need to use
In clojure I have lines like this that define default values: (def *http-port* 8080)
I'm new to Clojure and building a web app using the Noir framework (very
I am new to Clojure, and am beginning to experiment with building an application.
in clojure i have vector [myfn1 myfn2 myfn3] how can i call functions named
Clojures clojure.xml/parse, clojure.zip/xml-zip and clojure.contrib.zip-filter.xml/xml-> are excellent tools for pulling values out of xml,
Does clojure have a powerful 'loop' like common lisp. for example: get two elements

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.