« first day (363 days earlier)      last day (2281 days later) » 

8:40 AM
@ngn Roger asks if you have any feedback on the TAO Axioms.
 
 
5 hours later…
2:00 PM
Hey @Adám, any obvious golfs to this fn? ⊢/∧¨⍳ That's for finding the LCM between input and ⍳ Input
 
@J.Sallé I'm not sure I understand. Can you give me an example run?
 
@J.Sallé ...why the /? or even the ¨
 
@Adám for input 10, find the lowest common multiple between 10 and each of ⍳10
@EriktheOutgolfer residue of the first versions of the function, I guess. Works fine without it.
 
@J.Sallé Yeah, is scalar function (so ¨ does nothing), and reductions on a scalar argument does nothing either.
 
@Adám Ah, makes sense. I think I used the ⊢/ there at first so I could get the last element of the range as a left argument.
 
 
2 hours later…
3:54 PM
What does ? do in APL? I've never seen it used before but it's on my keyboard as <APL>-q
 
Ven
@Pavel Random
 
@Pavel ?A gives a random among ⍳A
@Pavel A?B gives A randoms among ⍳B without replacement.
 
If the right argument is a list, is it random choice?
 
@Pavel No, Monadic ? is scalar; it applies to each.
@Pavel Dyadic ? can only take a single numbers
 
Ven
@Pavel "pick one" is A[?⍳A]
 
4:00 PM
{⍵[?⍴⍵]}, not , no?
 
@Ven No, A[?≢A]
 
Ven
Thanks
yeah, I paste the ⍳ instead of thinking about it
 
Or ?∘≢⌷⊢ as a function.
 
@Adám Why ≢ and not ⍴?
I thought ⍴ was length
 
@Pavel is (re)shape, but is number of items.
 
4:02 PM
Ah, so ⍴ will fail on 2d lists?
 
@Pavel Yeah, but so will []. However, ?∘≢⌷⊢ will work on any rank array.
 
@Adám Remind me what does?
 
Ven
@Pavel tack, returns the argument.
 
@Pavel is index (like [ and ] printed on top of each other), is just identity.
@Pavel So ?∘≢ is a random among the tally, indexes into the argument.
 
So tack automatically converts a block it's present in into a function?
 
4:06 PM
@Pavel No, it is just a normal function which returns its (right) argument. The entire thing, ?∘≢⌷⊢ is a single tacit function.
 
But why wouldn't just ?∘≢⌷ work?
 
@Pavel No, as that would be ?∘≢ applied to the result of monadic while we want the result of ?∘≢ to be the left argument to and to be the right argument. In effect, you are accessing the argument's value twice; once to get a random index, and once to get the array of data to select from.
 
I don't get tacit functions...
 
@Adám So a train is an arbitrary sequence of any APL objects where the righmost element is a function?
 
4:16 PM
@Pavel Yes, with the restriction that you can't have the two rightmost elements be Array,Function.
 
That explains why 2+ doesn't work.
 
@Pavel Indeed. You need 2∘+ or 2+⊢
 
I think I'm misremembering what ∘ does
 
Ven
@Pavel It currifies (returns the operator with an operand pre-applied)
 
@Pavel Two things: Array∘Function and Function∘Array converts a dyadic function to a monadic one, "filling" the argument slot.
@Pavel Second: A f∘g B is A f g B and f∘g B is f g B
 
4:21 PM
I did (+∘×) and I'm still trying to figure out what this function I composed does.
 
Ven
@Pavel applies one then the other.
Similarly to function composition in languages like Haskell, etc.
 
@Pavel Dyadic, it is the left argument plus the signum of the right. Monadic it is the complex conjugate of the signum, i.e. the signum.
 
In otherwords, it does exactly what I thought did, and I had no idea what monadic × did. Lovely.
 
 
1 hour later…
5:26 PM
Is there a shorter way to call a function recursively with arguments ⍺+1 and than ⍵∇⍨⍺+1?
Also, would it be acceptable (by PPCG consensus) to make a function taking 2 inputs when the challenge specifies a single input? This is the challenge in question, and I'm taking the list as and the number 1 as to call the dfn recursively.
 
ngn
6:04 PM
@J.Sallé I don't think there's a shorter way. You might be able to find an alternative if you look at the bigger picture. For example, sometimes the power operator (⍣) or reduction (/) could act as a substitute for recursion. (This is just general advice, I haven't looked at that particular problem yet.)
 
@ngn this is the current function I have: {∧/0=⍵|⍺+⍳≢⍵:⍺⋄⍵∇⍨⍺+1}
 
ngn
@J.Sallé I don't expect them to allow that, but it doesn't hurt to ask the original poster.
@J.Sallé it would cost you at most 2 chars: 1{...}⊢ instead of {...}
 
@ngn yeah, I actually thought of doing that. I'll post it like that and edit if it's acceptable to have a second input.
 
ngn
@J.Sallé Are you familiar with the Chinese Remainder Theorem? It might be useful there.
 
@ngn Nope, all I know is that there's a Mathematica built-in for it.
I'll look into it though
Just looked into it and realized I can't math hard enough to code that >.>
 
ngn
6:15 PM
@Adám I don't really have important feedback. I like the "Model" section very much - it cuts through the jungle of words and says precisely and concisely what I need to know. I'd move it to the top :)
@J.Sallé So, in your solution you're testing all integers recursively until you find a matching one? Maybe you could shorten it by testing with {}¨⍳B up to some upper bound B
 
@ngn I am, yes. I'll look into this upper bound thing, but I don't know if it'd save anything.
 
ngn
6:36 PM
@J.Sallé you can save 1 char by using signum and negating the guard: 1{∨/×⍵|⍺+⍳≢⍵:⍵∇⍨⍺+1⋄⍺}⊢
 
@ngn oh, that's interesting. I don't think I've ever used monadic × before.
 
 
4 hours later…
10:41 PM
@ngn I find it more elegant to use 1jot{...}
 
ngn
11:32 PM
@Uriel yep, that's probably better
@Uriel even better: {...}∘1 and swap and to save 1 char
@Uriel {∨/×⍺|⍵+⍳≢⍺:⍺∇⍵+1⋄⍵}∘1
 

« first day (363 days earlier)      last day (2281 days later) »