Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
By the way, I found a workaround to the string ordering. The workaround requires memory on the order of ↑(⍴V)×⌈/⍴¨V for a vector V. This should be enough justification for the proposed extension. Here's what I do: instead of doing the following: *z[⍋z←'foo' 'bar' 'test' 'aa']* ┌→───

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
Right. My opinion is that grade with an array of lists should do lexical ordering. Given the fact that grade on depth-2 arrays are not specified by the standard anyway, it should be safe. Regards, Elias On 8 July 2014 12:51, David B. Lamkins wrote: > I think it'd be really handy if that expres

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David B. Lamkins
I think it'd be really handy if that expression did what we'd like it to do. I guess it'd fall under the category of "conforming extension". Neither IBM nor ISO APL define a behavior for dyadic grade with other than a character matrix as the right argument. On Tue, 2014-07-08 at 12:40 +0800, Eli

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
To clarify, I tried the following: *(⎕UCS¨⍳1114111) ⍋ 'foo' 'bar' 'test'* DOMAIN ERROR (⎕UCS¨⍳1114111)⍋'foo' 'bar' 'test' ^ ^ Note of course that this is pretty insane, and there should be an easier way to do this. Regards, Elias On 8 July 2014 12:38, Elias Mårte

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David B. Lamkins
On Tue, 2014-07-08 at 12:38 +0800, Elias Mårtenson wrote: > Right, but just having a "plain" collating order for Unicode would > require me to pass a million-element array (⎕UCS¨⍳1114111) as left > argument to grade. > I guess you could do that if you needed to impose a complete collating order u

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
Right, but just having a "plain" collating order for Unicode would require me to pass a million-element array (⎕UCS¨⍳1114111) as left argument to grade. That said, I can't even get dyadic grade to work at all, but that's a separate issue. Regards, Elias On 8 July 2014 12:27, David B. Lamkins w

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David B. Lamkins
The problem with generating a permutation vector for an "arbitrary" Unicode string is still a problems of collating order. There is no inherent order in Unicode; someone has to decide on what makes sense as a collating order for the subset of code points used by the application. You should use ⎕uc

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
Dyadic grade doesn't make much sense in the context of Unicode though. How do you grade an arbitrary Unicode string? That issue is there even if we completely disregard all the *other* Unicode-related collating issues. Regards, Elias On 8 July 2014 12:00, David B. Lamkins wrote: > Check my fo

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David B. Lamkins
Check my follow-up post. I'm fairly certain that the issue is whether monadic grade applied to a list of strings should do anything but signal a domain error. The ISO spec says that monadic grade is defined only on numeric arguments. My test case appears to have monadic grade treating strings as

Re: [Bug-apl] Request: lib_file_io additions

2014-07-07 Thread David B. Lamkins
It looks like glob() subsumes the function of readdir(). There are some nasty details with allocated results, too... You could, however, combine fnmatch() with readdir(). http://linux.die.net/man/3/fnmatch On Tue, 2014-07-08 at 11:44 +0800, Elias Mårtenson wrote: > How about adding support for a

Re: [Bug-apl] Request: lib_file_io additions

2014-07-07 Thread Elias Mårtenson
How about adding support for a dyadic form where the left-side argument is a glob pattern to be used when matching the file names? http://linux.die.net/man/3/glob Regards, Elias On 8 July 2014 00:52, David Lamkins wrote: > Thanks, Jüergen. I'll change my code tonight to use the new calls. > >

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread Elias Mårtenson
Ordering by size first makes very little sense to me. It makes it very hard to sort any list of strings. I was hoping that the following would have done so, but it also suffers from the "length first" issue: *z[⍋ ⎕UCS¨ z←'aa' 'xx' 'aaa' 'xxx']* aa xx aaa xxx What is the proper way to sort

[Bug-apl] Execution properties - "cannot be suspended" bit

2014-07-07 Thread David B. Lamkins
The ISO spec for the component file interface says: "The functions described here must be written so that they do not suspend. Any errors encountered or detected must be passed to the context from which the function was invoked." I believe that means that the function's "cannot be suspended" attri

Re: [Bug-apl] SQL load library should not be erased

2014-07-07 Thread Blake McBride
The attached patch corrects the problem I described. Thanks. Blake On Sun, Jul 6, 2014 at 9:49 AM, Blake McBride wrote: > Currently, the function sql∆∆load_library gets called when the SQL.apl > gets executed to load the native library and then gets erased. This is a > problem in the follow

[Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David Lamkins
Given a list of character vectors (and scalars), grade appears to generate the permutation vector first by length then by content. ⍋'aaa' 'xx' 'y' 'bbb' 'cc' 3 5 2 1 4 This seems counterintuitive. It seems as if ⍋ treats character strings like numbers. Is this a bug? -- "The secret to cre

Re: [Bug-apl] Question about behavior of ⍋

2014-07-07 Thread David Lamkins
Looking at the spec, it seems that monadic grade is defined only for numeric data. That leaves open the question of whether my example should have signaled a domain error. On Mon, Jul 7, 2014 at 11:25 AM, David Lamkins wrote: > Given a list of character vectors (and scalars), grade appears to

Re: [Bug-apl] Request: lib_file_io additions

2014-07-07 Thread David Lamkins
Thanks, Jüergen. I'll change my code tonight to use the new calls. I like your solution to readdir() access. I fell asleep last night pondering how best to do that. On Mon, Jul 7, 2014 at 9:44 AM, Juergen Sauermann < juergen.sauerm...@t-online.de> wrote: > Hi David, > > I have added rename (FI

Re: [Bug-apl] Request: lib_file_io additions

2014-07-07 Thread Juergen Sauermann
Hi David, I have added rename (FILE_IO[27]), SVN 364. I didn't do readdir() because that would need you to opendir(), loop around readdir() and closedir(). Instead FILE_IO[28] returns the entire directory as a matrix in one go. Every row is a dirent struct but with a different order: *

Re: [Bug-apl] Request: lib_file_io additions

2014-07-07 Thread Juergen Sauermann
Hi David, thanks, I'll do that. /// Jürgen On 07/07/2014 09:31 AM, David B. Lamkins wrote: There are two functions that I'd like to access via lib_file_io: readdir() and rename(). I'm currently implementing these via popen() through lib_file_io, but that seems inelegant... I have immediate

[Bug-apl] Request: lib_file_io additions

2014-07-07 Thread David B. Lamkins
There are two functions that I'd like to access via lib_file_io: readdir() and rename(). I'm currently implementing these via popen() through lib_file_io, but that seems inelegant... I have immediate application for these calls in the component file library.