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 ...)
@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
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
@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.
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…
@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
(⊂⍤(⍎¨'-'(≠⊆⊢)⊃),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.
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
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
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.
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.
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
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)