LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-27-2004, 04:15 PM   #1
Hady
Member
 
Registered: Nov 2003
Posts: 55

Rep: Reputation: 15
Sorting a list of words in LISP!


hi!

how can i sort a list of WORDS in LISP?

(is there any function in LISP that is equivalent to C++'s strcmp?)
(can i get the ASCII code of a character in LISP?)

thank you
 
Old 05-01-2004, 03:29 PM   #2
eric.r.turner
Member
 
Registered: Aug 2003
Location: Planet Earth
Distribution: Ubuntu
Posts: 208

Rep: Reputation: 31
ANSI Common Lisp has a sort function and a few string comparison functions.

Code:
(sort sequence predicate &key key)
(string< string1 string2 &key start1 end1 start2 end2)
(string> string1 string2 &key start1 end1 start2 end2)
(string-greaterp string1 string2 &key start1 end1 start2 end2)
(string-lessp string1 string2 &key start1 end1 start2 end2)
To sort a list of strings in ascending order try this:

Code:
(sort '("foo" "baz" "bar") #'string-lessp)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Replace: Asian Words to English Words ieeestd802 Linux - Software 0 10-27-2004 07:48 PM
Lisp phoenix7 Programming 4 09-24-2004 07:40 AM
Gnome panel - window list (sorting) dnar Linux - General 0 06-06-2004 10:41 PM
This might sound strange, but I need a big list of dirty words. Travis86 Programming 12 07-17-2003 11:06 PM
Lisp, emacs-lisp aizkorri Programming 1 09-04-2002 06:16 PM


All times are GMT -5. The time now is 06:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration