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

The Archive Base Latest Questions

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

I am having some problems with a project and was hoping you could help.

  • 0

I am having some problems with a project and was hoping you could help.

I have some clojure functions like

(def player-grid {:width {} :height {}})

(defn contains-coord [grid x y]
  (if ((and (= ((grid :width) x) x) (= ((grid :height) y) y)))
    true
    false))

(defn add-to-grid [grid x y]
  (assoc grid :width (into (grid :width) {x x})
              :height (into (grid :height) {y y})))

and I also have a html page that has a 10X10 battleship game board made of checkboxes. I have tried to find a way to connect the two so that when I click on the board to put a ship the coordinates are sent to the clojure function.

Basically, I have no idea how to put the two together to work as a whole.

I’d really appreciate some advice or example on this matter since I found nothing useful when using compojure and hiccup except for creating new html pages from scratch.

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

    Whoa- You’re trying to connect two things that aren’t meant to connect together (but there’s no way you could know that as a beginner.)

    First, you need to decide where your clojure code should live- Should it live on a web server that is serving up these web pages, or should it live in the web browser on the computer that is being used to play battleship? Either possibility might make sense.

    If you want to run your clojure code on the server, you’ll have to write messages to the server when a user clicks on the grid. You’ll have to link each grid square to some javascript code, which then sends a message to your server to a url with a name like “http://battleshipgame.com/game/3243/grid?x=3&y=7” which you would then handle with compojure (and the compojure route handler would then link to your function.) Doing this is called AJAX, and many people would use the jQuery functions “click” to connect the grid space to the javascript and “post” to send the message to the url.

    If you want to run your clojure code on the client, then you can’t do it, since there is no clojure interpreter running in the user’s web browser… However, recently Rich Hickey released ClojureScript which can convert clojure code into javascript. Using ClojureScript you could do exactly what you want in the browser. Look at the twitter sample in the ClojureScript compiler to see how to do this: https://github.com/clojure/clojurescript/tree/master/samples/twitterbuzz

    As you can see, this is all a bit involved and might require some dedication on your part to learn how to accomplish all this stuff- Good Luck!

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

Sidebar

Related Questions

I am having some problems with my mini-project. I have to check if the
I'm having some problems with a project I'm doing using Google Maps. I have
I have been having some problems trying to get my PHP running. When I
I am having some problems executig the symfony command on my project root directory.
I'm having some problems with my project. I keep an .rvmrc in my project's
I'm having some problems when i try to compile my sample C++ project, i'm
I'm making a small project to learn Django, and i'm having some problems trying
I am having some problems with an assignment. The case project is: Create an
We are using Telerik RadEditor control in our project and having some problems with
I have been having some problems with this for a few days now... I

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.