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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:19:13+00:00 2026-06-17T21:19:13+00:00

I store graph coordinates in a circular list: (defun make-circular-list (size &key initial-element) (let

  • 0

I store graph coordinates in a circular list:

(defun make-circular-list (size &key initial-element)
  (let ((list (make-list size :initial-element initial-element)))
    (nconc list list)))

(defvar *coordinates* (make-circular-list 1024 :initial-element 0.0))

Now it’s easy to update *coordinates* whenever new coordinates must be set.

However, I have a library function that takes a sequence of coordinates to draw lines on a graph. Of course this function does not work with a circular structure, so I would like to make a copy of fixed length. A list or an array is fine.

So far I have tried subseq and make-array with the :initial-contents keyword, but it fails. loop or dotimes do work but I was hoping to avoid iterating on each elements of the list.

Is it possible to efficiently copy this circular structure or make a fixed length array in the spirit of a displaced-array?

  • 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-17T21:19:15+00:00Added an answer on June 17, 2026 at 9:19 pm

    There is nothing wrong with using LOOP.

    (loop for c in *coordinates* repeat 1024 collect c)
    

    Btw., sometimes it might be useful to hide the circular list behind a CLOS object.

    (defclass circular-list ()
       ((list)
        (size)
        (first-element)
        (last-element)))
    

    And so on…

    That way you can provide some CLOS methods for accessing and changing it (create, add, copy, delete, , as-list, …). You can also control printing of it using a method for PRINT-OBJECT.

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

Sidebar

Related Questions

copy('https://graph.facebook.com/$fbid/picture?type=large', 'images/$fbid.jpg'); i am using the above code to store the image locally ..
I need to store a graph for the map of a game inside a
There are three ways to store a graph in memory: Nodes as objects and
I need to store a undirected graph in a Google App Engine database. For
I need to store a large and dynamic undirected graph in google appengine, what's
I wanna create and store graph in php. I have bus schedule, so I
I need to store a non directed graph with multiple nodes (unknown to the
How graph databases store data to a persistent storage? PKV
Graph databases store data as nodes, properties and relations. If I need to retrieve
I am using the Boost Graph Library to store an undirected graph with double

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.