I'm new to lisp and newLisp - sorry if that's quite stupid ;)
Can I return a list from a function as element-by-element, without collecting it to the temporary variable? And is it have a sense?
To enumerate network interfaces I wrote such thing:
Code: Select all
# analog to: /sbin/ifconfig|awk '/^[[:alpha:]]/{print $1}'
(define (if-list)
(set 'iflist (list))
(dolist (str (exec "/sbin/ifconfig"))
(if (find "^[[:alpha:]][[:alnum:]]+" str 0)
(set 'iflist (append iflist (list $0)))))
iflist)
Possible there is a better way for such tasks?