« first day (1843 days earlier)      last day (794 days later) » 

7:16 AM
@Adám Thank you Adam...I'm Erik Friis, been a member of the APL community since 1983 when I started with IBM out of college. Have a few papers published through the ACM's SIGAPL.
 
@user18167503 What did you do at IBM?
 
I'm currently lead programmer for a US company that has a major application written in APL and we have plans to migrate it to Dyalog APL in order to modernize the UI and be able to go cross-platform...
And (something you don't hear very often these days) I'm looking to hire some APL programming talent part-time consulting
 
Whats the equivalent of python's random.random in APL?
 
@PyGamer0 ?
 
Preferably someone in the US though not required and knowledge of Dyalog APL is a strong plus, although knowledge of APL in general (APL2, etc) is required.
Adam: At IBM I was an application developer using APL2. I wrote a system called Flexi-View which was a very early OLAP/spreadsheet type system than ran on IBM/370
 
7:22 AM
@Adám python's random module has a random function which generates decimal numbers in range 0-1
 
@PyGamer0 Adam literally meant the ? glyph.
 
I got quite heavily involved in the APL community and ended up leaving IBM around 1992 and ended up on Wall St (Morgan Stanley) and then at a number of other investment banks.
 
⋄?5⍴10
 
@KamilaSzewczyk 2 6 8 6 1
 
@KamilaSzewczyk oh lol
 
7:23 AM
@KamilaSzewczyk Drop the 1
 
      ?0
0.895873078
ah
⋄?0 0 0 0
 
@PyGamer0 0.895873078 0.2233873821 0.9982037837 0.9644244921
 
@Adám for some reason I overlooked what @PyGamer0 said about what random.random does
 
Last few years I have been immersed on k/db-q and have been writing a book on the language in my spare time, but doing APL development for a US based company last few years and programming in A+ at Morgan Stanley again prior to that
 
@user18167503 Interesting. Btw, you can indicate a reply to a specific message by hovering the mouse over the target message and clicking ↳ which inserts a "tag" at the beginning of your message, similar to ":60398283"
 
7:27 AM
Anyway I'm looking to hire an APL consultant part-time to start to work as a direct report to me....any interested parties can send a resume and cover letter introducing themselves to erik.friis@me.com
@Adám got it :) thanks.
Nice meeting everyone here!
 
@user18167503 I've starred this message which will make it appear on the "star-board" → for a while, but for a more permanent visibility, you should add a listing on APL Wiki. Let me know if you want help doing so.
 
@user18167503 Hi Erik, is your k-book published?
 
@Adám Will try to add to the Wiki tomorrow. Good idea. Thanks.
@xpqz Not published yet, still manuscript, I read Q for Mortals which was a pretty good intro, but having 30+ years of APL experience and knowing where Arthur Whitney was coming from with k/q there was a lot more to describe including a lot of things that even some of the better q programmers I know didn't even know so there's a lot of good stuff in the book.
 
Adám has added an event to this room's schedule.
 
@xpqz Also looking for people who might want to review the material and provide feedback on presentation of the material if anyone is interested. Not sure if k/db-q is discussed here, but k is just another APL in different clothes :) It has first-classness which is really cool.
 
7:36 AM
@user18167503 Every Friday at 15:00 UTC we have an event ^ where you might spot some potential talent.
@user18167503 K has moved to its own chat room:
 
10:00 AM EST is a bit early for me as I'm usually up till about 4-5 AM these days doing research/writing for my book, but I'll try. Thanks.
@Adám OK good to know
 
You can make Dyalog sleep in parallel with ⎕DL& so e.g. ⎕DL&¨5⍴3600 will sleep 5 hours in just over 1 real-world hour :-D
 
@Adám Wish I could sleep in parallel, sleeping is one habit I've not been able to kick yet :D - though G*d knows I've tried.
 
 
1 hour later…
9:06 AM
I am trying to model dyadic , in Python
lambda x, y: [x] + [y] doesnt seems to be correct
lambda x, y: ([x]if not isinstance(x,list)else x) + ([y]if not isinstance(x,list)else y) also doesnt seem to work
(oh the arguments are vectors / scalars)
just for clarity; what i am really trying to do is translating {⊃∘.,/⍳¨⍵} to python
 
 
2 hours later…
11:02 AM
@PyGamer0 Willing to use NumPy?
 
11:20 AM
@Adám no.
(more clarity: i am doing it for flax)
 
so what you really want is iota with vector right operand
what i did in KamilaLisp was generating the ranges for each element in the vector and getting the cartesian product
                        List<List<BigDecimal>> iotas = arguments.get(0).getList().get().stream().map(x -> {
                            if(x.getType() != Type.NUMBER)
                                throw new Error("Invalid invocation to 'iota'. Expected a list of numbers.");
                            return iota(x.getNumber().get().toBigInteger().intValue());
                        }).collect(Collectors.toList());

                        return cartesianProduct(iotas)
                                .stream()
lots of fluff aside this was the basic idea
while cartesian product was implemented this way:
private static <T> List<List<T>> cartesianProduct(List<List<T>> lists) {
    List<List<T>> resultLists = new ArrayList<List<T>>();
    if (lists.size() == 0) {
        resultLists.add(new ArrayList<T>());
        return resultLists;
    } else {
        List<T> firstList = lists.get(0);
        List<List<T>> remainingLists = cartesianProduct(lists.subList(1, lists.size()));
        for (T condition : firstList) {
            for (List<T> remainingList : remainingLists) {
                ArrayList<T> resultList = new ArrayList<T>();
I have no clue about python but it should be easy to translate
 
11:50 AM
hi folks, noob question once again
what would be nicer, more idiomatic way to pad string to muliples of a number
I have this, but is seems cumbersome
q←'extend me to quads' ⋄ ⊂q↑⍨×∘4⌈÷∘4≢q
any cleaner way to write this ×∘4⌈÷∘4≢
 
how about {⊂⍵,' '↑⍨4|≢⍵}?
 
@KamilaSzewczyk is that java?
 
ill port it later, thanks
 
{⊂⍵↑⍨(≢⍵)+4|≢⍵} doesn't use the space constant but it's a bit longer.
if you trainified these maybe they'd turn out better.
 
11:58 AM
Kamila's as a train: ⊂⊢,' '↑⍨4|≢
 
⋄(⊂⊢↑⍨≢+4|≢)'extend me to quads'
 
@KamilaSzewczyk
┌────────────────────┐
│extend me to quads  │
└────────────────────┘
 
oh, TryAPL supports boxing. i forgot.
 
@MiljanNC I'd write 4×⌈4÷⍨≢.
 
if i understand trains: a 7 train breaks down like: xxxxxxx (each x is a dfn / primitive), -> xxxx(xxx) -> x(xxx)(xxx) -> (x(xxx)(xxx))?
so the end result is a fork?
 
12:01 PM
the performance is quite funny though:
      cmpx '(⊂⊢↑⍨≢+4|≢) str' '(⊂⊢,'' ''↑⍨4|≢) str' '{⊂⍵↑⍨×∘4⌈÷∘4≢⍵} str'
  (⊂⊢↑⍨≢+4|≢) str     → 7.8E¯7 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (⊂⊢,' '↑⍨4|≢) str   → 8.0E¯7 |  +2% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {⊂⍵↑⍨×∘4⌈÷∘4≢⍵} str → 6.0E¯7 | -23% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
@PyGamer0 No, that's wrong xxxxxxx is x(xx(xxx))
 
@Adám what?
 
The right-most 3 functions becomes a single (fork) function. Then repeat.
 
Oh
 
Trains are broken down in odd/even pairs.

2 (f (g X))
3 ((f X) g (h X))
4 (f (g X) h (i X))
5 ((f X) g (h X) i (j X))

etc
 
12:04 PM
so ××××××× -> (××(××(×××)))?
 
Sorry, yes, was missing one x.
abcdefgabcd(efg) → let p←efgabcdpab(cdp) → let q←cpqabq
 
suddenly trains begin to make sense
 
Yay.
Just note that at the very last step, you might end up short, with only two functions. That's an atop then.
 
YESSSS im done making a "game map" you can navigate and with an actual display made from scratch lets gooo!!!
 
i thought it was like: xxxx -> (x(xxx)) so i thought xxxxxx -> (xxx)(xxx)
 
12:08 PM
I think there's a term for that form of parsing, but I've forgotten it. Trains are just pattern recognition, thus hard to teach. I am curious if the documentation/tutorials could be improved
 
@PyGamer0 If so, then what would xxxxxxxxx be?
 
@Adám xxxxxxxxx -> (xxx)(xxx)(xxx)
 
And then what? Would that be a fork in itself?
 
yes
 
That would be interesting. I guess it'd lessen the need for parentheses in complex cases.
 
12:12 PM
Definitely confusing though :)
would this mean f g h i j k l m would be f (g h i) j (k l m)
 
I guess.
@PyGamer0 The thing is, with the current system, you can express that with parens if you want, but with that system, how would you write (f⍵)g(h⍵)i(j⍵)k(l⍵)?
 
@TryAPL i feel like the function above is a good example
      ⊂⊢↑⍨≢+4|≢
┌─┬───────────────────────┐
│⊂│┌─┬─────┬─────────────┐│
│ ││⊢│┌─┬─┐│┌─┬─┬───────┐││
│ ││ ││↑│⍨│││≢│+│┌─┬─┬─┐│││
│ ││ │└─┴─┘││ │ ││4│|│≢││││
│ ││ │     ││ │ │└─┴─┴─┘│││
│ ││ │     │└─┴─┴───────┘││
│ │└─┴─────┴─────────────┘│
└─┴───────────────────────┘
you have an atop and two parenless forks here. and a (A f g) construct which name i forgot.
 
Also a fork.
 
i treat APL more like a natural language than programming language
not sure why, i never did this with anything programming related.
 
For me, it pretty much is a natural language.
 
12:22 PM
it seems like i've been doing APL for 1.5y now with long breaks. i think i started treating APL more seriously only around january/february last year though.
 
I can feel a migrane approaching
I'll stick to thinking about J-style trains :)
 
oh and there's a huge gap in my orchard messages between january 2021 and july 2021. and august 2021 and december 2021.
 
@Adám I guess you could write (fg(hi(jkl)))
 
Ah, right.
 
I'm having an issue with the way i start my game. this is how i usually start my game:
'f'⎕WC'Form'
'f.i'⎕WC'Image'(0 0)('Picture' 'f.b')
'f.b'⎕WC'Bitmap'('CBits'(6⌿6/16 16⍴0))
startGame⍬

I've been trying to throw this into the actual startGame⍬ function but when i do that, for some reason it just shows a blank display instead of pixels.
https://github.com/Brian-ED/myGame
 
12:33 PM
@BrianBED Dfns return the result of the first non-assignment.
 
ohhhh... wait so i put it inside a function and it should work? like {}{startcode}
 
While you can use a dummy variable like _← to assign the result from ⎕WC, you can alternatively use the more modern/functional ⎕NEW system, e.g. f←⎕NEW⊂'Form' and f.i←⎕NEW'Image'(('Points'(0 0))('Picture' 'f.b')). This will also avoid creating f as a global variable.
 
ah interesting. i'll add the modern way ya thanks
 
12:49 PM
Just note that ⎕FIX is finicky about the constructor argument. You can't use positions (like (0 0)) and you must ensure the proper enclosure level (if you want only one property set, enclose the name-value pair).
 
1. what's a constructor argument?
2. and the rest also no idea what you mean. :)
 
1:13 PM
@FawnLocke whats the difference between APL's trains and J's trains?
 
1:25 PM
By J-style I mean "trains" as an idea, since that's where they came from. APL introduced them afterwards.

To answer your question though, J uses hook as 2-train compared to APL's atop.

J's
(f g) Y ≡ (Y f g Y) vs
APL's
(f g) Y ≡ (f (g Y))
J-hook in APL is f∘g⍨⍨Y
 
2:04 PM
@BrianBED The parameters for the created object. Every object has a bunch of properties, which you can either set at creation time or update later. ⎕WC lets you set them by position (in the order shown in the docs) or using the name of each property in a name-value list, but it is very lenient about the exact array structure of its argument. ⎕FIX is very strict.
 
2:42 PM
@Adám I thought ⎕FIX was a typo the first time you used it, that you meant ⎕NEW, but then you used it again. Can you explain the relation to ⎕FIX? Or type twice?
 
Yes, it should be ⎕NEW — I've been writing multiple things in parallel, and the other thing I'm writing about is ⎕FIX-related. Here, it should of course be ⎕NEW to create new objects.
 
Got it! For a moment I was worried about some other problems with ⎕FIX I was not aware of - I a have few I'm trying get fixed in next release of Dyalog.
 
@PyGamer0 You can fix the edge condition by doing a positive check for exactly two divisors.
 
what is the apl quest?
 
@PyGamer0 just a >∘1× then
 
@Adám how?
@Razetime oh this?
 
@BgilMidol Have a look at apl.wiki/APL_Quest
 
2:58 PM
@PyGamer0 you could try making a sieve
 
@Adám oh
 
unfortuntely APL won't let you memoize/declare const static initial prime table
 
@PyGamer0 If 0= the remainder, then +/ counts the divisors, and 2= does the job.
 
so you either hardcode it like pco does which is a horrible solution
or you recompute it each time which is an even worse solution
or you pollute the outer namespace, of course, which is at least to me is inelegant.
 
@KamilaSzewczyk You could memoise it. We can talk about that after the Quest.
Welcome to the second APL Quest!
Today's problem is 2013:2 – Making The Grade:
> Write a dfn which returns the percent (from 0 to 100) of passing (65 or higher) grades in a vector of grades.
 
3:01 PM
how to read the test cases?
 
Anyone has a solution they'd like to show?
 
65∘(100×1∘⊥⍤≤÷⊢∘≢)
 
@BgilMidol entering {your_solution} 25 90 100 64 65 should give 60 etc.
 
I had 100×≢÷⍨+⌿⍤≥∘65 although it errors on the problems page.
 
um is there foreach in apl?
 
3:02 PM
  100×65(+/⍤≥÷≢⍤⊢)
(optimisd by @FawnLocke)
 
@BgilMidol Yeah, although you should avoid it if at all possible.
 
why?
 
APL prefers operating on entire arrays at once.
 
coming up with something on spot, {100×(≢⍵)÷⍨⍵+.≥65} is interesting, but it's a dfn for now.
 
Oh I missed a golfing trick 1⊥ :)
`100×≢÷⍨1⊥≥∘65`
 
3:02 PM
{⍺←65 ⋄ 100×(+⌿÷1⌈≢)⍺≤⍵}
Oops nvm
 
The problem actually asks for a dfn. Trains weren't a thing in 2013…
 
Oh, I see.
 
 {100×(≢⍵)÷⍨+/⍵≥65}
 
((+⌿÷≢)≥∘65) is fairly cute.
 
All these solutions are pretty much equivalent.
 
3:03 PM
{⎕DIV←0 ⋄ ⍺←65 ⋄ 100×(+⌿÷≢)⍺≤⍵}
 
@Richard there's an inner product to be spotted here
 
Yep, I was interested in seeing fun solutions
 
@KamilaSzewczyk Missing 100×?
 
(I couldn't think of any)
 
@Adám oh, yeah.
 
3:04 PM
so is > vectorised?
 
@BgilMidol Yes, as are all arithmetic functions.
 
tryapl link?
 
Has anyone thought about what happens when the list of numbers is empty?
 
⋄1 2 3 > 3 2 1
 
3:05 PM
@KamilaSzewczyk 0 0 1
 
⋄{100×(≢⍵)÷⍨⍵+.≥65} ⍳0
 
@Adám I did but got the spec wrong at first
 
my initial solution handles it
 
@KamilaSzewczyk 100
 
@BgilMidol nvm found it
 
3:05 PM
Mine too.
 
Here's mine: {0=≢⍵:100⋄100×+/(≥∘65÷≢)⍵}
 
⍬≡⍵?
 
mine (although i think this is equivalent to the others): 100×≢÷⍨(+/65≥⍨⊢)
 
@Adám Well, the problem specified the ⍬ behaviour, although it seems strange to want that behavior to me.
      65∘(100×1∘⊥⍤≤÷⊢∘≢) ⍬

100
 
You could argue it should be 0 or undefined or something.
 
3:07 PM
@KamilaSzewczyk I'll take that as homework!
 
⋄(100×≢÷⍨65+.≥⍨⊢) 25 90 100 64 65
 
@KamilaSzewczyk 60
 
trainified version of mine
 
Yes, instinctively the "number of winners in a race of 0" is 0 not "all" to me.
 
It isn't the number. It is the percentage.
 
3:08 PM
@KamilaSzewczyk i think i spotted it
 
very nice
 
⋄100×65>1 2 3
 
So it is true that all participants won.
 
@BgilMidol 100 100 100
 
it's in my answer.
 
3:08 PM
It is also true that all participants lost.
… and dropped out :-)
 
@Adám I think the reasoning still stands.
 
@Adám why?
 
⋄ 0 65 {20×(+/⍺⍸⍵)-≢⍵} 25 90 100 64 65
Idea I had
 
@FawnLocke 60
 
But the problem setter sets the rules, so that's ok.
 
3:09 PM
@BgilMidol Can you find any participants that didn't lose?
 
what counts as "lose"?
 
The only way to win is ... not to play?
 
Hmm, is broken though :)
 
:D
 
@BgilMidol Score under 65
 
3:10 PM
how to calc score?
 
+.⍸ ftw
 
@BgilMidol The scores are given as argument.
@KamilaSzewczyk Doesn't work with Dyalog's inner product :-(
 
@Adám don't most of them pass the test cases?!
 
@Adám maybe dzaima or NARS support it ;)
(i feel like e.g. p7 from that year's competition were much more interesting btw)
 
@Richard I didn't mean the participants in the Quest. I meant the participants in the problem scenario.
 
3:12 PM
@Adám :)
 
Anyway, except for taronish's solution, everyone relies on 0÷0 giving 1.
 
(100×≢÷⍨(≢(⎕UCS 0,⍳64)~⍨⎕UCS))
 
What is that‽
 
lovely
we've got a winner
 
Why are you converting to character?
 
3:13 PM
it's highly important
 
for fun i presume
 
:0 :)
 
Wouldn't (100×≢÷⍨(≢(0,⍳64)~⍨⊢)) work just as well?
 
@Adám I forgot about that ...
 
… assuming all integers.
 
3:14 PM
numbers are too much for my brain to process
 
@taronish You're doing the safe thing.
 
@Razetime .. what about vectors?
 
If you'd rather that 0÷0 give 0, then you can set ⎕DIV←1
And if you'd rather an error on the empty case, then use ×∘÷ instead of ÷
@KamilaSzewczyk 100×≢÷⍨65+.≤⊢
 
Which one is the fastest, and can handle a large vector of grades most easy?
 
⋄ (100×≢÷⍨65+.≤⊢)⍬
@TryAPL ?
 
3:18 PM
@Richard the pure machine code one must be the fastest :p
 
⎕←'test'
@hyper-neutrino ???
 
Bot's on strike
 
it is revolting
 
Typical robot ...
 
      (100×≢÷⍨65+.≤⊢)⍬

100
 
3:19 PM
⋄1
 
we must take shelter
 
@BgilMidol ????
 
      (100×≢÷⍨65+.≤⊢)⍬
100
      ⎕DIV←1 ⋄ (100×≢÷⍨65+.≤⊢)⍬
0
      ⎕DIV←0 ⋄ (100×≢×∘÷⍨65+.≤⊢)⍬
DOMAIN ERROR: Divide by zero
      ⎕DIV←0 ⋄ (100×≢×∘÷⍨65+.≤⊢)⍬
               ∧
 
???
 
This is a manual session transcript, showing the effects of ⎕DIV and ×∘÷
 
3:21 PM
What is the '.' in this expression?
(100×≢÷⍨65+.≤⊢)⍬
the inner product?
 
Inner product
 
That's an inner product. However, when both arguments have rank ≤ 1 it is the same as +/≤
I'd like to draw the attention to what @RikedyP was doing before, using ⍺←65
 
@Adám I like my grade boundaries flexible
 
@Richard 65+.≤⊢ = +/65≤⊢
 
That's a neat way for making the solution more versatile, by giving the user an option to set the winning threshold, but still making 65 the default.
 
3:23 PM
true for the types of data the problem expects
 
@Richard They should all be mostly equivalent, except the solutions that start off by dividing, instead of starting off by summing.
      ]runtime -c {100×(+/65≤⍵)÷≢⍵}scores {100×+/(65≤⍵)÷≢⍵}scores {+/100×(65≤⍵)÷≢⍵}scores

  {100×(+/65≤⍵)÷≢⍵}scores → 6.7E¯4 |     0% ⎕
* {100×+/(65≤⍵)÷≢⍵}scores → 1.7E¯2 | +2466% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* {+/100×(65≤⍵)÷≢⍵}scores → 2.3E¯2 | +3360% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
Seemingly small differences in the formula, can make a big difference in performance!
 
Yes! can you explain?
 
Btw, the * indicates non-matching results, but that's just floating point errors.
The first solution does 100 comparisons, and 99 additions, then 1 division and 1 multiplication.
 
@Adám hold on, my entire server went offline
I'll get to the APL bot in a bit but I have more concerning things I need to try to fix; IDK if my server crashed or if the host is just offline itself
 
The second solution does 100 comparisons, 100 divisions, then 99 summations, and 1 multiplication.
The third solution does 100 comparisons, 100 divisions, 100 multiplications, and 99 additions.
@Richard Does the above make sense?
 
3:29 PM
yes it does!
@Adám then this one should also be fast?
 
It is worse for a different reason:
      ]runtime -c {100×(+/65≤⍵)÷≢⍵}scores {100×+/(65≤⍵)÷≢⍵}scores {+/100×(65≤⍵)÷≢⍵}scores (100×≢÷⍨(≢(0,⍳64)~⍨⊢))scores

  {100×(+/65≤⍵)÷≢⍵}scores      → 6.4E¯4 |     0% ⎕
* {100×+/(65≤⍵)÷≢⍵}scores      → 1.7E¯2 | +2612% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* {+/100×(65≤⍵)÷≢⍵}scores      → 2.3E¯2 | +3534% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  (100×≢÷⍨(≢(0,⍳64)~⍨⊢))scores → 3.4E¯2 | +5131% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
Wow.
 
I cannot get (≢|1⊥0 65∘⍸) to work, 0 and 100 is flipped :). I'm gonna go now.
 
I was just about to say that the last one could be fast :/ -- but I'm singularly bad at guessing what's fast and what's slow.
 
Have fun!
 
3:32 PM
  {100×(+/65≤⍵)÷≢⍵}scores → 5.7E¯7 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {100×(65+.≤⍵)÷≢⍵}scores → 7.5E¯7 | +31% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
today i learned inner product in Dyalog sucks
 
is it because of the ' without' ?
 
I don't understand the runtime difference between the version that has (+/65≤⍵) vs +/(65≤⍵) ...
 
@Richard Yeah, it has to change the size of the pocket over and over.
@taronish The functions have long right scope, so it isn't (+/65≤⍵) vs +/(65≤⍵) but rather (+/65≤⍵)÷≢⍵ vs +/(65≤⍵)÷≢⍵
 
@Razetime where is this week's Enterprise solution?
 
anyone can submit an enterprise solution
 
3:34 PM
      scores←?1000⍴100
      ]runtime -c {100×(+/65≤⍵)÷≢⍵}scores {100×(65+.≤⍵)÷≢⍵}scores

  {100×(+/65≤⍵)÷≢⍵}scores → 5.6E¯7 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {100×(65+.≤⍵)÷≢⍵}scores → 7.6E¯7 | +35% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕



      ⎕⎕⎕
      scores←?1000000⍴100
      ]runtime -c {100×(+/65≤⍵)÷≢⍵}scores {100×(65+.≤⍵)÷≢⍵}scores

  {100×(+/65≤⍵)÷≢⍵}scores → 2.7E¯5 |  0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
  {100×(65+.≤⍵)÷≢⍵}scores → 2.7E¯5 | -2% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
i wonder where the difference comes from (why does inner product works slowly for ""small"" arrays of 1000 elements)
 
(+/65≤⍵) is a single number that is divided by ≢⍵ while (65≤⍵) is a bunch of numbers that each is divided by ≢⍵ (then summed).
 
It is good to understand why some solutions are faster than others.
 
@Adám Ah, thank you.
 
@KamilaSzewczyk Just overhead in setting up the dyadic operator with its operands. Notice how the actual elapsed time is minuscule.
 
⍨ can represent a new emotion now - me when dynamic lexing/parsing
 
3:36 PM
@KamilaSzewczyk Btw, set auto-PW or set ⎕PW←9999 or turn ]rows on to avoid the awkward folding of lines.
 
@Razetime What qualifies as an enterprise solution? Do we have to use XML or CORBA or something? ;)
 
i know, i just didn't do it for some reason i can't remember now.
it'd be cool if i could autoenable rows, but sometimes i like them disabled.
 
your enterprise solution must have multiple entity relationship diagrams and a budget plan
 
@KamilaSzewczyk You can. Just save your session after turning it on. Alternatively, you can run ⎕SE.UCMD'rows on' at startup.
 
i like starting with clear ws each time
 
3:37 PM
Its still a clear workspace.
 
i guess so
 
It only affects ⎕SE, not #
 
Maybe some subcategories, for the fastest, most esthetic, most readable and most obfuscated ;)
 
@Richard :-D What solutions do you suggest for winning each of those?
 
Well, in my case they fall in category 4 I'm affraid :) But would like to go for cat 2 :)
 
3:40 PM
{100×(+/65≤⍵)÷≢⍵} is both fast and readable, no?
 
@Adám this one was the most out of the box for me
@Adám yes
 
I personally find 100×≢÷⍨65+.≤⊢ most aesthetic.
{⍺←65 ⋄ 100×(+/⍺≤⍵)÷≢⍵} is the most versatile.
 
So we miss an obfuscated one. (but don't want to stick that to APL)
 
There's no limit to how obfuscated you can go.
 
I feel like obfuscated is usually most appropriate as a deliberate category ...
 
3:44 PM
⎕←1+2
 
@hyper-neutrino 3
 
Uh, shouldn't that be 4? /jk
 
OK, so what do y'all say. Have we exhausted 2013-2?
 
3:45 PM
ok , not more than + 5 glyphs compared to the normal solution for an obfuscated one
@Adám thanks!
 
OK, then see you around next week for 2013-3: What Is In a Word
 
2013-P3 is not to conplicated I think. I'll try to find some within the different categories
 
@Adám Thanks for hosting!
 
@Richard Candidate: ⍬∘≡+(-∘-/0,2=(⎕UCS'd')/⎕NULL(⎕UCS'A')⍸⊢)⌹≡⌈+.=⍨
 
4:04 PM
@Adám 100×+.≥∘65÷≢
just got here
 
@rak1507 Oh, if I'm not mistaken, that takes the golf price. Nice.
 
@Adám :) keeps me of the street this weekend
 
can i golf this further: ,⍨⍴(⍳×⍨)
 
,⍨⍴∘⍳×⍨
 
huh.
 
4:14 PM
@PyGamer0 What is your ⎕IO?
 
0
 
Then ⊢⊥¨∘⍳,⍨ or ⊢⊥¨⍳⍤,⍨ too.
 
what how does that work?
 
@PyGamer0 ,⍨⍴∘⍳×⍨ → {(,⍨⍵)⍴⍳(×⍨⍵)}
 
@FawnLocke ah now i see it
 
4:21 PM
You could also do ,⍨⍴⍳⍤×⍨
 
]runtime doesn't like quotes. How can I enter expresions like
 ]runtime {⍵≠' '} text
 
use cmpx from dfns.
]runtime is just a wrapper over it.
 
how does that work?
 
]runtime '{⍵≠'' ''}',text is one solution
Also I think ]runtime is different
It uses ⎕AI & ⎕MONITOR, the latter not being present in cmpx
 
@Richard 'cmpx'⎕cy'dfns', and use the cmpx function by passing each expression as a string to it.
]runtime additionally measures the memory consumption (i think?), meaning that it might be of more interest.
but it's not that hard to approximate yourself:
      mem←{x←⎕wa⋄_←⍎⍵⋄x-⎕wa}
      mem¨ '⍳100' '⍳1000'
328 2224
could make it more accurate by checking the amount of memory consumed on a baseline expression: mem←{f←{x←⎕wa⋄_←⍎⍵⋄x-⎕wa}⋄b←f'⍬'⋄b-⍨f⍵}
 
4:40 PM
@KamilaSzewczyk how do I use the cmpx function? Is this a function which must loaded first?
 
      'cmpx'⎕cy'dfns'
      cmpx '⍳100' '⍳1000'
  ⍳100  → 4.3E¯8 |   0% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
* ⍳1000 → 8.0E¯8 | +87% ⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕⎕
 
yes, thanks!
⎕cy loads the function I see
 
exactly.
if you feel like, you can omit the left operand. it copies the entire workspace then.
 
There is a lot in there!
 
      ⎕wa
267066792
      ⎕cy'dfns'
      ⎕wa
261215584
there is indeed
I bet half of this is the hardcoded prime vector in pco.
 
5:29 PM
Lessons 19, 20, 21, 31, 34, 35, 37, 38, 43: xpqz.github.io/cultivations
 
 
2 hours later…
RGS
7:03 PM
@hyper-neutrino hey, sorry to bother, but can you give write access to someone for this chatroom?
"can you" = "do you have the permissions to do so"
 
RGS
7:41 PM
@user1145400 you should be able to chat in this room, now.
@RGS never mind :)
 
Foremost, thanks for providing the writing access. I have a weird question regarding the limitations of the system function ⎕FX. I have noticed there exists an upper bound on the size of the function created in APL (Obviously such a limit should exist, I just have not expected it to be so low). E.g. {1≠⎕FX↑(⊂'f'), ⍵⍴⊂'''x''': ∇ ⍵+1 ⋄ ⍵}0 returns 4095 on my pc. Where could I find out more about it? P.S. I do realize it is a bad practice to create such large functions (especially in APL).
 
8:26 PM
You should probably adjust the MAXWS parameter
 
What a coincidence, I just today bumped into the limit to the number of functions ⎕AT will take as a right argument at 4095
Not a WS size issue, clearly a limit.
    +⎕FX (⊂'z←foo z'),(4095⍴⊂'z←z+1')
0
    +⎕FX (⊂'z←foo z'),(4094⍴⊂'z←z+1')
foo
     foo 0
4094
 
Oh so it could probably be that the array is declared with a fixed size
 
8:44 PM
By the way, {1≠⎕FX↑(⊂'z←f z'), ⍵⍴⊂'z←z+1⋄z←z+1': ∇ ⍵+1 ⋄ ⍵}0 returns 2848 (and not something close to 2*11 = 2048 = 4096÷2, as I would naively expect). But {1≠⎕FX↑(⊂'z←f z'), ⍵⍴⊂'z←z+1⋄z←z+1⋄z←z+1': ∇ ⍵+1 ⋄ ⍵}0 does return 2047.
 
 
1 hour later…
RGS
9:48 PM
@LdBeth That's what I thought would do it.
 
10:08 PM
is there a way to get pixel rgb from a image file i can make in paint? i need it for drawing setpieces in my game, and i would rather draw them than making the rgb for each pixel
 
10:30 PM
you can use ⎕WC'Bitmap' I think
(⎕NEW 'Bitmap' (⊂'File' 'filename')).CBits
there is no documentation for this :/
but I found it from here optima-systems.co.uk/image-filters-apl
 
That's cool
 
errors are not particularly helpful either
      ⎕NEW 'Bitmap'
DOMAIN ERROR
      ⎕NEW'Bitmap'
      ∧
      ⎕NEW'Bitmap' 'test bitmap.bmp'
DOMAIN ERROR
      ⎕NEW'Bitmap' 'test bitmap.bmp'
      ∧
      ⎕NEW ⊂'Bitmap'
FILE ERROR 2 No such file or directory: The object could not be created
      ⎕NEW⊂'Bitmap'
      ∧
 
11:32 PM
@rak1507 thanks so much dude
:D
 

« first day (1843 days earlier)      last day (794 days later) »