« first day (2110 days earlier)      last day (545 days later) » 

12:05 AM
In J: how can I make ({.I.1<+/\%seq) “point-free” (i.e. seq doesn't need to be included inside the parentheses: ({.I. … ) seq)?
I get a syntax error before the 1< if I move seq outside the parentheses; I'm not sure how to convince J that (1<) should be parsed as a function. (Not sure if that's the right terminology, I'm still learning ...)
 
 
3 hours later…
3:35 AM
⍵∘(⌷⍨∘⊂)¨⍸((⍉=⊢),⍨∘≢⍴⍳∘≢)⍵ I need a better idiom for "∘.,⍨ without self,self". Especially for cases where there may be legitimate duplicates
 
4:07 AM
Wasn't there some trick for encoding an entire matrix as a single number?
ah, 1⊥,
 
 
1 hour later…
5:13 AM
@Adám another dyalog feature requestion ]history and ]history !first-previous-begins-with and ]history !?first-previous-contains
!cat in linux shell finds the previous bash history command that begins the line with cat. !?cat in linux shell finds the previous command containing cat somewhere in the command
there are loads of other history commands. for instance echo !git:$ inlines the last argument in the previous command that begins with git
instead of $ an integer argument returns that integer position in the command. for `git commit -am 'my commit message', $ returns the commit message, 2 returns -am, 0 returns git, you can also return a range
echo !git:1-2 inlines commit -am into the echo command
Finally, you can view your history by just typing history, and execute a specific command by its history number. !129 will repeat the 129th command in history
I find this would be very useful in my dyalog session for repeating things like link.create, especially when I need to clear, or when I need to load in another namespace for a test, and change around between namespaces
 
 
2 hours later…
7:12 AM
I'd be interested in any optimization suggestions for this solution 2017 day 5. p2 is very slow, but that may be the nature of the problem. But I wonder if there's an array oriented solution, rather than iterative
(C I A = Count Index Array)
 
 
3 hours later…
9:53 AM
@nathanrogers I don't get how that example even works (it seems to be the same as ,¨⍨, are you missing a ~ somewhere?), but how about ,∘.≠⍨⊢⍤/⍤1∘.,⍨
 
 
6 hours later…
4:06 PM
oh I see...
I just went ahead and used the identity matrix to filter out the self,self in ∘.,⍨A
 
@nathanrogers that isn't what your code actually does though
it returns the duplicates
 
Oh yes, I am forgetting ~
{⍵∘(⌷⍨∘⊂)¨⍸~((⍉=⊢),⍨∘≢⍴⍳∘≢)⍵}
 
anyway I missed that there can be legit duplicates, in that case ,∘.≠⍨⍤⍋⊢⍤/⍤1∘.,⍨
 
 
1 hour later…
5:16 PM
Sorry, but found some time now
'BC'(10 50){(r d)←⍺ ⋄ (g n p)←⍵ ⋄ m←100÷⍨d+.×r∘.=g ⋄ n+.×⍥(m∘×)p}g n p
Used ⍥ to get bonus points from @Adám
 
@nathanrogers True, I forgot that step.
 
'BC'(10 50){(r d)←⍺ ⋄ (g n p)←⍵ ⋄ m←100÷⍨d+.×r∘.=g ⋄ n+.×⍥(m∘×)p} 'ABBDCAB' (2 5 1 5 4 1 5) (4.99 4.99 8.99 8.99 7.99 8.99 2.99)
 
@SimonBranch I'm not really a Jer, but I believe the problem isn't actually 1< needing to be a function, but that you have a whole bunch of monadic applications: % and +/\ and I. and {. so you need a lot of Caps: ([:{.[:I.1<[:+/\%)seq
@nasseralshammari If I knew of a simpler solution, I'd put it on APLcart.
 
@Adám Thanks, that's what I came up with as well. Not super satisfying but oh well ...
 
Alternatively, you can compose the functions together.
@nathanrogers John is working on overhauling how the session log works, and it them may become easier to implement such functionality. Right now, you cannot distinguish between input and output without assuming that input begins with 6 spaces. For that, you can search ⎕SE.Log.
Actually, now I think of it, we could store all output as it happens, and then subtract that from the full Log to get only the input…
 
5:44 PM
@Adám Thanks for your efforts! I've been listening to Array Cast watching your videos. Great stuff.
 
 
2 hours later…
7:30 PM
@Adám Fun video. Never considered not using primitives. Thought you were going to reach for :If... etc
 
@Adám, I don't know if APL primitives do dynamic dispatch, but if it were possible for @ to accept a constant right operand ' '@'-'⊢'asdf-asdf' would be a very useful utility
 
It can indeed, but then it means "at indices"
 
Yes I know of ⎕R, but I'm trying to keep things APL/April agnostic
 
Uh, I didn't ask.
 
7:34 PM
Trying to think of a "cheap" way to express ⍎¨(char split ⊢)
I use this idiom all over the place
@Adám It just seems the obvious follow up to wanting to replace characters in a string
 
' '@(=∘'-') isn't so bad.
@nathanrogers ⊃⌽char⎕VFI?
 
Hey that's a neat feature I didn't know about
although, not implemented in April
 
I think you'll find a lot in "hobby" APLs, that while the fun core language might be all there, the stuff to actually get business done is lacking.
 
well, the nice thing about April is that I can inject any arbitrary Lisp function. So wahtever functionality is lacking I can implement
but for the purposes of AOC, I'm trying to solve each part implementation agnostically
I wonder if I could define ⎕VFI with the same name... ⍥
Or, I could define some vfr←⎕VFI, and then pass in a function in April which does the same thing... hmmmm
A wild mogus appears...@Richard
 
7:54 PM
@nathanrogers ?
 
@nathanrogers pretty short already
huh, never noticed this, ⎕vfi inserts 0s when there is nothing on the left/right
' '⎕vfi' ' is different to 'c'⎕vfi'c' then ...
 
(⊂⍤(⍎¨'-'(≠⊆⊢)⊃),1∘↓)¨' '∘(≠⊆⊢)¨ it's short enough, but I would prefer a single token for the frequency with which I seem to be using it. ⎕VFI is nice. And since I can define the behavior on my own in April, I can use ⎕VFI in April, and Dyalog won't know the difference.
 
@rak1507 Yes, it is basically a one-line CSV parser, taking delimiters as left argument.
 
why are spaces special cased?
 
And fields can be padded with spaces.
 
7:58 PM
hmm... fairs
 
((⊂⍤(⊃⌽)'-'⎕VFI⊃),1∘↓)¨' '∘(≠⊆⊢)¨ is much better imo, and more specific at any rate
 
What does that do?
 
@nathanrogers {{⊂⍎¨'-'(≠⊆⊢)⊃⍵}@0⊢' '(≠⊆⊢)⍵}¨ slightly nicer maybe
 
@Adám each field is space delimited, but the first field is a pair of numbers, '-' delimited
oh hey, that is nice
 
Can I have an example input line?
 
8:03 PM
2-9 c: ccccccccc
 
And you want 2 9 'c' 'ccccccccc' back?
 
(2 9) 'c' 'ccccccccc'
 
honestly for aoc stuff regex is pretty handy
 
Yeah.
 
but regex isn't implementation agnostic
 
8:04 PM
pcre definitely is
 
@nathanrogers hey i was just solving that one
 
being implementation agnostic is overrated anyway
 
I don't mean the regex notation isn't compatible accross APLs. I mean ⎕R and ⎕S are not in April
 
chances are ~most things aren't in subtle ways
@nathanrogers ah
 
My purpose is to write 1 solution to be testable in both
 
8:05 PM
why? for performance comparisons and stuff?
 
and for consistent behavior
 
fairs
 
some wonky behavior with @ in April, and trains aren't consistent
 
trains aren't consistent?? what
 
atops in particular tend to trigger parallel errors and dozens of emacs windows
 
8:06 PM
strange
 
Writing implementation-agnostic code is like taking ⎕ML-agnosticism to a whole new level.
 
well phantomics is aiming for consistency with dyalog
aside from the k-function and k-if syntax
 
Maybe log what you find as bugs.
 
--why anyone would aim for that I have no idea--
 
:P
I do log them as bugs. There's some performance stuff too, like for 2015 day 6. My impl def isn't the best or most optima, but nearly instant in Dyalog. In April... very long
 
8:08 PM
choosing to be dyalog compatible (read: compatible with dyalog's mistakes) is a bummer
unless april is planning to be a drop in replacement for dyalog (which it isn't), there's no sensible reason (to me anyway)
 
@rak1507 Well, you could ask his reasons, but I think its really just as a starting point from which to get an implementation working
He has some really interesting parallel and lazy behavior on primitives which differs from Dyalog quite a bit
 
@rak1507 Do you mean APL's mistakes, when you write "dyalog's"?
 
both
 
I think APL's are way more fundamental and important than Dyalog's.
Dyalog's are mainly suboptimally designed primitives, like and @ and .
 
choosing to be compatible with APL's mistakes when you're writing an APL... understandable
choosing to be compatible with *a specific APL implementation*'s mistakes... why
 
8:12 PM
in←{{⊂⊃⌽'-'⎕VFI⊃⍵}@0⊢' '∘(≠⊆⊢)⍵}¨
this works nice, unless theres a simplification?
 
You don't need
 
ideally it'd be neither but one is more understandable than the other
 
' '∘(≠⊆⊢)⍵ is ⍵⊆⍨' '≠⍵
 
yes, that was a holdover from ' '∘split¨
 
{⊂⊃⌽'-'⎕VFI⊃⍵} is (⊢/'-'⎕VFI⊃)
 
8:14 PM
yo, how is that?
 
⊢/a b is ⊂a⊢b
 
left argument bit vector, over integer right vector
oh, no
I see, its a R→L fold, so it just returns the right most element
cool
If anyone is wondering how April is extensible. A :space is an APL namespace, and within a :space you can :store-fun and any function passed in will work just like any other APL function. 1 argument is monadic, 2 arguments is dyadic.
 
that's fun
 
They can be used just like any function you define in APL. So for instnace, ⎕SH was missing, so I just passed in a function that calls shell commands and returns text
no⎕C, so I just defined lc which lowercases... Although, I just spoke to phantomics, I can define any function ⎕NAME, so I could conceivably write any utility that's missing and pass it into the global april namespace
if anyone wants to know more about how to get started using April, I'm using this project to help get a template project going. Checkout cl/aoc.asd, cl/setup.lisp, cl/year.lisp and cl/apl/. apl folder contains APL files. AOC defines the lisp system of files, setup defines all the April namespaces, and year does all the namespace configuration, i.e. passing in utility functions, if you need json parser, or make an HTTP request, or start a webserver...
Define all that in lisp, pass it into april... Or just call your april functions from lisp, although I haven't gotten that pattern sorted yet.
 
 
1 hour later…
9:55 PM
oh, when dyalog can't parse, it returns 0. Where I'm returning the text value itself
But @rak1507 One of the reasons I like the concept of April so much is that it's inside of lisp, which means its an APL with all the benefits of lisp, meaning I can extend the language to suit my needs. So now I can write a solution in Dyalog that uses ⎕VFI and it will "just work" in April
same input in RIDE same results
 
10:20 PM
@nathanrogers So you've said before :P
I'd rather have a language that already had most things to suit my needs than was easily 'extensible' (but relying on a whole other language and ecosystem)
it is neat though I'll give you that
 
@rak1507 Sorry, don't mean to repeat. Just wanted to show a real time example, since it was relevant to the preceding discussion. I won't harp on it
 
yeah, it's cool
pretty neat how you can easily add functionality and stuff
 

« first day (2110 days earlier)      last day (545 days later) »