« first day (1315 days earlier)      last day (1342 days later) » 

5:05 AM
@Jonah @xash In principle, but Dennis isn't really around to accept them, I think.
 
5:17 AM
@dzaima I have been trying to solve the curve stitching question, but the code I made here only draws a straight line. Did I mess up the draw loop?
 
@Razetime did you mean to put p×i in parenthesis? also, i←i+1 sets i locally just like Dyalog, you'd need to use i+←1
 
I didn't know that
sorry about that
 
@Marshall no 𝕊 is used in L90 of block.md
 
@dzaima Can I pass parameters to the draw function loop?
 
@Razetime where/how would you do that? (no)
 
5:30 AM
P5.draw←⍺{<insert code here>}⍵
 
@Razetime that'd just call the function, no?
 
yeah but can i use ⍺ and ⍵ in draw?
 
(also, there is P5.framecount/P5.fc for a frame counter)
 
I tried that lol
fc gives a distorted result
 
@Razetime it just gets no arguments like in Processing
 
5:33 AM
okok
 
@Razetime how so?
 
or i think it gave a distorted result in the previous wrong solution
anyway, the APLP5 canswer cannot compete
question asks for function parameters or stdin
yep, fc works now
after parentheses
 
5:48 AM
@Razetime I believe you could write a function that assigns to P5.draw at runtime
 
hmm, like, how exactly?
f←{} then P5.draw←x f y?
 
f←{w←⍵⋄P5.draw←{whatever w}}
or you could write a loop and skip P5.draw entirely
 
well, you can't call P5.ln outside of draw or setup right
 
@Razetime you can, just like in Processing
(well, P5.g.ln)
 
I've never used a loop in APL before lol
 
5:55 AM
@Razetime ¨
 
so you just do ⍳5¨{fn}
 
@Razetime {fn}¨⍳5
 
DomainError: Make P5.G calls in P5.setup/draw
f←{{P5.fc<⍺:P5.G.ln (⍵×P5.fc) 0 0 (⍵×(⍺-P5.fc))}⍳5}
 
@Razetime you don't need to use P5.fc if you're looping yourself. but you do need to make the call to f in P5.setup or draw
 
hmm this is a bit confusing for me
so
f is the function where the loop is right
 
6:03 AM
@Razetime yeah
 
i pass params to f in which there is a function that is mapped across ⍳5
how do I use the values from ⍳5
 
@Razetime they're in the inner dfn
 
ok so ⍳5 is ⍵
then how do I use the ⍵ from the outer one?
∇.⍵?
no, that's self
 
@Razetime you need to assign it to a variable or pass it as ⍺ (keeping in mind regular ¨ behavior)
 
ok I don't know regular ¨ behaviour so I'm just going to assign it
ok so this is what I got after following everything
But I'm getting a nullpointer exception
 
6:14 AM
@Razetime why the guard?
 
guard?
 
@Razetime the :
 
yes I should remove the condition
IT WORKS
FINALLY
Thanks for being so patient
 
also it'd look better if the call was in setup, not draw; have to go now
 
cool, see ya!
 
6:18 AM
(definitely golfable; each-right would also be good if passing arguments by ⍺)
 
yep, does look much cleaner
not sure how to do that, I'll try something
 
also i believe you could pass a vector of 4-item vectors to P5.g.ln instead of looping
 
this is the shortest working one I could make so far: f←{r←⍵⋄{P5.G.ln (r×⍵) 0 0 (r×(⍺-⍵))}¨⍳⍺}
so you mean, create a grid of zeros , replace firat and last rows, transpose, right?
then pass it to P5.g.ln
 
6:48 AM
I tried that, and it's a bit too long.
 
7:13 AM
@Razetime trivial golfing - f←{r←⍵⋄{P5.G.ln(r×⍵)0 0(r×⍺-⍵)}¨⍳⍺}
@dzaima 28 with that method
 
7:33 AM
oh, that works!
I was trying to make a grid of zeros to no avail ○∨○
 
 
4 hours later…
11:08 AM
How do I make an infinite loop?
I already checked APLcart for one
 
@Razetime What kind of loop? Using or recursion in a dfn or a tradfn control structure?
 
I've been looking at some time problems,and they require loops that run forever, put simply.
basically, something to execute a block forever.
One more thing, the ⎕CLEAR example in APL cart links to this: tio.run/##SyzI0U2pTMzJT///…
 
@Razetime f⍣{0} will run forever, as will f⍣⊢ if f always returns 0. Infinite tail recursion works too: {code goes here ⋄ ∇⍵}. In a tradfn, you can be explicit about it:
:Repeat
    code
    goes
    here
:EndRepeat
 
11:24 AM
there are english words in APL?
 
@Razetime Thanks. Fixed.
@Razetime Some APLs have keywords, but they all begin with : to preserve APL's "no reserved words".
 
having reserved words would be blasphemous indeed
{(⎕TS[5]=0)^(⎕TS[6]=0)⋄{,'BONG'}¨⍳⎕TS[4]⋄∇⍵}
I tried this, and it's only displaying a single value
 
@Razetime This will terminate before reaching ∇⍵ because it returns the value from the first statement.
 
hmm
 
Do you mean to print? (⎕←)
 
11:29 AM
yes
{(⎕TS[5]=0)^(⎕TS[6]=0)⋄{⎕←'BONG '}¨⍳⎕TS[4]}
why isn't this printing anything?
 
@Razetime It begins by evaluating 0∧0 (most likely, at least) i.e. 0, which it then returns.
 
will tail recursion work here?
 
Sure, but what are you actually trying to do?
 
45
Q: Big Ben goes BONG

user41805Your task is to create a program that is to mimic Big Ben (Twitter). Task Whenever a new hour has begun (according to your computer's local time or UTC), you have to output BONG repeated hour times (with a space between the words). For example, when it's 3 o' clock, you have to output BONG BONG...

this question
I linked it up there as well
Print BONG <hour> number of times whenever an hour is reached
loop forever
 
Ah, so you want to check all the time. But you should wait for a second after printing, or you'll end up printing multiple times per hour.
 
11:35 AM
yeah lol
I was more worried that I didn't know how to make an infinite loop first
 
Also, you'd want a conditional, not just a statement.
 
f←{(⎕TS[5]=0)^(⎕TS[6]=0)⋄{⎕←'BONG '}¨⍳⎕TS[4]⎕DL 1}
this look better?
or should the be a newline
 
Several issues: You'll still return on the first statement, and ⎕DL will return a value close to 1, which'll then pair with ⎕TS[4] and mess everything up.
 
so I'm not fitting the output criteria in many ways lmao
 
Also, ⎕← will print to a new line.
And you'll have a trailing space.
 
11:39 AM
so I need a full conditional
 
You could use
 
does :If exist?
 
Of course, but only in tradfns. Dfns use guards, but I don't think that'll work well here.
 
so, ⍬⍣{} ?
 
You need a function on the left and an expression on the right of
 
11:42 AM
{⎕←'A'}⍣{0} this, then
 
Yeah, that'll print As forever.
 
in the IDE it doesn't seem to do anything
on separate lines, correct?
 
Did you give it an argument?
@Razetime Not sure what you mean by that.
 
I mean It will not print AAAAAAAA
but
A
A
A
A
A
A
 
Nope, but you can get that with ⍞← instead of ⎕←
 
11:45 AM
⍞← for newlines, got it
 
But a much better approach is to construct the whole BONG phrase and output it at once.
⋄ 1↓(5×⎕TS[4])⍴' BONG'
 
@Adám BONG BONG BONG BONG
 
⋄ ⎕TS
 
@Adám 2020 9 1 4 45 52 117
 
{,'BONG '}¨⍳⎕TS[4] this is what I was doing
 
11:47 AM
Sure, but that seems a bit convoluted when you could also do ⎕TS[4]⍴⊂'BONG '
 
I think that's a good candidate for APLcart
 
What is?
 
repeat array n times
this snippet ⎕TS[4]⍴⊂'BONG '
@Adám I guess this is bettwer because it keep only one space between all of the bongs
 
So it'd be Iv⍴∘⊂Y Array of shape Iv filled with repetitions of the entire array Y
 
yeppo
The bind operator is for.. safety?
 
11:52 AM
to make it a single function
 
⎕TS[4] is in 24 hours :/
First need to convert it to 12 hr
never mind I'm dumb
 
@dzaima Fixed. Thanks!
 
 
3 hours later…
3:12 PM
@Razetime you could compare 0 0≡⎕TS[5 6]
 
3:46 PM
@TessellatingHeckler good idea. Then we can multiply that expression by 4 to determine what gets displayed.
 
4:17 PM
⋄{{,'-'}¨⍳⍵}5
 
@Razetime - - - - -
 
'-'⍴5
⋄'-'⍴5
 
@Razetime DOMAIN ERROR
 
⋄5⍴'-'
 
@Razetime 0 ⍴ 0
 
4:18 PM
⋄5⍴'-'
 
@Razetime -----
 
hmm
⋄5⍴'-'⍪5⍴'-'
 
@Razetime -----
 
@Razetime missing parenthesis around 1st 5⍴'-'?
(either way, is equal to , for vector arguments)
i suspect that what's wanted is (5⍴'-'),[.5]5⍴'-' (or with ,[1.5])
 
I'm trying to do this one.
what I've come up with is this:
⋄{⍪(⍪{'|',(⍵⍴' '),'\'}¨⍳⍵)((⍵+1)⍴'-')}5
 
4:30 PM
@Razetime
  | \
  |  \
  |   \
  |    \
  |     \
 ------
 
(with ⎕IO←0)
problem is, the first 5 lines have spaces before them
 
@Razetime doing ]box on would help seeing what's actually happening there
 
ah, looks like the first five lines are enclosed
 
@Razetime you probably don't want to use monadic at all
 
Well, I don't know what else I wanna use really
 
4:34 PM
it creates a n×1 matrix whereas you want to end up with an n×m where m is the horizontal length; monadic is useful for that (taking a vector of vectors as an argument)
 
⋄]box on⋄{({'|',(⍵⍴' '),'\'}¨⍳⍵)((⍵+1)⍴'-')}5
 
@Razetime
VALUE ERROR
  | \  |  \  |   \  |    \  |     \   ------
 
{↑(⊂(⍵+1)⍴'-'),⍨'|'∘,¨(⍳⍵)⌽⍤↑¨⊂'\'} is a quick dfn I threw together
 
@DyalogAPL something something no ]-commands in the bot
 
4:38 PM
@rak1507 cool answer
 
An APLCart game :)
 
@rak1507 (fwiw Razetime's solution can go to that size with simple changes; but there is at least one golfier approach)
 
it breaks for 0 but a lot of commenters said it was an edge case so
¯\_(ツ)_/¯
 
but it's in the question lol
 
@Razetime that's still a 2-item vector of (a vector of vectors) and (a vector); you want to end up with a single matrix
 
4:41 PM
hmm
@TessellatingHeckler you made this?
 
@TessellatingHeckler :-D Maybe I can add that to aplcart.info/quiz
 
@dzaima I tried an enclose on the second vector and now it prints the pattern correctly, just not matching.
 
@Razetime if you do that, you could use , instead of stranding to get a vector of the lines
 
@Razetime yep, I just thought of it in the context of "how could flashcards / spaced reptition learning help with APL?". Rumour has it that learning a foreign language, having flashcards of words on their own is less helpful than having a whole sentence with context, and some words missing - the context helps you remember the words where they are used and connected to other things. So, why not APL with bits missing, and some surrounding context as a prompt
 
@TessellatingHeckler How do you decide which ones can go?
 
4:45 PM
@Adám Has that been there all this time? :D
 
@TessellatingHeckler I like it.
 
ooh aplcart quiz
 
@TessellatingHeckler Only since May/June.
 
@Adám currently any APL symbol that isn't {}()[]
at least, that's the plan; I nicked the string from your javascript lb bookmarklet and cut it back a bit
might be good if it didn't choose ← or ⎕ either, they come up quite often
@Razetime :) I'd like it more if I could answer more of them!
 
@TessellatingHeckler Are × and valid answers for "A⍰B Logical AND"?
 
4:50 PM
I tried mixing, but it comes out like this:
⋄{↑((⍪{'|',(⍵⍴' '),'\'}¨⍳⍵)(⊂(⍵+1)⍴'-'))}5
 
@Adám it picks a row from the tsv, and cuts a symbol out, so it's only a valid answer if it's exactly what was in that spreadsheet row, it doesn't do any evaluation or anything clever
 
@TessellatingHeckler Right, but that is a bit unfair to the user. I had to deal with that in my crossword checkers.
 
I don't know enough list manipulation to figure this out, needs a lot more trial and error
or a different function
 
@Razetime You just need to stack the bottom line below the matrix instead of mixing them.
 
4:51 PM
@rak1507 how do you get spaces without the character?
 
@Razetime you are mixing a vector of vectors of vectors there, whereas here you definitely want to execute on a vector of vectors of characters. (or, from a different angle, forget about the last row for now)
 
n↑'whatever' pads with spaces
 
@Razetime as I suggested previously, you also don't want stranding (stranding being array creation by juxtaposition, i.e. as in (1 2)(3 4); you essentially have {↑(…)(⊂…)}, but you don't want to make that 2-item vector. you could insert a , between )(, but there are golfier ways around that problem)
 
@Adám for now, the user will just have to grumble about how unfair it is
 
@Razetime also no monadic !
 
4:56 PM
⍪ is pointless ↑ does what you want most likely
 
@dzaima awwww
but it's so cute
 
not ↓
 
@Razetime Btw, once you have the matrix, you can simply append a single - below it, and it'll be extended to all columns.
 
ooh
 
@rak1507 You know you can edit your messages for a short time?
 
4:57 PM
I do now
 
@Razetime you can still use it, just not monadically
 
⋄ {{⎕←⍵}¨({'|',(⍵⍴' '),'\'}¨⍳⍵),⊂(⍵+1)⍴'-'}5
 
@Razetime Illegal code
 
this is what I ended up with
 
@Razetime Don't output. You want to assemble the result.
 
4:58 PM
{'-'⍪⍨↑'|'∘,¨(⍳⍵)⌽⍤↑¨⊂'\'}
 
@rak1507 ,[1] is the same as (for matrices).
 
ah
that then
 
so I have a vector of strings, but it's all on a single line
 
⋄{'-'⍪⍨↑'|'∘,¨(⍳⍵)⌽⍤↑¨⊂'\'}0
 
@rak1507 -
 
5:00 PM
:/
 
(I've got a 20-byte flat solution with no loops.)
 
but you're Adám that's unfair
 
Of course you have
 
Except the 0 case :-(
 
oh lol
everyone falls to the 0 case
It's a bit late here, Imma sleep
 
5:01 PM
@Razetime because it's wrong!
 
hard luck lol
good night to y'all
 
24 with the 0 case.
 
gn
 
○/
 
@Razetime as the answer, is exactly what you want in place of {⎕←⍵}¨
 
5:02 PM
@Adám I'm assuming those 4 bytes are ⍵>0⋄
 
@Adám (trying to figure out where that 1 byte went)
 
@Razetime No, my solution is a train, not a dfn. (Also, that'd be ⍵>0:)
 
oh well
 
@dzaima What, you've got 21?
 
@Adám yeah (dfn)
 
5:05 PM
Wow, that probably means you're packing in a lot more action, since you loose 2 on the braces and you need here and there.
 
@Adám "here and there" ≡ once
 
My dfn equivalent has thrice.
Ooh, just hit 19 without 0 case. Completely new approach. So, 23 including 0.
So many interesting ways to attack this one
 
@Adám Soon you could add "tsv passes 0.5MB"; currently at 0.493MB. (I've been wondering how much the TIO example links will bulk it up).
 
still at a 21 byte train (plus 2 23-byters)
 
@TessellatingHeckler :-D But not really a milestone of interest to the user.
 
5:13 PM
@dzaima (fwiw it's 18 in Extended/dzaima; 21 as a train in Dyalog)
 
@TessellatingHeckler The average TIO link is about 100 bytes, so probably no more than 200kB.
@dzaima Interesting. My solutions wouldn't benefit from any extensions. Is that with or without 0 support?
 
@Adám no 0 support
 
You produce a matrix, right?
 
yeah
yay 20 byte train (regular Dyalog)
 
Wanna know how I add 0 support to a train in 4 bytes? Adding it in 3 bytes to a dfn is obvious, I presume.
 
5:20 PM
@Adám ×⍴∘⊂?
 
@dzaima No, that'll give an enclosed result for the normal cases, and still output whitespace (forbidden) for 0. But close.
 
@Adám ×⊢⍤/?
 
Almost. That'll still print a newline.
 
come on lets see it already, we're on the edge of our seats!
 
OK: Spoiler! (updated for performance)
 
5:24 PM
@Adám ooh, smart. my solutions
 
"DESCRIPTION : Is Dv a valid Finnish social security number? (10=≢Dv)" - I wonder if this came from FinnAPL
 
@TessellatingHeckler Of course it did. There's also "Syllabisation of a Finnish word Dv"
 
⋄ (⊢⊂⍨1,1↓≢↑2</'aeiouyäö'∊⍨⎕C)¨ 'hauska' 'tutustua'
 
@TessellatingHeckler haus ka tu tus tua
 
@dzaima Mine
 
5:38 PM
@Adám oh so i had another 20-byter by replacing ' ' with ''
@dzaima (s/another/your)
 
⋄ (⊢⊂⍨1,1↓≢↑2</'aeiouyäö'∊⍨⎕C)'Kolmivaihekilowattituntimittari'
 
@Adám Kol mi vai he ki lo wat ti tun ti mit ta ri
 
Apparently, the genitive plural of that is kolmivaihekilowattituntimittarienkolmivaihekilowattituntimittareidenkolmivaihekilowattituntimittareitten. Now you know!
I suspect an error in the declension algorithm.
 
Long but cool BQN triangle maker.
 
5:59 PM
@Marshall Seems very convoluted. Surely you can translate one of ours?
 
@Adám I disagree. It builds four sections and puts them together. Of course I can translate (" \|-"⊏˜·(⊢∾3¨∘⊏)⥊⟜2∾˘=⌜˜∘↕ is shorter, for example), but BQN will be longer because it won't put fills everywhere automatically.
 
@Marshall Why doesn't "-"∾˜"|"∾˘∾˜⥊"\ "/˜1∾⊢ work?
 
@Adám You're using strings instead of characters in a lot of places, and the last won't automatically extend a scalar anyway (why would it?).
 
@Marshall Characters are in single-quotes?
 
@Adám Yes.
 
6:12 PM
@Marshall '|'∾˘∾˜⥊"\ "/˜1∾⊢ gives me "TypeError: undefined has no properties" or sometimes "l is undefined"
 
ngn
⋄⎕io←0⋄' \|-'[3⍪⍨2,∘.=⍨⍳5]
 
@ngn INDEX ERROR
 
ngn
⋄⎕io←0⋄' \|-'[3⍪⍨2,∘.=⍨⍳5]
 
@ngn
|\
| \
|  \
|   \
|    \
------
 
@Adám Negative rank isn't working on atoms for some reason. (<'|') in place of '|' works.
 
6:25 PM
@Adám Two character fix; might have to wait a few seconds for Github to update.
∾˘⟜'-'⌾⍉'|'∾˘"\ "⊏˜↕≠⌜↕ works in dzaima/BQN but not in the JS version. It relies on invertible Under since the left operand to changes its argument's shape, and only structural Under (with insufficient shape checking, it seems) is implemented so far.
"\ |-"⊏˜·∾˘⟜3⌾⍉2∾˘↕≠⌜↕ gets it to 22 characters.
 
 
2 hours later…
8:33 PM
A string variable called month has been assigned the value ‘April’ and another
string variable called year has been assigned the value ‘2019’ as shown
below.
Line 1 DECLARE month INITIALLY "April"
Line 2 DECLARE year INITIALLY "2019"
Line 3
The variable shortDate is to be assigned the value ‘Apr19’ using substring
operations.
Using a programming language of your choice write line 3.
this is a question in a past paper I have to do for homework, do you think I could get away with doing shortDate ← ,3 ¯3↑⍤0 1↑ month year? lol
 
¯2?
You'd have an extra space, no?
 
Oh yeah good point, that's annoying to fix
¯2 wouldn't work
 
@rak1507 How about ∊3 ¯2↑¨month year or ∊3 ¯2↑¨⊂month,year?
 
yeah forgot that ↑ pads with spaces for a moment
 
Or go tacit with ∊3 ¯2↑¨∘⊂, taking month as left argument and year as right argument.
∊3 ¯2↑ᐵ, in dzaima/APL.
 
8:40 PM
dzaima APL is cool, it's crazy to me that basically everyone here has their own APL-ish language haha
like, learning APL was too easy so they decided to write their own language
 
∊3 ¯2↑⍥0 1, in Extended
 
@rak1507 dzaima claims to sometimes learn APL best by implementing it.
 
@Marshall I think ngn also did it for that reason.
 
ngn
@Adám yep, it's easier to learn that way :P
 
Fair enough, I have no idea where I'd even start with something like that, tokenisation and stuff seems very complicated
 
8:42 PM
@Marshall How would you do the assignment in BQN?
@rak1507 That's not really the hard part. APL-like languages are easy for a computer to parse. See e.g. an APL parser in APL here.
 
whoever made that had far too much time
that's just excessive
 
(Actually, it is a general purpose parser, not just for APL.)
 
that is insane
how do people do this stuff
 
@Adám Probably ∾3‿¯2↑¨month‿year. Or just ∾⟨3↑month,¯2↑year⟩?
 
ngn
@rak1507 are you familiar with scheme?
 
8:49 PM
not really
 
@Marshall There's no pair, only ≍○< right? ∊3 ¯2↑¨⍮ in Extended/dzaima becomes ∾3‿¯2↑¨≍○< but then you might as well do ∾3‿¯2↑⚇0 1∾
@Marshall , right?
 
ngn
@rak1507 it's a very simple dialect of lisp. it was made for playing with interpreters and language stuff.
 
yeah, it's still very impressive that someone could write a full parser for it in APL
 
@Adám That's right. I think joining only once is cleaner though.
 
@rak1507 I'd find it more impressive if someone could write a parser for a full programming language in, say, C.
 
8:53 PM
Fair enough
 
@Adám No, the , in ⟨3↑month,¯2↑year⟩ is a list separator—identical to .
 
@Marshall ``
 
@Marshall Oh, I misread the angle brackets as round parentheses.
@rak1507 Have you heard of co-dfns? It is written in Dyalog APL and compiles dfns to C.
@Marshall I still think that should be ; and should be ,
 
no I haven't, that sounds crazy, I feel proud of myself solving phase 1 problems and people do this stuff lmao, got a long way to go
 
@rak1507 What operating system do you use?
 
8:56 PM
windows + linux on a vm
 
@rak1507 Both of which are mostly written in C. Now that's impressive ;-)
 
Obviously the most impressive operating system is TempleOS though
 
@rak1507 Impending kOS
 
crazy stuff
 
@rak1507 Computer Science college courses spend a good deal of time on lexing, parsing, tokenising, computer language grammars, and the thing you get next (Abstract Syntax Trees). If you want to follow through how it works in general, craftinginterpreters.com is a free book that guides through building a small language interpreter in Java
 
9:07 PM
Thanks for the link, will definitely check that out!
 
(it's trying to be a casual-practical sort of book with real working examples, not a dense academic thing with "left as an exercise for the reader" all over)
 
@rak1507 There's also this unfinished series by RGS.
 
'define a doubly-linked list of heap-allocated strings' when this is on the first page I don't think I'll get very far with my current very limited C understanding
 
RGS
@Adám felt like I was reading a novel, even got goosebumps at the end
@Adám yup, have been thinking about what to put in for the 3rd post, probably gonna make smaller posts from now on so that I can post them more frequently
 
 
1 hour later…
10:12 PM
"Arthur succeeded in getting it to run, but eventually got drowned in device drivers."

i am shocked and amused.
a better strategy might be to target a specific hw platform.
(most of the kernel code isn't the scheduler or malloc, its all the device drivers - it is not surprising thats the wall they hit)
like kOS on RISCv or something
 

« first day (1315 days earlier)      last day (1342 days later) »