Page 1 of 1

noob question about pow

Posted: Wed Aug 22, 2018 6:29 pm
by Yves
Dear All,
i start to use recursive D-fns, and i try sample in immediate selfhelp (F1).

on recursive page, i understand fact function.

but for pow function, i dont understand. it illustrate ∇∇ and use only ∇.
what's the crumble ?

other points : i paste in APL session, and it do an error :
      pow←{             ⍝ Function power.
⍺=0:⍵ ⍝ Apply function operand ⍺ times.
(⍺-1)∇ ⍺⍺ ⍵ ⍝ ⍺⍺ ⍺⍺ ⍺⍺ ... ⍵
}
2 pow 5
VALUE ERROR
pow[1] ⍺=0:⍵ ⍝ Apply function operand ⍺ times.

pow 5
SYNTAX ERROR
pow 5
i dont understand what can i do.
i am lost outer space. can you help me to contact Houston ?

Great Thanks,
Yves

Re: noob question about pow

Posted: Thu Aug 23, 2018 6:07 am
by Veli-Matti
Welcome to the world of operators :)
In this case you need a function as the left operand.
Perhaps this gives some ideas:
      ⍟⍟⍟⍟ 5000
¯0.2720968003
4 ⍟ pow 5000
¯0.2720968003


-Veli-Matti

Re: noob question about pow

Posted: Fri Sep 21, 2018 4:51 pm
by Yves
Dear -Veli-Matti,
Great thanks for your help.

      'bee' ⎕wc 'form' ( 'coord'  'pixel' )
bee.AcceptFiles ← 1
bee.onDropFiles ← 'AffMsg'
┌→───────────────────────────────────────────────────────────┐
│ ┌→────────┐ ┌→────────────────────────────────┐ │
│ #.bee │DropFiles│ │ ┌→────────────────────────────┐ │ ¯1 0 │
│ └─────────┘ │ │C:\Users\user\Desktop\yes.dws│ │ │
│ │ └─────────────────────────────┘ │ │
│ └∊────────────────────────────────┘ │
└∊───────────────────────────────────────────────────────────┘

how to catch path simply with never error ? (i do always mistake or error)
      disp 1↑ 2↓ chn
┌→────────────────────────────────────┐
│ ┌→────────────────────────────────┐ │
│ │ ┌→────────────────────────────┐ │ │
│ │ │C:\Users\user\Desktop\yes.dws│ │ │
│ │ └─────────────────────────────┘ │ │
│ └∊────────────────────────────────┘ │
└∊────────────────────────────────────┘

usualy, i handcraft a trashable and piggy code.
Now, with your help, i do this :
      disp { (≡⍵) (⊃,/) pow ⍵ } 1↑ 2↓ chn
┌→────────────────────────────┐
│C:\Users\user\Desktop\yes.dws│
└─────────────────────────────┘

possible my solution is not the better solution.
i appreciate yours comments on it.
Yves

Re: noob question about pow

Posted: Sat Sep 22, 2018 6:26 pm
by Michael|Dyalog
Bonjour Yves ;-)

let me help to make it shorter:
with msg=

Code: Select all

┌→────────────────────────────────────────────────────────┐
│       ┌→────────┐ ┌→─────────────────────────────┐      │
│ #.bee │DropFiles│ │ ┌→─────────────────────────┐ │ ¯1 0 │
│       └─────────┘ │ │c:\User\desktop\yves.dws\)│ │      │
│                   │ └──────────────────────────┘ │      │
│                   └∊─────────────────────────────┘      │
└∊────────────────────────────────────────────────────────┘


you can also do this:

Code: Select all

      3 1⊃msg
┌→─────────────────────────┐
│c:\User\desktop\yves.dws\)│
└──────────────────────────┘

Re: noob question about pow

Posted: Tue Sep 25, 2018 2:08 pm
by Yves
Dear Michael & All,
Many Thanks for your help.

Before, i use only array with indexing.
Now, i see difference between them.
      ]display str ← 'abc'  'def'  'ghi'
┌→──────────────────┐
│ ┌→──┐ ┌→──┐ ┌→──┐ │
│ │abc│ │def│ │ghi│ │
│ └───┘ └───┘ └───┘ │
└∊──────────────────┘
]display 2 ⊃ str
┌→──┐
│def│
└───┘
]display str[ 2 ]
┌───────┐
│ ┌→──┐ │
│ │def│ │
│ └───┘ │
└∊──────┘


Thank you so much Michael
Guten Tag :-)