NB. Some problems with mbn

mbn=: ] [^:(_.=]) _.&".
   
   mbn '123'
123
   mbn 'test'
test
   mbn 'test 123'
|domain error: mbn
|       mbn'test 123'
   mbn '123 987'
123 987
123 987
   

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of June Kim
Sent: Thursday, December 27, 2007 17:54
To: Programming forum
Subject: Re: [Jprogramming] Numbers for numbers, otherwise leaving alone

Instructive in several ways. Thanks.

2007/12/28, Roger Hui <[EMAIL PROTECTED]>:
>   mbn=: ] [^:(_.=]) _.&".
>   mbn '12e3'
> 12000
>   mbn '3+45'
> 3+45
>
>
>
> ----- Original Message -----
> From: June Kim <[EMAIL PROTECTED]>
> Date: Thursday, December 27, 2007 4:41
> Subject: [Jprogramming] Numbers for numbers, otherwise leaving alone
> To: Programming forum <[email protected]>
>
> > Current numbers operation is:
> >    ". '12223'
> > 12223
> >    ". 'David'
> >
> >
> > I could change the behavior when y can't be turned into a number:
> >
> >    _99 ". 'David'
> > _99
> >
> > However, how would you define a verb that is:
> >
> >    maybe_numb '12223'
> > 12223
> >    maybe_numb 'David'
> > 'David'
> >
> > I am looking for a simple solution.
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to