« first day (2214 days earlier)      last day (593 days later) » 

12:48 AM
@Jeremygee "sometimes hard to follow threads on here" Seriously! I actually have no idea what comment this is replying to :P Glad to be of help.
 
5 hours later…
6:16 AM
Ah. No multiple indexed assignment?
Not really sure it could be defined in a natural way
7:04 AM
@B.Wilson Uh:
      a←⎕A
      b←⎕D
      (a[3])(b[2])←'x'
      a
ABxDEFGHIJKLMNOPQRSTUVWXYZ
      b
0x23456789
The syntax for the LHS is finicky, it would've taken me a few guesses
@Adám Parens! I see.
I believe this isn't supported…
It would be nice to have the grammar documented
@B.Wilson Well, note that a[3] b[2] doesn't mean what you think; it means ⊂b — yet another reason to stop using brackets!
7:13 AM
@Adám Because binding precedence makes it equivalent to (a[3] b)[2], right?
Yes.
If that wasn't the case, then 10 20 30[2] would be a rank error instead of giving 20, and it'd be incompatible with old (pre-nested arrays) APL.
Indeed, IBM broke this compatibility, making APL2 bind indexing stronger than stranding, so a[3] b[2] works more sensibly, but you need (10 20 30)[2]
With the implicit each on modified assignment, for some reason I wa1s thinking that (a b)[1]← might set the 1+~⎕IOth element of both a and b.
That'd be an each on the bracket indexing itself, which surely can't work.
The interpreter is Magic and designed by Harry Potter. It can do anything.
      a←⎕A
      b←⎕D
      (a b)⊣@1⍨←'x'
      a
xBCDEFGHIJKLMNOPQRSTUVWXYZ
      b
x123456789
↑ is only one character longer.
You can even write the shorter a b⊣@1⍨←'x' but this isn't recommended.
7:20 AM
Wow that's ugly :)
Really? I think it's pretty direct.
If we'd had Structural Under, maybe we'd never added those strange indexed and selective assignments. (a b)←1⍢⊃¨a b
I hate you, by the way. Always effortlessly producing nice little snippets like this :D
7:39 AM
Nice. Prepending an empty vector lets us control the prototype of a potentially empty vector.
Relying on that seems dangerous. Better prepend a cell of the type you want, and then dropping it.
Ah, okay. So that's an Implementation Detail™?
I'd say so, because 1. it varies between implementations, and 2. it varies between versions, and 3. it varies between array ranks (at least in Dyalog).
Yikes. Thanks for warning!
@B.Wilson This paper may interest you.
7:53 AM
Indeed, it does! Will read after work.
 
2 hours later…
9:36 AM
@Adám do note that currently, that if you want to index with a variable as I initially read Adam's snippet, you need brakets so a b(⊣@y⍨)←'x'
Assignment is messy - in the nonbracketed case, the interpreter thinks it should be assigning to y so @ sees the symbol y not it's value
 
3 hours later…
12:59 PM
Welcome to APL Quest 2018-5! Today's quest is What’s Your Sign? Revisited:
> Write an APL expression that, given a 2-element integer vector representing month and day, returns a character vector (string) of the corresponding Western zodiac sign.
Aries 	March 21–April 19 	Libra 	September 23–October 22
Taurus 	April 20–May 20 	Scorpio 	October 23–November 21
Gemini 	May 21–June 20 	Sagittarius 	November 22–December 21
Cancer 	June 21–July 22 	Capricorn 	December 22–January 19
Leo 	July 23–August 22 	Aquarius 	January 20–February 18
Virgo 	August 23–September 22 	Pisces 	February 19–March 20
⊃signs⌷⍨+/(⊂100 ⊥⍵)≥(100⊥⊢)¨dates
And the full version
btw, while the above table looks messy, you can copy and paste it into a character vector cv, and then do t←⎕CSV⍠'Separator'(⎕UCS 9)⊢cv 'S'
I should also have paid attention to the imput formatting perhaps
@Richard You can do something much more elegant.
Have a look at dyadic
ah, never really studied this dyadic way of the functon
reading it right now
ah nice :)
So it tells in which interval the values are
1:06 PM
Indeed.
But 100⊥ or something like that is still necesary. Or ⎕DT?
No, it handles TAO.
TAO?
Basically, lexicographical ordering, so 1 20 precedes 2 1.
yes thanks, thats realy nice
Where does TAO apply? Not for (2 10)>(1 5), whcih will give (1 1) I hope
1:11 PM
Only ⍒⍋⍸
Oh, btw, we'll start the APL Quest 2 hours later beginning March 17. Note that this is between the dates when USA and EU change from winter to summer time, so watch out! We'll begin at 15:00 UTC
so in this case we dan do (2 3)⍸dates and use that as the index for the signs, or rotating them as you did previous time
Wrong order of arguments to but yes.
ah yes, some other functions I also always switch the arguments...
With all this knowledge, and putting dates and signs into 1-letter variables, I have a 7-character solution.
:)
s⌷⍨d⍸⍵
1:18 PM
⊃⍨ but also, that fails when the date falls before the first cut-off.
The easiest is to rotate.
{⊃s⌽⍨d⍸⍵}
can't test it right now but something like this I think
Yes, that's perfect. I had:
(s d)←↓¯3 ¯2⌽2 12⍴⍉t[;1 3 2 4]
s←¯1↓¨s
d←(⍳⍤≢,⍤0⊢){2 2⊃' –'⎕vfi⍵}¨d
F←⊃d∘⍸⌽s⍨
t is test data?
25 mins ago, by Adám
btw, while the above table looks messy, you can copy and paste it into a character vector cv, and then do t←⎕CSV⍠'Separator'(⎕UCS 9)⊢cv 'S'
What is the most compact full definition? I have:
⊃((⍳⍤≢,⍤0⊢)19+1 0 2 1,2 4 2/2 4 3)∘⍸⌽'CapricornAquariusPiscesAriesTaurusGeminiCancerLeoVirgoLibraScorpioSagittarius'(∊⊂⊣)⎕A⍨
ok. Also intrigued by(⍳⍤≢,⍤0⊢)
1:31 PM
Oh, right, that's stupid of me.
(⍳⍤≢,⍪)
But either way, d{⍵,2 2⊃' –'⎕VFI⊃⍺}⍤0←⍳12 is more elegant. An example of putting significant amounts of code into the modifying function in modified assignment.
⊃((⍳⍤≢,⍪)19+1 0 2 1,2 4 2/2 4 3)∘⍸⌽'CapricornAquariusPiscesAriesTaurusGeminiCancerLeoVirgoLibraScorpioSagittarius'(∊⊂⊣)⎕A⍨ then.
And with 20.0, we could use write ⍳⍤≢⍛,⍪19+…
0←⍳12 I can not follow.
You know about A+←1, right?
asigning a function to A?
no
thats +∘1
That's incrementing A. Almost the same as A←A+1
ah , ok
1:37 PM
It exists in many programming languages. We call it modified assignment, but the world calls it
Augmented assignment (or compound assignment) is the name given to certain assignment operators in certain programming languages (especially those derived from C). An augmented assignment is generally used to replace a statement where an operator takes a variable as one of its arguments and then assigns the result back to the same variable. A simple example is x += 1 which is expanded to x = x + 1. Similar constructions are often available for various binary operators. In general, in languages offering this feature, most operators that can take a variable as one of their arguments and return a...
Dyalog allows any function, not just arithmetic primitives.
Here, the function used was {⍵,2 2⊃' –'⎕VFI⊃⍺}⍤0 so the expression is almost equivalent to d←d{⍵,2 2⊃' –'⎕VFI⊃⍺}⍤0⍳12
and ⍤ is rank in this case
Yes. Makes sense now?
@B.Wilson Did you want to post something, or shall we call it a day?
No not yet. A+←1 I get, but the 0 in 0←⍳12 I is nor a variable nor a function
No, the variable is d. 0 is just the right operand of which is part of the modifying function.
@Adám Sorry. Having clipboard problems.
1:49 PM
ok. I will play with it later on than. thanks for the food for thought :)
Late as always. Here's my attempt:
 f←{a w←⍵
  n←'|Capricorn|Aquarius|Pisces|Aries|Taurus|Gemini'
  n,←'|Cancer|Leo|Virgo|Libra|Scorpio|Sagittarius'
  t←(12 2⍴1⌽2⊢⍤/1↓¨⊢⊂⍨'|'=⊢)n
  s←20 19 21 20 21 21 23 23 23 23 22 22
  ⊃t⌷⍨⎕←a(1+w≥a⌷s)}
@B.Wilson Do you want a mod to nuke the message to protect your PPI?
@Adám Please!
@B.Wilson 1↓¨⊢⊂⍨'|'=⊢ is ⊢⊆⍨'|'≠⊢
@hyper-neutrino Can you nuke this to protect PPI?
@Adám Ah! Partition, not Partitioned Enclose. Beautiful.
Not sure why the ⎕← snuck in there :P
1:53 PM
Debugging?
@B.Wilson No need for ⊢⍤ when you have a constant as left argument.
Actually pretty clever to choose day-of-month cut-off from the outset :-)
Ah, yes. ⎕IO issues when pasting into test page.
But with that, I think we'll say, see you next week for 2018-6: What’s Your Angle?
@Adám Lol. You can tell I just rabidly hacked this out :P Thanks.
Note that we'll begin at 15:00 UTC starting March 17!
@Adám done
 
7 hours later…
9:35 PM
does the dyalog IME for windows able to work without dyalog apl installation?
10:28 PM
nevermind, at least github.com/abrudz/Kbd works for me

« first day (2214 days earlier)      last day (593 days later) »