bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

## Re: [Bug-apl] Power Operator (⍣) broken at svn 740 ?

 From: Christian Robert Subject: Re: [Bug-apl] Power Operator (⍣) broken at svn 740 ? Date: Sun, 12 Jun 2016 06:15:42 -0400 User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

```I see. Will test this later.

Unequal to zero or one or > 1, because they are vector of length 1 rather than
boolean scalar ?

what about {1+(divide)⍵}⍣5 ⊢ 1

in that case, 5 would not be a boolean. scalar, yes, but not boolean.

personnaly I prefer the old def who equiv scalar and vector of length 1.

thanks,

Xtian.

On 2016-06-12 05:28, Juergen Sauermann wrote:
```
```Hi Xtian,

the reason is that the arguments of the right function argument of ⍣
have different lengths and are therefore always unequal:

*      FIB←{ 3↓ {⍵,+/¯2↑⍵}⍣{(↑⍵)≤¯3+⍴⍺ ⊣ ⎕←'debug:' (⍴⍵) 'vs' (⍴¯3+⍴⍺)} ⊢ ⍵, 0
1 }**
**      FIB 12**
** debug:  3  vs  1 **
** debug:  4  vs  1 **
** debug:  5  vs  1 **
** debug:  6  vs  1 **
** debug:  7  vs  1 **
** debug:  8  vs  1 **
** debug:  9  vs  1 **
** debug:  10  vs  1 **
** debug:  11  vs  1 **
** debug:  12  vs  1 **
** debug:  13  vs  1 **
** debug:  14  vs  1 **
** debug:  15  vs  1 **
** debug:  16  vs  1 **
** debug:  17  vs  1 **
**      ...*

The power operator is now a macro which uses ≡ instead of ↑=
(which was sort of working, but wrong). The Dyalog manual says:

/"The right argument  must be a dyadic function that returns a Boolean scalar"/,

which is not the case in your example (the right lambda returns a Boolean
vcector).

You probably meant to do this instead:

*      FIB←{ 3↓ {⍵,+/¯2↑⍵}⍣{ ↑⍵≤¯3+⍴⍺ ⊣ ⎕←'debug:' (↑⍵) 'vs' (¯3+⍴⍺)} ⊢ ⍵, 0 1
}**
**      FIB 12**
** debug: 12 vs  1 **
** debug: 12 vs  2 **
** debug: 12 vs  3 **
** debug: 12 vs  4 **
** debug: 12 vs  5 **
** debug: 12 vs  6 **
** debug: 12 vs  7 **
** debug: 12 vs  8 **
** debug: 12 vs  9 **
** debug: 12 vs  10 **
** debug: 12 vs  11 **
** debug: 12 vs  12 **
**1 2 3 5 8 13 21 34 55 89 144 233**
*
/// Jürgen

On 06/12/2016 05:58 AM, Christian Robert wrote:
```
```At svn 739:
-----------

address@hidden:/home/xtian] \$ apl

______ _   __ __  __    ___     ____   __
/ ____// | / // / / /   /   |   / __ \ / /
/ / __ /  |/ // / / /   / /| |  / /_/ // /
/ /_/ // /|  // /_/ /   / ___ | / ____// /___
\____//_/ |_/ \____/   /_/  |_|/_/    /_____/

Welcome to GNU APL version 1.5 / 739

Copyright (C) 2008-2015  Dr. Jürgen Sauermann
Banner by FIGlet: www.figlet.org

This program comes with ABSOLUTELY NO WARRANTY;
for details run: apl --gpl.

This program is free software, and you are welcome to redistribute it
according to the GNU Public License (GPL) version 3 or later.

)load test
SAVED 2016-06-11 23:48:15 (GMT-4)
f←{3↓ {⍵,+/¯2↑⍵}⍣{(↑⍵)≤¯3+⍴⍺ ⊣ ⎕←('debug:') (↑⍵) ('vs') (¯3+⍴⍺)} ⊢ ⍵, 0 1}
df
┌→─────────────────────────────────────────────────────────────────────────────┐
│┌→┐ ┌→───────────────────────────────────────────────────────────────────────┐│
││f│ ↓λ←λ1 ⍵                                                                  ││
│└─┘ │λ←3↓ {⍵,+/¯2↑⍵}⍣{(↑⍵)≤¯3+⍴⍺ ⊣ ⎕←('debug:') (↑⍵) ('vs') (¯3+⍴⍺)} ⊢ ⍵, 0 1││
│    └────────────────────────────────────────────────────────────────────────┘│
└∊─────────────────────────────────────────────────────────────────────────────┘
f 26
debug: 26 vs  1
debug: 26 vs  2
debug: 26 vs  3
debug: 26 vs  4
debug: 26 vs  5
debug: 26 vs  6
debug: 26 vs  7
debug: 26 vs  8
debug: 26 vs  9
debug: 26 vs  10
debug: 26 vs  11
debug: 26 vs  12
debug: 26 vs  13
debug: 26 vs  14
debug: 26 vs  15
debug: 26 vs  16
debug: 26 vs  17
debug: 26 vs  18
debug: 26 vs  19
debug: 26 vs  20
debug: 26 vs  21
debug: 26 vs  22
debug: 26 vs  23
debug: 26 vs  24
debug: 26 vs  25
debug: 26 vs  26
1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711
28657 46368 75025 121393 196418
)off

Goodbye.

At svn 740:
-----------

address@hidden:/home/xtian] \$ apl

______ _   __ __  __    ___     ____   __
/ ____// | / // / / /   /   |   / __ \ / /
/ / __ /  |/ // / / /   / /| |  / /_/ // /
/ /_/ // /|  // /_/ /   / ___ | / ____// /___
\____//_/ |_/ \____/   /_/  |_|/_/    /_____/

Welcome to GNU APL version 1.5 / 740

Copyright (C) 2008-2015  Dr. Jürgen Sauermann
Banner by FIGlet: www.figlet.org

This program comes with ABSOLUTELY NO WARRANTY;
for details run: apl --gpl.

This program is free software, and you are welcome to redistribute it
according to the GNU Public License (GPL) version 3 or later.

)load test
WARNING: this workspace was )SAVEd with SVN version  739
but is now being )LOADed with SVN version  740
Expect problems, in particular when the )SI was not clear.
In case of problems, please try )COPY instead of )LOAD.
SAVED 2016-06-11 23:48:15 (GMT-4)
df
┌→─────────────────────────────────────────────────────────────────────────────┐
│┌→┐ ┌→───────────────────────────────────────────────────────────────────────┐│
││f│ ↓λ←λ0 ⍵                                                                  ││
│└─┘ │λ←3↓ {⍵,+/¯2↑⍵}⍣{(↑⍵)≤¯3+⍴⍺ ⊣ ⎕←('debug:') (↑⍵) ('vs') (¯3+⍴⍺)} ⊢ ⍵, 0 1││
│    └────────────────────────────────────────────────────────────────────────┘│
└∊─────────────────────────────────────────────────────────────────────────────┘
f 26
debug: 26 vs  1
debug: 26 vs  2
debug: 26 vs  3
debug: 26 vs  4
debug: 26 vs  5
debug: 26 vs  6
debug: 26 vs  7
debug: 26 vs  8
debug: 26 vs  9
debug: 26 vs  10
debug: 26 vs  11
debug: 26 vs  12
debug: 26 vs  13
debug: 26 vs  14
debug: 26 vs  15
debug: 26 vs  16
debug: 26 vs  17
debug: 26 vs  18
debug: 26 vs  19
debug: 26 vs  20
debug: 26 vs  21
debug: 26 vs  22
debug: 26 vs  23
debug: 26 vs  24
debug: 26 vs  25
debug: 26 vs  26
debug: 26 vs  27
debug: 26 vs  28
debug: 26 vs  29
debug: 26 vs  30
debug: 26 vs  31
debug: 26 vs  32
debug: 26 vs  33
debug: 26 vs  34
debug: 26 vs  35
debug: 26 vs  36
debug: 26 vs  37
debug: 26 vs  38
debug: 26 vs  39
debug: 26 vs  40
debug: 26 vs  41
debug: 26 vs  42
debug: 26 vs  43
debug: 26 vs  44
debug: 26 vs  45
debug: 26 vs  46
debug: 26 vs  47
debug: 26 vs  48
debug: 26 vs  49
debug: 26 vs  50
debug: 26 vs  51
debug: 26 vs  52
debug: 26 vs  53
debug: 26 vs  54
debug: 26 vs  55
debug: 26 vs  56
debug: 26 vs  57
debug: 26 vs  58
debug: 26 vs  59
debug: 26 vs  60
debug: 26 vs  61
debug: 26 vs  62
debug: 26 vs  63
debug: 26 vs  64
debug: 26 vs  65
debug: 26 vs  66
debug: 26 vs  67
debug: 26 vs  68
debug: 26 vs  69
debug: 26 vs  70
debug: 26 vs  71
debug: 26 vs  72
debug: 26 vs  73
debug: 26 vs  74
debug: 26 vs  75
debug: 26 vs  76
debug: 26 vs  77
debug: 26 vs  78
debug: 26 vs  79
debug: 26 vs  80
debug: 26 vs  81
debug: 26 vs  82
debug: 26 vs  83
debug: 26 vs  84
debug: 26 vs  85
debug: 26 vs  86
debug: 26 vs  87
debug: 26 vs  88
debug: 26 vs  89
debug: 26 vs  90
debug: 26 vs  91
debug: 26 vs  92
debug: 26 vs  93
debug: 26 vs  94
debug: 26 vs  95
debug: 26 vs  96
debug: 26 vs  97
debug: 26 vs  98
debug: 26 vs  99
debug: 26 vs  100
[... and continue until WS_FULL ...]
```
```
```

reply via email to

 [Prev in Thread] Current Thread [Next in Thread]