Programming Leftovers
-
Dynamic binding without special in Common Lisp
Common Lisp has two sorts of bindings for variables: lexical binding and dynamic binding. Lexical binding has lexical scope — the binding is available where it is visible in source code — and indefinite extent — the binding is available as long as any code might reference it. Dynamic binding has indefinite scope — the binding is available to any code which runs between when the binding is established and when control leaves the form which established it — and dynamic extent — the binding ceases to exist when control leaves the binding form.
-
Two tiny Lisp evaluators
Everyone who has written Lisp has written tiny Lisp evaluators in Lisp: here are two more.
Following two recent articles I wrote on scope and extent in Common Lisp, I thought I would finish with two very tiny evaluators for dynamically and lexically bound variants on a tiny Lisp.
-
The Dangers of Enforcing a Premature RTO Policy
Amazon used to have a generous remote work policy. Since last week it demands at least 3 days at the office per week. It is not the first company to enforce RTO (return to office) policy: [...]
-
A glex/acetone example
Glex is such a limited and clueless lexer that has zero idea about context, and acetone is such an strange and weird parser that doesn’t look anything like a traditional BNF string rewriting parser. At first glance they look like they’d be beyond useless. So here’s a worked example.
-
End Users Over All Else, Even In Our Tools
While the consumerization of software has made strides towards putting the focus and decision making power in the hands of end users, many people are still required to use obtuse software because somebody from Company A took somebody from Company B out to dinner and a round of golf. In return, the person at Company B said, “Sure, we’ll throw you our business.”[1]
-
Zig's Curious Multi-Sequence For Loops
Zig has just gained new for loop syntax that allows you to iterate on multiple slices / arrays at the same time. In this blog post I’m going to explain in detail the rationale behind this choice, while also introducing you to a couple useful patterns that the syntax is meant to encourage.
-
Strsep() Function in C Language
Practical tutorial on how to use the strsep() function, the theoretical explanation of its operation, its syntax, and the type of data that they each accept.
-
Strdup() Function in the C Language
Comprehensive tutorial on how to use the strdup() function, its syntax, its theoretical explanation about its usage, and its input and output arguments.
-
Do-While Loops in the C Language
Guide on how to use the conditional “do-while” loop, what the conditional loops are consist of and discussed the different options available in the C language.
-
Python Pad a String with Leading Zeros
To pad the string with leading zeros in Python, the “f-string“, “format()”, “zfill()”, “rjust()”, and “ljust()” methods can be used.
-
Python Add String to List
To add the string to the list, the “+” operator, the “insert()” method, the “extend()” method, and the “itertool.chain()” method can be used.
-
Python Inline If-else
The inline if-else is a logical statement that allows users to preserve the code quality in a single line by replacing the number of lines of “if-else” code.
-
Python Prepend List
To prepend the Python list, the “+” operator with square brackets “[ ]”, “slicing” method, “insert()“ method and “deque.appendleft()“ method can be used.
-
Pip Install Tkinter
The pip install tkinter command is used to install the tkinter package, a GUI building tool, in your Python Environment. Read this guide to learn about Tkinter.
-
Python Substring After Character
To get substring after a character in Python, the “split()” method, the “partition()” method, the “index()” and the “find()” method are used.
-
Python Check if a String is a Float
To check if a string is float or not in Python, the “float()” method, the “replace()” method and the “isdigit()” method are used.
-
Python Truncate String
Truncating a string means splitting the string into separate parts. In Python, truncating a string can be done by slicing and by using the rsplit() method.
-
Python Insert Character Into String
Use the concatenation operator (+) to add the character(s) at either end of the string, or use the string slicing to insert them into the middle of the string.
-
Python KeyboardInterrupt
The Python KeyboardInterrupt is the action performed by the user by pressing the combination “CTRL + C” terminating the execution of the program.
-
Overwrite a file in Python
To overwrite a file in Python, either use the open() method with the mode “w” or the truncate method. To overwrite specific content, use the re.sub() method.
-
Python Multiply List by Scalar
In Python, a list can be multiplied with a scalar using list comprehension, loops, maps, and the Numpy Package. Read to learn all these methods.