So I thought I'd try out my #awk skills and do #adventofcode day1 in that at well, and it turned out surprisingly succinct and nice ๐ I really like this.
@RL_Dane@benjaminhollon
https://gist.github.com/sotolf2/a7cbc76fdf36afeeedb1233a858737ca
@RL_Dane@benjaminhollon
https://gist.github.com/sotolf2/a7cbc76fdf36afeeedb1233a858737ca
R. L. Dane
•It's funny how familiar and yet how different awk feels coming from shell and Perl.
The fact that it just instantiates and array out if thin air is kinda scary ^__^
Of course, Perl does this if you don't use `use strict;', but I consider that barbaric. ๐
Not sure what asort() does. I think you've mentioned this before. It's not in standard awk, and the gawk manual was pretty terse.
Sotolf
•Yeah that, and the stringly typed thing is a bit scary, even though it kind of makes sense for what it does.
Yeah, it's a gawk extension, and it's basically array sort, and not standard awk ๐
R. L. Dane
•Not sure about the begin/end thing, but you can structure it any way you want if you implement your own read loop.
> I feel too stupid for perl ๐
Aw, give yourself some credit. Perl isn't *hard*, just different
> strongly typed
IIRC, there's really only a couple types, scalars and arrays
> array sort
That's what I thought it was. gawk manpage was so terse ๐
Sotolf
•Yeah the man pages are a bit very terse ๐ I found it in the awk book ๐
The hardest thing about perl is that it lets me be too clever, and it's hard to keep from doing clever things in it, because it is quite cool ๐ and then I suffer for it afterwards ๐
R. L. Dane
•Sotolf
•R. L. Dane
•I say that with respect and fear. X'-D
If you like Forth, you gotta check out #uxn / #uxntal, if you haven't done so already.
Just imagine a vm assembler based on the ideas and values of Forth, implemented in very simple (~2k SLOC) C & SDL