« first day (883 days earlier)      last day (1761 days later) » 

7:55 AM
Idiom recognition appears to really bear some resemblance to database query optimization. There, too, specific operator constellations — speaking of the relational algebra here — are mapped to specific physical execution plans. A good query optimizer comes with a whole library of such constellations that tend to occur again and again in typical query workloads.
 
 
1 hour later…
9:10 AM
0
Q: I can't find apk release file for Play Store

BekzhanI want to release 2nd android app in Play Market. For release need apk file Firstly, I go to Genereate Signed Bundle or APK, there I choice android.jks file from my 1st app and key alias. I get message : App bundle(s) generated successfully: Module 'app': locate or analyze the app bundle. Whe...

 
 
1 hour later…
10:28 AM
does anyone have a better 'fizzbuzz' than this, because it's an introductory programming thing people will occasionally ask me? {⊃,/⍵'Fizz' 'Buzz'[⍸(⍱/,⊢)0=3 5|⍵]}¨⍳15
 
@dogstar {∨/d←0=4/3 5|⍵:d/'FizzBuzz'⋄⍵}¨
 
fizzbuzz is basically: for the numbers 1 to something (usually 100), if the number is divisible by 3 print 'fizz', if it's divisible by 5 print 'buzz', if divisible by both print 'fizzbuzz' otherwise print the orginal number
 
@dogstar Morten Kromberg's high-performance edition:
FizzBuzz←{
    primes←3 5
    text←'Fizz' 'Buzz' 'FizzBuzz'
    case←2⊥⊖0=primes∘.|⍵ ⍝ 0=nothing, 1=Fizz, 2=Buzz, 3=FizzBuzz
    replace←⍸0≠case      ⍝ Indices that need to be replaced
    (text[case[replace]]@replace)⍵
}
 
@Adám i am so curious if a fizzbuzz can be written (nicely) that doesn't use each
 
@dogstar ^^
 
10:33 AM
oh let me look at little closer at that!
 
@dogstar Notice "high performance" ≈ "doesn't use each"
 
also, i did not realize you could use replicate like that, but that makes sense! if it's a scalar on the left, it just replicates the array on the right as a whole, element-by-element?
 
@dogstar Yes. But always be aware of the difference between 3/2 3 and 3/⊂2 3/3⍴⊂2 3 and 3⍴2 3.
⎕←3/2 3 ⋄
⎕←3/⊂2 3 ⋄
⎕←3⍴2 3
 
@Adám
2 2 2 3 3 3
┌───┬───┬───┐
│2 3│2 3│2 3│
└───┴───┴───┘
2 3 2
 
@Adám yeah, that's what i was contrasting with. is there a difference between 3/⊂2 3 and 3⍴⊂2 3?
 
10:43 AM
@dogstar Not if you use a scalar as left argument. But 2 3/⊂4 5 and 2 3⍴⊂4 5 are of course very different:
⎕←2 3/⊂4 5 ⋄
⎕←2 3⍴⊂4 5
 
@Adám right :)
 
@Adám
┌───┬───┬───┬───┬───┐
│4 5│4 5│4 5│4 5│4 5│
└───┴───┴───┴───┴───┘
┌───┬───┬───┐
│4 5│4 5│4 5│
├───┼───┼───┤
│4 5│4 5│4 5│
└───┴───┴───┘
 
In an odd sense, / is like + and is like ×.
 
@Adám huh, that is not what i expected 2 3/⊂4 5 to do.
 
@dogstar What did you expect?
 
10:45 AM
LENGTH ERROR?
 
@Adám either an error, or the same thing as 2/⊂4 5
but i guess i can understand the dimensional logic there
 
@TorstenGrust @dogstar Why, there is a scalar on the right and a vector on the left. APL tends to pair that up by extending the scalar to the length of the vector.
 
Scalar extension.
Yes.
 
gotcha
 
One possible use case is the user being allowed to give exactly one or two arguments. If they give one, you want to use that one twice:
⎕←1 1/2 3 ⋄
⎕←1 1/2
 
10:47 AM
@Adám
2 3
2 2
 
Any other length argument will issue an error.
 
also here's arcfide's fizzbuzz. though it doesn't use the traditional formatting, leaving spaces in places and uses alphabet chars, it generalizes to any amount of parts
 
@Adám would you consider this an idiomatic solution or a golf solution? something like {∨/d←0=3 5|⍵:⊃,/d/'Fizz' 'Buzz' ⋄ ⍵}¨ feels 'more correct' to me, but that ⊃,/ definitely feels gross
@dzaima oh that's amazing, i need to pick it apart
 
@dogstar In this case, you can use instead of ⊃,/ but yes, that look OK to me.
 
@Adám aha i keep forgetting about that! thank you :)
 
10:58 AM
@dogstar How about d/∊'Fizz' 'Buzz'? That reads "correctest" to me. ;-)
 
@TorstenGrust clearly the perfect compromise
also, speaking of @arcfide, i noticed in a few of his talks he mentions the idea of 'machine sympathetic language' (notably in the 'does apl need a type system' talk). does anyone know of any talks or papers where that idea is elaborated on?
 
@TorstenGrust 'FizzBuzz' ≡ ∊'Fizz' 'Buzz'
 
@Adám That's exactly the point.
The single character vector has an aura of hack, though. ;-)
 
@TorstenGrust What?
 
Nevermind. 'FizzBuzz' is just fine.
 
11:24 AM
Dyalog interprets a b←1 2 as (a b)←1 2. I think one of Polivka's books says the result would be a (b←1 2). Is that a hiccup in the book?
 
@TorstenGrust No, it is a dialectical difference. APL2 requires parentheses for multiple assignments, so leaving them out makes a strand instead (bad, since it prevents implementing modified assignment). Dyalog allows omitting them (also bad, since it creates a multiple vs modified assignment ambiguity).
 
I see. (Yes that's from an APL2 book.)
Thank you.
 
@TorstenGrust Morale is obviously to always use parens: a(b←1 2) or (a b)←1 2
 
I'd add a(b←)1 2 for modified assignment if that was allowed. It isn't, unfortunately. So to be safe, you can write a b∘⊢←1 2 or a(b⊢)←1 2 for modified assignment.
 
11:43 AM
 
@dzaima Yes, me too. It is syntactically unambiguous, fairly clean to look at, and fits nicely with the other assignment disambiguations: a(b←1 2) vs (a b)←1 2 vs a(b←)1 2 vs a(b←1)2
 
TIL my apl doesn't allow this :|
 
12:07 PM
k i think that's all, now to think what else might've gone wrong trough my many refactorings to get that to work..
 
@dzaima Should amend←(+←) ⋄ a amend 4 be allowed?
 
@Adám no; right, i should probably make v ← (f←) error, as v ← (f←) ⋄ v ← (f←) already does
 
@dzaima What happens with f←+ ⋄ f(-←)3 or f←42 ⋄ a←10 ⋄ a(f←)20?
 
@Adám the generic SyntaxError: couldn't join everything up into a single expression
 
@dzaima Good.
 
12:33 PM
there's that, along with fixing a←[3] & a←← by limiting what can be assigned to variables instead of allowing anything
 
 
9 hours later…
9:31 PM
@Adám do you think I can save a few bytes by going tacit with this? 50{+/∪∊⍸¨0=⍵|¨⊂⍳⍺}2 3 5
Ignore the inputs, I just copypasted from my repl
I still have trouble transforming dfns into tacit functions when there's a lot of stuff going on
 
@J.Sallé | is a scalar fn.
@J.Sallé No, tacit won't work well, as you have so many monadic applications: ⍸¨ .
 
Yeah, that's what I figured
 
But you can save 2 by converting to tradfn body: +/∪∊⍸¨0=⎕|⊂⍳⎕
 
Ah, that's nice
 
9 mins ago, by Adám
@J.Sallé | is a scalar fn.
 
9:45 PM
@J.Sallé +⌿⍸∨⌿0=⎕∘.|⍳⎕ has no ¨s
 
@dzaima leftover
@Adám I don't think I can explain that well enough though
 
@J.Sallé Really? It is just a remainder table. Very similar to the classic APL primes formula.
@J.Sallé Another alternative: +/a∩,⎕∘.×a←⍳⎕
 
@Adám ⎕∘.|⍳⎕ I assume this is the remainder table?
Ah yes, it is
Okay, I can explain that too I guess
 
@J.Sallé Yes:
⎕←2 3 5(('|',⊢)⍪⊣,∘.|)⍳10
 
@Adám
| 1 2 3 4 5 6 7 8 9 10
2 1 0 1 0 1 0 1 0 1  0
3 1 2 0 1 2 0 1 2 0  1
5 1 2 3 4 0 1 2 3 4  0
 
9:51 PM
@Adám Is there a reason for using +⌿ instead of +/?
 
@J.Sallé No.
 
Okay
 
@J.Sallé Well, one byte: +/⊢∘⍳∩∘∊×∘⍳¨
⍞←2 3 5(+/⊢∘⍳∩∘∊×∘⍳¨)50
 
@Adám 907
 
Oh god, the jots are real
Let me see if I can explain that one
@Adám needs ⎕IO←0 to get the right output for the challenge, btw
Not sure if that changes anything
 
9:53 PM
@J.Sallé Nope: Try it online!
 
Nice! I'm trying to explain it now. ]box on is my friend there
I don't get what this part is doing: ⊢∘⍳∩
 
@J.Sallé ⊢∘⍳ is just ⍳⍵ 'cause think of it as ⍺⊢∘⍳⍵ i.e. ⍺⊢⍳⍵ i.e. ⍳⍵
 
Aaaaah, that's a good trick
 
@J.Sallé is intersection, it returns the elements of its left arg that appear in its right arg. So instead of finding the unique, we just take from the list where they only occur once each.
 
Yeah, now that the ⊢∘⍳ bit is clear, the rest is pretty easy
 
10:02 PM
@J.Sallé 18.0 should replace ⊢∘⍳ with ⍳⍤⊢ which, imho, is much clearer.
 
Indeed it is
 
@J.Sallé Also because it can be used with the left arg, ⍳⍤⊣. Though, with the addition of (which isn't scheduled), one could write ⍳⍛⊣
 
@Adám But they'd be functionally the same, right?
 
@J.Sallé Yes.
 
Nice
 
10:05 PM
@J.Sallé Actually, there is a difference in a very special case.
 
Really?
 
2{a←⍵}⍤⊣4 is shy while 2{a←⍵}⍛⊣4 isn't.
 
Ah, I see. A very special case indeed
 
@J.Sallé You understand why?
 
@Adám Not really, but I don't remember the definition you gave in Extended ⍨
I know is atop
 
10:09 PM
@J.Sallé like but in reverse: A f⍛g B is (f A) g B
Contrast with A f⍤g B which is f A g B
So with g←⊣ we have:
(f A)⊣ B  ⍝  A f⍛g B
 f A ⊣ B  ⍝  A f⍤g B
So with , f is the last function to be applied, and if it is shy, so is the whole expression.
 
@Adám Wait, that's backwards isn't it? Hahahahah
The former is A f⍛g B
 
@J.Sallé Yes, sorry. Fixed :-D
 
Hahahah not a problem though, I got it
 
With we apply after f, and since isn't shy, the whole expression isn't.
 
That's probably something to keep in mind while golfing, I guess
In extended at least
 
10:16 PM
The shy-negation probably doesn't often make a difference, but is really useful for "split-compose": A f⍛g∘h B
It means "apply f to A and h to B, then use those as arguments for g.
 
@Adám Ooooh, that's like (f A) g (h B)?
Ah, ninja'd
 
@J.Sallé Indeed, a very common construct.
 
Yeah, I usually suffer with those pesky parens
 
@J.Sallé You can already write "split-compose", but ugh: g⍨∘f⍨∘h
 
That looks very weird though, especially in a function
A dfn, rather
 

« first day (883 days earlier)      last day (1761 days later) »