Re: APL question

This is a discussion on Re: APL question within the APL forums in Programming Languages category; BTW the enclose function is the "left shoe" character in APLX. "Paul Houle" <asmguru @ yahoo.com> wrote in message news:... > You need to enclose the left argument (scalarizing it) to distribute it > properly across all the right arguments. > > ({enclose}1 2) berp {each} 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1 > > ...Paul > > "Peter Keller" <psilord @ merlin.cs.wisc.edu> wrote in message > news:48f81aab$0$9898$80265adb @ spool.cs.wisc.edu... >> Paul Houle <asmguru @ yahoo.com> wrote: >>> Though you really want to re-write your function: >>> >>> r {gets} n binc i >>> r {gets} ...

Go Back   Application Development Forum > Programming Languages > APL

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 10-17-2008, 01:42 AM
Paul Houle
Guest
 
Default Re: APL question

BTW the enclose function is the "left shoe" character in APLX.

"Paul Houle" <asmguru@yahoo.com> wrote in message news:...
> You need to enclose the left argument (scalarizing it) to distribute it
> properly across all the right arguments.
>
> ({enclose}1 2) berp {each} 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1
>
> ...Paul
>
> "Peter Keller" <psilord@merlin.cs.wisc.edu> wrote in message
> news:48f81aab$0$9898$80265adb@spool.cs.wisc.edu...
>> Paul Houle <asmguru@yahoo.com> wrote:
>>> Though you really want to re-write your function:
>>>
>>> r {gets} n binc i
>>> r {gets} (x/{iota}n) {divide} (x/{iota}i) x x/{iota}n-i
>>>
>>> So you can use the result in subsequent calculation.
>>> ...Paul
>>>
>>> "Paul Houle" <asmguru@yahoo.com> wrote in message
>>> news:qwUJk.2652$hc1.2401@flpi150.ffdc.sbc.com...
>>>>
>>>> 5 binc {each} 0 1 2 3 4 5

>>
>> Wow. I somehow had typed every other combination of {each} except the
>> one you just did, which I tried and it worked just fine. That is pretty
>> cool and makes me very happy since currying in this manner is a common
>> idiom I wish to use.
>>
>> And I rewrote my functions about 5 minutes before you mentioned why as I
>> had just puzzled out the VALUE ERROR I was getting in APLX.
>>
>> However, I have another function, berp, which is the berstein polynomial
>> that takes the binomial coefficient parameters, plus a parameteric
>> variable
>> which represents a location on the bernstein polynomial curve.
>>
>> It looks like this:
>>
>> Z {gets} c berp u
>> Z {gets} (c[2] binc c[1]) x (u*c[1]) x (1-u)*c[2]-c[1]
>>
>> And produces good answers:
>>
>>> 1 2 berp 0

>> 0
>>
>>> 1 2 berp .5

>> .5
>>
>>> 1 2 berp 1

>> 0
>>
>> However, when I try the same trick:
>>
>> 1 2 berp {each} 0 .1 .2 .3 .4 .5 .6 .7 .8 .9 1
>>
>> It fails with a LENGTH ERROR on the marker on 1.
>>
>> Why doesn't {each} work in this context? Do I not have a vector on the
>> left
>> in the same manner that 5 binc {each} 0 1 2 3 4 5 did?
>>
>> Thank you.
>>
>> -pete

>
>



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 11:19 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.