LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 08-12-2007, 07:54 PM   #1
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Lisp: Testing Symbol Equalities


I want to pass a symbol as an argument to a function, but the problem is I can't seem to find a way (none that come to mind, anyways) to test for an equality.

I'm writing a quick Lisp script to save me having to type in "wodim -eject -sao -vv dev=/dev/dvd file.0 file.1 ... file.n" all the time. I'm not trying to make this script efficient in any way shape or form (at least in the way the writing is structured - plus, I'm also using this as a good way to practice my Lisp hacking).

In the script, I want to pass a symbol to a function, dictating the burning style: SAO, DAO or TAO.
Code:
(defvar *device* "/dev/dvd")
(burn-data-dvd :files '("list" "of" "files")
               :device *device*
               :eject t
               :session-type 'sao)
In the function BURN-DATA-DVD I want to test to see what type of burning session was passed. I don't want to resort to passing strings, though.

What predicate do I use to test if SESSION-TYPE is equal to 'SAO, 'DAO or 'TAO? I've tried EQL, EQUAL, EQUALP and I know = won't work as it's reserved for numerical tests.

EDIT: I suppose I should explain, somewhat: the reason I'm not custom tailoring this script for my specific needs and hardware setup is so I can (in hopes) distribute this script.

Last edited by indienick; 08-12-2007 at 08:01 PM.
 
Old 08-14-2007, 05:17 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
I used
Code:
(strcmp string1 string2)
in Scheme. In Lisp you can try also
Code:
(string= string1 string2)
(string-equal string1 string2)
the latter should be case-insensitive! Not tested anyway...
 
Old 08-14-2007, 09:05 AM   #3
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Original Poster
Rep: Reputation: 65
That works perfectly, thank you very much!

I wouldn't have thought to use string-based predicates!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
symbol lookup error: /usr/lib/libgtk-x11.2.0.so.0: undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM
./firefox-bin: symbol lookup error: /usr/lib/libpango-1.0.so.0: undefined symbol: g_s cb8100 Slackware 3 10-05-2006 10:55 AM
LISP or COMON LISP Compiler for Debian carspidey Programming 3 04-19-2006 07:46 AM
debian testing gnumeric 1.5.1-1: undefined symbol: cell_formats forgox Linux - Software 1 09-28-2005 05:26 PM
Lisp, emacs-lisp aizkorri Programming 1 09-04-2002 06:16 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:16 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration