Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Dmi

#406
> (set 'q '(a b))
(a b)
> (q 1)
b
> (q 2)
b

but from last call I expect "nil" or something similar.

Does I wrong?

I want a list where last few elements will be optional (all together).

Can I know (through one operator) is such element presents in list and (if present) got its value?



Thanks.
#407
Anything else we might add? /
June 05, 2005, 08:30:48 AM
Thanks, Peter! That helps!
#408
Hello!

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:
# 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)

Can I somehow remove "iflist" from code?

Possible there is a better way for such tasks?