« first day (2636 days earlier)      last day (42 days later) » 

1:22 AM
I especially struggle with multi dimensional arrays. It feels like there's an elegant way to make them work, but I couldn't figure out how to refactor my code for that yet.
 
1:50 AM
Using a flat vector and a shape header for them
and determine the iteration pattern solely on the shape
 
 
7 hours later…
8:56 AM
@LdBeth thx :3
 
 
1 hour later…
10:01 AM
@Mark this looks interesting! could you explain how parsing works to somebody who doesn't speak Rust? it looks like you're using a parser generator but I don't fully understand it
(i ask because working with my APL implementation parsing was definitely the hardest step, but it looks like you did it easily)
 
yes, sure! I am using yacc implementation in Rust. apiel.l contains my tokens, apiel.y is the yacc grammar. The build.rs generates the parser.

My main entry point is apiel/src/parse/mod.rs parse_and_evaluate() that runs parse::eval() (located in apiel/src/parse/eval.rs) on the expression passed to it. The parse::eval() is just a huge match expression that performs operations on the data contained in the Expr enumeration according to the expression type (it always calls parse::eval() recursively for lhs and rhs of the expression).
@RubenVerg well for generating the parser I just followed the examples provided with the libraries. But I feel like I am not itilizing the recursion properly yet. Might need to expand the Val enumeration to also hold a vector (flat vector). But it seemed daunting
@RubenVerg I actually got inspired by TinyAPL ☺️ But it was hard to translate what I saw in your project to mine :D
 
10:26 AM
@Mark yeah parsing especially looks quite complex to understand in tinyapl
maybe I should try parser generators too
 
10:39 AM
@Mark *The build.rs generates the Rust code for the parser generator
 
 
1 hour later…
11:57 AM
@Mark Definitely go with shape plus element list for the representation, but a tip for actually working with these arrays is to compute the "strides" which are the distances required to move along each axis. For example, a shape a, b, c array will have strides bc, c, 1, which you can compute with a backwards loop that also spits out the total number of elements ab*c at the end.
This section explains how strides can help with simplifying dyadic transpose, which is one of the more difficult multidimensional operations. At the beginning of my talk on reduction another pattern that might be helpful is described: this is a one-axis operation, so you can split the axes into groups above, equal, and below that axis.
ngn/apl tends to have pretty good simple implementations of things, if you can work out what the variables mean.
 
@Marshall Thank you so much! I've stored trees/tries in a single array before, but not multidimensional arrays, which seems more complex. Although, in general it makes sense to me. I'll dig into your articles and talks, thanks once again ☺️
 
12:12 PM
Also Uiua is written in Rust and might be worth checking out. Fairly large codebase at this point though.
 
@Marshall yep yep, I was looking at it, but ultimately started on my own path from the ground up. I guess it's not easy to see the reason for specific choices until you try it yourself
 

« first day (2636 days earlier)      last day (42 days later) »