[Jprogramming] Is there a way to distinguish input 1 from 01 ?
Piet de Jong
pietdion at gmail.com
Fri Sep 15 19:30:08 UTC 2023
I was hoping for a verb u that would tell me generally how many zeroes are at the front of eg 0001001 so that I could distinguish it from 1001.
Thinking about things I want u such that (u y) returns both the y and the number of zeroes fronting y.
> On 16 Sep 2023, at 04:50, 'robert therriault' via Programming <programming at jsoftware.com> wrote:
>
> Is this what you are looking for, Piet?
>
> Cheers, bob
>
> datatype 01
> integer
> datatype 1
> boolean
> datatype
> 3 : 0
> n=. 1 2 4 8 16 32 64 128 1024 2048 4096 8192 16384 32768 65536 131072 262144
> t=. '/boolean/literal/integer/floating/complex/boxed/extended/rational'
> t=. t,'/sparse boolean/sparse literal/sparse integer/sparse floating'
> t=. t,'/sparse complex/sparse boxed/symbol/unicode/unicode4'
> (n i. 3!:0 y) pick <;._1 t
> )
>
>
>> On Sep 15, 2023, at 11:45, Piet de Jong <pietdion at gmail.com> wrote:
>>
>> Would like a verb u such that (u 1) does not match (u 01)
>> Without resorting to character input.
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list