Iterating through arrays for( @arr ){ print $_,$/; } Iterating through multiple arrays # Stop at end of shortest while( @arr1 && @arr2 ){ print shift @arr1, " ", shift @arr2, \$/; } # Stop at end of longest while( @arr1 || @arr2 ){ print shift @arr1, " ",
Edit. Interestingly, the final implementation offered below suffers a flaw. If the arguments supplied to let-syntax are unbalanced, the procedure throws an error. This occurs because let-keywords expects a list constructed only of :key value pairs. A potential solution to this is to filter the list with the predicate keyword?
Inspired by recent journey into lisp and scheme, I thought I’d have a crack at bringing some lisp-like heterogeneous lists into c. To compliment this, I’ll also implement some lisp primitives, namely cons, car and cdr, for list operations. Up for discussion: are the lists in this post truly heterogeneous?
An exercise was posted over at ProgrammingPraxis called ‘Jumble’. The aim is to re-arrange a collection of jumbled letters into a real word. A few solutions were posted on the blog (including the original solution in Scheme which is quite nice). I included a solution in gawk in the comments,
… exercise a degree of skepticism with regard to the application of formulas for there is uncertainty as to the limitations of use or the areas of applicability.A.C. Ugural + S.K. Fenster in Advanced Strength and Applied Elasticity Forewarning. This post (as all others on this page) serve as a
In my earlier post discussing the markdown to html parser written in awk, I mentioned the potential to migrate the code over to Perl for some potential speed increases. This was driven mostly by two things Dependency on gawk only functions, reducing portabilitySomething else I don’t remember. Probably suspicious about
Unfortunately, I have been having difficulties with getting rendering inside code blocks. When using wxmaxima, the output from each line formats beautifully in latex, but when transferred to this blog the pretty format disappears. Hopefully I can resolve this for future posts… I’ve recently been looking at the tools I
Got myself a copy of The Rust Programming language, the new 2018 edition version. The Rust Programming Language <meta>is that a new keyboard???</meta> One of the exercises near the end of the book leads you to write your own multi threaded webserver. The web server you end up with is
Resizing a bunch of images from the commandline? imagemagick has your back. convert -resize 50% '*.jpg' small_%03d.jpg This will half the resolution of all .jpg‘s in the current directory, outputting the files with names like small_001.jpg, small_002.jpg, ... etc. Nice one.
Mechanical Keyboard Adventures A while back I bought a mechanical keyboard from over at WASD. I opted for the cherry mx blue keys, for the typing experience. The delivery was quick and the final product looked gorgeous. Some nizxcvm/* gahhH! About 4 days into ownership I spillled nearly a full