Search found 94 matches

by Veli-Matti
Wed Apr 24, 2024 2:07 pm
Forum: APL Chat
Topic: Help with complex numbers wanted
Replies: 7
Views: 26308

Re: Help with complex numbers wanted

Hi, Ray
is this for any help?
ComplexTimes←{(⍺,¯11○1)+.×9 11∘.○⍵}
      ⎕←vec←0J220+⍳5
1J220 2J220 3J220 4J220 5J220
      2 ComplexTimes vec
2J220 4J220 6J220 8J220 10J220
      100 ComplexTimes vec
100J220 200J220 300J220 400J220 500J220
-Veli-Matti
by Veli-Matti
Mon Jan 15, 2024 2:03 pm
Forum: APL Chat
Topic: multiply a vector by a matrix line by line
Replies: 4
Views: 15015

Re: multiply a vector by a matrix line by line

..or just using another way:
x×[2]y
-Veli-Matti
by Veli-Matti
Thu Jan 05, 2023 8:32 am
Forum: APL Chat
Topic: Symbols for sort idioms
Replies: 25
Views: 527025

Re: Symbols for sort idioms

Hmm.. Behind (and other Adám's proposals) looked pretty interesting and I cannot wait getting my hands on them. But I have to admit that the proposal for monadic ∨ and ∧ sounds easier to grasp. What is more, you can make the example with current tools: ⍝ sort←(⊂⍤⍋⍤⊣⌷⊢) sort'world' dlorw 20 10 40 30 4 ...
by Veli-Matti
Sun Nov 27, 2022 11:34 am
Forum: Language
Topic: Returning functions from functions: TRADFNS vs DFNS
Replies: 6
Views: 20806

Re: Returning functions from functions: TRADFNS vs DFNS

There's this clumsy way how to simulate function setting:
SetSort←{Sort∘←⍋ ⋄ 1=⍵:⍵ ⋄ Sort∘←⍒ ⋄ ⍵}
It's better than nothing.

-Veli-Matti
by Veli-Matti
Wed Sep 14, 2022 7:56 pm
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Nice, tclviii, nice! Usually the old skool ways tend to be efficient, they just don't look that modern, though :) What follows is a warning about code golfing compared to effectiveness: I had this idea making the triangle columnwise, i.e. (I have renamed the functions in my workspace) ∆←pascal_7 r;c; ...
by Veli-Matti
Thu Aug 25, 2022 6:38 pm
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Of course... Good news: I found even quicker solution: ⍝ ]runtime -c "pascalCD6 1000" "pascalCD3 1000" pascalCD6 1000 → 3.2E¯3 | 0% ⎕⎕⎕ pascalCD3 1000 → 3.9E¯2 | +1118% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕ Bad news: there's something fishy when the size goes beyond 1000 :( ⍝ ]runtime "pascalCD3 1 ...
by Veli-Matti
Thu Aug 25, 2022 7:34 am
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Good grief! (why didn't I notice that?) Here's a short recap of the development: ⍝ ]runtime "pascal0 1000" ⍝ ⍉(⍳⍵)∘.!⍳⍵ Elapsed: 41365 ]runtime "pascal1 1000" ⍝ (∘.≥⍨v)×(⊢!⍉)⍵ ⍵⍴v←¯1+⍳⍵ Elapsed: 40769 ]runtime "pascal1a 1000" ⍝ 1,0⍪×\(∘.≥⍨v)×((⌽v-1)⌽r⍴⌽v)÷(r←2⍴⍵-1)⍴v←⍳⍵-1 Elapsed: 267 ]runtime "pasca ...
by Veli-Matti
Wed Aug 24, 2022 5:11 pm
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Once an APL2 bigot, always an APL2 bigot.. ..but thanks for appraisal :) A couple of millisecs can be gained by just a couple of minor changes pascalCD3←{ (⎕IO ⎕ML)←0 3 ⋄ ⎕FR←(⍵>999)(↑⌽)645 1287 ∆←⍵ ⍵⍴0 ⋄ ∆[;0]←1 ⋄ r←0 ∆⊣{∆[r;⍳1+r⊣r+←1]←(⍵,0)+0,⍵}⍣(⍵-1)⊢1 } I have to admit that the ..1+r⊣r+←1.. part ...
by Veli-Matti
Wed Aug 24, 2022 6:03 am
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Being thrilled by pascalCD I noticed that you can pretty easily make that even quicker by just simplifying the code. ]runtime "pascal3 10000" * Benchmarking "pascal3 10000" (ms) CPU (avg): 15875 Elapsed: 15877 ]runtime "pascalCD 10000" * Benchmarking "pascalCD 10000" (ms) CPU (avg): 9282 Elapsed ...
by Veli-Matti
Tue Aug 23, 2022 7:32 pm
Forum: APL Chat
Topic: need a big pascal's table
Replies: 21
Views: 142444

Re: need a big pascal's table

Oh, that's nice! I just realised that the min function was unnecessary in pascal3 making the calculation slightly quicker: m[r;1+i]←×\(⌽i)÷i←⍳r-1 ..but it is still half as quick as your pascalCD. Hats off! Nevertheless, you might be amused with this different kind of approach pascal4←{ (⎕IO ⎕DIV)←1 ⋄ ...