Jump to content

Recommended Posts

Posted

HI ..

 

Its me again :unsure:

 

I have a list like (((block1 ((a b) (m n))) (block2 ((x y) (m n))) ....)

 

Block name will be a user input .. if I input "block1" ans will be (((a b) (m n))) ...

 

I got function "member" which can match and extract a value from a list.. any other suggestion?

 

pbe, David, Tharwat, Lee , resu.. ..guys I hope u all are not in vacation ..

 

 

...Thnx..

 

Subho

Posted

Probably what the native functions do but... in lisp :)

(defun getAtom (label lst / i len return )
   (setq i -1 len (length lst))
   (while(< (setq i (1+ i)) len)
       (if(eq label (car (nth i lst)))
           (setq return (nth i lst) i len)
       )
   )
   return
)

Posted

list : - ((block1 (m n) ( k r)) (block2 (r t) (y c)) .........) [may be sub-list repeat multiple times]

 

block name will be user input.. if i input block1, the result will be ((block1 (m n) ( k r)) (block1 (.........))

 

will assoc works?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...