Last kick at this one. I didn't like having 1 2&{ repeated!
fun=: 100 #. ({. (* , *&(+/)) 1 2&{) - 0 0, 1&{
fun 7 2 5
143547
Cheers, bob
On Dec 13, 2014, at 11:25 PM, robert therriault <[email protected]> wrote:
> Thanks Skip
>
> Tacit version and I'm done on this one.
>
> fun=: 100 #. ({. * 1 2&{),({. * [: +/ 1 2&{)-1&{
> fun 5 3 2
> 151022
> fun 9 2 4
> 183652
> fun 8 6 3
> 482466
> fun 5 4 5
> 202541
> fun 7 2 5
> 143547
>
> Cheers, bob
>
> ps. Only my mom calls me Robert (and that is when I have done something
> wrong!)
>
> On Dec 13, 2014, at 10:30 PM, Skip Cave <[email protected]> wrote:
>
>> Good job Robert!. Your solution is more concise than mine. However, this
>> was the paper and pencil solution.....
>>
>> rb =:]#~(' '~:]) NB. Remove all blanks
>>
>> fun =. 3 : ' rb ":|.(a+b-1{y),(b=.*/0 2 {y),(a=.*/0 1 {y)'
>>
>> fun 5 3 2
>>
>> 151022
>>
>> fun 9 2 4
>>
>> 183652
>>
>> fun 8 6 3
>>
>> 482466
>>
>> fun 5 4 5
>>
>> 202541
>>
>> fun 7 2 5
>>
>> 143547
>>
>>
>> I'm sure there is a more concise way to write
>> ​my function, but I'm not good enough in J to shrink it any further.
>>
>>
>> Skip
>>
>> On Sat, Dec 13, 2014 at 6:59 PM, robert therriault <[email protected]>
>> wrote:
>>>
>>> Hey Skip,
>>>
>>> I'm sure that there are more elegant ways but, here goes.
>>>
>>> fun=: 3 : 0
>>> ​'a b c'=. y
>>> ​(a*b*10000)+(a*c*100)+(a*b+c)-b
>>> ​)
>>> fun 5 3 2
>>> 151022
>>> fun 9 2 4
>>> 183652
>>> fun 8 6 3
>>> 482466
>>> fun 5 4 5
>>> 202541
>>> fun 7 2 5
>>> 143547
>>>
>>>
>>> Cheers, bob
>>>
>>>
>>> On Dec 13, 2014, at 3:17 PM, Skip Cave <[email protected]> wrote:
>>>
>>>> Oops! printing mistake...
>>>>
>>>> fun 5 3 2
>>>> 151022
>>>> fun 9 2 4
>>>> 183652
>>>>
>>>> fun 8 6 3
>>>>
>>>> 482466
>>>>
>>>> fun 5 4 5
>>>>
>>>> 202541
>>>>
>>>> fun 7 2 5
>>>>
>>>> ???
>>>>
>>>>
>>>>
>>>> Skip Cave
>>>> Cave Consulting LLC
>>>> ----------------------------------------------------------------------
>>>> 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
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm