Hi Alex,
yes, correct.
/// Jürgen
On 10/12/2015 05:37 AM,
alexwei...@alexweiner.com wrote:
Jürgen,
Just
wondering: Does this optimization in SVN 682 also apply to
I was just looking at the change, and it's the addition of the following
code, run just after the check for ) or ] commands:
Token constant;
ExecuteList * fun = ExecuteList::fix(statement.no_pad(), constant, LOC);
if (fun == 0)
{
if (constant.get_tag() == TOK_APL_VALUE1) return
Jürgen,Just wondering: Does this optimization in SVN 682 also apply to a homogeneous list of numbers? For example, if the input string is '1 2 3 3 45 3 2'. Is this what you mean when using the term 'single value' ?-Alex
Hi Elias,
I have added an optimization for ⍎ with a single APL
value. SVN 682.
/// Jürgen
On 10/09/2015 04:36 PM, Elias Mårtenson
wrote:
Hello Jürgen,
I am assuming that I am not alone
Hi Elias,
good idea, I will look into this.
Do you have your code somewhere?
I believe the proper way is to stop after the tokenizer stage if
the result is a single APL value.
That way no extra processing is performed and parsing and creation
I think this is a great optimization!!
On Fri, Oct 9, 2015 at 9:36 AM, Elias Mårtenson wrote:
> Hello Jürgen,
>
> I am assuming that I am not alone in commonly using ⍎ for the purpose of
> parsing a number embedded in a string as APL (i.e. something analogous to
> PARSE-INTEGER in Lisp, or strt
Hello Jürgen,
I am assuming that I am not alone in commonly using ⍎ for the purpose of
parsing a number embedded in a string as APL (i.e. something analogous to
PARSE-INTEGER in Lisp, or strtol() in C).
With that in mind, I made a small change to
Bif_F1_EXECUTE::execute_statement() which checked
Of course this was in the context of Jay’s comment on Elias’ APL.
So in that specific case Jay suggested:
(⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400
and then modified it, suggesting ((1+⌊10⍟N)⍴10) to become
(⍳N)⍪[1.5]+\+⌿((1+⌊10⍟N)⍴10)⊤⍳N←400
But this produces the same result:
(⍳N)⍪[1.5]+\+⌿((⌈10⍟N)⍴10)⊤⍳N←400
Hi Peter,
I guess when L⍟(|R)+R=0 is integer then ⌈ and ⌊ would be
the same
and then the 1+⌊ is different from ⌈.
/// Jürgen
On 10/07/2015 04:19 PM, Peter Teeson
wrote:
Re: encode
((1+⌊10⍟N)⍴10)⊤...
On 7 October 2015 at 15:19, Peter Teeson wrote:
> I was wondering why the APL Lang Ref Manual p.161 shows:
> ⌊1+L⍟(|R)+R=0
>
> Why would this not be just as correct?
> ⌈L⍟(|R)+R=0
>
> and so
>> ((⌈10⍟N)⍴10)⊤...
This would tell you that 1000 only has 3 digits.
Jay.
Re: encode
> ((1+⌊10⍟N)⍴10)⊤...
I was wondering why the APL Lang Ref Manual p.161 shows:
⌊1+L⍟(|R)+R=0
Why would this not be just as correct?
⌈L⍟(|R)+R=0
and so
> ((⌈10⍟N)⍴10)⊤...
two symbols less……..
Hi Elias,
using ⍎ in an inner loop is almost certainly a mistake.
In your example ⍎ is evaluated 202287 times. That means we have
less than 5 micro-seconds for tokenising, parsing, and executing
the left argument of ⍎ and for producing it.
It's slightly annoying that you have to know how many 10s to use on
the left of ⊤. You can work it out as:
((1+⌊10⍟N)⍴10)⊤...
On 6 October 2015 at 09:44, Jay Foad wrote:
> (⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400
Your solution is inherently O(n²) because you're using ¨⍳ inside ¨⍳.
The obvious way to fix this is with +\:
(⍳N)⍪[1.5]+\{+/⍎¨⍕⍵}¨⍳N←400
The other obvious source of inefficiency is your use of ⍕ and ⍎.
Instead, how about:
(⍳N)⍪[1.5]+\+⌿10 10 10⊤⍳N←400
I don't know how to do timings in GNU APL s
I found the following quiz on G+, and decided to solve it with APL:
https://plus.google.com/108865431001865524379/posts/FKMrYkF6h3u
The solution I came up with was this:
* (⍳N)⍪[1.5]{+/⍎¨⊃,/⍕¨⍳⍵}¨⍳N←400*
This creates a table showing the number of pages, and the sum of the digits
for that n
15 matches
Mail list logo