« first day (1407 days earlier)      last day (46 days later) » 
01:00 - 16:0016:00 - 23:00

1:12 AM
<phantomics> Hey all, have a question about how numbers are implemented/formatted in APL
<phantomics> For instance:
<phantomics> ⋄ ⍪12.2J44 3J8 19J210.17
<phantomics> I entered 3J8 as a complex integer, but when printed in a column with floats, the 3 is appended with .0 as though it were a float
<phantomics> In April, I do things differently. The above code will result in:
<phantomics> 12.2J044.0
<phantomics> 3 J008
<phantomics> 19.0J210.17
<phantomics> Not representing the 3J8 as a float. Does normative APL print non-floats with decimal points in order to make column printing neater?
phantomics: I don't think there's any standard on number alignment when formatting. Even if ISO does specify, it doesn't have complex numbers, so it wouldn't be relevant here.
In Dyalog and J, complex numbers can only have floating point components, so the decimal points you're seeing wouldn't be a misrepresentation.
<phantomics> Got it, in April as in CL complexes can have either rational or float components
<phantomics> Then the other confusing thing in other APLs is how floats are rendered without decimal points when they're close to a rounded integer value, like 10.0
<phantomics> Also are all the floats in Dyalog double?
Yeah, Dyalog semantically only has IEEE doubles (well, and 128-bit decimal floats if you set ⎕FR).
So I guess the answer is that yes the extra decimals you showed are only there for alignment, but Dyalog's free to format numbers however it wants because it doesn't have to describe the type.
<phantomics> Ok, got it, defaulting to singles causes confusion when 10.0|21010111 results in 2.0
<moon-child> the main thing I'm confused by is not the lack of trailing zeroes, but the leading zeroes. Why not '3 J 8'?
<phantomics> The leading zeroes are to align the 8 with the other numbers
1:27 AM
I would definitely default to doubles.
<moon-child> right; why align with zeroes instead of spaces?
<phantomics> It's standard in other APLs
<phantomics> Marshall: sounds good
<phantomics> I think aligning with zeroes is preferred because when there are spaces, there's a risk that the column could be read as multiple columns at a glance
<phantomics> Normative APLs don't put any spaces inside the representation of a number, that way you can always tell that a printed column is one column
<moon-child> don't you run the same risk by doing '3 J' instead of '3.0J'?
The spaces could also be frustrating since you can no longer copy-paste the number effectively. I'm inclined to say that's worse than bad alignment would be.
<phantomics> Yes, that's the issue with my current representation, but I don't want to represent a complex integer as a float
<phantomics> I've been thinking of printing them like this: 3__J008
<phantomics> And maybe tweaking my reader so that it'll handle underscores like that
<moon-child> I think that would be good esp. if you can also use it as a separator
<moon-child> e.g. 3_000_000 instead of 3000000
That could work. I like being able to separate numbers.
<phantomics> Thing is, if I print with decimals like this: 3.0J008 , then if you pasted that the reader would read the number as a complex float
<phantomics> In Dyalog and others that only have complex floats, it's not an issue, but in April you can have complex integers and ratios
<moon-child> I don't know how closely you're trying to keep april to cl semantics, but I think that the integer/float distinction should be transparent to the user
<phantomics> moon-child: Interesting!
1:31 AM
Actually, I should probably allow underscores in BQN numbers since they're ignored in identifiers already.
<phantomics> Underscores don't seem to have a semantic role in any APL I know of, so they seem like a good candidate for this
<moon-child> (and if you're doing that, then 3.0 should be represented internally as an integer, to avoid potential loss of precision)
<phantomics> moon-child: transparency between ints and floats is pretty complicated and can cause many possible errors
J turns the literal 3.0 into an integer and it seems to always be causing problems.
<phantomics> Marshall: exactly right, if you're coercing between types all the time there's a lot of potential for unpredictable strangeness
<phantomics> If programmers are going to get deep into math they need to have some appreciation for the difference between ints and floats and how they work
<moon-child> using floats in the first place has potential for unpredictable strangeness. (To whomever it was I was arguing with about floats in here a couple of months ago: I've changed my mind :)
<moon-child> @Marshall curious, what problems did that cause?
<phantomics> Yes, so it should be clear when you are and aren't using them, and the language shouldn't randomly cast you into float-world
<moon-child> It'll do that anyway with division, trig, pow/log, ...
<moon-child> bbiab
<phantomics> In CL/April division gives you rationals: ÷⍳5 => 1 1r2 1r3 1r4 1r5
<phantomics> You're right about ○, *, ⍟, etc. but those functions are clear gateways into float-world
moon-child: I can't actually figure out how it worked now (since integers pretty readily get turned into floats), but there have been a few forum posts where the issue was just that a value had a type the programmer didn't expect.
<moon-child> phantomics: this is why I want an apl-based CAS, so you can represent all those precisely
<moon-child> (or at least the minimum that hboehm android calculator does)
1:40 AM
* is debatable when the right argument's an integer.
<phantomics> Yeah, when both args are whole you get an integer in CL/April
<phantomics> moon-child: the function inverter ⍣¯x is sort of a simple example of that, I've learned a bunch from building it
<phantomics> I'm curious as to how Dyalog's inverter is able to invert a stored function when it has no access to the syntax tree
<phantomics> I haven't fully built out the functionality, but how I'm going to deal with it is to automatically invert every defined function (if possible) and store its inverted form along with it, that way when you ask for the inverse of a variable-referenced function, it'll just fetch the stored inverse and throw an error if the inversion wasn't possible
phantomics: Dyalog only inverts tacit code (or dfn idioms, but those are stored as a single token), so it can just walk through the function's representation.
<phantomics> Yeah, so a tacit function like (32∘+)∘(×∘1.8) is stored in a tree form that can be read by the inverter?
Seems like you kind of have to do that; what if a use tries (f g)⍣¯1 with functions f and g?
<phantomics> My experiments have shown there's a lot of potential for confusion in inverting an arbitrary defn, but it should be possible with a ton of constraints
1:50 AM
@DyalogAPL Yes: a derived function is just a value with fields for the operator and operands.
<phantomics> In April's case that's just another code-generating closure
<phantomics> By the way, a while back you posted an operation that would be impossible with operators as macros, could you remind me of that?
<phantomics> I've reworked the operators a bit; now they're fundamentally implemented with macros, but most of them now generate a call to a runtime function that does the operation
It was o←⍤ ⋄ {o←⍥⋄1}⍣var⊢0 ⋄ 1 +o- 2.
<phantomics> Cool, I can look up logs there
<phantomics> That should still not be possible, it might be with some reworking of the parser for a case like that
I just added some functionality to BQN's JS VM to expose the function representation. It also uses closures for trains and derived functions. The idea is just to create another function such as ()=>[3,f,g,h] inside the closure, then assign it as a property to the returned function. That requires Javascript's ability to add properties to anything though.
<phantomics> given +o-, the o cannot be a function, it could be a value though. I'd have to create a form that would check for it to be either a value or an operator at runtime and then work accordingly
1:59 AM
That lambda should cost nothing to create at runtime because the closure has to keep the values it uses around anyway, but in JS I find it's not much different from just creating the value. I don't know if this is because JS is good or bad at optimizing.
<phantomics> What am I saying, it could also be a monadic function. So the form would have to handle all those cases
That's the problem with compiled APL.
<phantomics> Yeah, I'm considering another version of April that will offer first-class functions, and called functions will be followed by : colons
You might be able to get something usable by restricting assignments that change a variable's class. Which may or may justify the restriction.
<moon-child> ngn/apl and co-dfns seem to handle it ok. You do type inference and disallow reassignment with a different type
<moon-child> right, yes
<phantomics> (a b c)←{⍵+1} {⍵+2} {⍵+3} ⋄ a b c: 4 5 6
<moon-child> phantomics: I like the k solution, where to disambiguate function calls you use indexing notation: f[x;y;z]
<phantomics> The vector of functions a, b, c is called on vector of values 4, 5, 6
2:02 AM
How do you keep that from forming a train?
<moon-child> phantomics: how do you keep that from making a fork of a, b, and c?
I'm not sure why we need both of us here but there you go.
<moon-child> :)
<phantomics> A train needs to be enclosed in parens, in this case the function vector is prefaced by the :
<phantomics> The : would probably be a special compiler form
<moon-child> if trains need parens, then in something like F<-f g h, what is F?
I meant the three dfns to the right of the first assignment.
<phantomics> That's an ambiguous case, you're right
<phantomics> Strand assignment is handled by a special case in the April compiler, I could parse the defns differently if a strand assignment is made
<phantomics> So F←f g h would be a single train assignment still
<phantomics> Btw moon-child April lets you use k-style n-argument functions: a←{[x;y;z] x+y×z} ⋄ a[4;5;6]
<moon-child> or you could allow destructuring of trains. Which would allow for in-userspace introspection
<moon-child> phantomics: can you call regular function that way, as in +[5;6]?
<phantomics> No, only works with defns that have axes at the start
<phantomics> Train destructuring: you mean like treating a train as a vector of functions that you could reference elements of? You could call the entire train or just call functions within it?
<moon-child> I wasn't thinking to treat it as a vector in general, just to allow destructuring it in general in strand assignment
<moon-child> so you F<-f g h <> (nf ng nh) <- F would result in something useful
<phantomics> Right
<phantomics> Vector modeling of trains could work, though, it would be really interesting
<moon-child> the problem is that then your previous example of a b c: 4 5 6 <-> (a 4) (b 5) (c 6) doesn't work
2:14 AM
We didn't use the destructuring syntax, but dzaima/BQN just added a function deconstruction thing today. Discussion starts at chat.stackexchange.com/transcript/message/56306684#56306684.
Using it does require you to be able to call a function on another function.
<phantomics> Cool
(I'll add it to my BQN implementation once it has system functions).
<moon-child> neat!
Also probably worth checking out BQN's inverse ("Undo") specification at mlochbaum.github.io/BQN/spec/inferred.html. It's fairly strict so you might want to treat things more loosely, but I don't know of any APL that actually documents what inverse is supposed to mean.
<phantomics> a b c: 4 5 6 would work if you rule that the functions to the left of : aren't composed into a train by default; : would be a special compiler form so such a provision could be made in that particular case
<phantomics> Marshall: thanks, I noticed that negative power is sparsely documented where available, Dyalog lists the composing operators that work with it but not the lexical functions
2:18 AM
But if you can't dynamically create the function array, is it really giving you anything over (a 4)(b 5)(c 6)?
<phantomics> The use case I see for it is when you want to do something like process rows in a matrix with a series of different functions, could be great for image manipulation, signal processing etc.
<phantomics> If v is a vector of functions, then do v:⍤1⊢matrix
<phantomics> Here's how to do it: a b c:¨4 5 6
<phantomics> That calls each function on each value
I didn't think you had a way to make a vector of functions though?
<phantomics> a b c: 4 5 6 calls the functions as a train
<phantomics> If I implement trains as function vectors, a←{⍵+1} {⍵+2} {⍵+3} would be both a train and a function vector
<phantomics> call a like a: 1 2 3 4 and it works as a train
I guess so. Seems very artificial.
<phantomics> call a[1]:5 and you call the first function of a on 5
2:26 AM
I definitely agree the functionality is useful. In BQN you can call the left argument on the right with {𝕎𝕩} and I use that a fair amount (github.com/mlochbaum/BQN/blob/master/src/cjs.bqn#L13). I just think it shouldn't use special syntax.
<phantomics> The special syntax being :?
<phantomics> Capitalizing functions is a possible alternative, as you've demonstrated
Another option, which I've advocated in J, is to have a special form to enclose a function, and another to get it out or call it or something (although I guess in a Dyalog-like language you could just use First, since functions can return functions).
<moon-child> phantomics: it matches lisp, too, as essentially a limited form of quoting
<phantomics> Right
<moon-child> @Marshall imo tie is generally not great to use in j
<phantomics> Implementing an APL with first-class functions is way easier in Lisp that emulating standard APLs
<moon-child> (I don't like quoting either, though. My solution involves a form of precedence, which I naturally expect most apl people to have a distaste for)
2:29 AM
moon-child: It's horrible, which is why I have pushed for enclosing functions instead.
<moon-child> @Marshall how do you distinguish enclosing and tying? (And doesn't tie essentially box a verb, which is the j equivalent of enclosing?)
Tie makes an array that represents the function, which then has to be detected when it's passed to various operators.
I think enclosing could probably be nicer syntactically if there were dedicated support for it, but it wouldn't be as nice as capitalization, which is still a lot worse than function syntax in typical languages.
Although if you can apply a function with capitalization and juxtaposition or brackets that's kind of the best of both worlds.
Except that you have to be okay with two different ways to write the same thing that don't look very similar.
<moon-child> how does capitalization give you multiple ways to write the same thing?
<phantomics> Worse than function syntax in typical languages? Where you need many more characters to call a function?
<moon-child> (fwiw using precedence lets you have completely uniform syntax, though I still plan to have a bracket form)
Worse for using first-class functions specifically.
<moon-child> phantomics: in most languages, parsing is context-independent
<moon-child> phantomics: in apl, you have to know the type of every symbol in order to parse a sentence correctly
<phantomics> Capitalization or special syntax solves that
2:43 AM
For example you could apply F as x F y or F[x;y].
The ordering is weird though.
<moon-child> yes; this is one of my complaints about k
<phantomics> k doesn't allow infix for user-defined functions does it?
<moon-child> (imo better would be to let you say alpha F omega, or F[alpha;beta;gamma;delta;...]. 24 parameters should be enough for everybody!)
@Marshall Decided to ignore underscores in numbers as well as identities, so you can now write 1_.2e_5__ or whatever. @dzaima
<moon-child> most languages that let you use separators in numbers disallow having more than one in sequence (so 3_5 is ok but 3_____5 isn't). That always seemed kind of arbitrary
<phantomics> Nice, I'll add the underscore feature into April too
<phantomics> It'll allow any number, before parsing the underscores will just be removed
moon-child: Definitely a weird restriction. Allow them or don't.
It's easy to imagine wanting double underscores for another layer in very long numbers.
2 hours later…
4:55 AM
<phantomics> Underscores are now usable within April: (april "1__000_000__000_000+5") => 1000000000005
<phantomics> And printed for alignment: (april-f "⍪12.2J44 3J8 19r13J5r2")
<phantomics> (april-f "⍪12.2J44 3J8 19r13J5r2")
<phantomics> 12.20J44.0
<phantomics> 3___J_8
<phantomics> 19r13J_5r2
<phantomics> The leading zeroes have been replaced with crosshairs, which I like better since the leading zeroes can make numbers look bigger at a glance than they are
<phantomics> not crosshairs, underscores
5:42 AM
whats the best way to get input one line at a time?
@Razetime I think the best bet is to have an input text file and read it with ⎕NGET
which conveniently returns the content newline-separated
and process all of them at once, of course
(But being able to do so from stdin would be definitely nice)
6:46 AM
@Bubbler ended up hardcoding the whole thing
7:17 AM
@Razetime For future problems, I have a utility function you can use here that will fetch your input, store it, and return it same as ⊃⎕NGET 'input.txt' 1. Make sure to ]load HttpCommand first.
You can get your cookie from Chrome dev tools or something similar.
7:32 AM
Hello people.
@voidhawk thanks, that's neat
@EliasMårtenson hellooo
7:44 AM
Is there a simple algorithm for computing ⌹?
@EliasMårtenson Are you considering all cases supported by Dyalog?
(vectors, non-square matrices)
<phantomics> @EliasMårtenson you can see how I implemented the monadic and dyadic functions here: github.com/phantomics/april/blob/master/library.lisp#L360
<phantomics> Those two functions reference this function: github.com/phantomics/april/blob/master/aplesque/…
Just found an article that claims to have found a simple way to calculate matrix inverse
8:03 AM
@Bubbler Not sure. I never actually used ⌹ myself. I do want to cover the ISO use case though.
(but it doesn't guarantee that algorithm is correct for all non-singular matrices, e.g. it won't work with ↑(0 1 1)(1 0 1)(1 1 0))
@EliasMårtenson I don't know what ISO says, but you can find the basic formula for all cases supported by Dyalog here.
I guess LU decomposition or Gauss-Jordan would be the most common implementation
The ISO spec refers to this: "Domino—An APL Primitive Function for Matrix Inversion—Its Implementation and Applications"
APL Quote-Quad Vol III No. 4, February 1972, pp 4-15
8:19 AM
<phantomics> Elias, I had a question about Emacs, I'm looking into quick ways to implement an April REPL
<phantomics> Is it possible to create a variation of the comint mode that interacts with an Emacs Lisp function instead of an external CLI program?
Hmm, does April implement matrix divide?
<phantomics> Yes it does, I posted links to the relevant functions above
Oh I missed it. Sorry. :-)
8:21 AM
<phantomics> In an Emacs instance with Slime running and connected to an inferior-lisp, I can evaluate April expressions like this: (slime-interactive-eval "(april:april \"1+1 2 3\")")
Anyway, the answer is yes. It can be done, but it's a hassle. For example inferior-emacs-lisp-mode does it.
<phantomics> Ok, so that mode may have some useful code
But it's pretty ridiculous. It runs hexl as a dummy process, just so that it has a binary to attach to. hexl works becuase it's shipped together with emacs, and it never outputs anything.
<phantomics> Yeah, from my inspection it seems comint is built with a strong assumption that you're connecting to an outside binary
I would probably not go down that route, and use the same method as SLIME does, which is its own mode.
I have implemented something like that myself when I created a chat client in Emacs. It uses the same ideas as ERC.
8:24 AM
<phantomics> The advantage of comint seems to be that it comes with many quality-of-life features built in, like history browsing
Yes. Which is precisely why ielm uses it even though it needs to have a dummy process for it to work.
@EliasMårtenson Do you want that one?
<phantomics> For now I'm inclined to try something based on the ielm source so I don't have to reimplement all the QOL stuff
Meh, that article only discusses the methods, it doesn't describe how to implement them.
9:01 AM
@Adám I think that would be useful, yes. Thanks.
@Adám OK, then it's not useful.
I'm going to look into outright lifting the algorithm from April.
When playing AoC, I think I've found a discrepancy/bug in the Dyalog jupyter kernel. I get the wrong result in jupyter but the correct result in the interpreter for:
{6::⍵⋄⍎⍵}¨'- :'segs '18-20 d: bsddtgwddddddzdzdbdd'
(segs from dfns)
I expected (and got in the interpreter):
      {6::⍵⋄⍎⍵}¨'- :'segs '18-20 d: bsddtgwddddddzdzdbdd'
│       ┌→┐ ┌→───────────────────┐ │
│ 18 20 │d│ │bsddtgwddddddzdzdbdd│ │
│       └─┘ └────────────────────┘ │
@xpqz I'ma try this now
In jupyter, the last element gets converted to a long string of numbers.
So some type conversion when passed to the kernel is off, maybe?
@xpqz 1) do you have latest kernel from github? 2) I'm not getting that - what dyalog version too?
9:09 AM
Version: 18.0.38756
How do I see the jupyter version?
@xpqz I forget - I'm not sure we actually version it - frankly it doesn't seem like a Jupyter bug, looking at the commits I can't see anything that would indicate fixing of a bug like this
@xpqz Is that when you do ]version in a jupyter notebook?
No, that was the interpreter itself. In Jupyter I get:
↓ Dyalog  18.0.38756 64-bit Unicode, BuildID d885fcf7                                                                           │
│ OS      Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64 │
│ SALT    2.807, Link: 2.0.3                                                                                                    │
9:24 AM
@xpqz Well it's the same version as your terp - I think my advice for now is install latest kernel from github and see if it helps, I'll ask colleagues
@xpqz Did you try analysing at what point things start looking off? E.g. before or after execute?
It's definitely the ⍎.
So what happens if you run just ⍎'bsddtgwddddddzdzdbdd'?
So this does the right thing:
'- :'segs '18-20 d: bsddtgwddddddzdzdbdd'
If I do:
⍎VALUE ERROR: Undefined name: bsddtgwddddddzdzdbdd
Which is also correct :/
@RikedyP My participants (foreign language students and teachers) have never heard about APL and most of them have never coded. I used it as an example of a powerful tool of thought and an alternative programming language that one could really like. It is really trendy now in universities in TW to offer to all students computational thinking training. Now at least they know that APL exists and know they can start learning it with tryAPL.
9:35 AM
@xpqz Maybe change the dfn to {6::⋄'res=',⎕←⍎⎕←⍵}?
@brgal That is very cool, thank you. In particular: on your linkedin post it seems they had tryapl open - did they get much of a chance to try it during your session?




@RikedyP No !
@brgal Ah I see - thank you for answering my questions :)
9:42 AM
@RikedyP I demonstrated it
@xpqz Can you try {6::⋄⎕←⎕DR⍵ ⋄ ⎕←⍎⎕←⍵}¨(,'d') 'bsddtgwddddddzdzdbdd' ?

@xpqz OK, I think we can conclude that the long numeric vector doesn't actually originate with the data. Try updating everything (there should be a new version of 18.0 available later today).
@Adám Will do. As an alternative, I tried ⍎@0 1⊢ ... but that doesn't do what I mean, it seems.
10:30 AM
My advent of code solution for today is horrible, I use a regex to create an expression and then evaluate it using ⍎
10:44 AM
@rak1507 sounds funny
@rak1507 I did this
Regex sounds interesting
I just did general APL stuff
yeah I was lazy and couldn't be bothered properly parsing it
are you on the private leaderboard?
Don't think so, what's the code
10:48 AM
I made one before, but I didn't realise there was another
thats the cgcc private leaderboard
Ah ok
Hello @chrispsn
11:21 AM
@Razetime @rak1507 well done both of you for using plain text files and not .dws, .ipynb, etc
lol I'm too dumb to properly use git, I just do solutions in the repl and copy paste them into the files
@rak1507 still better than publishing a blob :)
are you going to publish your solutions?
@rak1507 i have
Oh yeah you use K
looks confusing!
I'll wear that as a badge of honor. You know how it goes: if it was hard to write, it should be hard to understand :)
I find APL a lot harder to read than to write
Your approach is inspirational -- very lisp-macro!
@xpqz isn't ≥⍨ the same as ≤ ?
11:59 AM
Yeah. Probably. I always find it confusing when swapping l-r how the comparison should change.
That's nice
the use of ≠ is clever, I didn't think of that
12:12 PM
@xpqz Just visually mirror the glyph, but that said, (⍎t)≤⍨≢⍵(≢⍵)≤⍎t
12:28 PM
did anybody try an array-oriented solution to day 2?
No, I couldn't think of any way to do one
i think you just have to use ↓⍉↑ on the inputs and add an ¨ here and there
@ngn I wondered if that would be possible.
Sounds like good practice.
@xpqz i'll try it on your solution in a moment..
if it wasn't AoC and it actually meant something I would have gone with a non regex solution
12:38 PM
@xpqz btw, the use of ⌸ seems overkill, you just need the count of one particular letter
Yes, this is very true.
I'll use ⍷ instead.
why not use =
I feel bad for = ― people tend to be afraid of it for no reason, grasping for or or ≡¨ instead.
\me slaps fore head.
1:10 PM
@ngn dws is a bit of a pain to use quickly
Good ol Ctrl-C Ctrl-V is the way
@xpqz here's an attempt at array-orientation. i tried to rewrite it many times, but i couldn't make it beautiful as i hoped:
p q l s←⍎¨¨@1 2↓⍉↑'- :'∘segs¨⊃⎕nget'2'1
+/(p∘≤∧≤∘q)+/¨s=∊l ⍝part1
+/≠⌿↑p q⊃¨¨⊂s=∊l ⍝part2
making it beautiful is kinda hard with string parsing
rak's solution looks really clean with regex
@Razetime yeah, i don't know why regex gets so much hate
the parsing could be just: '\w+'⎕s'&'¨
I just don't know regex very well so i used a billion vars
@Razetime \w matches letters and digits. ⎕s is effectively splitting all other chars like '- :'
1:21 PM
oh cool
rak's solution matches the whole line with ⎕s, expecting a rigid input format, and then uses groups to extract the interesting parts, then forms an apl expression as a string and ⍎-s it
@ngn nice!
now for using a 2-d char array of the s-s?
@Razetime hi!
1:37 PM
@xpqz sounds like a good idea. that would open up opportunities to use ⍤ (rank).
@ngn -- can you elaborate a bit on how +/≠⌿↑p q⊃¨¨⊂s=∊l works?
Too clever for me.
@chrispsn ah took a while lol
@xpqz s=∊l is a vec of bool vecs for the occurrences of the desired letters. p q⊃¨¨⊂ picks the pairs of positions, mixes the result as a 2×n bool matrix. the rest is your trick with and a +/ to count the valid passwords.
2:00 PM
aaaaaaaaaa writing a function in BQN and got hit by blocks not containing 𝕨/𝕩 not being functions 3 separate times..
p q l s←⍎¨¨@1 2↓⍉↑'\w+'⎕s'&'¨⊃⎕nget'2'1
+/(p∘≤∧≤∘q)+/b ⍝part1
+/≠/(p,⍪q)⊃⍤0 1⍤1⊢b ⍝part2
that is so elegant
very nice
i'm not so sure about the double use of in part2. can anybody improve?
@dzaima (to be fair, the code is intentionally unAPLy, but that's because it has to be)
BQN does a pretty good job at making writing imperative code hell (but i guess that's partly the intention, and much of the problem is inherited from APL)
@dzaima and another time
2:28 PM
I'm saving this for posterity:
@Adám lol :D
@dzaima APL dfns ― ftfy.
@Adám for what it's worth, i'd much prefer APLs dfns (oh, hell, tradfns) to what i'm doing now
@ngn Double is quite normal.
@Adám 'Toboggan Corporate Policies have no concept of "index zero"!', blame it on them :)
2:32 PM
I'm still working on my Lisp project at the moment, but I'm thinking of some things to do for KAP. I was wondering how Dyalog deals with binary data (byte streams basically)
Is there a streams concept?
@EliasMårtenson no, there are just number arrays (signed bytes because then the impl keeps it as 1 byte per item)
@dzaima {𝕤⋄body} is still shorter than defining a no-argument lambda in nearly any language. You just have to remember to write it.
I guess the problem is that the errors you get will be very confusing if you use it as an operand.
@Marshall {𝕊⋄body}, no? (it's not shorter than both java and JS, the only 2 langs i really care about, and in JS i often take a single unused argument anyways, at which point it's shorter)
@dzaima Comparison to JS in this section. Did I miss something?
@Marshall ah, you're including the braces. With a single returned thing ()=>123 is enough
2:42 PM
@Adám it would be much nicer if [ ] indexing was available as a primitive function, we wouldn't have to jump through hoops with ⌷ and ⊃ and ⍤
@Marshall the problem isn't that i have to write something to get a lambda, it's that it's conditionally needed, and removing and adding 𝕩s changes that condition
@dzaima But without the braces they're the same length.
@Marshall _=>123 is functionally equivalent in 99.99% of the cases
@dzaima Oh, I didn't think of that.
I guess the safe thing to do is add 𝕤⋄ to every function if you're going to use it for its side effects.
@Marshall the "if" in that sentence is still a problem. Having an optional syntax for marking having side-effects is still annoying
2:53 PM
@dzaima Yeah, but it really is something you should be aware of.
It's annoying, but I think it's more important for immediate blocks to be easy to write.
s/immediate blocks/module blocks/?
I think immediate blocks are important enough even without exports.
how so?
Just as a tool for organizing code by keeping things in separate scopes.
@Marshall so indeed completely useless to me
so the tradeoff is people who care about variable scoping in linear functions, vs mutating code
@dzaima (which is actually more equivalent to what the BQN equivalent is doing than ()=>123)
3:02 PM
Something like that. And I'll point again to the acronym IIFE as evidence that a lot of people care about scoping.
@Marshall afaict that acronym mostly exists for closures and because JS's var is stupid. There are a lot of acronyms for mostly useless things everywhere
@dzaima Immediate blocks can give you closures too though? That's one reason I use them.
@Marshall i'd expect that quite often immediate blocks for closures would contain no-arg functions. (and personally i'd prefer syntax for intentionally-closured group of variables over maybe-has-side-effects)
@dzaima (immediate blocks for closures would definitely contain side-effect-ful functions. So the only case when the current syntax is shorter is when using them just for hiding variables from the surrounding function)
3:20 PM
@dzaima But that is without considering modules, which for me makes it go from a close decision to not at all close.
3:32 PM
bqn-in-erlang update, since ive had some time last cpl nights to work on it.

much better understanding of atoms/values/functions.
stdlib is mostly working (can construct 1-2 modifiers out of fns).
vm is stepping thru sections, stepping thru bytecodes + arguments, going to the right case is working.
stack manipulation is partial.
getting the right opcodes and arguments seem to be working.
ive started using javascript debugger.

few outstanding questions:
- currently im keeping the stack as a mutable value in the process dictionary (memory local to the process running it). Will the vm ever n
@Marshall you could just say that module blocks always are by default immediate. Wouldn't even really break anything more than it already is
3:45 PM
"I've somehow never hear of APL before seeing your comment. Felt like I was having a stroke when I started reading it.
And then the feeling somehow got worse reading the explanation."

- about my AoC day 1 code. :(
@ngn I agree. However, which one? The brackets have ;s which gives them that extra aspect that a function cannot provide.
@TessellatingHeckler hah do you have a link?
@Adám single-arg [ ] would be a sane choice, like: a[b] ←→ a squiggle b
maybe use [] in isolation as that "squiggle": a[b] ←→ a([])b. afaict it doesn't clash with anything old.
rereading this is starting to help
3:58 PM
@cannadayr the answer probably depends on how your closures/variable list work. a[i]=v; should just change the i'th element in the canonical a to v.
01:00 - 16:0016:00 - 23:00

« first day (1407 days earlier)      last day (46 days later) »