3 ms·
You Only Use 10% of Printf() – Here Are Things They Didn't Teach You [video]
- db48x 4mo agoWait until you hear about Common Lisp’s string formatter.
- hnlmorg 4mo agoWant to share some details?
- bandrami 4mo agoThe FORMAT directive is Turing-complete. The full spec is here: https://www.lispworks.com/documentation/HyperSpec/Body/22_c.htm https://www.lispworks.com/documentation/HyperSpec/Body/22_c....
- hnlmorg 4mo agoprintf is also Turing complete. Thanks for the link, I'll have a read of that later
- db48x 4mo ago`printf` with some GNU extensions is accidentally Turing–complete because you can overwrite it's internal state. Common Lisp’s `format` is intentionally and safely Turing–complete because it includes directives for conditionals, iteration, goto, and recursion. The classic example for printing lists: (setq foo "Items:~#[ none~; ~S~; ~S and ~S~ ~:;~@{~#[~; and~] ~S~^ ,~}~].") (format nil foo) => "Items: none." (format nil foo 'foo) => "Items: FOO." (format nil foo 'foo 'bar) => "Items: FOO and BAR." (format nil foo 'foo 'bar 'baz) => "Items: FOO, BAR, and BAZ." (format nil foo 'foo 'bar 'baz 'quux) => "Items: FOO, BAR, BAZ, and QUUX." <https://www.lispworks.com/documentation/HyperSpec/Body/22_cgb.htm https://www.lispworks.com/documentation/HyperSpec/Body/22_cg...> The directives for recursion takes a format string and a list, calls `format` on the string using the list as the list of arguments and then inserts the result into the current output. This is much less verbose than calling `snprintf` to create a temporary string and then insertimg it into the current output with %s. <https://www.lispworks.com/documentation/HyperSpec/Body/22_cgf.htm https://www.lispworks.com/documentation/HyperSpec/Body/22_cg...> There is also a directives for calling a Lisp function to print the next argument, and the standard library includes several functions intended to be called from within a format string. <https://www.lispworks.com/documentation/HyperSpec/Body/22_ced.htm https://www.lispworks.com/documentation/HyperSpec/Body/22_ce...>
- apimade 4mo ago[flagged]
- hnlmorg 4mo agoIf it's interesting then it's not spam. And why should you care if AI was utilized or not if you found it interesting? Dave (from that video) is an experienced engineer after all. The worst part of GenAI seems not to be AI slop (I can easily close the tab if the content isn't interesting). It's the fact that every...single...submission(!!!) on HN now has someone questioning and dissecting the content to dismiss it as AI generated. I'd much rather people gave submissions the benefit of the doubt, or just clicked `Flag` if it is obviously worthless slop.
- sieabahlpark 4mo ago[dead]
- apimade 4mo agoIt's moreso the "AI-isms" that irk me. It's interesting, but I'm not finishing the video because once I notice it -- I can't help but focus on it. Instead, I tl;dr'd the transcript. People question my use of AI when I double `-` with an iPhone on the internet constantly.[0] I get it, it's annoying. However, if our barrier for quality is "at it's core, the content of this is interesting", then the quality of this place will fall off a cliff. This is factoid-level interesting. It's not a hacker writing something profound or presenting a breakthrough in garbled grade 8 English. It's a fun fact being presented in an acceptably, inoffensive, reasonably produced format.. Is that the bar? [0] https://news.ycombinator.com/item?id=48151641 https://news.ycombinator.com/item?id=48151641
- hnlmorg 4mo agoDave (the guy in that video) is an older timer Microsoft engineer. I don't know if he used AI to help compose his script but you can guarantee the subject matter is from his own experience. I suspect the AI-isms you identified were really just more his own personal presentation style. I've watched a few of his videos over the years and from what I recall, they were similarly written.
- kelsolaar 4mo agoInsightful video, never thought that such complexity was hiding there. In a hindsight, it makes total sense.