Elias,
The best I can do in the way of a non-recursive one-liner follows
G ← {⍎,⊃((⍵>2),(⍵=2 1 0))/('1 1,(g¨2↓⍳ ⍵)' '1 1' '1' '0⍴0'),0⍴f←⍵
⍴1,0⍴g←{f[⍵]←+/f[⍵+¯1 ¯2]}}
I speculate the time complexity of this solution is O(n). The solution
gives the same results as the F function.
Oh wait... Forget it. I see it now. It's a clever way of seeing how many
first-axis elements there are, with 1 being returned for scalars, yes?
Regards,
Elias
On 4 July 2014 10:34, Elias Mårtenson wrote:
> I have now been looking at the monadic form for a while, and I just can't
> figure out w
I have now been looking at the monadic form for a while, and I just can't
figure out what it is good for. I also don't understand what the ⍴ actually
does with ⍬ as its left argument.
Regards,
Elias
On 4 July 2014 01:23, Juergen Sauermann
wrote:
> Hi,
>
> thanks, added in SVN 358. It also has
Thanks. Interesting solutions.
Frederick, AFAICT your solution has a time complexity of O(n²). Is there a
one-line solution that (like David's) is O(n) but does not use an explicit
loop?
Regards,
Elias
On 4 July 2014 09:12, Frederick H. Pitts wrote:
> Elias,
>
> While Jurgen's solutio
Elias,
While Jurgen's solution is correct for the problem as you stated it,
'Problem 3 - Tell a Fib' in
https://studentcompetitions-general.s3.amazonaws.com/testing-challenge/dyalog/2014%20PhaseI%20Problems.pdf
actually asks for the first n Fibonacci numbers, not the Fibonacci
sequence up
Hi,
thanks, added in SVN 358. It also has a monadic form returning ⍬⍴(⍴B),1.
(according to NARS)
/// Jürgen
On 06/30/2014 04:35 PM, Elias Mårtenson wrote:
Now that we have ≢ (not-identical-to) in the keymap, would it make
sense to implement support for it as well? As far as I know, it only
Here's a formulation using GNU APL. I was thinking in terms of d-fns when I
wrote this. It uses simulated tail recursion. (I alter the args just before
jumping to the function entry point.) If you actually wrote this using a
d-fn, fibgen would be a local function of fibupto.
⍝!
∇z←seq fibgen limi
Hi,
how about this:
* F←{ ⍎ ↑(↑⍵>¯1↑⍵) ↓(1≠⍴,⍵) ↓'F ⍵,1 1' '¯1↓1↓⍵' 'F ⍵, +/¯2↑⍵' }**
**
** F 44**
**1 1 2 3 5 8 13 21 34**
*
/// Jürgen
On 07/03/2014 06:39 PM, Elias Mårtenson wrote:
I am actually trying to do it with GNU APL. I just got the challenges
from Dyalog. :-)
I'll se
I am actually trying to do it with GNU APL. I just got the challenges from
Dyalog. :-)
I'll send you a link to it when I'm in front of a computer.
Regards,
Elias
On 4 Jul 2014 00:32, "David Lamkins" wrote:
> I assume you're trying to do this with Dyalog d-fns.
>
> You need a generator that can
I assume you're trying to do this with Dyalog d-fns.
You need a generator that can produce the next number in the sequence, and
a test to check whether you're done.You can run the generator and test in a
tail-recursive loop while accumulating the results.
I don't know that you'd need to use local
I was playing around with solving the Dyalog challenge, and I found them
pretty easy with the exception of one.
The goal was to write a lambda function that given a single integer,
returns a list of the Fibonacci series up to that number.
The only way I can think of solving it is by using a full
Hi Elias,
thanks, fxed in SVN 357.
/// Jürgen
On 06/30/2014 05:51 AM, Elias Mårtenson wrote:
I'm doing a simple test with alpha-underbar in a lambda function and
getting an error message. To reproduce:
*F ← { ⍺ ⍶ ⍵ }*
*10 + F 20*
VALUE ERROR
F[1] λ←⍺ ⍶ ⍵
^
Regards,
Elias
12 matches
Mail list logo