Re: Help please: or function

2009-03-09 Thread Meikel Brandmeyer
Hi Tim, your getArg function is actually a nice use case of a not very often used of condp: :>>. Please note in the following example: as David Nolen said, we have to use seq after re-seq since re-seq doesn't return a nil but the empty list. Hence I used comp to chain the two together. Also inco

Re: Help please: or function

2009-03-09 Thread David Sletten
On Mar 9, 2009, at 5:48 AM, timc wrote: > > (re-seq #"([a-zA-Z_0-9]+)=([^ ]+)" arg))] > Two small suggestions--it's easier, and more legible to use \S to match non-whitespace characters: (re-seq #"([a-zA-Z_0-9]+)=(\S+)" arg) And you've basically defined the "word character" cl

Re: Help please: or function

2009-03-09 Thread Steve Fisher
On Mar 9, 10:48 am, timc wrote: > Can someone please see what's wrong with this. > > (defn getArg [arg] >         "Return a [keyword value] depending on the form of the string arg: >         1. arg is of the form +x ==> [:x true]. >         2. arg is of the form -x ==> [:x false]. >         3.

Re: Help please: or function

2009-03-09 Thread timc
Thanks David. On Mar 9, 4:22 pm, David Nolen wrote: > The first regex is returning an empty list not nil. > David > > On Mon, Mar 9, 2009 at 11:48 AM, timc wrote: > > > Can someone please see what's wrong with this. > > > (defn getArg [arg] > >        "Return a [keyword value] depending on the

Re: Help please: or function

2009-03-09 Thread David Nolen
The first regex is returning an empty list not nil. David On Mon, Mar 9, 2009 at 11:48 AM, timc wrote: > > Can someone please see what's wrong with this. > > (defn getArg [arg] >"Return a [keyword value] depending on the form of the string arg: >1. arg is of the form +x ==> [:x t

Help please: or function

2009-03-09 Thread timc
Can someone please see what's wrong with this. (defn getArg [arg] "Return a [keyword value] depending on the form of the string arg: 1. arg is of the form +x ==> [:x true]. 2. arg is of the form -x ==> [:x false]. 3. arg is of the form x=v ==> [:x v]. 4. el