Skip to main content


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
in reply to Sotolf

I was writing a long response to this when my battery died ^__^

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.
in reply to R. L. Dane :debian: :openbsd:

yeah, I think awk was one of the big inspiration to perl if I remember correctly, I think perl even can do the begin end and implicit read loop too right? Perl is really cool in all it can do, awk is just a bit simpler ๐Ÿ˜› I feel too stupid for perl ๐Ÿ˜›

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 ๐Ÿ˜€
in reply to Sotolf

My understanding is that Perl was intended to combine the strengths of shell/awk/grep/sed.
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 ๐Ÿ˜›
in reply to R. L. Dane :debian: :openbsd:

did I say strongly? I ment to say stringly, like strings and numbers are basically the same, it just depends on the context ๐Ÿ˜€

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 ๐Ÿ˜›
in reply to Sotolf

LOL, I thought it was a typo, so I just quietly corrected it for you XD
in reply to R. L. Dane :debian: :openbsd:

haha, yeah I wasn't sure they are so similar, well at least it has types, I've done some things in forth and there everything is just raw bytes that you interpret however you feel like in each situation ๐Ÿ˜›
in reply to Sotolf

Forth is madness ^__^
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
in reply to Sotolf

1.8kb uxn emulator in uxn itself ^__^

There's a bunch of folks doing AoC in uxntal. That's too hard for me tho.

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.

โ‡ง