This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let grammar (grammar<- " | |
shifts: shift* :end. | |
shift: start [nap* :list] :list. | |
start: timestamp :drop 'Guard #' :count ' begins shift\n'. | |
nap: timestamp 'falls asleep\n' | |
timestamp 'wakes up\n' :list. | |
timestamp: '[' date _ time ']' _. | |
date: (!_ 1)+. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parson (Cant edition) one-liners: | |
'#' :count ' @ ' :count ',' :count ': ' :count 'x' :count | |
:count ', ' :count | |
'Step ' {1} ' must be finished before step ' {1} ' can begin.' | |
:count ' players; last marble is worth ' :count ' points\n' | |
'position=<'_ :integer ','_ :integer :list ['> velocity=<'_ :integer ','_ :integer '>' :list] | |
{5} ' => ' {1} | |
{1} '=' :integer ', ' {1} '=' :integer '..' :integer | |
'depth: ' :count '\ntarget: ' [:count ',' :count :list] '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Issues: | |
;; - Different behavior on ragged arguments, zip vs. transpose. How to resolve? | |
;; - Have to handle when the arguments don't match on operator | |
;; - Add methods for .ragged, .pad-left, .pad-right | |
;; We can avoid a 2x2 table of what to do here if we have methods to | |
;; deal with terms and lists in a unified way. | |
;; Currently: | |
;; - term: term<-, term.tag, term.parts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uh... thinking about balanced ternary again. | |
Earlier I thought a bit about written notation for balanced trits. | |
Some maybe fun follow-on topics: | |
------- | |
What would a 4-trit character encoding look like? It'd be less | |
cramped than the historical 6 bits of many earlier systems, but | |
more cramped than ASCII. Find a cute system starting with: the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; "The ultimate conditional syntax" by Lionell Parreaux, examples | |
;; (untested translations to Cant) | |
;; Example 1 | |
(hm (may some-value | |
(be {none} 0)) | |
(let _ (console .log "It's not none!")) | |
(may some-value | |
(be {some {~ {some name} {left str}}} | |
(do [(name name.capitalize)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reimplement einsum to check my understanding. Efficiency not a goal. | |
# in Python3 | |
# An 'array' variable is a numpy ndarray. | |
# spec_string looks like "mn,np->mp" | |
import itertools | |
import numpy as np | |
def einsum(spec_string, *arrays): | |
instr, out = spec_string.split('->') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If the git config --global http.sslCAInfo command produced an empty output, it implies that git has not been explicitly configured with a specific Certificate Authority (CA) bundle file, and so it is falling back to the system's CA bundle file. | |
The fact that you see in the strace output that it's opening /etc/ssl/certs/ca-certificates.crt confirms that it is indeed using the system's CA bundle file. It means that git is using the correct file for SSL certificate verification. | |
Given that the certificate is valid, the issuer is Let's Encrypt (which is widely trusted), and the system is correctly referring to the CA bundle file, the issue is likely not with the SSL certificate itself or with the CA bundle file. | |
You may want to consider the following possibilities: | |
Network issues: Are you possibly behind a proxy or firewall that could be interfering with git's connection? Try cloning the repository from a different network environment, if possible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] | |
How about programs to read with especially interesting source code? The ray tracing book above sounds like it's of that type. | |
Studying well-written source code can be a valuable learning experience for programmers. Here are a few projects with interesting source code that your friend might enjoy: | |
SQLite (https://www.sqlite.org/): SQLite is a widely-used, self-contained, serverless, zero-configuration SQL database engine written in C. Its source code is well-documented and provides insight into efficient database management. | |
Redis (https://github.com/redis/redis): Redis is an in-memory data structure store, used as a database, cache, and message broker. It's written in C and offers a good example of clean and efficient coding practices. | |
Git (https://github.com/git/git): Git is a distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Its source code, primarily written in C, showcases advanced algorithms and data structure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] | |
Binary search is not helpful here because, in the original nested loop, the total count of all the inner loop steps is going to be just n. But maybe we can simplify that code still: try rewriting it by fusing the cdf-computing loop with the (incf index) loop. Do you see what I'm getting at? | |
I see what you're getting at now. You want to compute the cdf and perform the resampling step in a single loop, effectively removing the need for the inner loop. Here's a version of the function that combines the two steps: | |
lisp | |
Copy code | |
(defun systematic-resample/normalized (weights) | |
(loop with n = (length weights) | |
with sum-weights = 0d0 | |
with index = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[email protected] | |
I have questions about some Common Lisp code. First, I'm unfamiliar with defsubst. Is it a standard macro? | |
Yes, defsubst is a standard macro in Common Lisp. It is similar to defun, which is used to define functions, but with a key difference: defsubst is used to define inline functions, also known as "substitute functions" or "substitutions". | |
When a function is defined with defsubst, the compiler is advised to expand the function at compile-time, essentially inlining the function's body wherever it is called. This can lead to performance improvements, as the function call overhead is eliminated. However, it may also increase the size of the compiled code. | |
Keep in mind that using defsubst is just a suggestion to the compiler, and it is not guaranteed to inline the function. The decision is ultimately up to the compiler's optimization settings and heuristics. | |
[email protected] | |
Thanks. Now some of the function defs are preceded by, apparently a type declaration. I haven't seen this form of tha |
NewerOlder