### Re: iterate over list until you find a match

No you didn't misunderstand AlexI guessed the necessity for "for" when the extracted line gave an error but didn't understand why. Your referral to "for"s documentation explained though I had to play with some examples to drum it in :). Cristophe's examples were very helpful too because

### Re: iterate over list until you find a match

Hi Christophe, > >> : (T (== 1 1) T) > >> !? (T (== 1 1) T) > >> T -- Undefined > > Hi Alex, I'm not sure that you understood Dean's question. > Or maybe I didn't understand your answer. Not sure. I hope I didn't misunderstand ;) > What Dean did: > To understand your definition of mmbr, Dean

### Re: iterate over list until you find a match

Alex, Cristophe I can see I've got quite a bit to learn. Thank you for drawing my attention to the way FOR and Lisp work. I wasn't expecting that at all but it looks very elegant. Thank you also for the extra examples. They do help. Best Regards Dean On 24 November 2016 at 15:35, Christophe

### Re: iterate over list until you find a match

On Thu, Nov 24, 2016 at 1:24 PM, Alexander Burger wrote: > Hi Dean, > >> : (T (== 1 1) T) >> !? (T (== 1 1) T) >> T -- Undefined >> .. >> i.e. I'm assuming this is a... >> "A list is evaluated as a function call, with the CAR as the function >> and the CDR the arguments to

### Re: iterate over list until you find a match

Hi Dean, > : (T (== 1 1) T) > !? (T (== 1 1) T) > T -- Undefined > .. > i.e. I'm assuming this is a... > "A list is evaluated as a function call, with the CAR as the function > and the CDR the arguments to that function. These arguments are in turn > evaluated according to these three rules." >

### Re: iterate over list until you find a match

If I isolate the following line... I get T as undefined : (T (== 1 1) T) !? (T (== 1 1) T) T -- Undefined Whereas...inside the function (de mmbr (Trgt L) (for Ele L #(T (== Ele Trgt) T) (T (== 1 1) T) ) ) : (mmbr 'B '(A B C)) -> T : (mmbr 'D '(A B C)) -> T it works fine. I'm

### Re: iterate over list until you find a match

Alex Thank you very much for this. Best Regards Dean On 23 November 2016 at 21:00, Alexander Burger wrote: > Hi Dean, > > > I'm just wondering what my options are re doing this > > > > (de mmbr (Trgt L) > >(for Ele L > > (if (== Ele Trgt) (println "found so

### Re: iterate over list until you find a match

Hi Dean, > I'm just wondering what my options are re doing this > > (de mmbr (Trgt L) >(for Ele L > (if (== Ele Trgt) (println "found so exit with true") > (println "try next") > ) >) >(prinl "list exhausted so return false") > ) > > (mmbr 'B