Hi Alex,
one more question:

(de pwilcox (X Y Z I J)
    (! native `*LibRmath "pwilcox" 1.0 (cons X 1.0) (cons Y 1.0) (cons Z
1.0) I J ) )
## double pwilcox(double, double, double, int, int);


: (rmath~pwilcox 2.7 6.20 5.4 1 3)
(native "libRmath.so" "pwilcox" 1 (cons X 1) (cons Y 1) (cons Z 1) I "J")
! J
-> NIL
! I
-> 1
!
-> -4

Why is that second Integer argument interpreted as transient symbol, and
then NIL although the actual arg = 3?
In the docs I only find:
    "The number of fixpoint arguments is limited to six."
but that looks irrelevant here.

So how do I specify a
     ## double pwilcox(double, double, double, int, int);
signature correctly?

Cheers
Thorsten

Am Fr., 13. Nov. 2020 um 17:15 Uhr schrieb Thorsten Jolitz <
tjol...@gmail.com>:

> Hi Alex,
> yes that works with (cons X 1.0), I knew it was a trivial problem.
> Thanks!
> Cheers
> Thorsten
>
> Am Fr., 13. Nov. 2020 um 08:00 Uhr schrieb Alexander Burger <
> a...@software-lab.de>:
>
>> Hi Thorsten,
>>
>> welcome back! :)
>>
>> > I'm playing around with the native function again (after a long long
>> time
>> > ;-) and somehow I don't manage to call a native wrapper with double arg.
>>
>> >
>> > Using rmath from R, random value from poisson distribution:^
>> >  ## double›  rpois(double);
>> > ...
>> > This works
>> > : (native "libRmath.so" "rpois" 1.0 (2.567 . 1.0))
>> > ...
>> > but this dumps
>> > : (de rpois (X) (native "libRmath.so" "rpois" 1.0  (X . 1.0) ) )
>> > ...
>> > When I debug it, X=3 when the function is called.
>>
>> The problem is (X . 1.0), it calls 'X' as a function.
>>
>> So this would work:
>>
>>    : (de rpois (X)
>>       (native "libRmath.so" "rpois" 1.0 (cons X 1.0) ) )
>>
>> ☺/ A!ex
>>
>> --
>> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>>
>>

Reply via email to