Programming thread

  • 🔧 Actively working on site again.
And yeah, I haven't bothered doing any extra parsing or anything yet. (Although maybe that should be done: it occurred to me as I was checking the output timestamps for the blog that someone making a comment probably also changes the sitemap's last modification time too, maybe, which we're not so interested in. I'll have to check that.)
You probably don't need to parse the timestamps unless you specifically need it. They seem to be formatted as to be able to be compared lexicographically as strings. (ie all the numbers are 0 padded)
 
  • Like
Reactions: Yotsubaaa
The clojure looks much nicer, but it doesn't work for me with the example url.
I already added the "sitemap.xml" to the uri, i.e. https://lispy.wordpress.com/sitemap.xml
checked again on a fresh repl and it works

But to your other point, did you know there used to be a s-expr based serialization format? I don't remember its name at the moment.
Anyway we should now move to edn, which is just clojure data literals, can be read by any language with a decent collections library. As it is the sanest and best choice, it'll never happen.
Which makes me doubly hate protobuff. fuck
 
Pure CLI:
Code:
curl https://lispy.wordpress.com/sitemap.xml | xmllint --xpath '/*[local-name()="urlset"]/*[local-name()="url"]/*[local-name()="loc" or local-name()="lastmod"]' - | sed -E 's/<[^>]+>//g' | paste -d ' ' - - | sort -r -k 2

Append `| head 5` at the end if desired.

You should have `xmllint` installed if you've installed the libxml2 package. Unfortunately it doesn't let us register namespaces, which is why the XPath has the hacky `/*[local-name()="urlset"]` garbage instead of just `/ns:urlset`.

(Is there BBCode on this thing for inline code styling? Also, fuck BBCode.)
 
Like a binary one?
No, it was text based s-expression data format. don't remember its name, but just like json or xml, just sensible.
For binary some guy wrote a library which serializes and compresses Clojure data directly to binary so you could say it counts, but it's new.
 
No, it was text based s-expression data format. don't remember its name, but just like json or xml, just sensible.
For binary some guy wrote a library which serializes and compresses Clojure data directly to binary so you could say it counts, but it's new.
Just... sexprs themselves? (write '(foo (bar) baz))?

There's sxml, but it's specifically a representation of xml in sexprs.

If you're not trying to store specifically xml, you can just use an arbirary sexpr layout for your data, as long as you keep it straight in your head (and code).
 
If you're not trying to store specifically xml, you can just use an arbirary sexpr layout for your data, as long as you keep it straight in your head (and code).
And there's conventions for putting in extra structure, like alists and plists.

I want optional types as well that I can publish as s-expressions. Call these "schema" if it makes people happy.

And in this century, we should be binary serialising as a matter of course.
 
Last edited:
Just... sexprs themselves? (write '(foo (bar) baz))?
yes. it wasn't sxml. It's something older than xml
edit: was probably DSSSL, came after SGML, before XML
And there's conventions for putting in extra structure, like alists and plists.

I want optional types as well that I can publish as s-expressions. Call these "schema" if it makes people happy.

And in this century, we should be binary serialising as a matter of course.
Binary edn serializing: https://github.com/ptaoussanis/nippy
 
yes. it wasn't sxml. It's something older than xml
edit: was probably DSSSL, came after SGML, before XML
I'm still as confused as @Marvin on this one:

No, it was text based s-expression data format. don't remember its name, but just like json or xml, just sensible.
The read syntax of s-expressions is a data format, like json and xml, at least as sensible as json, and with no good reason to have been reinvented.

It's got some love in Ocaml, where there are preprocessors to derive s-expression (de)-serialisers for arbitrary data-types, and one of the Ocaml compiler's own intermediate languages is s-expression based.
 
  • Like
  • Informative
Reactions: FuckedUp and Marvin
I like powershell for how easy it is to quickly set up and do something, how it works with c#, and how hard it is for some fucking droolbrain to make an illegible script (i found an obfuscated powershell botnet that took like 2 hours to reverse engineer.)

But seriously, fuck the syntax. I want to find the fucker who came up with -eq, -ne, -like, -gt, -lt, etc. and murder him. I can get < and > not being easily viable due to stdout pipelines but who the fuck would ever use if ( $shit -eq "fucked" ) when == exists
 
I like powershell for how easy it is to quickly set up and do something, how it works with c#, and how hard it is for some fucking droolbrain to make an illegible script (i found an obfuscated powershell botnet that took like 2 hours to reverse engineer.)

But seriously, fuck the syntax. I want to find the fucker who came up with -eq, -ne, -like, -gt, -lt, etc. and murder him. I can get < and > not being easily viable due to stdout pipelines but who the fuck would ever use if ( $shit -eq "fucked" ) when == exists
I think Bash or Perl are to blame.
 
But seriously, fuck the syntax. I want to find the fucker who came up with -eq, -ne, -like, -gt, -lt, etc. and murder him. I can get < and > not being easily viable due to stdout pipelines but who the fuck would ever use if ( $shit -eq "fucked" ) when == exists
Agree that it's weird at first. I do kind of like how it puts -like, -contains, -match and the -notx operators for those at the same level as the regular -eq. Probably use those more than -gt & -lt in reality.
 
  • Agree
Reactions: Yotsubaaa
but who the fuck would ever use if ( $shit -eq "fucked" ) when == exists
I don't know Powershell but in POSIX shells you have "-eq" specifically for integers and "=" for strings.
This is necessary because typing isn't possible; "if [ foo = bar ] " just calls /bin/[ (or a compatible builtin) with "foo = bar ]" as its command line arguments.
 
Powershell doesn't have that problem. In fact, while most unix shells (in fact, all of them that I'm aware of) pass around text, PowerShell actually normally passes around objects (there is a .ToString() method, and sometimes the default representation of an object is a string, but by default, everything is an object.)
That means that yes, typing exists, but Microsoft made a conscious decision to use those operators.
 
Powershell doesn't have that problem. In fact, while most unix shells (in fact, all of them that I'm aware of) pass around text, PowerShell actually normally passes around objects (there is a .ToString() method, and sometimes the default representation of an object is a string, but by default, everything is an object.)
That means that yes, typing exists, but Microsoft made a conscious decision to use those operators.
At that point just use Eshell
 
At that point just use Eshell
Look, I realize that Lisp would be a better option.

I also realize that as someone barely above a codeshitter, I can do most everything I need to do in a few lines of Powershell with an hour at most of testing, and if I need to do anything more complex I can build a quick C# library to call from my Powershell code.

Basically I should stop being lazy
 
Look, I realize that Lisp would be a better option.
No, no. Powershell's idea of passing around the actual in-memory objects is eminently sensible, and possible because it's a shell for .NET.

UNIX shells are shells for a UNIX userland. In this world, programmer utilities are not nice memory-safe, typed CLR functions and methods. They are C programs which do very bad things the second you misuse their memory. As mentioned above, even conditional fucking logic is implemented by a C program.

To guard against the inevitable segmentation faults and memory based exploits arising from this nightmare, the UNIX policy is that programs should not share memory directly, but instead waste CPU cycles spitting out their data into a bespoke text format and then expect every other program to waste cycles with bespoke, often catastrophically buggy, parsers to accept text in these formats.

This is eminently retarded, as are most things about UNIX. eshell doesn't fix it, because the problem is at the layer below.
 
Last edited:
One of the nice things about eshell is that it has fallback implementation for plenty of the UNIX userland utils.
While I agree having a bespoke text format is mental, the idea of composing simple programs via a functional pipeline is rather pleasant.
If programs were functions, they would compose just like any other function with even less ceremony:

Code:
bar x | foo

is just

Code:
foo(bar(x))
I appreciate that I'm in a minority here, and lots of people think that UNIX pipes are cool. To be fair, it is a good idea in a highly networked world to make sure you've made streaming data a priority. But aside from streams, the fact that anyone thinks UNIX pipelines are pleasant is proof of how brain-damaged UNIX has made us, and apparently this brain-damage is so bad that it's infected Powershell.

I mean, what the hell is the thought process?

"We have small units of functionality in UNIX called programs. These programs have an input and output."

Okay. So far so good. You've got functions.

"These programs input and output text."

Okay, hang on.

"To send the output of one program into another program, you ask the kernel to create a special data structure called a pipe with an input and an output end. You tell the first program that its output is the input of this pipe, and the second program that its input is the output of this pipe."

Err...what the fuck? If you want to send the output of a function f to a function g, why can't you just do g(f(x)).
 
Last edited:
Back