Solved

Trivial question on Lisp. Getting string length

Posted on 2003-10-28
8
301 Views
Last Modified: 2010-05-18
Is there a build-in function in lisp to return the length of a string?
If there isn't what are the ways in getting it?
0
Comment
Question by:klackons
  • 4
  • 3
8 Comments
 
LVL 69

Expert Comment

by:Callandor
ID: 9641730
I think the function you want is string-length
0
 

Author Comment

by:klackons
ID: 9641816
well.. string-length didn't work..
but i managed to find it on the web. The function I was looking for is (length string)
thanx anyway...

However now I have another question and that is can there be a AND/OR condition when defining the condition in the (cond ) function??
0
 
LVL 69

Expert Comment

by:Callandor
ID: 9642280
I don't see why not - a condition is not limited to a single test, and Lisp is known for its nested structures.  It's been a while since I actually coded in Lisp, though.
0
 

Author Comment

by:klackons
ID: 9642314
can u pls show me some examples?
let say i want to have a simple AND condition like:

if (A = 1 and B = 1)
  print (stuff)

how should i code this in clisp?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:Tommy Kinard
ID: 9642383
(strlen string) for acad2000i

The cond function can be used like a case select statement:
(cond
     ((= s 1) "Y")
     ((= s 2) "N")
     ((= s 3) "T")
     ((= s 4) "P")
)

I would need a smple set of data to setup the cond.

HTH
dragontooth

0
 
LVL 69

Accepted Solution

by:
Callandor earned 50 total points
ID: 9642756
>if (A = 1 and B = 1)
>  print (stuff)

((and (equal A 1) (equal B 1)) (print stuff))
0
 

Author Comment

by:klackons
ID: 9642817
thanx callandor for the quick reply, that was what I needed to know..
One last question, does that mean 'OR' will work as well?

meaning: ((or (equal A 1) (equal B 1)) (print stuff))

is possible as well?
0
 
LVL 69

Expert Comment

by:Callandor
ID: 9643279
Correct.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 128
why my code login on a web site with access vba don't work on microsoft access 2016 26 58
Modify a small python script 19 97
Beginner to Unreal Engine 4 5 62
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now