Below you will find pages that utilize the taxonomy term “Programming”
October 6, 2021
Go is Korean, Lisp is Japanese
Recently I took a fresh at look at the Go programming language after having last taken a look at it before version 1.0 was released back in 2009. What I’ve found in just a few days is shocking in a really really good way.
January 1, 2020
The Golden 20s
The Golden 20s of the 20th century began with the end of WW1 and ended with the stock market crash of 1929. It was considered the decade that was the calm before the storm. However, it was a decade of sweeping technological change and innovation that transformed industrial productivity, life in general and in turn the world economy. It improved the general well-being of many. Electricity, the internal combustion engine and radio changed everyday life forever.
December 5, 2019
When will Rust be formally specified ?
The sooner a language is formally specified and standardized the better. I don’t want to see Rust go the way of languages like Ruby(which eventually got a spec) or Clojure (still does not have one). Without this and the longer it’s delayed, external libraries spring up to solve problems that should be fully or partially addressed in the core of the language. A formal language spec along with standardization would also potentially inform much higher quality crate design while also allowing quicker progress on many fronts due to less ambiguity.
December 3, 2019
Error handling or The Emperor's Old Clothes.
TLDR; This problem has been solved for 40 years but the software development industry is still very fashion-oriented.
In both Common Lisp and Smalltalk error handlers can resume the computation that raised it, restart it, or refuse to handle it while the error handling code itself can be separated out from where it is caught i.e. into re-usable functions. Without unwinding the stack and losing the context of why/where the error occurred.
October 6, 2019
Everyday Ada : Simple REST Service
Ada (previously) is a time-tested, safe, secure programming software-engineering language with a 40-year record of success in mission-critical applications such as… Air Traffic Management SystemsDesktop and Web ApplicationsCommercial AviationBanking and Financial SystemsRailway TransportationInformation SystemsCommercial RocketsCommercial Shipboard Control SystemsCommercial Imaging Space VehiclesTelevision/Entertainment IndustryCommunication and Navigational Satellites and ReceiversMedical IndustryData CommunicationsGeneral IndustryScientific Space VehiclesMilitary Applications How good is Ada though for something that most programmers might work on in their day to day ?
September 22, 2019
Raspberry Pi 4
The Raspberry Pi 4 is a leap forward not just for the Pi but for single-board computers across the board. It’s a great light-weight desktop replacement. It’s even surprised me as a viable Rust / Ada development environment. Raspberry Pi 4 running MATE desktop My setup includes a Raspberry Pi 4 FLIRC case which is basically a giant aluminum heat sink. This allows for a completely silent setup running at an average of 54’C.
September 10, 2019
Ada, Rust and Steelman language requirements
Ada is the only pragmatic language that is still growing in a healthy way that meets the Steelman language requirements (created by US DoD circa 1978). Ada is rare among programming languages in that it is one of the few that was designed up-front according to a years-long well defined specification. Rust, at least aspires to meeting some of these requirements, even if not intentionally.
Crucial in the Steelman requirements were: A general, flexible design that adapts to satisfy the needs of embedded computer applications.
March 14, 2019
Happy PI day with Rust !
https://github.com/jgrant27/jngmisc/tree/master/rust/machin-pi
December 3, 2015
Two sorts with Rust
Here are some initial thoughts on Rust in the almost two years since I last looked at it along with some implementations of merge and quick sort. (These are just my opinions so please don’t panic !)
1. Cargo is awesome for managing package dependencies and building projects.
2. Rust is a very nice systems programming language that supports a functional style of programming. Much easier to work with than C/C++ with very near the same performance in many cases.
May 26, 2014
Ring probabilities with Elixir
I’ve been hearing more about Elixir lately so I thought I’d take it for a spin.
“Elixir is a functional, meta-programming aware language built on top of the Erlang VM. It is a dynamic language that focuses on tooling to leverage Erlang’s abilities to build concurrent, distributed and fault-tolerant applications with hot code upgrades.”
I’ve never really spent any time with Erlang but always been curious about it and the fact that it’s one of the best kept ‘secrets’ in many startups these days.
August 22, 2012
Purely Functional Data Structures & Algorithms : Union-Find (Haskell)
*Updated 08-23-2012 01:04:38*
Replaced the use of Data.Vector with the persistent Data.Sequence which has O(logN) worst case time complexity on updates.
A Haskell version of the previous code using the more efficient(access and update) persistent Data.Sequence type so that the desired time complexity is maintained for the union operation.
-- Disjoint set data type (weighted and using path compression). -- O((M+N)lg*N + 2MlogN) worst-case union time (practically O(1)) -- For M union operations on a set of N elements.
August 19, 2012
Purely Functional Data Structures & Algorithms : Union-Find
It’s been a while since I last posted in this series. Today we look at the disjoint-set data structure, specifically disjoint-set forests and the complementary algorithm : union-find.
In computing, a disjoint-set data structure is a data structure that keeps track of a set of elements partitioned into a number of disjoint (nonoverlapping) subsets. A union-find algorithm is an algorithm that performs two useful operations on such a data structure:
August 16, 2012
Codebreaker - A new film about the life of Alan Turing
CODEBREAKER tells the story of one of the most important people of the 20th century. Alan Turing set in motion the computer age and his World War II codebreaking helped save two million lives. Yet few people have heard his name, know his tragic story, or understand his legacy. In 1954, Turing committed suicide at age 41 after being forced to undergo hormone therapy to “fix” his sexual orientation. He left behind a lasting legacy and lingering questions about what else he might have accomplished if society had embraced his unique genius instead of rejecting it.
July 10, 2012
Alan Kay on Programming today (and a few other things)
From a recent Dr. Dobbs interview :
On adults –
Binstock: So you called them on the lying.
Kay: Yeah. But the thing that traumatized me occurred a couple years later, when I found an old copy of Life magazine that had the Margaret Bourke-White photos from Buchenwald. This was in the 1940s — no TV, living on a farm. That’s when I realized that adults were dangerous. Like, really dangerous.
September 19, 2010
Facts about STM
These days there just can’t be enough said to counter the hype that comes with STM. The following paper is an eye opening read(it measures actual peformance of STM). Hopefully some of the STM faithful will re-consider their fanatic beliefs.
Software transactional memory: why is it only a research toy?
“In this article, we explore the performance of a highly optimized STM and observe the overall performance of TM is much worse at low levels of parallelism, which is likely to limit the adoption of this programming paradigm.
July 22, 2010
π in assembly (spigot algorithm)
// pi_spigot.s - calculates Pi using a spigot algorithm // as an array of n digits in base 10000. // http://mathworld.wolfram.com/SpigotAlgorithm.html // // x86-64/SSE3 with for Linux, Intel, gnu assembler, gcc // // assemble: as pi_spigot.s -o pi_spigot.o // link: gcc -o pi_spigot pi_spigot.o // example run: ./pi_spigot 100 // output: 3.14159265358979323846264338327950288419716939937510582097494459230 ... // ... 78164062862089986280348253421170679 // .section .rodata .LC0: .string "%d." .LC1: .string "%04d" .text .globl print .type print, @function print: .
May 15, 2010
The Dangers of Computer Science Theory
Quotes from Don E. Knuth :
“If we make an unbiased examination of the accomplishments made by mathematicians to the real world of computer programming, we are forced to conclude that, so far, the theory has actually done more harm than good. There are numerous instances in which theoretical “advances” have actually stifled the development of computer programming, and in some cases they have even made it take several steps backward!
March 14, 2010
Happy π approximation day/night (in assembly) !
// pi_x64.s - calculates Pi using the Leibniz formula. // Each iteration prints a closer approximation to 50 digits. // This is not an optimal implementation and it runs forever. // // x86-64/SSE3 with for Linux, Intel, gnu assembler, gcc // // assemble: as pi_x64.s -o pi_x64.o // link: gcc -o pi_x64 pi_x64.o // run: ./pi_x64 // output: 3.14159264858204423376264458056539297103881835937500 // 3.14159265108366625440794450696557760238647460937500 // 3.14159265191852199450295302085578441619873046875000 // 3.14159265233600137889879988506436347961425781250000 // .... and on forever .
July 23, 2009
Generating π in Haskell
Haskell beats CL quite comfortably using the same algorithm :
module Main( main ) where import System( getArgs ) arccot :: Integer -> Integer -> Integer arccot x unity = arccot' x unity 0 start 1 1 where start = unity `div` x arccot' x unity sum xpower n sign | xpower `div` n == 0 = sum | otherwise = arccot' x unity (sum + sign*term) (xpower `div` (x*x)) (n+2) (-sign) where term = xpower `div` n machin_pi :: Integer -> Integer machin_pi digits = pi' `div` (10 ^ 10) where unity = 10 ^ (digits+10) pi' = 4 * (4 * arccot 5 unity - arccot 239 unity) main :: IO () main = do args <- getArgs putStrLn (show (machin_pi (read (head args) :: Integer))) The first 10000 digits.
July 23, 2009
Generating π in CL (faster)
Thanks to metacircular for pointing out that (floor (/ x y)) can be written as (floor x y) while avoiding
the intermediate rational.
(defun machin-pi (digits) "Calculates PI digits using fixed point arithmetic and Machin's formula with double recursion" (labels ((arccot-minus (xsq n xpower) (let ((term (floor xpower n))) (if (= term 0) 0 (- (arccot-plus xsq (+ n 2) (floor xpower xsq)) term)))) (arccot-plus (xsq n xpower) (let ((term (floor (/ xpower n)))) (if (= term 0) 0 (+ (arccot-minus xsq (+ n 2) (floor xpower xsq)) term)))) (arccot (x unity) (let ((xpower (floor (/ unity x)))) (arccot-plus (* x x) 1 xpower)))) (let* ((unity (expt 10 (+ digits 10))) (thispi (* 4 (- (* 4 (arccot 5 unity)) (arccot 239 unity))))) (floor thispi (expt 10 10))))) The first 10000 digits again.
July 22, 2009
Generating π in CL
Update 2009-07-23 : Faster version in CL and a Haskell version.
——————————————————————————–
A trivial approximation using the Leibniz formula.
(defun leibniz-pi() (labels ((local-pi(sum n) (if (< n (expt 10 6)) (local-pi (+ sum (/ (expt -1 n) (+ (* 2 n) 1))) (+ n 1)) sum))) (* 4 (local-pi 0f0 0f0)))) And here’s a longer version(but faster and more precise) using Machin’s formula with fixed point arithmetic to x digits.
April 9, 2009
Visualization of SBCL development history since 2000
My curiousity got the better of me tonight. Video behind the link.