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

  • Home
  • SEARCH
  • 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 158113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:37:27+00:00 2026-05-11T10:37:27+00:00

I have a query request-uri in the form of /node/143 (just an example of

  • 0

I have a query request-uri in the form of ‘/node/143’ (just an example of the format).

I want to strip the first forward slash from the string, I looked up the function remove and had a try. I just can’t seem to get it working (I’m using SBCL on Linux).

I’ve set the request-uri using this code.

(setq request-uri '/node/143') 

When I check the variable I have this returned.

request-uri '/node/143' 

I now try to remove the first slash (at this point it’s just anything at all to see how the function is properly used).

(remove '/' request-uri) '/node/143'  (remove '/ request-uri) '/node/143' 

I even tried supplying a list

(remove '('/') request-uri) '/node/143'  (remove '('/) request-uri) '/node/143' 

Even though strings are vectors of characters I thought that somehow maybe the whole string may be placed in one cell and I tried to remove the whole thing, still no luck.

(remove '/node/143' request-uri) '/node/143'  (remove '/node143 request-uri) '/node/143' 

So I’m at a loss right now, this seemingly simple function has really eluded me, I thought I followed the documentation to the letter, but nothing is working.

Can anyone shed some light on what’s happening here?

Thanks.

Edit: I found the answer to my question, which raised another question.

To remove an element from the string I used

(remove #\/ request-uri) 

What about a whole string

`(remove #\node request-uri`) 

Only works for the first character and throws an error, and the following all do nothing.

(remove 'node' request-uri) (remove 'node request-uri) (remove ?\node request-uri) (remove #\node request-uri) (remove '('node') request-uri) 

I’m not sure how else it should be addressed here.

  • 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. 2026-05-11T10:37:28+00:00Added an answer on May 11, 2026 at 10:37 am

    Learn to read the Common Lisp HyperSpec.

    Strings are Sequences, Arrays (one-dimensional vectors of characters) and, well, Strings. This means that most of those functions are applicable.

    Let’s look at REMOVE. CLHS gives this signature:

    remove item sequence &key from-end test test-not start end count key     => result-sequence 

    Strings are sequences of characters. So a call to remove would be:

    (remove #\/ '/foo/') 

    or (for example)

    (remove #\/ '/foo/' :start 2) 

    Remember: #\a is a character. #\node is no character. Illegal. A string is '/foo/'.

    The item to REMOVE from a string has to be a character. Nothing else. Why? Because the TEST is by default EQL and EQL compares the character in the string with your item argument. Also key is by default IDENTITY and does not change the items.

    What if your argument is a string? Well, then you have to do more:

     (remove '/' '/abc/' :key #'string :test #'equal) 

    This looks at each character of the sequence and makes it into a string. The string then will be compared with your item '/' using the function EQUAL. This works also. The cost is that it needs to generate a string from each character of '/abc/', each string is a new object.

    Another way to do it is:

     (remove '/' '/abc/' :test (lambda (a b) (eql (aref a 0) b))) 

    Above retrieves the first character of '/' in every test and compares it with the character from the string '/abc/'. Again the cost is that it needs to get the character five times (in this example).

    So the best way to write it if your original object comes as a string:

    (remove (aref '/' 0) '/abc/') 

    Above we get the character from the string '/' once and then REMOVE compares this character with the default EQL test with each character in the string – it returns a new string of those characters that are not EQL to #\/.

    What do you expect ?\foo to be? In Common Lisp this is the symbol |?fOO|.

    Also (remove 'foo' 'afoob') does not work since a string ('foo' here) is not an element of a string. Remember, characters are elements of strings. Remember also that strings with one item like '/' are still strings and not a character. Thus '/' and #\/ are of different type. The first is a string and the second is a character.

    SUBSEQ extracts a sequence from a sequence. That means it also extracts a string from another string:

    (subseq '0123456' 1 5)      where 1 is the start and 5 is the end index. 

    CONCATENATE appends sequences. This means that it also appends strings.

    (concatenate 'string 'abc' '123')   returns a new string with the strings 'abc' and '123' appended. 

    To remove parts of a string see also the functions STRING-TRIM, STRING-LEFT-TRIM and STRING-RIGHT-TRIM.

    So, as in one other answer to remove substrings from a string you need to write some code to extract some strings and then concatenate those.

    SEARCH searches for strings in strings.

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

Sidebar

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you want an instance of myListener to be placed… May 11, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer Your code does work when you escape the plus signs:… May 11, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer If the user can function without the database they should… May 11, 2026 at 4:31 pm

Related Questions

I have a web form that I am attempting to implement dynamic drop down
I have a Joomla installation with search-friendly-urls at the root level of the domain,
What I want to do is build some mini cms which hold pages with
I have copied the files and database from BradPPresents.com to BradP.com . The .htaccess

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.