bug-apl
[Top][All Lists]
Advanced

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

Re: [Bug-apl] Two questions


From: Christian Robert
Subject: Re: [Bug-apl] Two questions
Date: Sun, 29 Mar 2015 13:49:04 -0400
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Your example from memory is the exact thing I tryed last friday, it give a "LENGTH 
ERROR"

      ∆length
┌2─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌5────┐ 
┌13──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││meter│ 2┌2─┐    ┌2─┐    ┌2─┐     ┌2─┐    ┌2─┐   ┌5────┐ ┌2─┐     ┌9────────┐  
        ┌6─────┐         ┌4───┐     ┌4───┐     ┌4───┐     ┌4───┐      ││
│└─────┘ ││nm│    │um│    │mm│     │cm│    │dc│   │meter│ │km│     │lightyear│  
        │parsec│         │inch│     │feet│     │yard│     │mile│      ││
│        │└──┘    └──┘    └──┘     └──┘    └──┘   └─────┘ └──┘     └─────────┘  
        └──────┘         └────┘     └────┘     └────┘     └────┘      ││
│        │┌5────┐ ┌5────┐ ┌6─────┐ ┌5────┐ ┌4───┐ ┌→┐     ┌6─────┐ 
┌18────────────────┐ ┌14────────────┐ ┌8───────┐ ┌8───────┐ ┌8───────┐ 
┌10────────┐││
│        ││v÷1E9│ │v÷1E6│ │v÷1000│ │v÷100│ │v÷10│ │v│     │v×1000│ 
│v×9454254955488000│ │v×3.0856776E16│ │v×0.0254│ │v×0.3048│ │v×0.9144│ 
│v×1609.344│││
│        │└─────┘ └─────┘ └──────┘ └─────┘ └────┘ └─┘     └──────┘ 
└──────────────────┘ └──────────────┘ └────────┘ └────────┘ └────────┘ 
└──────────┘││
│        
└∊───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│
└∊∊────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
      (2 (2 8)⊃∆length)←'v×9454254955488E3'
LENGTH ERROR
      (2 (2 8)⊃∆length)←'v×9454254955488E3'
      ^                ^

In fact, it goes too deep into the matrix

      (2 (2 8)⊃∆length)←'X'
      ∆length
┌2─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌5────┐ 
┌13──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││meter│ 2┌2─┐    ┌2─┐    ┌2─┐     ┌2─┐    ┌2─┐   ┌5────┐ ┌2─┐     ┌9────────┐  
        ┌6─────┐         ┌4───┐     ┌4───┐     ┌4───┐     ┌4───┐      ││
│└─────┘ ││nm│    │um│    │mm│     │cm│    │dc│   │meter│ │km│     │lightyear│  
        │parsec│         │inch│     │feet│     │yard│     │mile│      ││
│        │└──┘    └──┘    └──┘     └──┘    └──┘   └─────┘ └──┘     └─────────┘  
        └──────┘         └────┘     └────┘     └────┘     └────┘      ││
│        │┌5────┐ ┌5────┐ ┌6─────┐ ┌5────┐ ┌4───┐ ┌→┐     ┌6─────┐ 
┌18────────────────┐ ┌14────────────┐ ┌8───────┐ ┌8───────┐ ┌8───────┐ 
┌10────────┐││
│        ││v÷1E9│ │v÷1E6│ │v÷1000│ │v÷100│ │v÷10│ │v│     │v×1000│ 
│XXXXXXXXXXXXXXXXXX│ │v×3.0856776E16│ │v×0.0254│ │v×0.3048│ │v×0.9144│ 
│v×1609.344│││
│        │└─────┘ └─────┘ └──────┘ └─────┘ └────┘ └─┘     └──────┘ 
└──────────────────┘ └──────────────┘ └────────┘ └────────┘ └────────┘ 
└──────────┘││
│        
└∊───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│
└∊∊────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘



      (2 (2 8)⊃∆length)←18↑'Hello'
      ∆length
┌2─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌5────┐ 
┌13──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││meter│ 2┌2─┐    ┌2─┐    ┌2─┐     ┌2─┐    ┌2─┐   ┌5────┐ ┌2─┐     ┌9────────┐  
        ┌6─────┐         ┌4───┐     ┌4───┐     ┌4───┐     ┌4───┐      ││
│└─────┘ ││nm│    │um│    │mm│     │cm│    │dc│   │meter│ │km│     │lightyear│  
        │parsec│         │inch│     │feet│     │yard│     │mile│      ││
│        │└──┘    └──┘    └──┘     └──┘    └──┘   └─────┘ └──┘     └─────────┘  
        └──────┘         └────┘     └────┘     └────┘     └────┘      ││
│        │┌5────┐ ┌5────┐ ┌6─────┐ ┌5────┐ ┌4───┐ ┌→┐     ┌6─────┐ 
┌18────────────────┐ ┌14────────────┐ ┌8───────┐ ┌8───────┐ ┌8───────┐ 
┌10────────┐││
│        ││v÷1E9│ │v÷1E6│ │v÷1000│ │v÷100│ │v÷10│ │v│     │v×1000│ │Hello       
      │ │v×3.0856776E16│ │v×0.0254│ │v×0.3048│ │v×0.9144│ │v×1609.344│││
│        │└─────┘ └─────┘ └──────┘ └─────┘ └────┘ └─┘     └──────┘ 
└──────────────────┘ └──────────────┘ └────────┘ └────────┘ └────────┘ 
└──────────┘││
│        
└∊───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│
└∊∊────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘


So, I'm reporting this a an official bug on using diadic "right shoe" in a 
selective assignment.

Xtian.


On 2015-03-28 15:08, Juergen Sauermann wrote:
Hi Xtian,

I believe the answer to 1 is something like:

*(2 (2 8)  ⊃ ∆length)←'**v×9454254955488E3'*

Regarding Q2 I need more information how to reproduce. If I remember correctly 
then characters in *⎕TF* refer
to some IBM code page., There could be elements of the GNU APL *⎕AV* that are 
not in that
codepage (and not in the IBM*⎕AV*).

/// Jürgen


On 03/28/2015 02:18 AM, Christian Robert wrote:
)clear
CLEAR WS
      ⎕pw←500
      )copy Convert2 ∆length
SAVED 2015-03-27 16:52:16 (GMT-4)
      24 ⎕cr ⊃
┌2─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌5────┐ 
┌13──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││meter│ 2┌2─┐    ┌2─┐    ┌2─┐     ┌2─┐    ┌2─┐   ┌5────┐ ┌2─┐ ┌9────────┐      
    ┌6─────┐         ┌4───┐     ┌4───┐ ┌4───┐     ┌4───┐      ││
│└─────┘ ││nm│    │um│    │mm│     │cm│    │dc│   │meter│ │km│ │lightyear│      
    │parsec│         │inch│     │feet│ │yard│     │mile│      ││
│        │└──┘    └──┘    └──┘     └──┘    └──┘   └─────┘ └──┘ └─────────┘      
    └──────┘         └────┘     └────┘ └────┘     └────┘      ││
│        │┌5────┐ ┌5────┐ ┌6─────┐ ┌5────┐ ┌4───┐ ┌→┐     ┌6─────┐ 
┌18────────────────┐ ┌14────────────┐ ┌8───────┐ ┌8───────┐ ┌8───────┐ 
┌10────────┐││
│        ││v÷1E9│ │v÷1E6│ │v÷1000│ │v÷100│ │v÷10│ │v│     │v×1000│ 
│v×9454254955488000│ │v×3.0856776E16│ │v×0.0254│ │v×0.3048│ │v×0.9144│ 
│v×1609.344│││
│        │└─────┘ └─────┘ └──────┘ └─────┘ └────┘ └─┘     └──────┘ 
└──────────────────┘ └──────────────┘ └────────┘ └────────┘ └────────┘ 
└──────────┘││
│ 
└∊───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│
└∊∊────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

My first first question is, is there any method to update the formula into 
'∆length' for example
to change the 'v×9454254955488000' into for example 'v×9454254955488E3' in a 
single line assignement
without using any temporary variables ?

I though I can do that with the diadic '⊃' but did not succeed.


My second question is about ")dump sample" of this workspace (to include it in 
this mail);
on reload of sample the '∆length' variable is different from the original one.
See the first 4 lines of this email.


I've also seen some days ago "2 ⎕tf 'varname'" removing an "∊" from what it 
supposed to do, may be related.


I Know that 2 questions in one mail is bad, but you can answer one at a time.



Xtian.

∆length←'meter' (2 13⍴'nm' 'um' 'mm' 'cm' 'dc' 'meter' 'km' 'lightyear' 
'parsec' 'inch' 'feet' 'yard' 'mile' 'v÷1E9' 'v÷1E6' 'v÷1000' 'v÷100' 'v÷10' 
'v' 'v×1000' 'v×9454254955488000' 'v×3.0856776E16' 'v×0.0254' 'v×0.3048' 
'v×0.9144' 'v×1609.344')









reply via email to

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