On Tue, 1 Nov 2016 04:28:26 +0100, meino.cra...@gmx.de wrote: > >Hi Jon, > >thanks for reply! :) > >My plan was, to return only one element from that list and >possibly some extra informations and pass that to the processing >function so it could right jump onto that train... > >Is that possible?
Sure. I'm guessing that the list elements are not simple values that can be matched directly, but rather you need to extract and match a search key. You can do something like: (define (find-it lst key) (cond ([null? lst] ;; end of the list (list #f '())) ([equal? (car lst) key] ;; matched the search key ;; return item and next list position (list (car lst)(cdr lst))) (else ;; keep going (find-it (cdr lst) key)) )) To return the 2 values, you can use a list, a vector, a structure or even (values). Depends on what you need to do with them. In Racket (or Scheme or Lisp) an object is just a reference to a heap allocation somewhere. In C terms, you are always dealing with pointers that are implicitly dereferenced when you look at them ... and it isn't possible to get a null pointer. [Actually it's more like workin with references in C++.] When you return the "tail of the list", all that is being passed is a pointer to some element of the original list. This explanation is very simplistic [and not quite correct], but it is close enough to reality that you won't go far wrong thinking about things in this way. The technical details are too involved for you to worry about until you learn more. Hope this helps, George -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.