Archive
9,565 entries: 46 from X, 8,923 from Pinboard, saved 1998 to 2026.
Browse by tag, site, author, folder or language
Tags
- #python 393
- #programming 343
- #tutorial 187
- #books 186
- #javascript 150
- #webdesign 146
- #mathematics 130
- #blog 128
- #css 123
- #linux 112
- #reference 107
- #lisp 101
- #business 95
- #free 95
- #history 95
- #productivity 95
- #llm 93
- #design 91
- #statistics 90
- #gtd 83
- #opensource 81
- #r 80
- #lifehacks 78
- #ajax 77
- #graphics 77
- #datamining 75
- #typography 75
- #funny 74
- #photography 73
- #visualization 73
- #ai 67
- #machine-learning 67
- #plone 64
- #algorithms 63
- #kannada 61
- #database 59
- #india 59
- #education 58
- #learning 56
- #science 55
Sites
- youtube.com 251
- news.ycombinator.com 222
- github.com 190
- en.wikipedia.org 161
- reddit.com 96
- amazon.com 71
- nytimes.com 70
- medium.com 69
- arxiv.org 34
- code.google.com 34
- x.com 33
- archive.org 28
- groups.google.com 28
- wired.com 27
- theatlantic.com 24
- theguardian.com 24
- bloomberg.com 21
- newyorker.com 21
- stackoverflow.com 21
- wsj.com 21
- en.m.wikipedia.org 19
- bbc.com 18
- plone.org 18
- goodreads.com 17
- btbytes.com 16
- btbytes.github.io 16
- old.reddit.com 16
- washingtonpost.com 16
- artima.com 15
- google.com 15
- thehindu.com 15
- onlamp.com 14
- www-128.ibm.com 14
- aws.amazon.com 13
- cs.cmu.edu 13
- economist.com 13
- thriftbooks.com 13
- atlasobscura.com 12
- informit.com 12
- smashingmagazine.com 12
Authors
- @achumukundan00 1
- @antoniogm 1
- @BrankoMilan 1
- @Chris_arnade 1
- @code_star 1
- @DeepknowledgeU 1
- @dhh 1
- @dillon_mulroy 1
- @ElamBend 1
- @elisa_freschi 1
- @emollick 1
- @EmreSevinc 1
- @foxyjackfox 1
- @francoisfleuret 1
- @gabrielpeyre 1
- @GunduHuDuGa 1
- @hamsanandi 1
- @HistoryinStory 1
- @itometeam 1
- @kmadathil 1
- @MistralAI 1
- @mprestonmeyer 1
- @NousResearch 1
- @npparikh 1
- @paulabartabajo_ 1
- @paulg 1
- @PEoperator 1
- @pmddomingos 1
- @ringer 1
- @RMantri 1
- @rockatanescu 1
- @sebasbensu 1
- @seriesgraph 1
- @shanselman 1
- @ShriramKMurthi 1
- @stellensatz 1
- @Stunt_ManMik3 1
- @TheIcahnist 1
- @tonywu_71 1
- @twofifteenam 1
Folders
Languages
Tags and folders
44 entries#programming-language ×
2025
The Array Cast
arraycast.com
podcast about Array programming languages like j k apl etc
podcast about Array programming languages like j k apl etc
raku
"APL since 1978" in Proceedings of the ACM on Programming Languages
dl.acm.org
The Evolution of APL, the HOPL I paper by Falkoff and Iverson on APL, recounted the fundamental design principles which shaped the implementation of the APL language in 1966, and the early uses and other influences which shaped its first decade of enhancements.
By Roger Hui. (108 pages). Should be a comprehensive historical review of the APL language.
The Evolution of APL, the HOPL I paper by Falkoff and Iverson on APL, recounted the fundamental design principles which shaped the implementation of the APL language in 1966, and the early uses and other influences which shaped its first decade of enhancements.
By Roger Hui. (108 pages). Should be a comprehensive historical review of the APL language.
2024
C3 Programming Language
C3 programming language. Full C ABI compatibility, Module system, Generic modules, Design by contract, Zero overhead errors, Semantic macro system, First-class SIMD vector types, Struct subtyping, Safe array access using slices, Easy to use inline assembly, Cross-platform standard library which includes dynamic containers and strings, LLVM backend.
C3 Tutorial; has online playground.
C3 Blog by the creator, Christoffer Lernö
Also look at dlang's betterC - Better C - D Programming Language
2023
typescript
Typescript was created at Microsoft.
Learn
TypeScript Deep Dive by basarat is a good tutorial for TS. It helped me understand various terminology like what what package.json, tsconfig.json are. commonjs modules, exports; setting up projects for various target - node.js vs browsers etc.
Typescript Book by Simone Poggiali.
Cloud
Val Town -- If GitHub Gists could run And AWS Lambda was fun. Val Town is a social website to write and deploy TypeScript. Build APIs and schedule functions from your browser.
Awk
- Fascination of AWK | Volodymyr Gubarkov
- AWK technical notes | Volodymyr Gubarkov
- Python vs. awk - To awk or not
- Why Learn AWK? | Jonathan Palardy's Blog
- xonixx/intellij-awk: The missing IntelliJ IDEA language support plugin for AWK
- awk introduction - CLI text processing with GNU awk
- The AWK book's 60-line version of Make
Similar to Awk
- Tablespoon (tbsp) -- (tree-based source-processing language) is an awk-like language that operates on tree-sitter syntax trees.
Java
Modern Java - an online book; a 2026 approach to learning Java in bite-sized lessons. Don't have to start in an IDE for one.
Internals
- Overhead of Returning Optional Values in Java and Rust | Piotr Kołaczkowski
- Writing a Profiler in 240 Lines of Pure Java | Mostly nerdless
Articles
- Use Java for Everything (2014) and related Java in the small (2024).
- Java Best Practices | Jonathan Giles
Interesting libraries
Permazen Permazen is a ground-up rethink of Java persistence. It has been in production use in commercial software since 2015.
Instead of starting from the storage technology side, it starts from the programming language side, asking the simple question, "What are the issues that are inherent to persistence programming, regardless of programming language or database storage technology, and how can they be addressed at the language level in the simplest, most correct, and most language-natural way?"
Csharp
Why Tracebit is written in C#; Jan 2025. "Tracebit deploys and maintains tailored security canaries, proactively detecting intrusions across your organization. From cloud infrastructure, to identity and endpoints."
- Comes with two standard libraries: one (DotNet) that is compatible with .NET and supports everything from console to JSON, and another (Zero) that is stripped to bare minimum and doesn't even have a GC.
- Run C# with no operating system, on bare metal
- Build native code or .NET bytecode
- Based on parts of the .NET 7 SDK
- Invoke bflat directly from terminal, integrate with a shell script, Makefile, or even MSBuild.
2020
Common Lisp
Why
Why I Chose Common Lisp — Dan's Musings; Jan 2025.
Core
Learning
If you are a beginner to CL, this challenge will help you to get started with setting up a development environment from scratch and begin the journey of learning CL together with other community members.
Reading /practicing CL programming
Scripting
Common Lisp as a Scripting Language, 2015 edition - Cybernethics / Cybernéthique — LiveJournal
Install cl-launch:
git clone https://gitlab.common-lisp.net/xcvb/cl-launch.git
cd cl-launch
make
make install
which cl
/usr/local/bin/cl
Example script -- cllaunch1.lsp:
#!/usr/bin/cl -sp lisp-stripper -E main
(defun main (argv)
(if argv
(map () 'print-loc-count argv)
(print-loc-count *standard-input*)))
Run it: chmod +x cllaunch1.lsp
Fails with: Component "lisp-stripper" not found, required by #<SYSTEM "cl-launch-build-0">
To fix this, i cloned https://github.com/fare/lisp-stripper to ~/common-lisp, and the above problem goes away. Next it fails to find cl-ppcre.
I do remember installing it using quicklisp -- ls ~/quicklisp/dists/quicklisp/software/cl-ppcre-20190521-git.
Distributing CL binaries
Links
Common Lisp Books
Blogs
Projects
Fairly recent Common Lisp project that is not just a web application etc., -- https://github.com/atgreen/red-light-green-light -- "A git-centric policy management and enforcement tool designed to accelerate your CI/CD pipelines."
Opusmodus -- "Music Composition System"
Opusmodus revolutionizes music composition, fuses traditional notation with modern concepts, and streamlines the path to a finalized score.
Editing
Haskell Programming Language
Why Haskell
- Why Haskell is beyond ready for Prime Time
- Intro talk on Haskell by SPJ
- Weaknesses of Haskell
- Jocellyn's Blog - Why do I love Haskell more than Ruby?
- What Makes Haskell Unique, Part 1 - DZone Web Dev
Why Not Haskell
- A twitter thread in response to Leaving Haskell behind; Aug 2023.
Learning Haskell
2020-06-10: Haskell for imperative programmers is a series of short videos (10-15 mins) that are very good!
albohlabs/awesome-haskell -- A curated list of amazingly awesome Haskell articles and talks for beginners.
soupi/haskel-study-plan: An opinionated list of resources for learning Haskell; "This is great." -- Stephen Diehl
Learn Haskell from Mark Karpov.
Beginning Haskell tutorial by Stephen Diehl.
What I Wish I Knew When Learning Haskell by Stephen Diehl.
Things software engineers trip up on when learning Haskell | William Yao
Haskell reading list by Stephen Diehl.
Another Haskell reading list on haskell.org.
2014/11/17 How I start - Haskell
2014/11/17 Holy Haskell project starter -- an automatic project starter with sandbox, tests and all the fixins.
2014/11/18 Intro to haskell
Teaching Haskell For Understanding - Google Slides by Julie Moronuki (author of Haskell Programming from first principles).
2018/2/20 Haskell by Example -- one-to-one corresponding examples to "Go by Example"
2018/6/5 Codeworld: Haskell as a First Programming Language — Monday Morning Haskell
My Haskell Journey from C#
- 2020/1/23 For Beginners by Julie Moronuki (aka
argumatronic); The post date says Jan 1, 1970... sure... reddit thread has good discussion. - 2020/3/19 Notes for 'Thinking with Types: Type-level Programming in Haskell', Chapters 1–5 | abhinavsarkar.net for https://thinkingwithtypes.com/
Liquid Haskell
Write Simple Haskell
Read Haskell code
- Peter Siebel attempts a Sudoku solver in Haskell. [Sep 2015]
- bravit/hid-examples: Examples to accompany the book "Haskell in Depth"
Video lectures and talks
- Interview with Graham Hutton on Haskell Foundation Podcast; 2021-08
- [Zürich Friends of Haskell]https://www.youtube.com/channel/UC2zfPMH_srjxUN5EYrfIhCw) including ZuriHac 2018 Beginner Session Saturday (uncut version) - YouTube
- Erik Meijer teaches functional programming fundamentals. Video series on MSDN's channel9.
- Haskell tutorial by Derek Banas (recommended by Gabriel Gonzalez); related code for the video.
- Michael O'Church's Summer Haskell Class slides:
Courses
- Functional Programming an introductory course on functional programming in Haskell by Graham Hutton.
- Introduction to Haskell at UPenn by Brent Yorgey, Joachim Breitner et al. This in my experience is the best introduction to Haskell in a classroom format you can find. The lecture notes are self-explantory and written in a conversational, easy to follow manner.
- CMSC498V -- "Advanced Functional Programming Languages (Fall 2017)" taught by Dr Niki Vazou at UMD.
Developing with Haksell
- Haskforce -- Haskell plugin for IntelliJ IDEA Community Edition [2014/10]
- A detailed guide to using Haskell-emacs mode (2011).
- Haskell Development on Emacs by Tim Dysinger (2014).
- Haskell Best Practices for Avoiding "Cabal Hell" -Experience report developing in Haskell by CTO of Capital Match; Nov 2015.
- An opinionated guide to Haskell in 2018 [Feb 2018]
- Infinite Negative Utility: Some Notes About How I Write Haskell [Dec 2017] -- Good section on how to use list comprehensions.
- The Haskell User experience [Aug 2015]
- Introducing Haskell to a company
- I Released A Haskell Product!
- Development Tools for Haskell; Nov 2019.
Resources
- TechBookHunter/Free-Haskell-Books: A curated collection of free eBooks about Haskell
- Code World -- an online playground for writing and executing Haskell code.
- Phil Wadler's video lectures at University of Edinburgh
- Magazine
- Bob Ippolito's "Haskell for Erlangers"; 2014. Good code examples of IO monads, and monads.
Blogs
- quchen/articles
- Randomhacks/haskell
- Building Monad Transformers - Part 1 - Jakub Arnold Blog
- Haskell for OCaml programmers
- ocharles.org.uk-- [24 days of Hackage 2012/2013]
- tel.github.io -- [types of data, mutable algos in immutable langs]
- Justin Le
- Haskell for all
- Blank.Denum
- Liam O'Connor
- Kwang's Haskell Blog - Home
Blog posts / articles
- A bt client in Haskell
- using stack for haskell dev, from Sean Hess (Practical Haskell series).
- PROGRAMMING WITH EFFECTS by Graham Hutton, January 2015
- Using Mondads by Sean Hess is a good one on Monads.
- quchen/articles
- Distributed Systems in Haskell :: Will Yager
- Monads to Machine Code
- Rest API in Haskell | maciek.io
- Haskell Success Stories - Michael Snoyman's blog
Meta lists
Editors
- Haskell idea plugin
- Haskell for Mac
- Code.world
- Haskell-tools A GHC based toolset for Haskell programming. Currently featuring Haskell-tools Refact, a refactoring framework.
- HyperHaskell -- is a graphical Haskell interpreter (REPL), not unlike GHCi, but hopefully more awesome. You use worksheets to enter expressions and evaluate them. Results are displayed using HTML.
Papers
- Practical type inference for arbitrary-rank types
- Best monad tutorial? Tackling the Awkward Squad
My Notes
What are some of the low-friction ways of using Haskell?
- Pandoc -- add custom elements, extract metadata from documents.
- Hakyll -- build custom site renderers.
- Shake -- build system where Make isn't sufficient.
If you get can't load .so/.DLL for when installing cabal package:
put shared: True in ~/.cabal/config
Cabal
Sandbox:
cabal sandbox init
cabal init #to init a new proj.
remember to
export HASKELL_PACKAGE_SANDBOX=.cabal-sandbox/x86_64-osx-ghc-7.6.3-packages.conf.d
inside the cabal sandbox.
- How to write a Haskell program
- How to develop packages with Cabal
jupyter notebook
See www.btbytes.com/stack.yaml for dependencies.
stack new myproj
cd myproj
stack init
brew install zmq
stack exec ipython -- notebook
Note: iHaskell binary is installed in ~/.local/bin:
Copied executables to /Users/pgowda/.local/bin/:
- ihaskell
(not sure if the above two lines are actually important ...)
Libraries and tools
Haskell Reference
- Real World Haskell. Free online version.
- Beginning Haskell: A Project-Based Approach Read Haskell Tutorial and Cookbook | Leanpub
Misc
Links
Projects in haskell
- Glot.io -- an open source pastebin with runnable snippets and API. Source code
Zig Programming Language
The Zig Programming Language is an open-source programming language designed for robustness, optimality, and clarity.
Introduction
- Introduction to the Zig Programming Language - Andrew Kelley
- zig in 30 minutes; HN; Jan 2021.
- Learning Zig by Karl Seguin.
- Zig's Lovely Syntax; Aug 2025 by
matklad.
Code
- andrewrk/tetris: A simple tetris clone written in zig programming language.
- Hejsil/pokemon-randomizer: A Pokémon Rom randomizer tool written in Zig
- dbandstra / oxid · GitLab
Learning
- An Introduction to Zig, a project-based book.
Articles
Zig And Rust by Alex Kladov/
matkladZiggifying Kilo; Apr 2023.
When Zig is safer and faster than Rust; Mar 2023.
Problems of C, and how Zig addresses them; Jun 2023.
Why I am not yet ready to switch to Zig from Rust | by Pekka Enberg | Jun, 2024 | Medium
Why Zig Clicks; Mar 2021
- A small core
- tagged unions
- optionals
- automatic deserialization to structs
- type checked string formatting
- Local Reasoning
- Generics
- C interop
- RAII
- A small core
Project Management
FFI
- Andrew K: Friendly challenge for Go programmers:
Provide or link to a small (50-200 ish lines) idiomatic Go program demonstrating concurrency. (Elegant use of goroutines, channels, etc)
I'll provide the equivalent Zig program using
async/awaitandstd.event.Loopfor comparison.
My notes
Cross compiling zig
Code
# crosscompile.zig
const warn = @import("std").debug.warn;
pub fn main() void {
warn("Hello, world!\n");
}
Compiling natively on Mac OSX
$ zig build-exe crosscompile.zig
$ file crosscompile
crosscompile: Mach-O 64-bit executable x86_64
Cross-compiling for Linux
The C ABI tuple of (operating system, architecture, C compiler environment) is defined by --target-os --target-arch --target-environ flags of zig. [ref]
zig build-exe crosscompile.zig --target-os linux --target-arch x86_64
Verify the executable file type created:
$ file crosscompile
crosscompile: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, with debug_info, not stripped
Software written in Zig
D Programming Language
Why D?
- May I Propose D for memory safe programing?
Show off D
Semantics
- Copy and Move Semantics in the D Programming Language, talk by Ali Çehreli at DConf 2013. Describes the differences between
const,immutable;struct,classetc.,
Garbage Collection
- See the D garbage page on how to set GC options on a D program and also collect GC summary on program termination. Very handy!
- Don’t Fear the Reaper – The D Blog [March 2017 on D blog].
- Concurrent garbage collection for D -- Dconf 2013 talk by Leandro Lucarella. DGC (appears to be for D1/tango only)... need to find out if it's been ported to the D2 runtime.
- See Lucarella's garbage collection posts circa 2009.
- Maxime Chevalier-Boisvert on D's garbage collection problem and Circumventing the D garbage collector; Oct 2014. Her Higgjs JIT compiler for JS written in D. D's New GC and Object Allocation Pools
- Matt Kline's work on D's owning types (Unique and RefCounted)
- Martin Nowak's "Garbage Collection in D" talk; Mar 2015.
- Audio plugin written in D
- Forum discussion on garbage collection, Dec 2015.
- Xomb (pronounced zombie), an exokernel operating system written in D without use of GC.
- The real problem with GC in D - Infognition tech blog
- DmitryOlshansky/gchunt is a tool to identify and keep in check GC usage of D projects. My question about dub flags
- Implementing Alternative Garbage Collector - D Programming Language Discussion Forum
- "D generates lot less garbage"
Example code showing GCStats:
import std.stdio;
extern (C)
{
void gc_stats(GCStats* stats) nothrow;
}
struct GCStats
{
size_t poolsize; // total size of pool
size_t usedsize; // bytes allocated
size_t freeblocks; // number of blocks marked FREE
size_t freelistsize; // total of memory on free lists
size_t pageblocks; // number of blocks marked PAGE
}
void main()
{
GCStats stats;
gc_stats(&stats);
writeln(stats);
auto p = new byte[200];
gc_stats(&stats);
writeln(stats);
p = new byte[1000];
gc_stats(&stats);
writeln(stats);
p = new byte[10000];
gc_stats(&stats);
writeln(stats);
}
To turn on garbage collection profiling
$ max_column_sum_by_key_v1 --DRT-gcopt=profile:1 ngrams.tsv 1 2
max_key: 2006 sum: 22569013
Number of collections: 132
Grand total GC time: 246 milliseconds
GC summary: 35 MB, 132 GC 246 ms
What's the go with the GC these days? ; Jan 2019 D forum discussion. recent PRs to add a more precise GC.
Profiling D's Garbage Collection with Bpftrace — The Art of Machinery; Apr 2019.
Summary of GC discussion
See June 2016 discussion on the Garbage collector
- Precise GC is in the works. (todo: summarise progress)
- "Only a few language features forces you to use the GC." (which ones?)
- "For most uses you are not forced to use the GC in any form especially with the help of std.experimental.allocator." (How?)
- Current GC is based on a forked version of Boehm GC. So, not easy to upgrade to current version without deep understanding of how D does Thread Local Storage etc.,
- "we can disable the GC so it won't go ahead and scan upon allocation (only time it does)" (how?)
Memory allocations are /always/ expensive. Higher level languages like Java have the benefit of using pools and optimizing for this usage pattern, D does and will never have this. Keep in mind an allocation = usage of malloc + write to returned pointer. -- rikki c.
The point is, D doesn't have to have a GC. Not using it is way easier than in most other languages because all the tools to help you profile it and avoid it are provided by the compiler. Go without a good GC is a dead language. D without a good GC is just not as good as it could be. And btw we're generally faster than Go ;-) The point is: while a better GC is a work in progress we'll never have a GC that can fit all needs, but it's not as critical as it is in Go or in C# because we provide other ways to manage memory when limitations arise. -- cym13
"Has anyone thought about taking GC from .NET and reusing it in D?"
One significant point has been already mentioned: cost of write barriers. I'd like to mention another factor: .NET GC is a copying one, it moves data around. One good feature of current D is it never moves data, so you can very easily call C and C++ code and pass pointers to your buffers and stuff and C/C++ code just takes these pointers and works with them as usual. No pinning, no marshaling, zero overhead. If you take a moving GC like .NET's, you immediately make all C/C++ interaction much harder, now you need to worry about pinning stuff or copying "managed" data to "unmanaged" memory and back. This is all costly both in terms of CPU cycles and of programmer cycles. You'll need "FFI", what most other GC-ed languages have to have, and D doesn't. --thedeemon
Precise Garbage Collector
It is essentially in a similar state that it was when Rainer presented it at DConf2013. The version in the pull request is not different from the one Rainer presented at all. It's actually the same one, just updated with what has been changed in druntime recently and my attempts at making the marking phase faster.
Meta programming3
- User:Quickfur/Compile-time vs. compile-time - D Wiki
- Metaprogramming in D - From a beginner's perspective
- Type safe OpenGL - Converting strings into types in D -- using templates and mixins.
Debugging
Building
- To build projects using
ldc2instead ofdmd2withdub, use the--compilerswitch, thus:dub build --compiler=ldc2 - To build the release version of the software, use the
-bswitch, thus:dub build -b release
Cross Compiling
Serialization
- Orange library for serialization.
Concurrency
- Forum question What are the real advantages that D offers in multithreading?
- See Ali's book from "Parallelism" to "Fibers".
- Getting more fiber in your diet
- Concurrency in the D Programming Language | 13.1 Concurrentgate from Andrei's D book.
Range based programming
- poita.org has couple of articles on range based programming.
Profiling / performance
- andrewtrotman / D Profile Viewer — Bitbucket -- The D language profiler that comes with DMD produces traces that are not designed for humans to read. This program reads a trace file (trace.log) and turns it into an interactive HTML file designed for human navigation and understanding.
- PGO: Optimizing D's virtual calls
D run time
- Running D without its runtime (experience in building audio plugins in D without using the D run time.)
Testing
- Behaviour-driven development with D and cucumber by Atila Neves at Dconf 2015
C/C++ binding
Creating D bindings for a C library on D forum. "State of the art" as of Nov 2015.
Interfacing D with C and Fortran uses
-betterCtechnique.
Lexing and parsing
- hsc - Halo 3 scripting lexer, parser, compiler in D
- Implementing a programming language in D: Lexical Analysis
Another option is to use a lexer/state machine generator. Ragel supports D and Rust (as of the not-quite-released v7) as target languages. HN
Memory safety
- Memory Safety in by Jakob Øvrum.
Documenting D code
- harbored-mod A documentation generator for D with support for both DDoc and Markdown in documentation comments.
Higher level programming
Resources
Introduction
- Diving into Dlanguage -- Andrei Alexandrescu explains the basics of D programming Language.
- Pragmatic D Tutorial by
qznc. - DPaste -- paste code, run it online, see the output.
- The Dlang tour, forum announcement -- "The basic idea behind this tour is to introduce features of the language with short explanations and example code that is compiled and run online.". See also playpen, a sandbox used by Rust to create their playpen.
- glot.io -- an open source pastebin with runnable snippets and API.
- explore.dgnu.org compiler disassembler.
- An active D reddit
- Three cool things about D - PDF presentation.
- ApplyYourDLang Channel on Youtube
- Quick start with D!
- D tutorials by Minas Mina
Intermediary
Articles
- Evaluating D for games
- Functional programming in D
- A comparison between C++ and D
- D as a scripting language - Infognition tech blog
Tutorials
- Beginner level -- Tutorials - D-Land (in German)
Presentations
- Dive into D: Slides by Dmitry Olshansky; Mar 2016.
Editor
IntelliJ plugin for D language -- look at the screenshots. It is a fairly complete IDE with syntax highlighting, auto completion, compile checking, code linting (via Dscanner), navigate to classes etc.,
DDT -- the Eclipse based D IDE works as advertised. Use the 3.7(Indigo) version. [In Oct 2012, DDT did not work with the latest version of Eclipse: Juno].
Blogs
- The art of machinery by Seimon Arneaud.
- Planet D
- nomad.so/tag/d
- To:goto To; -- D, go, nim, rust ; language benchmarks.
- Bitbashing.io
- braingam.es
- w0rpzone
- rharriso -- D, intellij, lldb.
- infocognition blog
- leonardo
- Programming blog of Johan Engelen
- Blog - Bradley Chatha, see "Simple JSON Serialiser" etc.,
Talks
- Andrei Alexandrescu Three Cool Things about D - YouTube; Dec 2015.
- Functional Programming with D ― Andreas Zwinkau
- DConf 2013 Day 1 Talk 5: Using D Alongside a Game Engine by Manu Evans - YouTube
Read code
- dmin.io -- URL shortener in D. Uses vibe.d.
- See also ccbikai/Sink: ⚡ A Simple / Speedy / Secure URL Shortener with Analytics, 100% run on Cloudflare., written in JS.
- DUB registry -- list of D library packages; dub can be installed on Mac OS X using
brew. - facebook/warp -- A fast preprocessor for C and C++
- https://github.com/karpovr/veda uses vibe.d
- terminix -A tiling terminal emulator for Linux using GTK+ 3. GTK + D.
Discussions
- Andrei Alexandrescu's AMA on reddit post his decision to work on D full time. [Aug 2015]
- Why didn't D language become mainstream comparing to Golang?
- D Roadmap etc.,; specifically DIPs, Review Queue.
- RejectedSoftware Forums for vibe.d, dub etc discussion forum.
Contributing to D development
Software written in D
Developing and distributing D software
- Carlos Soriano Sánchez / GtkDApp · GitLab. This is a template for a Linux app, using Flatpak, GTK+, Meson, and D.
Misc
- Dlang comic strips
- Codeeval supports D.
- Rust v D
- SDLang -- "simple declarative langauge" used by dub project for configuration.
User experience
- D for HFT by SD
- wilzbach comments on An introduction to non-uniform random sampling using D. Experience report of using D for six months. Forum link
- The Expressive C++17 Coding Challenge in D
- Advent of D – The Scribbler of the Rueful Countenance -- see day 18 for concurrency, 8 for mixins, 7 for ctRegex.
- Why D is a good choice for writing a language
Libraries
For some reason, many D programmers have this "collection of D libraries", which is interesting in the sense that more than one developer has found it just easy to write their own library to do X...
- adamruppe/arsd
- CyberShadow/ae
- kxml -- recommended in D cookbook for XML parsing large files.
- treecount SDL2 etc.,
- runtimer Application runtime configuration for applications built in the D programming language.
- dstruct -- has
WeakReference(T), Some(T), Option(T), HashMap(K,V), HashSet(T), Matrix(T), Matrix(T, rowCount, columnCount), BasicGraph(T, edgeDirection). - Tango-D2
- mbierlee/poodinis: A dependency injection framework for D with support for autowiring. and aedi
- Literate -- A modern literate programming system written in D
- Abscissa/scriptlike: Utility library to help you write script-like programs in D
- sociomantic-tsunami/ocean: General purpose, platform-dependant, high-performance library for D extends Tango-D2, which is a D2 port of the Tango project.
- Derelict -- D bindings to popular C libraries.
- tamediadigital/asdf: fast and simple JSON for Dlang
- tamediadigital/je: json extract: a tool to extract data from json
- Ocean is a general purpose library, compatible with both D1 and D2, with a focus on supporting the development of high-performance, real-time applications. developed by Sociomantic. runs only on linux. What's inside --
core, io, math, net, stdc, task, text, time, util.
In addition to those of CWEB:
- Markdown based -- very easy to read and write Literate source.
- Generates readable and commented code in the target language (the generated code is usable by others)
- Reports syntax errors back from the compiler to the right line in the literate source
- Supports any language including syntax highlighting and pretty printing in HTML
- Compatible with Vim (literate.vim)
- Highly customizable (you can add your own HTML or CSS)
- Runs fast -- wc.lit compiled for me in 7ms for both code and HTML output
- Supports TeX equations with
$notation.
Inspired from CWEB:
- Automatically generates hyperlinks between code sections
- Formatted output similar to CWEB
Interop
The power of reflection | Átila on Code
import autowrap;
mixin(
wrapDlang!(
LibraryName("mylib"),
Modules(
Module("mymodule"),
Module("myothermodule"),
)
)
);
The code above, when compiled, will generate a Python extension (shared library) that exposes every D function marked as “export” in the modules “mymodule” and “myothermodule” as Python functions. It’ll even convert their names from camelCase to snake_case. Any D exceptions thrown will become Python exceptions. D structs and classes become Python classses. If the original D functions take a D string, you’ll be able to pass Python strings to them in user code. Modulo bugs, this… works! The code shown above is the only code that needs to be written. Setting up the build system takes more work!
Forth
History
Chuck Moore -- inventor of FORTH. I saw Chuck at Strange Loop 2013. The picture on his home page is from his talk at that Event.
Articles
- A collection of links to FORTH articles and resources.
- My history with Forth & stack machines
- Shell Has a Forth-Like Quality | HN
- Thoughts on Forth Programming. comments.
- Interview with Chuck Moore in Masterminds of Programming
Presentations
- "Forth: The programming language that writes itself" -- Dave's Forth Talk 2023 ;HN
Books
Implementations
8th-dev -- modern programming language for mobile, desktop, server and embedded application development
Gush: A stack based language eventually for genetic programming -- DustyCloud Brainstorms
Easy Forth a browser based forth + tutorial.
See also: Factor
jonesforth/jonesforth.S at master · nornagon/jonesforth "A sometimes minimal FORTH compiler and tutorial for Linux / i386 systems."
cxxforth/cxxforth.cpp.md at master · kristopherjohnson/cxxforth "use modern C++ to create a Forth implementation that is easy to understand, easy to port, and easy to extend. " written in literate style.
Discussions
Interesting take:
Forth is the language that taught me (among other things) that its possible to break problems into pieces that are too small to understand the whole. I'm not sure really what to call this other than something along the lines of can't see the forest for the trees. Its the opposite of having functions so large it takes hours to figure out what they do. In this case you have words that you can't figure out what they do for days because the call graphs step across 300 different modules and 10k other words all of which are like "update-pie-with-apples" and comprise two other words "dup pie, apple-pie-update" or something. -- via
PHP Programming Language
25 years of PHP history a chronological story of PHP by JetBrains.
- PHP in 2019 - stitcher.io
- PHP The Right Way; apparently the best way to do PHP dev in 2019. :thumbsup: Also PHP - The Wrong Way
- The 2018 Guide to Building Secure PHP Software - Paragon Initiative Enterprises Blog [Dec 2017]
Jan 2019 Notes:
- My Modern PHP Development Setup · John Mackenzie; Jan 2019
- Use PHPStorm
- Use
.editorconfig - Use Docker
- Use PHP-CS-Fixer
- VSCode is also nice
- Built in server --
php -S localhost:8000 - Frameworks
Success stories
Facebook’s backups were written in PHP. Well, the second version was, anyway. (T... | Hacker News
Multiprocess, forking, long-lived, server-side, I/O intensive PHP. And it worked brilliantly. Over the following years, it scaled from a backup set of a few hundred TB to many, many petabytes.
Alternatives
alekcz/pcp: PCP: Clojure Processor -- Like drugs but better
Just use it like PHP on a webserver (say nginx):
#new pcp config => change .php to .clj
index index.clj index.html index.htm;
#new pcp config => change .php to .clj
location ~ \.clj$ {
#default nginx config on digital ocean lemp image
#include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include scgi_params;
scgi_intercept_errors on;
scgi_pass 127.0.0.1:9000;
}
PCP has following libraries built in:
(require '[cheshire.core :as json]
'[clostache.parser :as clo]
'[selmer.parser :as parser]
'[selmer.filters :as filters]
'[clj-http.lite.client :as client]
'[next.jdbc :as jdbc]
'[honeysql.core :as sql]
'[honeysql.helpers :as helpers]
'[postal.core :as email]
'[clojurewerkz.scrypt.core :as sc])
FrankenPHP: the modern PHP app server "Uses the official PHP executor embedded in a state-of-the-art web server: Caddy"; written in golang
Clojure programming language
Clojure is a Lisp that runs on the Java Virtual Machine (JVM).
Learning resources
- Maria a coding environment for beginners.
- nerdy + lanky | The Practice of Clojure Advice for beginners. -- " I highly recommend using a structural editing mode like Parinfer. I avoided code insertion / code completion tools in Ruby, but structural editing is a massive productivity boost in Lisps."
- JUXT Radar for Clojure
- Getting started with Clojure
- Clojure Docs is a community-powered documentation and examples repository. Very neat looking website. Navigate namespaces and functions to see description and typical usage.
- (another) Clojure Docs -- this website is more about tutorials, articles and cookbooks.
- Guide to programming in Clojure for beginners
- Aphyr's Clojure from the ground up
- 10 minute emacs for clojure guide.
- Clojure for the Brave and True, an Online Book for Beginners -- very nice tutorial on emacs.
- Clojure links by Lee Phillips
- Learning Clojure: coping with dynamic typing Sept 2018.
- Clojure Design Patterns
- Clojure Concurrency Tutorial for Beginners with Code Examples by Eric Normand, "In this tutorial, you'll learn 16 ways for doing concurrency in Clojure including how to start threads and how to communicate between them."
- Lambda Island | Screencast series about ClojureScript and Clojure
Clojure as a Lisp
Courseware
- Poetry of Programming - Puzzle Based Introduction to Functional Programming | popbook. The Reading exercise (PDF) are great.
Presentations
- The Simplicity of Clojure at OSCON 2014.
- ClojureTV Youtube Channel
- Philly ETE 2016 #2 – Dmitri Sotnikov – Transforming Enterprise Development with Clojure – Chariot Solutions a good demo of lumius framework with a "guestbook app" example (both clj and cljs.)
- The spirit of Clojure by Karsten Schmidt about thi-ng
Clojure like languages
IDE and infrastructure
Lightmod -- Lightmod is a tightly integrated tool for making full stack Clojure and ClojureScript web apps. It is fully self-contained -- no need to install the JDK or any build tool. It hot reloads both client and server code automatically with zero setup.
Nightlight is an editor you run inside your Clojure projects. Instead of being a separate application like traditional editors and IDEs, it's just a library that you add to your project. It spins up a web server and provides a completely browser-based interface to edit your code.
CIDER is the successor to nrepl.
Cursive Clojure IDE -- is an IDE built on IntelliJ
REPL
online playgrounds
- small clojure interpreter playground
- glisp for generative-art. 2020-06-11
Getting started with Lighttable
Basic instructions. I use cmd for the shortcuts below, substitute ctrl on non-mac platforms.
- Install Leiningen http://leiningen.org/ you do not need to install clojure, lein will grab clojure for you.
- lein new playground from the command line to create a 'playground' project
- Open Light Table
- ctrl-space woto for "Toggle Workspace tree"
- Add the playground project folder you just created
- cmd-o core.clj to open the main clojure file for the project
- On an empty line type (+ 1 1) and hit cmd-enter
Things will grind away for a while as all the dependencies are downloaded and the JVM starts up. Get a cup of coffee or something. Eventually you'll see a green 2 show up.
You can then type anything in the tutorial and hit cmd-enter to evaluate it or cmd-shift-enter to evaluate the entire file. Think of the file as a shell with an editable history instead of something you'd want to commit to source control.
Documentation is searchable via ctrl-shift-d or moving your cursor on top of a function name and hitting ctrl-d. Autocomplete is available on tab, you can jump to definition with cmd-. and back with cmd-,
TODO: Explore CIDER + AC(autocomplete) + ritz.
Applications
Libraries
- Clojure libraries I recommend - quanttype Oct 2018.
- Javelin -- Spreadsheet-like dataflow programming in ClojureScript.
- Ring inspired by Python WSGI. Primer
- Clojure toolbox -- categorised directory of libraries and tools for Clojure.
- boot
- Quil: animation in Clojure
- https://polylith.gitbook.io/polylith/ is a software architecture that applies functional thinking at the system scale. It helps us to build simple, maintainable, testable, and scalable systems.
- Defold - Cross platform game engine written in Clojure.
Spec
- What Spec is; Sep 2020. HN
the biggest win from spec has been with parsing. This completely changes how you'd write a library that takes a data structure and parses it into something meaningful (for example, what hiccup does for html or what honeysql does for sql). In the past, this required a lot of very ugly parsing code and manual error-checking. With spec, you write specs and call s/conform. If it failed, you get a nice error, especially if you pair it with expound. If it succeeded, you get a destructured value that is really easy to pull data out of. I've done this in a half dozen different libraries and i'm pretty sure i wouldn't have even written them without spec.
Mallimalli and specmonstahspecmonstah are my favourite Clojure(Script) libraries built on top of Clojure Spec.
Clojure books
Learn to Program the World's Most Bodacious Language with Clojure for the Brave and True
Programming Clojure, 3rd Edition by Aaron Bedra, Stuart Halloway, Alex Miller
Practical Clojure by Luke VanderHart, Stuart Sierra
Clojure in Action, Second Edition by Amit Rathore et al
Clojure Applied by Alex Miller et al
Clojure Web Development Essentials by Ryan Baldwin
Mastering Clojure Macros by Colin Jones
Clojure Data Analysis Cookbook - Second Edition by Eric Rochester
Clojure Reactive Programming by Leonardo Borges
The Joy of Clojure by Michael Fogus and Chris Houser
Elements of Clojure WIP as of Oct 2018.
The first chapter, Names, explains why names define the structure of our software, and how to judge whether a name is any good.
The second chapter, Idioms, provides specific, syntactic advice for writing Clojure which is clean and readable.
The third chapter, Indirection, looks at how code can made simpler and more robust through separation.
The final chapter, Composition, explores how the constituent pieces of our code can be combined into an effective whole.
Clojurescript books
- ClojureScript: Up and Running by Luke VanderHart, Stuart Sierra
- Learning ClojureScript by Allen Rohner, Rafik Naccache, W. David Jarvis
Experience reports and discussions
Effective Programs - 10 years of Clojure by Rich Hickey
- "situated programs" (10:30 mark)
- "effective" (around 17:00)
Using Clojure in Production | Demystify FP Sept 2018.
A Year in Clojure -- this article has a nice overview of the many novel features of Clojure. The author is an experienced FP language user (F# etc.,); Oct 2017.
Clojure Design Decisions "Rich Already Answered That! A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (Hickey)".
Matthias Nehlsen has good blog posts on clojure+clojurescript applications he has created. He is also writing a book - Building a System in Clojure (and ClojureScript) by Matthias Nehlsen
Articles
- Articles submitted to lobste.rs tagged clojure
Talks and presentations
- CLojure at netflix -- good projects to start -- "Diagnostic services".
Tips and tricks
- The Clojure Style Guide
- Readable Clojure @ tonsky.me
- Should I use boot or tools.deps to build command line applications? ClojureVerse ..and this ..via. Seee also frobnicate
Cool projects / Read Code
- thi.ng - computational design tools for Clojure & Clojurescript
- thegeez/clj-board: A drag & drop "kanban board" example with Clojure
- nasa/Common-Metadata-Repository
- BirdWatch
- Inspect Example
- matthiasn/meins: a personal and smart journal
- Systems-Toolbox: Trailing Mouse Pointer Example
Visualization / Notebook
- Gorilla REPL · Gorilla REPL
- metasoarous/oz: Data visualizations in Clojure and ClojureScript using Vega and Vega-lite
Web development
Big data
Blogs
ClojureScript
- dundalek/clojurescript-guide: My notes on ClojureScript
- magomimmo/modern-cljs: A series of tutorials on ClojureScript is one of the clearest tutorials I've read.
- ClojureScript -- Homepage
- Austin -- browser REPL.
- om-cookbook
- ClojureScript Unraveled a book.
- Plank -- ClojureScript REPL for Mac
- Transforming Data with ClojureScript
Graal
- This nextjournal notebook has a recipe for building Babashka "executing Clojure snippets or scripts in the same space where you would use Bash."
Web development
PCP
alekcz/pcp: PCP: Clojure Processor -- Like drugs but better
Just use it like PHP on a webserver (say nginx):
#new pcp config => change .php to .clj
index index.clj index.html index.htm;
#new pcp config => change .php to .clj
location ~ \.clj$ {
#default nginx config on digital ocean lemp image
#include snippets/fastcgi-php.conf;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include scgi_params;
scgi_intercept_errors on;
scgi_pass 127.0.0.1:9000;
}
PCP has following libraries built in:
(require '[cheshire.core :as json]
'[clostache.parser :as clo]
'[selmer.parser :as parser]
'[selmer.filters :as filters]
'[clj-http.lite.client :as client]
'[next.jdbc :as jdbc]
'[honeysql.core :as sql]
'[honeysql.helpers :as helpers]
'[postal.core :as email]
'[clojurewerkz.scrypt.core :as sc])
Learning Journal
- this is a good demo of how to use Clojure's
-Sdepsat the command line to execute a script (even one hosted remotely on git):
clojure -Sdeps '{:deps
{hello-clojure
{:git/url "https://gist.github.com/athos/b68b15b08efedffaf14d8c020b125202"
:sha "1c9a05106171f97f9b8e8ac8f58c7bd8dbe021f9"}}}'
-m hello-clojure
Javascript
News
Learning
The Modern JavaScript Tutorial ⬅️ is a nice and easy tutorial (read it in Dec 2020).
30 seconds of code "Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less." (with an FP flavour)
WAT
JS Alternatives
- Why TypeScript Should Replace JavaScript in Your Tech Stack; 2022/11.
- Typescript vs Haxe; 2015/08.
- Bucklescript vs Elm vs Typescript: Typed Javascript showdown! by Adam Bard; Nov 2017.
--
- Sweet.js - Hygienic Macros for JavaScript via Stop Writing JavaScript Compilers! Make Macros Instead
Reading
- How JavaScript works: inside the V8 engine + 5 tips on how to write optimized code
- React, Redux and JavaScript Architecture
Functional programming
- Flow: A Static Type Checker for JavaScript
- fantasyland/fantasy-land: Specification for interoperability of common algebraic structures in JavaScript
- sanctuary-js/sanctuary: Refuge from unsafe JavaScript
- Professor Frisby's mostly adequate guide to functional programming using Javascript
Tooling
- Parcel.JS -- "Blazing fast, zero configuration web application bundler".
- Modern Javascript tooling [July 2015].
- Javascript fatigue the problems with javascript tooling; Dec 2015.
- JS NICE: Statistical renaming, Type inference and Deobfuscation
- JavaScript Modules: A Beginner’s Guide
Libraries
- SolidJS -- give this a try next time.
- HTML DOM - Common tasks of managing HTML DOM with vanilla JavaScript
- Micro JS -- Micro-frameworks and micro-libraries.
- dotjs -- dotjs is a Google Chrome extension that executes JavaScript files in
~/.jsbased on their filename. - JointJS -- diagramming library. Demo.
- Recharts -- "A composable charting library built on React components"
- Marko friendly UI library
- ryansolid/solid: A declarative, efficient, and flexible JavaScript library for building user interfaces. has extensive examples which makes it some what interesting to study.
- confetti.js. throws confetti. see demo on the page.
- faces.js - A JavaScript library for generating vector-based cartoon faces
Visualization
- Fabric.js Javascript Canvas Library -- via
- Two.js -- two-dimensional drawing api geared towards modern web browsers. It is renderer agnostic enabling the same api to draw in multiple contexts: svg, canvas, and webgl. Jul 2015.
Frameworks
It is similar to JavaScript frameworks such as React and Vue, which share a goal of making it easy to build slick interactive user interfaces. But there's a crucial difference: Svelte converts your app into ideal JavaScript at build time, rather than interpreting your application code at run time. This means you don't pay the performance cost of the framework's abstractions, and you don't incur a penalty when your app first loads. You can build your entire app with Svelte, or you can add it incrementally to an existing codebase. You can also ship components as standalone packages that work anywhere, without the overhead of a dependency on a conventional framework.
- Knockout.JS -- MVVM framework
- Batman JS
- Falcor – A JavaScript library for efficient data fetching | HN.. in the same space as GraphQL
- Atlaskit by Atlassian based on react; "Atlassian's official UI library, built according to the Atlassian Design Guidelines."
- SolidJS · Reactive Javascript Library
- Hono - Ultrafast web framework for the Edges
- Elysia - Fast, and friendly Bun web frameworks | Elysia.js for use with bun.
- https://fresh.deno.dev for use with deno
- wasp-lang/wasp: The fastest way to develop full-stack web apps with React & Node.js.
- AdonisJS - A fully featured web framework for Node.js -- "a TypeScript-first web framework for building web apps and API servers. It comes with support for testing, modern tooling, an ecosystem of official packages, and more."
- The BETH Stack: Build Hypermedia-Driven Web Apps with Great DX and Performance -- Bun, Elysia, Turso, HTMX.
- How about BATH framework? - Bun, Adonis, Turso, and HTMX
- or BATH? - Bun, Astro, Turso and HTMX?
The Bandolier: A Learn JavaScript the Hard Way Project by Zed Shaw. A fresh approach, and since it was built to teach JS programming, it should be easy to grok.
Links
- Lazy loading of JavaScript files
- Emacs + Javascript
- emacs + js
- Modern JS developer workflow makes me sad : javascript
- Vue.js vs. React | Hacker News
Apps
Books
- Eloquent Javascript. Free online version, now in second edition. This is an interactive book. Eloquent JavaScript 3rd Edition (2018) | Hacker News
Talks
See also: webpack
A Programming Language (APL)
- APL – a Glimpse of Heaven (2006); via Mar 2019.
- PL and J by Ben Lynn; via HN.
- A History of APL in 50 Functions
- APL At Its Core - Anthony Cipriano; July 2018.
- Getting Started with APL
- The Problem With APLs • Hillel Wayne [Feb 2018] -- "In summary: when working with an APL finding the right primitive is really tough, and verb classification and a better phrasebook would go a long way towards fixing that." NuVoc referenced within.
- APL Style: Patterns/Anti-patterns via
\@doublec. - AMA: Explaining my 750 line compiler+runtime designed to GPU self-host APL | Hacker News via Smaller Code, Better Code | Hacker News
- Vector, the Journal of the British APL Association
- Smaller code, Better code -- discussion
- APL Papers and Reports — Software Preservation Group
- A History of APL in 50 Functions, HN.
- APL and me
- APL\3000 – HP Journal – July 1977 [pdf]
kdb, Q etc.,
- kdb+ 3.5 released last month | Lambda the Ultimate. Good links.
- Kx Systems Announces Financial Industry’s First Platform for Acquiring, Analyzing and Managing [Pricing info]
Morgan-Stanley/hobbes: A language and an embedded JIT compiler
Morgan-Stanley/hobbes: A language and an embedded JIT compiler -- Morgan Stanley in recent years has used Hobbes where they’d previously used kdb. LtU Discussion, HN Discussion; Author.
Shakti, the new data platform from Arthur Whitney | Hacker News
kcc/kparc -- +/∞ - kcc
ref/kparc -- +/kei | K reference card
APL learning resources
- Introduction — Learning APL
- Dyalog APL Tutor
- FrontPage - APL Wiki
- APL Cloud
- APLcart - Find your way in APL
- A History of APL in 50 Functions
- FinnAplIdiomLibrary - APL Wiki .... via
- apl a day - Fastidious Elegance
- APLcart - Find your way in APL
APL like languages
Rust Programming Langauge
A modern alternative to C and C++ for system programming.
Why?
- Why Rust?, a mini book by Jim Blandy of Mozilla. [Sep 2015]
- Rust for Clojurists [updated Sep 2015].
- A Swift guide to Rust · faq.sa
- Oxidation Plan by Mercury SCM gives good reasons to replace Python code with Rust (and not C).
- Why is Rust difficult?
- (Blanco-Cuaresma and Bolmont 2017) arXiv
How
Articles / Talks
- Visualising Rust's type system; [Jul 2015]
- OMG Iterators by Alexis Beingessner of Carleton University + Mozilla Research
- Packet Capturing MySQL with Rust -- talks about
Spyglassa network traffic tool aimed at MySQL data packets. - Rust Means Never Having to Close a Socket - good discussion of the borrow checker etc.,
- What Are Sum, Product, and Pi Types? by Manish.
- Math with distances in Rust: safety and correctness across units
- Rust for Serious Developers by Armin Ronacher.
- Karol Kuczmarski's Blog – Rust as a gateway drug to Haskell
- Learning systems programming with Rust - Julia Evans Sept 2016.
- 5 Tips for Writing Small CLI Tools in Rust - Pascal’s Scribbles
- What Elm and Rust Teach us About the Future
- Elegant Library APIs in Rust - Pascal’s Scribbles
- Josef “Jeff” Sipek » Rust Pointers for C Programmers
- 21-security-perf.pdf by Pierre C, a contributor to Suricata.
- Learning rust programming by AndreaPessino
- From Bash to Rust Sept 2018.
- Rust after the honeymoon Oct 2020 by BryanCantrill.
- Rust Anthology Master List
Books
Print books
- PacktPublishing/Hands-On-Concurrency-with-Rust: Hands-On Concurrency with Rust, published by Packt
- PacktPublishing/Network-Programming-with-Rust: Network Programming with Rust, published by Packt
Online books
- Introduction - The Rust Performance Book
- Rust Design Patterns
- Learn Rust 101 | A guide to aid you in your journey of becoming a Rustacean (Rust developer). at https://rust-lang.guide
- Effective Rust
- Data Engineering With Rust
Experience reports
- Packet Capturing MySQL with Rust
- From Mordor, with love: Rust: First impressions from a C++ developer
- Falling in love with Rust by Bryan Cantrill.
- From Julia to Rust Aug 2024.
Papers / reports
- You can't spell trust without rust -- master's thesis of Alexis Beingessner. PDF
Videos / Talks
- into_rust(): screencasts for learning Rust
- Rust Camp 2015
- Zen and the art of convincing your company to use Rust
- Steve Klabnik on Why Rust [Jul 2015]
- RustCamp 2015
- Gökberk Yaltıraklı videos about "port scanner in Rust, Dictionary server with Rust".
- C++Now 2017: Niko Matsakis "Rust: Hack Without Fear!" - YouTube
Blogs
- Llogiq's blog -- rust "learner's" blog.
- Three months of Rust; [Jun 2015] -- appears to be a decent blog to read in general.
- Herman Radtke's blog
- The blog of Martin Wernstål
- Design is refactoring
- Burntsushi's blog
- Ironic blog -- Explore the ownership system in Rust.
- Sevag H -- creator of
pq. - Introducing the Rust crash course by Snoyman (Haskell/Yesod)
- Sabrina Jewson; this entry talks about using Rust to build her blog; src.
Tutorials
- Learning Rust by
quinedot. - rust-learning
- mre/idiomatic-rust: A peer-reviewed collection of articles/talks/repos which teach idiomatic Rust.
- Rust Language Cheat Sheet
- Breakdown Notes; Jan 2019
- Rust Quiz ; med-hard.
- Welcome - 100 Exercises To Learn Rust, created by the author of Zero to Production in Rust.
- Welcome to Comprehensive Rust 🦀 - Comprehensive Rust 🦀
- Introduction - Roguelike Tutorial - In Rust
- amos - A half-hour to learn Rust
- Guaranteeing memory safety in Rust | Air Mozilla
- Notes on Rust by
rbranson - Rust: A Type System You Didn't Know You Wanted by Felix Klock of Mozilla. July 2015/ Curry On conf.
- Arcaders a tutorial series in building a game with Rust.
- rust-101 -- 16 part tutorial.
- The Rustonomicon -- The Dark Arts of Advanced and Unsafe Rust Programming
- 24 Days of Rust
- nrc/r4cppp: Rust for C++ programmers -- this is a pretty good collection of articles.
- Hello, Rust! -- This site will collect resources, guides, articles and links around Rust & WebAssembly.
- rochacbruno/py2rs: A quick reference guide for the Pythonista in the process of becoming a Rustacean
- A gentle introduction to Rust by Steve Donovan.
- The Periodic Table of Rust Types
Courseware
- The Adventures of OS; Making a RISC-V Operating System using Rust by Stephen Marz.
- EECS 3/495: Concurrent Programming in Rust -2017; 2016.
- Introduction - The Rust Programming Language ; the second edition of the Rust book, WIP.
- CIS 198: Rust Programming; Spring 2016.
- Rust class on Operating Systems at Virginia University.
- CIS 198: Rust Programming -- Fall 2016 at UPenn.
Source code to study
Links
Libraries and tools
- Lib.rs — home for Rust crates "Index of 97k+ Rust libraries and applications. Fast, lightweight, opinionated, unofficial alternative to crates.io"
- Blessed.rs "which crates they ought to use and which crates they ought to trust."
- BurntSushi/xsv A fast CSV toolkit written in Rust. xsv is a command line program for indexing, slicing, analyzing, splitting and joining CSV files.
- rustdoc and sliderust to convert this into this
- Multirust -- tool for managing multiple installations of the Rust toolchain. It replaces the standard Rust toolchain with components that dynamically choose between alternate implementations based on context.
- .gdbinit for rust
- coio-rs -- Coroutine scheduling with work-stealing algorithm; Non-blocking I/O; Asynchronous computing APIs.
- Nickel.rs -- web application framework for Rust.
- leptos-rs/leptos: Build fast web applications with Rust.
- poem-web/poem: A full-featured and easy-to-use web framework with the Rust programming language.
WASM
- Seed -- A Rust framework for creating web apps
Applications
To study code, library usage etc.,
- mcux/kylyp: A new Forum. The project uses rust, rocket, diesel, postgresql, and responsive design to build a new Forum.
Command Line Tools in Rust: See also: Common *nix commands written in Rust – gcollazo

ekzhang/rustpad: Efficient and minimal collaborative code editor, self-hosted, no database required alternative to codepad.
Editor setup
- Emacs and Rust. The best setup guide for emacs to date. [Aug 2015]
- Visual Studio + Rust's tasks.json setup.
Performance
- Profiling Rust Applications on Linux using valgrind, oprofile.
Memory Management
- Memory Management in Rust and Swift – Ryan Levick – Medium
- Custom allocators in Rust -- "making it possible for different parts of a program to chose their memory allocation strategies."
Safety-critical programming
Ferrocene is the main Rust compiler - rustc - but quality managed and qualified for use in automotive and industrial environments (currently by ISO 26262 and IEC 61508) by Ferrous Systems. It operates as a downstream to the Rust project, further increasing its testing and quality on specific platforms.
References and borrowing
- Rust: The Hard Parts - Part One · naftuli.wtf -- references and borrowing.
Lifetimes
- Rust Lifetimes for the uninitialised by Florian Gilcher.
- Understanding Rust Lifetimes; Jan 2019.
- The Power of Lifetimes
- common-rust-lifetime-misconceptions · pretzelhammer/rust-blog
Async / Await
Web
- Introduction · The Rusty Web
- EpicZenGarden webassembly demo by unreal engine.
- Gotham | A flexible web framework created in Rust
Embedded
This book is an "introductory course" on microcontroller-based "embedded systems" that uses Rust as the teaching language rather than the usual C/C++.
Comparisons (Rust vs X)
- Comparing Rust and Java — Llogiq on stuff
- Rust for professionals -- "... intended for developers that already know another language. In the examples, Rust is compared with TypeScript, JavaScript or Java, sometimes with C++ or Kotlin."
FFI
- rustgo: calling Rust from Go with near-zero overhead
- Calling Rust From Python | bheisler.github.io
- The easiest way to speed up Python with Rust; Jul 2023.
// rustimport:pyo3
use pyo3::prelude::*;
#[pyfunction] // ← expose the function to Python
fn fibonacci(number: u64) -> u64 {
...
import rustimport.import_hook
from rustfib import fibonacci
- Extending C with Rust – 101 – Spejss Blog
- Making Python 100x faster with less than 100 lines of Rust; Mar 2023. Good example with profiling. Uses pyo3
- PyO3/maturin: Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages; Apr 2023. Some projects using
maturinare ruff, polars, orjson, watchfiles and a few apache-arrow projects.
Discussions
- A discussion around "Advanced Rust Programming Book Draft"
- Yield/async/continuations etc.,
- What does Rust have instead of garbage collector? - SO
- A decent discussion of Rust vs other PLs on r/rust [Oct 2015].
- What has rust borrowed from Haskell
- rust - How can this instance seemingly outlive its own parameter lifetime? - Stack Overflow
Cargo
- Make your own make -- using Cargo as a general purpose task automation solution.
Installing a package that is not on crates.io: cargo install -f --git https://github.com/cjbassi/ytop ytop
- Cargo Dist distributes your binaries. and in combination with oranda it also generates websites.
Best Practices / Tips
Hardware / bare metal
Rust vs Python
- rochacbruno/py2rs: A quick reference guide for the Pythonista in the process of becoming a Rustacean
Rust and Python
- Making Python 100x faster with less than 100 lines of Rust uses
py-spyfor profiling; usesmaturinto create the project, andpyo3to create the bindings.
Rust vs Java for rest services
-- via reddit
I gave a talk (video) today about "Rust for Java programmers" at my local java users group. Part of the talk was comparing the implementation of a minimal rest service in a container for the following 4 approaches:
- Payara-micro (JEE/JAXRS)
- Wildfly-swarm (another JEE/JAXRS micro deploy)
- Javaspark (non JEE "lightweight" framework)
- Rust-rocket
The comparisons are striking, viewed in the same 1/2/3/4 sequence above:
Container Image Size: 173MB / 151MB / 104MB / 2MB
Container Startup Time: 22.2s / 17.6s / 1.6s / 0.6s
Memory Usage at Startup: 630MB / 401MB / 34MB / 1.6MB
Memory Usage under Stress: 647MB / 522MB / 74MB / 1.7MB
CPU usage and throughput show a similar progression as above.
Nice job, Rocket! (results are unscientific. fight me) -- Source code
Success Stories
We had a similar challenge supporting sending this many notifications at OneSignal, which we solved using Rust. We recently hit a peak of 850 Million notifications per second, and 5 billion notifications per day. Here's a blog post on how we do it. Written back when we were at "only" 2 billion notifications per week: https://onesignal.com/blog/rust-at-onesignal/
Rolling log of things
2017-09-08:
There is a new book -- Programming Rust by Jim Blandy, and Jason Orendorff. Jim Blandy has also written a concise short book Why Rust [PDF]
Rust is currently unable to call directly into a C++ library; so that way Rust is probably behind D.
- simple event hooks in Rust
- Multithreading in Rust with MPSC (Multi-Producer, Single Consumer) channels
- A web application completely in Rust – Sascha Grunert – Medium
- Rust + actixweb success story July 2018
- My RustConf 2018 Closing Keynote Sept 2018.
Rust, by design, makes certain programming patterns more painful than others. This is a GOOD thing! It turns out that, for game development, the patterns that end up being the easiest to deal with in Rust closely mirror the patterns that are easiest for game development in any language. Rust highly rewards data-oriented design with simple, understandable ownership semantics, and this is great news because this is a really good fit for game development.
See also: rust2018
References
- Blanco-Cuaresma, Bolmont (2017). What Can the Programming Language Rust Do for Astrophysics?.
Go Programming Language
Go is the only programming language that has been designed from the ground down. -- vzverovich

- Go is still not good; Jul 2025.
- Lies we tell ourselves to keep using Golang; Apr 2022.
- An intro to Go for non-Go developers via; 2020-06-11
- Go: the Good, the Bad and the Ugly
- Why Go is no good; Jun 2014. HN1, HN2, shoutout to D.
- Why Go's design is a disservice to intelligent programmers | Nomad Software; Mar 2015.
- Ten Reasons Why I Don't Like Golang [July 2016]
- The Codex » I Do Not Like Go;lobste.rs discussion is a balanced discussion.
- The Cost and Complexity of Cgo | Blog | Cockroach Labs, lots of gotchas on that one... FFI is not as simple as one would assume.
- go-is-not-good/README.md at master · ksimka/go-is-not-good - A curated list of articles complaining that go (golang) isn't good enough
- I Love Go; I Hate Go | HN
- Making the move from Scala to Go, and why we're not going back | Lobsters
- I don't get where people get the idea that Go is simple | HN
- Go doesn't support exception, in syntax. Go has many exceptions, in syntax. * Blog /r/programming
- Bugfender's issues with using Go - has list of their blog posts.
- Golang sucks // Speaker Deck by Cloudfare Engineers. reddit.
- Why Go and not Rust; Sep 2019.
- The Zen of Go by David Cheney at Gophercon Israel 2020.
- "I thought Go does not have generics?"
- "you shall not have any color!"
- Understanding Real-World Concurrency Bugs in Go [pdf], via HN
Go advocates for making thread creation easy and light-weight and for using message passing over shared memory for inter-thread communication. Indeed, we saw more gor-outines created in Go programs than traditional threads andthere are significant usages of Go channel and other message passing mechanisms. However, our study show that if not used correctly, these two programming practices canpotentially cause concurrency bugs.
Shared memory vs. message passing: Our study found that message passing does not necessarily make multi-threaded programs less error-prone than shared memory.In fact, message passing is the main cause of blocking bugs.To make it worse, when combined with traditional synchro-nization primitives or with other new language featuresand libraries, message passing can cause blocking bugs thatare very hard to detect. Message passing causes less non-blocking bugs than shared memory synchronization and sur-prisingly, was even used to fix bugs that are caused by wrongshared memory synchronization. We believe that messagepassing offers a clean form of inter-thread communicationand can be useful in passing data and signals. But they areonly useful if used correctly, which requires programmersto not only understand message passing mechanisms wellbut also other synchronization mechanisms of Go.
Error Handling in Go -- "Rob Pike Reinvented Monads", Jun 2016.
- amos - I want off Mr. Golang's Wild Ride; Feb 2020. Mostly around problems on Windows.
Project structure
- How to start a Go project in 2023 | Ben E. C. Boyter; May 2023.
- The Within Go Repo Layout - Christine Dodrill; Sep 2020.
- Simple Go project layout with modules - Eli Bendersky's website; Oct 2019
A very common question Go beginners have is "how do I organize my code?". Some of the things folks are wondering about are:
- How does my repository structure reflect the way users import my code?
- How do I distribute commands (command-line programs that users can install) in addition to code?
- How do modules change the way I organize my code?
- How do multiple packages coexist in a single module?
Moving to Go
History
Learning
The Go Programming Language by Donovan and Kernighan.
- Learn Go with Tests - Learn Go with tests this is an innovative approach to learning Go. Via tests.
- Go Books
- The Complete Guide to Learning Go - Calhoun.io
- Advise from Go developers to Go programming newbies
- 50 Shades of Go: Traps, Gotchas, and Common Mistakes for New Golang Devs
- Go by example
- working-with-go
- Network programmign with Go last update Apr 2012.
- Go In 5 Minutes - Short, helpful screencasts for professional Go developers
- quii/learn-go-with-tests: Learn Go with test-driven development
Training
Reading
- Static analysis features of Godoc
- Language Design in the Service of Software Engineering
- The case for Go language -- collection of opinion article on Go.
- and some more ...
- Ten Useful Techniques in Go
Development practices
The Go team has published official guidelines for organizing / structuring a Go project: https://go.dev/doc/modules/layout This includes recommended project layouts for different kinds of projects: a simple package, a command-line tool, a mix of the two, etc. via
Deployment practices
- Deploying Go servers with Docker
- The Go binary diet -- reducing go binary size.
Performance monitoring
User Groups
- Go Steel Programmers - Pittsburg, PA.
Presentations
Libraries
- Go-git discussion about this git client library [esp see gogit].
- webgo.io -- inspired by web.py
- Go-LINQ -- LINQ for Go.
- Godep -- Go package dependency management.
- Gox -- Go cross compile tool.
- overseer -- Monitorable, gracefully restarting, self-upgrading binaries in Go
- GitHub - xlab/c-for-go: Automatic C-Go Bindings Generator for Go Programming Language
Read Code
- reticulum -- distributed image and thumbnail server.
- Go by example and it's source code
- augend -- fact database using Riak and Go.
- l3x.github.io golang-code-examples
List of Lists on Go
- Awesome Go -- A curated list of awesome Go frameworks, libraries and software.
Editors
- emacs for go 2014/8/28
- Microsoft/vscode-go: An extension for VS Code which provides support for the Go language. -- worked out pretty well for me on Mac OSX. I was able to configure all the features including debugging using the "delve" debugger. Has nice snippets feature that can be turned on .
- GitHub - piqoni/vogte: The Agentic TUI for Go codebases
Vogte uses a two-step approach for providing tasks to the LLM. In the first step, it extracts relevant parts (structs/interfaces/methods along with signatures) from your repository and asks the LLM which files it needs in full to solve the problem expressed by the user. During this step, the LLM returns a list of files, which vogte then provides back with their full content so the LLM can apply the solution.
FFI
Garbage Collection
Why Discord is switching from Go to Rust - Discord Blog
In Go, on cache key eviction, memory is not immediately freed. Instead, the garbage collector runs every so often to find any memory that has no references and then frees it. In other words, instead of freeing immediately after the memory is out of use, memory hangs out for a bit until the garbage collector can determine if it’s truly out of use. During garbage collection, Go has to do a lot of work to determine what memory is free, which can slow the program down. These latency spikes definitely smelled like garbage collection performance impact, but we had written the Go code very efficiently and had very few allocations. We were not creating a lot of garbage. After digging through the Go source code, we learned that Go will force a garbage collection run every 2 minutes at minimum. In other words, if garbage collection has not run for 2 minutes, regardless of heap growth, go will still force a garbage collection.
garbage collection - How fast is the go 1.5 gc with terabytes of RAM? - Stack Overflow
3-4ms pauses under 1.6, with about an 8GB heap and 150M allocations/minute.
- Garbage Collection In Go : Part I - Semantics
- Garbage Collection In Go : Part II - GC Traces
- Garbage Collection In Go : Part III - GC Pacing
Concurrency
- Interesting ways of using Go channels | Nomad Software
- Visualizing Concurrency in Go · divan's blog
- Fun with Concurrency in Golang · Alex Sears
Programming notes
Debugging notes
Build notes
Cross compiling a binary for Linux on Mac.
git clone git@github.com:xyproto/algernon.git
cd algernon
env GOOS=linux GOARCH=amd64 go build
Tools
Package management
Web
- So you want to expose Go on the Internet
- REST Servers in Go: Part 1 - standard library - Eli Bendersky's website
- valyala/quicktemplate: Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template
Frameworks
Go Blueprint Hello -- "Choose your desired features, and we'll generate the command you can use to create your project."
blackfyre/wga: Jumping forward ~30 years --
This repositry contains the code for the Web Gallery of Art project. The project is a web application that allows users to browse through a collection of paintings, sculptures and other forms of Art. This project is inteded to shave off the 3 decades of tech debt on the original website and provide a modern, responsive and user friendly experience with the same content.
-- study this project and the choices it has made -- pocketbase, htmx, bulma, golang, sass, andgoreleaseranthdm/superkit still in development.
Templating
templ -- "A HTML templating language for Go that has great developer tooling." github
package main
templ Hello(name string) {
<div>Hello, { name }</div>
}
templ Greeting(person Person) {
<div class="greeting">
@Hello(person.Name)
</div>
}
OCaml programming language
OCaml for the impatient . The web's quickest and dirtiest OCaml getting started guide
This is the most up to date setup using Opam, jbuilder, Merlin, VSCode etc.,(. August 2017). (ed note, 2023-10-10: Since then the OCaml system has made huge strides in developer productivity.)
xvw.lol - Why I chose OCaml as my primary language, an opinion piece by a programmer that uses OCaml professionally at tarides. Is a good intro the ecosystem in 2025; via
Language
Concurrency
Learning OCaml
Courseware
- Cornell's 3110 -- Data Structures and Functional Programming course (2013); 2016 2018; 2020
- Cornell's Functional programming in OCaml, CSCI 49201.
- Harvard's CS51 -- Introduction to Computer Science II: Abstraction and Design
- Functional Programming -- Cornell, 2016 by Michael Clarkson
- Computer Laboratory – Course pages 2016–17: Types
- Computer Laboratory – Course pages 2016–17: Advanced Functional Programming
- CS 3110 Tournament History (CS.Cornell)
- 2017 fall
- Functional Programming in OCaml -- Fall 2018 Edition Cornell's cs3110, compiled into a gitbook.
- Functional Data Structures by PLRagde at Waterloo
- Functional Programming in OCaml - Spring 2019 Edition
- Introductory Data Structures and Algorithms — YSC2229 2021 This course on classic imperative data structures and algorithms has been offered by Ilya Sergey at Yale-NUS College in 2019-2021.
Tutorials
- Introduction to OCaml
- OCaml for the skeptical
- Using, Understanding, and Unraveling The OCaml Language by Didier Remy [2002].
- An overview of OCaml [2015].
- OCaml and Emily In a Walnut -- Custom Designed For C++ and Java Programmers
- Early OCaml workflow pains
- ocamllabs/ocaml-effects-tutorial: Concurrent Programming with Effect Handlers (CUFP'17)
- A Tutorial to OCaml -ppx Language Extensions | Victor Alexandru Darvariu
- dmbaturin's blog - ocaml and specifically - introduction to OCaml
- Getting Started with OCaml in 2021 · Perpetually Curious Blog
Best practices
Books
- Developing applications with OCaml -- online book by INRIA.
- Unix System Programming in OCaml
- How to Think like Computer Scientist (OCaml)
- Fun of Programming -- a work in progress.
- Real World OCaml -- expected in Fall 2012(!)
Textbooks
- uds-psl/Prog -- Introduction to Functional Programming and the Structure of Programming Languages using OCaml by Gert Smolka
- OCaml Programming: Correct + Efficient + Beautiful — OCaml Programming: Correct + Efficient + Beautiful
Articles
- How OCaml Type Checker works. In general Olegs http://okmij.org/ftp/ is a treasure trove of CS material.
- Memory Layout in Ocaml -- comment by
avsm - Why OCaml in 2024 by
kcsrk - Why OCaml [2002]. Also has many links to OCaml pages. - OCaml programming with emacs.
- Another Why OCaml
- OCaml briefly -- a brief tour of OCaml.
- What is the appeal of OCaml today? Why use it over something like Haskell or Java (reddit); 2018-07-11.
Blogs
- Danny Willems - Blog - You have ideas, I have skills.
- let author = “Rudi Grinberg” — Rudi Grinberg documentation
- Shayne Fletcher
- dmbaturin's blog - ocaml tagged articles -- has a series on "Introduction to OCaml". Also notable - If you think ReasonML compiles to JS, you are wrong
- Jane Street Tech Blog
Resources
- Learn OCaml v.0.14.1 -- François Pottier designed a series of advanced interactive OCaml exercises where students implement: - The nondeterminism monad - Parser combinators - An algebraic pretty-printer & this is an in-browser IDE!
- TryOCaml - This site is a demo for the programming environment used during the first session of the OCaml MOOC.
- Ocaml Reddit
- OCaml for the Skeptical: OCaml in a Nutshell
Papers
- Polymorphism, subtyping and type inference in MLsub; online editor of the inference enginer
- PhD Thesis: Tierless Web programming in ML | Drup's thingies
Package managers
- opam
- GODI
- YYPkg
- Using jbuilder/topkg -- "Platforms, Packaging, Progress"; [Aug 2017]
- ~lthms: Building Static Binaries for OCaml Projects; Dec 2023.
OCaml Languages
Reason: a syntax for OCaml, so native development or melange development to compile to JS
ReScript: a syntax similar to Reason, but the entire toolchain. Closer to JavaScript, can't compile to native.
Talks
Yaron Minsky:
- OCaml for the masses in ACMQueue.
- Effective ML talk at Harvard and "Caml Trading" talk at CMU.
- More Effective ML
Miscellaneous
- OCaml Skeleton a jumpstart environment for to get code up-and-running. An example application with unit tests is a nice sandbox for language discovery.
- Try Ocaml a web based OCaml REPL.
- OCaml style guide
- another OCaml style guide from UPenn, which is based on,
- SML style guide
OCaml as a replacement language
- Replacing Python with OCaml. Thread and thread2
- Felix is offered an alternate to OCaml
- OCaml vs Haskell discussion on Quora. YMMV.
- 8 months of OCaml after 8 years of Haskell in production - DEV Community -- has a table comparing OCaml and haskell
- OCamlers' critique of Haskell
Writing languages using OCaml
- Developing Applications with Ocaml - Chapter 6 implements a BASIC interpreter.
- The programming language zoo by Andrej Bauer has multiple examples of simple languages built using OCaml.
- Toy APL implementation by Kragen Sitaker.
- CS 421/521: Compilers and Interpreters
- Lua-ML pure OCaml implementation of Lua 2.5 by Normal Ramsey.
- ML to C++ compiler
Tools, ecosystem and libraries
- Setting Up an OCaml Development Environment in Debian - The Always Learning Marty ; Aug 2018
- OCaml Lint detects common errors in OCaml code.
- IOCaml, OCaml kernel for iPython.
- Domical = OCaml + Iodide - Iodide; Sep 2018.
- Regular expressions in OCaml
- Opam-Android --An OCaml 4.02 toolchain for Android and several useful libraries
- OCaml Scientific Computing — Owl Numerical Library
Js_of_Ocaml
- js-skeleton -- sample
project showing how to build a Javascript web-app using
js_of_ocaml,TyXMLandReact - H.261 Video Decoding in OCaml. -- This notebook will demonstrate a simple H.261 Video Decoder written in OCaml and compiled to javascript with js_of_ocaml.
OCaml project tools
Build tools:
- OMake
- OCamlbuild
- OASIS
- opam-publish -- A tool to ease contributions to opam repositories
Some opinions on the merits of using these tools:
What is the preferred way to structure and build OCaml projects?
- recco: use
ocamlbuildbutoasismay be better now. ocamlbuildcomes with the distribution.oasisbuildsmyocamlbuild.mlfile automatically for you.oasisgives you access tooasis-db, a CPAN like system.- to manage libraries, use
ocamlfind. opamreally doesn't care about build systems.- MLState is using
ocamlbuildfor buildingOpa lang.
- recco: use
Code bits
Explicit Typing of a polymorphic variant
type download_result =
[ `aborted_by_user
| `network_failure of string
| `success of filepath ]
Information
- What is good about OCaml's module system?
- What good is First class Modules?
- "Using an error monad in a language like ocaml is superior to exceptions in almost every way." via
Sample code / Read Source
- github.com/chrismamo1/zipper -- a CLI tool in the imperative style.
- collaborative text editor using Eliom
- vbmithr (Vincent Bernardoff) / Repositories
- bcpierce00/unison: Unison file synchronizer
- Gopiandcode/ocamlot: An Activitypub server in OCaml!
Multicore OCaml
- Multicore OCaml - What's coming in 2021 - Speaker Deck; Anil and KCSRK
- Practical OCaml, Multicore Edition by Yawar Amin
Object oriened OCaml
- The O in OCaml -- a reddit discussion, with strong answers from 'gasche'.
- Experiences with OCaml objects - Thomas Leonard's blog
Hindley-Milner type system
- Show HN: Hindley-Milner Type Inference Algorithm in OCaml | Hacker News see links within.
Semantics
Web programming with OCaml
PPX
Comparison
- OCaml vs haskell vs go
- Thread by @wilfredh: I'm a lisper who has spend a little over six months getting up to speed in OCaml, and it's been really interesting...
min-caml
esumii/min-caml: a complete optimizing native-code compiler for a reasonably usable subset of OCaml, in 2000 lines of OCaml. Paper.
Running log
PSA: Tired of inscrutable type errors from OCaml? If you use jbuilder/dune, just add this to your jbuild build stanza:
(flags (:standard -short-paths))and your type errors and inferred types from Merlin will magically improve!
NixOS
- Nix-powered development with OCaml - Dimitrije's Website; 2023/3/6
- Bye Opam, Hello Nix | Emil Privér; May 2024.
Data Science and AI
- OCaml Scientific Computing: Functional Programming in Data Science and Artificial Intelligence (Undergraduate Topics in Computer Science): Wang, Liang, Zhao, Jianxin, Mortier, Richard: 9783030976446: Amazon.com: Books (Book); Springer link
OCaml Garbage Collection
- Garbage Collection · OCaml Tutorials
- An in-depth Look at OCaml’s new “Best-fit” Garbage Collector Strategy | OCamlPro
- Lecture 26 of Cornell CS3110
My notes
emacs + utop + merlin + typerex = Excellent IDE.
2014-11-25: Run ocamlbrowser in a shell to see a tk based documentaiton browser.
OCamlEditor
Fortunately, you can install it using opam install ocamleditor... unfortunately you are dealing with various idiosyncrasies of GTK on mac... ugh.. To keep it short, lablgtk
installation by opam might fail with pkg-config errors. The fix is:
https://github.com/Homebrew/homebrew/issues/14123#issuecomment-37896791
... before running opam install ocamleditor. Solution
via
Note: looks butt-ugly on mac, as expected.
opam allows you create "sandboxes" and install packages in them. See the -A --alias-of option.
See Setting up an OCaml environment for Programming. Use ocamlfind, ocamlbuild and make.
Apr 2016. See ogen -- a tool for creating new OCaml projects with OPAM, Oasis, and Merlin.
Compiling an ocaml file:
That has no dependecies
ocamlopt foo.ml -o foo
that has a dependency (say csv)
ocamlfind ocamlopt -o test -linkpkg -package csv test.ml
ocamlfind
ocamlfindis a program that finds all the ocaml packages that are installed on your system (or opam instance, for that matter).ocamlfind -hto see list of commands available.ocamlfind printconfshows the path configs etc.,ocamlfind listwill list all the packages installed.
ocamldep
typical usage: ocamldep *.ml, which will dumps dependency lines.
** Different file types **
.cmo--.cmi--.mli--
--
OCaml has good study materials -- textbooks, lecture notes. There is also the advantage of being able to roll-over to F# for "enterprise" stuff.
Interesting Programming Languages
An opinionated collection of programming languages. This is a list of what I consider interesting. Requests to add to this list are welcome, but there is no guarantee I'll include them. As you can see many mainstream programming languages are missing from this list.
Of these, I try to maintain interest in -- ATS, Chapel, Zig, Nim, Flix, Crystal, Vale, and Roc, outside the mainstream languages.
- Alore is a language that explores optional typing in a Python-like programming language.
- Alpaca is a statically typed, strict/eagerly evaluated, functional programming language for the Erlang virtual machine (BEAM). At present it relies on type inference but does provide a way to add type specifications to top-level function and value bindings. It was formerly known as ML-flavoured Erlang (MLFE).
- Amber -- "The Programming Language compiled to bash. Write your scripts in a modern type-safe and runtime-safe programming language that handles many bugs and mistakes during compilation process."
- appcypher/astro: A multi-paradigm programming language that compiles to WebAssembly and native code. with Python syntax.
- Arturo programming language; looks like REBOL? and claims "Want to ship your scripts anywhere? For any operating system? Without weird dependencies and without asking the user to install an endless list of modules/gems/packages? That's exactly what Arturo was designed for.", and batteries included.
- Asymptote is a descriptive vector graphics language that provides a natural coordinate-based framework for technical drawing. Labels and equations are typeset with LaTeX, for high-quality PostScript output.
- ATS is a statically typed programming language that unifies implementation with formal specification. It is equipped with a highly expressive type system rooted in the framework Applied Type System, which gives the language its name. In particular, both dependent types and linear types are available in ATS.
- Ballerina "Ballerina is a compiled, transactional, statically and strongly typed programming language with textual and graphical syntaxes. Ballerina incorporates fundamental concepts of distributed system integration into the language and offers a type safe, concurrent environment to implement microservices with distributed transactions, reliable messaging, stream processing, and workflows." See ballerina.
- Boomerang is a language for writing lenses—well-behaved bidirectional transformations—that operate on ad-hoc, textual data formats. Every lens program, when read from left to right, describes a function that maps an input to an output; when read from right to left, the very same program describes a "backwards" function that maps a modified output, together with the original input, back to a modified input.
- Biscuit is simple imperative programming language using LLVM backend implemented in C. See Tine editor
- Blorp; Blorp is meant to feel direct at the surface while keeping the compiler's safety and runtime choices explicit.. Static Types, Hindley-Milner-Style inference, Value Semantics, Perceus Ownership, Native Output. Blorp compiles to C, so idiomatic Blorp code is intended to run within range of hand-written C.
- C2 an evolution of C, using LLVM.
- C3 - Full C ABI compatibility, Module system, Generic modules, Design by contract, Zero overhead errors, Semantic macro system, First-class SIMD vector types, Struct subtyping, Safe array access using slices, Easy to use inline assembly, Cross-platform standard library which includes dynamic containers and strings, LLVM backend
- Cell offers, among other things, a very flexible, entirely structural type system; deterministic, repeatable execution; support for reactive programming; the ability to use relations to store data; transactions and propagation of undefined values for error handling; and ortogonal persistence. "Cell is designed to complement and integrate with your primary language, not to replace it. Once a component of an application has been implement in Cell, the compiler will generate from it an easy-to-use Java, C++ or C# class that can be integrated into an existing project. Support for other languages will be added in the future."
- Chapel is a modern programming language that is parallel, productive, portable, scalable and open-source by Cray.
- Ciao is a modern prolog implementation and a general-purpose programming language which supports logic, constraint, functional, higher-order, and object-oriented programming styles. Its main design objectives are high expressive power, extensibility, safety, reliability, and efficient execution.
- Circle compiler enables you to metaprogram C++ in C++. It encourages a seamless mixing of compile-time and runtime capabilities that upends decades of language design.
- Cito automatically translates the Ć programming language to C, Java, C#, JavaScript, ActionScript, Perl and D. Ć is a new language, aimed at crafting portable programming libraries, with syntax akin to C#.
- Clean is a general purpose, state-of-the-art, pure and lazy functional programming language designed for making real-world applications. Some of its most notable language features are uniqueness typing, dynamic typing, and generic functions. quick look.
- Cool is a small language designed for use in an undergraduate compiler course project. While small enough for a one term project, Cool still has many of the features of modern programming languages, including objects, automatic memory management, and strong static typing. Used for Stanford CS1 Compiler class.
- Crystal -- is a ruby syntax inspired, statically type checked language that compiles to binary. Mint is a language for writing Single page applications. Mint is written in Crystal.
- Cuneiform is a functional programming language for large-scale data analysis workflows. Cuneiform uses distributed Erlang to scalably run in cluster and cloud environments. The flexible foreign function interface lets you integrate tools and libraries from many different sources. This allows you to drive a heterogeneous software collection through a uniform interface (Bash, Erlang, Python, Java, R, MATLAB, JS). Static type checking.
- Curry -- Haskell with Logic Extensions
- Cyber -- is a scripting language for fast, efficient, and concurrent scripting, written in Zig -- Dynamic and static types. Concurrency with fibers. Memory safe. FFI and Embeddable.Fast VM and JIT. Cross platform.
- Dafny: A Language and Program Verifier for Functional Correctness - Microsoft Research
- Dao is a lightweight and optionally typed programming language; Optional typing with type inference and static type checking; Object-Oriented Programming (OOP) with class and mixin class; Abstract interface and concrete interface to supplement class-based for OOP; Code section methods as a better alternative to functional methods; Support closures, anonymous functions; Deferred block and exception handling by defer-recover; Native support for concurrent programming; Concurrent garbage collection;
- Derw -- is a programming language aimed at making complex apps in a simple way. It's built on top of TypeScript and Node, so it's easy to have interop with TypeScript. See also Gren
- dg — it's a Python! No, it's a Haskell! -- "Slow. Stupid. Absolutely adorable.". Python with Haskell syntax.
- Duet delta is an educational dialect of Haskell aimed at interactivity.
- Eff Programming Language is a functional programming language based on algebraic effect handlers. This means that Eff provides handlers of not only exceptions, but of any computational effect, allowing you to redirect output, wrap state modifications in transactions, schedule asynchronous threads, and much much more… Try it out in the browser
- The Egison Programming Language
- Ela combines strict and lazy evaluation, dynamic typing and features, which are normally adopted by statically typed languages, such as algebraic data types andHaskell style type classes. Compiles to .NET
- Euphoria -- the language that brought me back from the C++ induced panic :D
- rxi/fe -- A tiny, embeddable language implemented in ANSI C. Used to make grid based game framework cel7
- DRAKON, is a visual language for specifications. Discussions
- Eyg
- Elixir is a functional meta-programming aware language built on top of the Erlang VM.
- Fay is a proper subset of Haskell that compiles to JavaScript
- Fennel -- Lisp in Lua. "Full Lua compatibilty, Zero Overhead, Compile-time macros, Embeddable".
- Felix claims to have its own type system based on a combination of Ocaml and Haskell. Like Ocaml it provides strong support for functional programming, whilst also supporting imperative programming. The type system is strict.
- Flapjax is a new programming language designed around the demands of modern, client-based Web applications. Its principal features include: Event-driven, reactive evaluation; An event-stream abstraction for communicating with web services; and Interfaces to external web services. Flapjax is just a JavaScript framework. Flapjax is built entirely atop JavaScript, it runs on traditional Web browsers without the need for plug-ins or other downloads. It integrates seamlessly with existing JavaScript code and other frameworks.
- Flask staged Functional Programming for Sensor Networks
- Flex group at YC Research has a few interesting lanauges like: Ohm, Seymour, Purple, Trainee, and transcript.
- Flix -- "takes inspiration from F#, Go, OCaml, Haskell, Rust, and Scala. Flix visually resembles Scala, but its type system is closer to that of OCaml and Haskell. Its concurrency model is inspired by Go-style processes and channels. Flix compiles to JVM bytecode and runs on the Java Virtual Machine. Flix supports full tail call elimination which means that tail calls (even to other functions) never overflow the stack."
- Futhark - A High Performance Functional Array Language. "a small programming language designed to be compiled to efficient parallel code. It is a statically typed, data-parallel, and purely functional array language in the ML family, and comes with a heavily optimising ahead-of-time compiler that presently generates GPU code via OpenCL, although the language itself is hardware-agnostic."
- Gleam is a statically typed functional programming language for building scalable concurrent systems. It compiles to Erlang and has straightforward interop with other BEAM languages such as Erlang, Elixir and LFE. Interview with the creator of Gleam
- Gren is a functional programming language with carefully managed side-effects and a strong static type system. is a "fork" of Elm with a node.js target.
- Gush: A stack based language eventually for genetic programming
- Hazel, a live functional programming environment featuring typed holes.
- hobbes -- a programming language, JIT compiler, and database system for low-latency, high-volume trading applications (built at Morgan Stanley).
- Idris is is a general purpose pure functional programming language with dependent types.
- Imba is a programming language for the web that compiles to performant and readable JavaScript. It has language level support for defining, extending, subclassing, instantiating and rendering dom nodes.
- Inko " is a gradually-typed, safe, object-oriented programming language for writing concurrent programs. By using lightweight isolated processes, data race conditions can not occur. The syntax is easy to learn and remember, and thanks to its error handling model you will never have to worry about unexpected runtime errors."
"Inko is an object-oriented programming language, drawing heavy inspiration from Smalltalk, Self, and Ruby. There are no statements used for conditionals and loops, instead Inko uses message passing for (almost) everything." Processes don't share their memory, and communicate by passing messages, which are deep copied. This removes the need for explicit synchronisation, and makes data race conditions impossible. Inko uses a high performance parallel garbage collector, based on Immix. Each process is garbage collected independently, removing the need for a global stop-the-world phase. Inko is an interpreted programming language, with a bytecode virtual machine written in Rust. Inko is gradually typed, with static typing being the default. This gives you the safety of a statically typed language, and the option to exchange this for the flexibility of a dynamically typed language. Related reading: * Joe Duffy - The Error Model
- ISPC -- Intel® SPMD Program Compiler is a compiler for a variant of the C programming language, with extensions for "single program, multiple data" (SPMD) programming. Under the SPMD model, the programmer writes a program that generally appears to be a regular serial program, though the execution model is actually that a number of program instances execute in parallel on the hardware. The story of ispc: origins (part 1)
- Janet is a functional and imperative programming language. Janet makes a good system scripting language, or a language to embed in other programs. Think Lua or Guile. Janet also can be used for rapid prototying, dynamic systems, and other domains where lisp shines.
- Jolie is a service oriented proramming language that compiles to the JVM. I'm reminded of Ballerina. Jolie crystallises the programming concepts of service-oriented computing as linguistic constructs. The basic building blocks of software are not objects or functions, but rather services that can be relocated and replicated as needed. A composition of services is a service.
- Julia is a high-level, high-performance dynamic programming language for technical computing.
- Kit is a “Compiles-to-C” language. It is strong, and statically typed with many modern language features like type inference, algebraic data types, pattern matching, generics, implicits, while still having low level features like raw pointers, and manual memory management. Kit is written in Haskell. kit notes.
- Koka -- is a function-oriented programming language that seperates pure values from side-effecting computations, where the effect of every function is automatically inferred. The language is strict (as in ML), but seperates pure values from side effecting computations (as in Haskell). Through the effect types, there is also a strong connection to its denotational semantics, where the effect type of each function has a direct translation to the type signature of the denotational function. more Recently, Koka fully supports user-defined effects through algebraic effect handlers.
- Koto -- language for adding scripting to applications developed in Rust. Koto's runtime is fast enough for many applications, with performance comparable to similar embedded scripting languages for Rust like Rhai and Dyon
- lambdaway :: _ -- S-expression based markup, styling & scripting
- The Lemon Programming Language -- python with curly braces. embeddable.
- Lily -- an interpreted, statically typed programming language focusing on expressiveness and safety.
- The Little Language is a statically typed, C-like scripting language. "... might be useful for you if you are still using Tcl (or Tcl/Tk) but wish it had a more C-like syntax. ". L forum on bitkeeper
- Lobster is a game programming language. Unlike other game making systems that focus on an engine/editor that happens to be able to call out to a scripting language, Lobster is a general purpose stand-alone programming language that comes with a built-in library suitable for making games and other graphical things. Looks like python, but is statically typed.
- Logtalk is an object-oriented logic programming language that can use most Prolog implementations as a back-end compiler.
- Luna "is a data processing and visualization environment built on a principle that people need an immediate connection to what they are building. It provides an ever-growing library of highly tailored, domain specific components and an extensible framework for building new ones. Luna targets domains where data processing is the primary focus, such as data science, IoT, bioinformatics, graphic design and architecture."
- LuxLang/lux: The Lux Programming Language "It's meant to be a functional, statically-typed Lisp that will run on several platforms, such as the Java Virtual Machine and JavaScript interpreters." Written in Clojure. tutorial.
- Mercury is a logic/functional programming language, which combines the clarity and expressiveness of declarative programming with advanced static analysis and error detection features.
- Myrddin is a programming language that runs close to the metal, giving the programmer predictable and transparent behavior and mental model. It also does strong type checking, generics, type inference, closures, and traits.
- Mythryl is a rewrite of the SML/NJ compiler
- Nim -- see my more exhaustive set of notes here.
- Nitlanguage.org
- Objective-Smalltalk is an evolution of Smalltalk based on the Objective-C runtime.
- odinlang - Odin is a general-purpose programming language with distinct typing built for high performance, modern systems and data-oriented programming. Odin is the C alternative for the Joy of Programming. ed: seems to have gained much popularity among game developers.
- Onyx -- A data-oriented, expressive, and modern programming language, targeted at WASM.
- Opis reliable distributed systems in Ocaml (paper, 2009).
- P: Safe Asynchronous Event-Driven Programming by Microsoft Research
- P P provides a high-level state machine based programming language to formally model and specify distributed systems. See Youtube talk
- Picat is a simple, and yet powerful, logic-based multi-paradigm programming language aimed for general-purpose applications. Picat is a rule-based language, in which predicates, functions, and actors are defined with pattern-matching rules. Picat incorporates many declarative language features for better productivity of software development, including explicit non-determinism, explicit unification, functions, list comprehensions, constraints, and tabling. Picat also provides imperative language constructs, such as assignments and loops, for programming everyday things. The Picat implementation, which is based on a well-designed virtual machine and incorporates a memory manager that garbage-collects and expands the stacks and data areas when needed, is efficient and scalable. Picat can be used for not only symbolic computations, which is a traditional application domain of declarative languages, but also for scripting and modeling tasks.
- Pike - a dynamic programming language with a syntax similar to Java and C. "the World Wide Web servers Roxen WebServer and Caudium are both written in Pike. Pike’s advanced data types and built-in support for sockets makes it ideal for use in Internet applications."
- Piplin is a language that lets you write Clojure to simulate and program FPGAs.
- Ponylang -- is an object-oriented, actor-model, capabilities-secure, high-performance programming language.
- Play -- a statically typed stack language (aka Forth)
- Propane Language a language for simple, correct-by-construction network configuration
- Pure -- is a modern-style functional programming language based on term rewriting. It offers equational definitions with pattern matching, full symbolic rewriting capabilities, dynamic typing, eager and lazy evaluation, lexical closures, built-in list and matrix support and an easy-to-use C interface. The interpreter uses LLVM as a backend to JIT-compile Pure programs to fast native code.
- Pyret -- python like language (syntactially) with FP ideas. inbuilt testing emphasis with
where:keyword. structured data like OCaml etc., Runs on top of Racket. - The QED programming language -- "[for]... designing complex graphical user interfaces the simple way. Its parallel GUI/business logic (GUI/BL - or guible) coding paradigm offers unequaled binding power, which considerably reduces the lines of code required to develop a GUI application. QED runs in both native and web environments, without changing a single line of code."
- RacketScript is an experimental lightweight Racket to JavaScript (ECMAScript 6) compiler. RacketScript aims to leverage both JavaScript and Racket's ecosystem, and make interoperability between them clean and smooth. RacketScript takes in Racket source files, uses Racket's macro expander to produce Fully Expanded Programs, and then compile these fully expanded programs to JavaScript.
- Rascal -- is a metaprogramming language that integrates source code analysis, transformation, and generation primitives on the language level
- Red ; FAQ
- Reva -- a small, cross-platform Forth. Recommended by @deech in the context of "read the source code of the programming language to learn how things work".
- Roc's goal is to be a fast, friendly, functional language. tutorial; via
- Rosie Pattern Language -- a better Regex. See MWPLS 2019 slides (PDF). Has a REPL, JSON output, Can use with C, Python, Haskell, Go.
- Roy is a programming language that tries to meld JavaScript semantics with some features common in static functional languages and targets JavaScript.
- Rye is a high level, homoiconic dynamic programming language based on ideas from Rebol, flavored by factor, Linux shell and golang. For Interactive use, backend, servers, information exploration and processing. It's written in Go and could also be seen as Go's scripting companion as Go's libraries are very easy to integrate, and Rye can be embedded into Go programs as a scripting or a config language.
- Quirrel is a purely declarative query language designed for performing analytics and statistics on large-scale, multi-structured data sets.
- Quorum -- an OOPs lang for teaching that compiles to Java byte-code.
- scrapscript solves the software sharability problem. Modern software breaks at boundaries. APIs diverge, packages crumble, configs ossify, serialization corrupts, git tangles, dependencies break, documentation dies, vulnerabilities surface, etc. To make software safe and sharable, scrapscript combines existing wisdom in new ways:
- all expressions are content-addressible “scraps”
- all programs are data
- all programs are “platformed”
- Self is a prototype-based dynamic object-oriented programming language, environment, and virtual machine centered around the principles of simplicity, uniformity, concreteness, and liveness.
- SharpScript, a scripting language for .NET Core and .NET Apps that utilizes a familiar expressive Syntax to enable dynamic scripting of .NET Apps via controlled access to pluggable methods and arguments within a sandbox environment. looks good for exploratory and literate programming.
- Shen is a statically (optional) typed Lisp variant targeting Common Lisp, JavaScript, the JVM and possibly more targets
- SparForte "... allows you to write small scripts (think bash) and when they (inevitably) grow, you can transform them piecewise into Ada. The approach is similar to starting with Python and extending it with Rust where necessary. The advantage is the language is explicitly designed to support that use case." -- via
- syn·di·cate -- a language for interactive programs. Syndicate is an Actor-based programming language offering. Pub/sub pattern-based message routing, for mapping events to actors. Dataspaces, stores for semi-structured data, for managing shared state. State change notifications for keeping actors informed of changes in dataspaces. Integrated techniques for registering and discovering services and for cleaning up after both graceful and unexpected actor failures. Recursive layering of groups of actors, each group with a private dataspace of its own, for organising larger programs
- Tab is a kind of general-purpose query language for text files.
- Terra is a new low-level system programming language that is designed to interoperate seamlessly with the Lua programming language. Like C, Terra is a simple, statically-typed, compiled language with manual memory management. But unlike C, it is designed from the beginning to interoperate with Lua. Terra functions are first-class Lua values created using the terra keyword. When needed they are JIT-compiled to machine code.
- Tree Language Tree Notation is a simpler kind of code. Tree Notation is an error-free base notation like binary. Check out the "dumbdown" (markdown) designer demo.
- TXL is a unique programming language specifically designed to support computer software analysis and source transformation tasks.
- Uiua - A stack-based array programming language (think FORTH + APL)
- Vale -- "a fast, safe, and easy programming language." AOT compiled to LLVM, statically-typed, and uses the new generational references technique for memory safety with speed and flexibility. Read comparisons to JS, C++ and Rust.
- Verse -- language by Epic Games, designed by SPJ et al
- virgil - A Fast and Lightweight Systems Programming Language by Ben L. Titzer of CMU; WebAssembly co-founder, former V8 engineer.
- wing - programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
- Wuffs - Wrangling Untrusted File Formats Safely - is a memory-safe programming language (and a standard library written in that language) for wrangling untrusted file formats safely. Wrangling includes parsing, decoding and encoding. Example file formats include images, audio, video, fonts and compressed archives.
- Wren is a small, fast, class-based concurrent scripting language # Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a familiar, modern syntax. Used in luxe game engine.
- Yaksha - A manual memory managed, compiled to C99, programming language with Python-like syntax.
- Yeti is ML style functional programming language, that runs on the JVM.
- Zig Programming Language is a system programming language which prioritizes optimality, safety, and readability. Ambition to replace C discussion on lobste.rs. Iterative Replacement of C with Zig
- ZL is a C compatible and C++ like programming language that focuses on extensiblilty and giving the programmer control over how high-level constructs (such as classes) are implemented. ZL archives the first goal by means of a customizable grammar and a powerful Scheme-like macro system. ZL archives the second goal by using the macro system to define high-level constructs from a C-like core language in a similar in spirit to Scheme.
Other Programming Langauge Related Lists
- Six programming paradigms that will change how you think about coding
- ‘A Language a Day’ — Advent Calendar 2019 – Andrew Shitov’s Blog
- Toolbox languages post by Hillel Wayne comparing J, Raku, Picat, AutoHotKey, and Frink.
Blogs etc.,
Courseware
- Programming languages and techniques [PDF] from CIS120
Related Reading
- syntax across languages (One Big Page) -- "Quite comprehensive comparison of syntax across languages"
- A quick comparison of 10 non-mainstream programming languages
- A list of multi-paradigm programming languages
- Hostiness: list of languages targeting an exiting host platform
- A wish list for new programming language. A laundry list of features. July 2015.
- Advanced programming langauges by Matt Might on Haskell, Scala, Scheme, SML and OCaml.
Tools
Comby is a tool for matching and rewriting code. You start by writing a simple template to match syntax. Look at this Go function:
func main() { fmt.Println("hello world") }We can match the arguments to
fmt.Printlnwith this match template:fmt.Println(:[arguments])
Learning Programming
Fun
- James Iry - One Div Zero: A Brief, Incomplete, and Mostly Wrong History of Programming Languages
- James Iry - History of programming languages (illustrated with pictures and large fonts)
- Say something you dislike about a language you love | Lobsters
- Say something nice about a programming language you dislike | Lobsters
Implementing programming languages
- Build your own Lisp Learn C by building a Lisp.
- Programming Languages: Application and Interpretation
- Less is more: language features
- What are some niche features you'd like to see in more languages? : ProgrammingLanguages ... same on lobste.rs
- Languages I want to write -- Wesley Aptekar-Cassels [Apr 2019]
Blog posts
Books
- Programming language Pragmatics by Michael L Scott covers some of the theoritical background behind programming languages beyond the syntax.
Benchmarks
- trizen/language-benchmarks: A simple benchmark system for compiled and interpreted languages.. LuaJIT is very fast. OCaml is the fastest "adavanced" language.
Linkbacks to this page
Lisp
What makes lisp special?
- Rondam Ramblings: Yes, code is data, but that's not what makes Lisp cool [2018]
- What Made Lisp Different; Paul Graham [2002].
- How Lisp Became God's Own Programming Language; Oct 2018 by Sinclair Target at Two-Bit History.
Starting to code in Common Lisp
Articulate Common Lisp -- How to write Common Lisp in 2018 - an initiation manual for the uninitiated.
A Road to Common Lisp / Steve Losh; Aug 2018
Starting a minimal Common Lisp project | notes.eatonphil.com; Mar 2018.
How I got started with Common Lisp in 2017; Sep 2017 -- this one uses roswell, compares different editors (atom, emacs-bare/prelude and portacle), explains a bit how asdf and directory structure works etc., useful.
CL-References
- CLHS: Permuted Symbol Index (I)
- Lisp Machine Manual 1984 by Moon, Stallman and Weinreb.
- Simplified Common Lisp reference -- appears to be not complete, but interesting presentation.
Other Lisps
- fogus: The German School of Lisp
- Lumen -- Right! I've been waiting a couple years for Lumen to get some traction. | Hacker News -- wherein user
shawnshows off the cool things you can do with Lumen Lisp. Reference to Ken Thompson's "Trusting Trust" paper. - Lush: Lisp Universal SHell
- uLisp is a Lisp for microcontrollers (Arduino ATmega, Adafruit, BBC MicroBit, STM32, ESP8266 and MSP430 based Launchpad boards).
- GameLisp -- a scripting language (lisp) for Rust game development.
- The Many Faces of an Undying Programming Language — Jakob's Personal Webpage; Jul 2020.
- Lush: my favorite small programming language | Locklin on science
T
- The T Project "T was one of the best Lisp implementations, and set a standard for clean design that few newer dialects have been able to meet." -- Olin Shivers History of T.
- Orbit paper (pdf) by Jonathan Rees
Urn
Urn is a Lisp that compiles to Lua. Its tutorial is one of the friendliest to learn Lisp itslef.
Picolisp
uLisp
- uLisp -- Lisp for Arduino, Adafruit M4, Micro Bit, ESP8266/ESP32, and MSP430 boards.
Notes
To add readline support to the SBCL REPL, use rlwrap
Use quicklisp to discover, install and manager Lisp libraries
Starting SBCL with QuickLisp pre-loaded.
$ rlwrap sbcl --load ~/quicklisp/setup.lisp
Quotes
In C, you are writing assembly constructs disguised as a high level language. In lisp, you are writing compiler constructs (abstract syntax trees) disguised as a high level language. Assembly language targets hardware-oriented geeks. Lisp targets compiler-oriented geeks. Since the two don't (generally) understand the other's viewpoint, each hates the other's favorite language.
-- gvb at i hate lisp.
Implement your own Lisp
- Build your own Lisp
- mal: make a lisp in multiple languages.
- Lisp in a few lines of Haskell by Ben Lynn at CS.Stanford.
- krig/LISP: My attempt at implementing the original LISP paper while learning lisp. Nothing special, mostly posted as a homage to McCarthy.
Links
- These years in Common Lisp: 2018 – Vince Zd – Medium
- Lisp and DSLs
- Classic Lisp books
- Writing a Common Lisp Web App in caveman2. Blog written in CL Source
- LispOS: Specification of a Lisp Operating System” (Robert Strandh, 2013) (PDF).
- Discussion on Lisp
- Adam Tornhill's Programming Pages
- uLisp - Lisp for the arduino
- L-99: Ninety-Nine Lisp Problems
- Pascal Costanza's Highly Opinionated Guide to Lisp
Blogs
Borretti -- Articles. See State of the Common Lisp Ecosystem, 2015
stablecross.com lisp articles. See The Myth of the Super Programming Language?
Lisp journey. See Introducing Replic: an executable and a library to build a readline app in no time - Lisp journey / State of Common Lisp Web Development - an overview - Lisp journey
Videos
- Baggers' Little bits of Lisp (shorter videos, few minutes each).
- Baggers' Lots of bits of Lisp (longer videos 1-2 hour).
Algorithms
- Lisp, the Universe and Everything: "Programming Algorithms" Book [WIP book]; Jul 2019.
Lisp Machines
Books
- norvig/paip-lisp: Lisp code for the textbook "Paradigms of Artificial Intelligence Programming" (Also contains PDF of the book).
- Land of Lisp: Learn to Program in Lisp, One Game at a Time!
- Practical Common Lisp (free book)
- On Lisp by Paul Graham (free book)
- Lisp Outside the Box; partially completed; original plan
- Full stack Lisp; develop web applications (hence the "fullstack") using Common Lisp. [Work in progress]
- マンガで分かるLisp(Manga Guide to Lisp) in Japanese-u.
IDEs
The de-facto IDE for most lisps in Emacs. Howver Portacle - A Portable Common Lisp Development Environment is a good, ready-to-go, purpose-built distribution of Eamcs for use on Windows, Mac and Linux.
Talks
People
- dlweinreb's comments | Hacker News ; Daniel Weinreb passed away in 2012.
- Fernando Borretti
- 40ants -- "are a group of Lisp hackers. Our goal is to extend Common Lisp's ecosystem and to solve realworld problems using the most powerful programming language."
Implementations
- SBCL
- ABCL
- CCL
- Corman Lisp (windows only)
- Allego CL
- Lispworks
- jscl: A Lisp-to-Javascript compiler bootstrapped from Common Lisp
Distributions
- quicklisp
- ultralisp.org/ -- bleeding edge quicklisp
Interesting programs / libraries
- https://github.com/Shinmera/beamer slide show program based on trial game engine. Example slide from ELS 2018.
Tips
lisp tip: run visual programs with (uiop:run-program '("sudo" "htop") :output :interactive :input :interactive) works for sudo, vim, htop, ncdu… see also (cmd:cmd "sudo htop" :<> :interactive)
Discussions/ Comparisons
Outperforming everything with anything. Python? Sure, why not? : programming ... has some discussions on Common Lisp and CLASP.
Dynamic language compilation discussion, many interesting points about Common Lisp and AOT; Apr 2019.
Why lisp over Julia (HN).
Understanding the words "package", "system", "project" .. which have different meanings than commonly understood ones.. As explained by sjl on lobste.rs:
Common Lisp’s terminology is confusing because it’s old and uses a lot of words that we use now (like “package”) to mean different things than people mean today. Things get easier once you internalize what Common Lisp means by the terms.
A package in Common Lisp is a container for symbols. They’re a way to group related names (symbols) together so you don’t have to do the miserable prefixing of every name with
mylibrary-...like you do in Emacs Lisp or C to avoid name clashes.Unlike other languages like Python/Clojure/etc, packages and files on the hard disk are not tied strongly together in Common Lisp. You can have several files that all work with the same package, a single file that switches back and forth between packages, or even write code that creates/mutates packages at runtime. Files and packages are orthogonal in Common Lisp, which gives you maximum flexibility to work however you want.
A system in Common Lisp is a collection of code (mostly) and a description of how to load that code (and some metadata like author, license, version, etc). For example: my directed graph library
cl-digraphcontains a system calledcl-digraph. That system has a description of how to load the code, and that description lives in thecl-digraph.asdfile. It creates a Common Lisp package (calleddigraph).The Common Lisp language itself has no knowledge of systems. ASDF is a Common Lisp library bundled with most (all?) modern implementations that handles defining/loading systems. (The name stands for Another System Definition Facility, so as you might guess there have been several other such libraries. ASDF is the one everyone uses today.)
Systems and packages are orthogonal in Common Lisp. Some systems (like small libraries) will define exactly one package. Some systems will define multiple packages. Rarely a system might not define any new packages, but will use or add to an existing one.
A project in Common Lisp is not an official term defined anywhere that I know of, but is generally used to mean something like a library, a framework, an application, etc. It will usually define at least one system, because systems are where you define how to load the code, and if it didn’t define a system how would you know how to load the code? My
cl-digraphlibrary mentioned above is a project that defines three systems:
cl-digraphwhich contains the actual data structure and interface.cl-digraph.testwhich contains the unit tests. This is a separate system because it lets users load the main code without also having to load the unit test framework if they’re not going to be running the tests.cl-digraph.dotwhich contains code for drawing the directed graphs with Graphviz. This is a separate system because it lets users load the main code without also having to load thecl-dotsystem (the graphviz bindings) if they don’t care about drawing.If I were writing this today I’d use ASDF’s
foo/barsystem naming notation instead of separating the names with a dot, because there’s some nice extra support for that. I just didn’t know about it at the time, and don’t want to break backwards compatibility now.We saw how Common Lisp has no concept of a system — that comes from ASDF. Similarly, ASDF has no concept of the internet, or reaching out to somewhere to download things. It assumes you have somehow acquired the systems you want to load, maybe by sending a check to an address and receiving a copy of the code on floppy disk, as many of my old Lisp books offer in the back pages.
Quicklisp is another library that works on top of ASDF to provide the “download projects from the internet automatically if necessary” functionality that people want in our modern world. So when you say
(ql:quickload :cl-digraph)you’re asking Quicklisp to downloadcl-digraph(and any dependencies) if necessary, and then hand it off to ASDF to actually load the code of thecl-digraphsystem. Unlike ASDF, Quicklisp is relatively new in the Common Lisp world (it’s only about eight years old) bundled with any modern Lisp implementations (that I know of) (yet?), which is why you need to install it separately.So to summarize:
- Files are files on your hard drive.
- Packages are containers of symbols. They are orthogonal to files.
- Systems are collections of code, plus instructions on how to load this code. They are orthogonal to packages.
- Projects are high-level collections of… “stuff” (code, documentation, maybe some image assets, etc). They are (mostly) orthogonal to systems (seeing a trend here?).
- Common Lisp knows about files and packages. ASDF adds systems. Quicklisp adds the internet.
This is a pretty high-level view that glosses over a lot, but maybe it’ll clear things up and help you dive into the details later.
Nim Programming Language
NOTE: nim was previously known as nimrod.
A quick look at nim programming language
This is a short intro to a fun, productive language called nim.
nim is a new programming language developed by Andreas Rumph.
nim is a statically typed, compiled langauge.
What kind of language is it?
There are few things more irriting than a programming language or library webpage that doesn't show how the syntax/typical usage looks like. So, let's see how nim code looks like:
# compute average line length
var count = 0
var sum = 0
for line in stdin.lines:
count += 1
sum += line.len
echo "Average line length: ",
if count > 0: sum / count else: 0
The var keyword is familiar if you have used C#, which essentially
means that the variable count has an implicit type. That is, you don't
have to explicitly mention the type, in this case an integer.
The for loop line reads naturally for the Python programmer, including
the : starting a new block.
nim is inspired by many popular languages old and new. It is quite easy to read and understand what is going on.
According to Araq, the creator of Nim:
Macro system inspired by Lisp.
Export marker taken from Oberon.
Argument passing semantics taken from Ada.
distinct types inspired by Ada.
Syntax also heavily influenced by Python.
Generics inspired by C++.
The 3 pointer like types ptr, ref, var taken from Modula 3.
async / await stolen from C#.
let taken from ML.
...
One could also argue that Nim is a statically typed Lisp with an
infix syntax extended by essential features necessary for
systems programming. And dumbed down to support efficient
compilation to C (where are my continuations?!)..
How to install it?
Checkout the code from github. (Note these steps are outdated since the language was renamed from nimrod to nim).
$ git clone git://github.com/Araq/Nimrod.git
$ cd Nimrod
$ git clone --depth 1 git://github.com/nimrod-code/csources
$ cd csources && ./build.sh
$ cd ..
$ bin/nimrod c koch
$ ./koch boot -d:release
$ ./kock install $HOME/nimrod
This installs nimrod under $HOME/nimrod. Add $HOME/nimrod/bin to the
$PATH.
What is the performance like?
Nim compiles to C, so you can expect C-like performance (hard performance numbers are a game of benchmarks and nobody ain't got no time for that...). To go with Nim's authors' own word "it is performant for 'soft real time' systems like games". Take it as you may.
For me, Nim is a vast upgrade over dynamic languages like Python and Ruby without sacrificing a whole lot of expressiveness.
What are some of the quirks
By looking at examples and reading applications/libs written in Nim
you would not guess it, but nim is case insensitive. That is
var hello and var HELLO and var HeLlo are treated as the same by
the compiler. Where nim takes it one step ahead is it's treatment of
underscores, which means var H_E_l_lo is same as var hello. This
might appear crazy, but this removes the entire bikeshed argument about
which style of variable naming is best.
The nim programming community has it's own best practices for
variable names, for instance, new types are declared as TFoo an
inspiration from Pascal.
A quick tour of the command line
To compile a nim file foo.nim, you type
nim c foo.nim
which will give you a foo executable in the same directory, assuming
there were no compilation errors. You will also see a nimcache
directory.
This directory contains the intermediary C files generated.
What are the resources to learn more
The website: http://www.nim-lang.org The forum: http://forum.nim-lang.org -- this is probably the best place to get your questions answered.
How can I use nim?
For a young language like nim has not managed to corner itself into any one niche.
nim has been used to write: (Update, Aug 2024: See Awesome Nim and nimble.directory for a list of libraries for nim - a lot more diverse than you think!)
Personally, I have been using nim to replace a few of command line python applications that process large amounts of data.
Standard libraries
Nim's standard library has XML, CSV, Web, String, Regular expressions, OS, Database drivers, Network programming and more.... It also has wrappers to popular C libraries like X, GTK, pcre, cairo, sdl, OpenGL etc.,. nim libraries have you covered for day-to-day programming needs.
Web development
Editors and IDEs
Emacs has a nim-mode. A nim specific IDE called Aporia built using
the GTK toolkit. I haven't used it much beyond installing it because I
prefer using the Emacs nim-mode.
Aug 2024: I use zed, and it uses LSP.
Packaging and reusing libraries
nim libraries can be installed using the nimble package manager. The nim
After successful compilation, copy the babel executable to a directory in
your $PATH. I put it under $HOME/nim/bin along with other nimrod
executables.
Distributing applications written in nim
A .nimble file is required at the root of your application source
directory. Take for example the jester.nimble file that is part of the
Jester web framework distribution" --
[Package]
name = "jester"
version = "0.1.0"
author = "Dominik Picheta"
description = "A sinatra-like web framework for Nimrod."
license = "MIT"
SkipFiles = "todo.markdown"
The file is self explanatory. Once you have the nimble file in the directory, running nimble build will build binaries.
Cross Compilation
From SO
I was having the same issue getting nim to compile executables for Windows, from a GNU/Linux machine, so I made a bash script. It takes the path to the directory containing
*.nimsource files and the name of the executable file to output. I'm sure you could swap out the GCC compiler (MinGW in this case) and change the--os: switchas appropriate:
#!/usr/bin/env bash
# Nim must generate C sources only, to be fed to MingW
nim c --cpu:amd64 --os:windows --opt:speed --embedsrc --threads:on --checks:on -c -d:release $1/*.nim
# Copy nimbase.h so MingW32 can find it during compilation and linking
cp /opt/Nim/lib/nimbase.h $1/nimcache/nimbase.h
mkdir -p $1/bin
cd $1/nimcache && x86_64-w64-mingw32-gcc -save-temps $1/nimcache/*.c -o $1/bin/$2.exe
rm $1/nimcache/*.{i,s} # only care about *.o objects
ls -lAhF $1/nimcache
ls -lAhF $1/bin
Concepts
Memory Model
Related
Links
Choosing Nim out of a crowded market for systems programming languages - Nim forum; Nov 2022.
Metaprogramming abilities, article by Andreas Rumpf, creator of Nim.
Debugging Nim [forum thread
Discussion on GC in light of Gradha's decision to "leave"
What makes nim practical -- how to use
niminstamong other things.Introduction to Metaprogramming in Nim · HookRace - a Nim blog for now
Speeding Up Python with Nim; Jan 2019.
DNA Alignment with Python, Nim and JavaScript - Boolean Biotech
Markdown Parser in Nim; Oct 2018.
Why I enjoy using the Nim programming language at Reddit. : RedditEng; Nov 2022.
Books
Tutorials
Interop (FFI)
- (2) Exporting C APIs from Zig, D, and Nim - YouTube
- Subset Park: Nim for Python Programmers
- PyVideo.org · Nim: A New Option for Optimizing Inner Loops
Testing
Interesting projects in Nim
- Fusion OS, an OS written in Nim.
Compile time
Libraries
- nimongo -- study for the async, asyncdispatch methods.
- nim-appkit -- github org around various useful nim libs; eg:
nim-yaml. - genotrance/nimgen: Nimgen is a helper for c2nim to simpilfy and automate the wrapping of C libraries
- FedericoCeratto/nim_project_maker: Initialize a Nim project directory
- Patty - A pattern matching library | patty
- citycide/cascade - Method & assignment cascades for Nim, inspired by Smalltalk & Dart.
- zero-functional/zero-functional: A library providing zero-cost chaining for functional abstractions in Nim.
- Pebaz/nimporter: Compile Nim Extensions for Python On Import!
Web development
- planety/prologue: Powerful and flexible web framework written in Nim (This is the framework I used for developing tohray. )
- An older (2019) but useful article about Nim tutorial for setting up a website.
- Mummy is a multi-threaded HTTP 1.1 and WebSocket server. Used to write cxplanner website. Production Use of Mummy, and another
Dev tools
Dev Notes
Upgrade nim to the latest version using choosenim:
$ choosenim update stable
# downloaded, built and installed 2.0.8 (Aug 2, 2024)
$ which nim
/Users/pradeep/.nimble/bin/nim
$ nim -v
Nim Compiler Version 2.0.8 [MacOSX: amd64]
...
Random notes
Nim's GC is per thread: You can easily have threads which are hard realtime and don't use the GC and happily use the GC in the other threads... And the type and effect system ensures you don't mix these different per thread heaps. -- Araq
[Nim has] C++-like features (generic types, operator overloading, function overloading, inline functions, optional O-O, optional data hiding, C pointers, bitwise-compatibility with C, your choice of manual memory management or GC) and C++-like run-time speed, combined with Python-like syntax and compile-time Lisp-like macros. -- HN comment
The no GC future is
--gc:stackwhich replaces the GC with memory regions. So any library that uses the GC really uses a memory region. The entire situation is ok. Note that the GC is always thread local anyway, so you can also just run realtime threads with other threads that use the stdlib and thus the GC. -- Araq
use these:
alloc, dealloc, allocShared, deallocShared. You can cast the pointer from and toptrtypes and then you have your manually managed heap memory. (This is a general answer to how to use non-GC'd memory and has nothing to do with memory regions) -- flyx
A good example of using FFI in nim in comparison to D and rust.
Discussion in /r/python about a nim article.
From a reddit thread: What problem does Nim solve?
Low friction, high performance development.
It feels like a scripting language in terms of writing code rapidly. Deferred GC means no need to worry about memory (although easy to manually manage it). So, a sort of statically typed, compiled Python with C-level speed and tiny, self contained executables.
High level AST metaprogramming that lets you hygienically extend the language, has static typing with inference and uses structural typing for generics which often means you don't even need object hierarchies, extensive compile time evaluation (to the point you can process files, create hash maps or pull web data by simply defining your desired variables as 'const').
It compiles to C, C++, LLVM (experimental), and Javascript. Excellent FFI so you can use all the C, C++ and JS libraries as well as Nim ones. Very fast compilation that's going to get faster from what I've read about future plans.
This may be subjective but I also like how clean it looks. Few $!;@ symbols and easy to read.
Personally, it's brought the fun back into development for me.
Stack vs GC vs Manual memory management
type Foo = object-> Value type, on the stacktype Foo = ref object-> Ref type, managed by GCtype Foo = ptr object-> Pointer type, manual memory management (malloc, free, memcopy ...)- Pointer arithmetic can be achieved using casts. via
Stack vs Heap from a Reddit thread:
By PMunch:
First order of business heap vs. stack: Whenever you call a function it creates a stack frame. Stacks are simply said first in last out, so when a function call is done it pops it's frame from the stack, and you return to the previous frame. When you declare a variable inside a scope in is typically allocated on the stack. This means that when the function returns that part of memory is not in use anymore and the value is gone (technically it's still there, but we shouldn't try to access it). The heap on the other hand is quite a bit different. Items on the heap are allocated and live there until you deallocate them. In C this is done manually with calls like malloc and free. In Nim however, and C# for that matter, we have the garbage collector (or GC), this nifty thing reads through our memory and checks if anything still points to things allocated on the heap and if nothing is pointing to that which was previously allocated it gets free'd. This means that we won't leak memory as easily as you would in C as things that we've lost every reference to get's automatically cleaned. Okay, now that we know where our stuff lives in memory, let's look at how Nim represents those things. Basic types are things like integers, floats, bools, and characters. Their size is known and static. Nim also calls strings a basic type, but those are not quite like the rest since they can change in size. Since our stack is first in last out it means that it makes sense to store everything in order. But storing things in order isn't possible if you want to change the size of something (for example appending to a string). So when we create numbers in our Nim code they will be stored on the stack, this is why you never need to free your numbers and don't have to set them to nil when you're done with them. So what are types? In Nim you can create aliases for types like type age = int this is just a way to say that age is an integer, and it will be treated like one for all intents and purposes. If we want to create collections of types to represent something particular we can create objects, don't think of these quite like objects in an object oriented language, think of them more like structs in C. Such objects are simply a collection of values. So in Nim when we create an object it will live with us on the stack. If we return an object it will be copied to our caller, and if we insert it into a data structure it will also be copied. While this might be practical in many cases (even offering a speed benefit if done right) we often don't want to copy our large objects around. This is when allocating on the heap comes into play. If we define our type as a ref object it means that the type is actually a reference to an object. I'll come back to the difference between a reference and a pointer later, but for now just remember that a reference is the memory location of an object on the heap. This means that if we return a ref object it means that we're only returning the memory address of that object, not copying the object itself. This also means that if we insert it into a data structure only the reference to the object is inserted. Whenever you see new SomeObject it means that it allocates memory for that object on the heap, and gives us a reference to this object. If we had simply done var myObject: SomeObject and SomeObject was defined as a ref object we would only have a reference on our stack, so trying to access it would crash saying we had an "Illegal storage access". This is because Nim defaults our value to nil, and no-one is allowed to access memory area 0. So imagine we had an object that contained the height, the weight, and the age of a person. That could be represented by three integers. If we wanted to return this object it would mean copying all those three values to our caller. If we defined it as a reference, we would only pass one integer, the position in memory (on the heap) where we stored the three others. Conveniently this also means that if one functions modifies a value in a referenced object, that change would be visible for all other functions using the same reference (since they all point to the same place in memory). This is practical for example if you want to make one list sorted by age, one by height, and the third by weight. Instead of copying our person three times, we could just use three references, one in each list. So now that we know where and how are values are stored we can look at the difference between a pointer and a reference. In pure Nim code you would typically only use references, these are what every call to new creates and what goes on behind the scenes most of the time when working with strings. A reference is also called a managed pointer, it simply means that Nim manages this area of memory, and that it will be automatically free'd for us by the garbage collector when Nim sees that we're not using it any longer. Pointers on the other hand are unmanaged meaning that Nim doesn't try to do anything with the memory behind that pointer, most of the time you won't even know what is there. The reason there are pointers in Nim is mostly to interface with C. In C every time you want objects on the heap you need to manually malloc and free them. Many C libraries work by passing around a pointer to a structure containing some state and all good libraries have some way of dealing with this memory. Typically you do it by calling some initialisation function when you begin and then some cleanup function when you are done. In Nim we might want to use a C library such as that, but since we might loose the reference in our own code while the library still keeps a reference somewhere which Nim doesn't know about we can't have a reference to it as Nim would garbage collect it. So instead we have pointers. I hope this made it somewhat clearer, if you want more examples or if anything was unclear, feel free to ask.
Benchmarks
- basic benchmarks against Crystal, D, Go, Julia, and other compiled langs.
Talks
- Dominik Picheta at NIDevCon, June 2017
- C++ as Assembly 2.0 - Hello Nim from Open Fest Bulgaria; Dec 2019.
- FOSDEM 2020 - Async await in Nim by Dominik Picheta.
- "Nim Nuggets: Systems Programming & Metaprogramming Magic" by Aditya Siram at Strange Loop 2021. The slides are here.
Editors
Visual studio Code
Nimlime
Nimlime is a plugin for Sublime Text the provides Nim compatibility. This is my custom settings overriding the default settings:
{
"nim.executable": "/Users/pgowda/src/Nim/bin/nim",
"nimble.executable": "/Users/pgowda/.nimble/bin/nimble",
"nimsuggest.executable": "/Users/pgowda/.nimble/bin/nimsuggest",
"provide_immediate_nim_completions": true,
"output.send": false
}
The output.send option set to false is an important one; withtout this,
the plugin would create a new compiler output buffer everytime the file is
built, which is everytime I saved the file!.
Blogs
Code
Code to read etc.,
- def-/nim-unsorted: Unsorted Nim code that I wrote for some reason (largely Rosetta Code)
- generating bindings to a C library (libarchive) in this case -- https://github.com/genotrance/nimarchive/blob/master/nimarchive.cfg this is pretty fascinating.
- krux02/opengl-sandbox: just a macro that generates the fuzz you need to deal with OpenGL
Eventually I decided, that being able to do transformations on the AST (abstract syntax tree) of the programming language would greatly help to develop this toolbox. I tried out Rust, but I quickly found out that their macros are too weak to even implement println, and I had to look somewhere else. (At this point in time Rust also has procedural macros, but they still don't appear to be powerful enough to do the things I need to do for this project). Eventually with Nim I finally found a language that suited my needs. It has AST based macros, arbitrary code execution at compile time, static typing, reflection and a lot more.
News
See also: Crystal, Interesting Programming Languages, D, Python, Rust.
Lua Programming Language
Learn
Lua associated languages
Pallene + Lua. Paper .Found via janet lang's gitter channel. It is a "Friendly Fork" of Titan Language. Pallene is a moon of saturn?
Terra -- low level lua like language.
teal; The compiler for Teal, a typed dialect of Lua
Luau is a fast, small, safe, gradually typed embeddable scripting language derived from Lua.
Links and references
- Lua.Space -- lua community blog; started Dec 2015.
- What's different about Lua
- Is Lua interesting, from a programming language design perspective?
- Lua date manipulation
- Lua - world's most infuriating language.
- How to lua and c - a short novel
- lua's nil
- Lua links by Tao of Mac
Cool Lua stuff
Luvi A project in-between luv and luvit. The goal of this is to make building luvit and derivatives much easier. Luvi has a somewhat unique, but very easy workflow for creating self-contained binaries on systems that don't have a compiler:
- Using luvi to ship binaries
- Holy build box
- lit - Toolkit for developing, sharing, and running luvit/lua programs and libraries.
- example of luvit code - IRC activity bot by
technomancy.
Fengari is the Lua VM written in JavaScript. It uses JavaScript's garbage collector so that interoperability with the DOM is non-leaky.
rxi/lume: Lua functions geared towards gamedev -- "lua's missing standard library" according to @technomancy
- rochus-keller/LjTools: LuaJIT 2.0 bytecode parser, viewer, assembler and test VM
- I build Lua programs in prod. I use fennel or moonscript as the frontend, and ev... | Hacker News; Dec 2019.
2020-06-04 oasislinux/oasis: a small statically-linked linux system; uses lua for setup, building, package spec etc.,
Mako Server This tiny, ready-to-run application server packs a punch with its super compact and efficient Lua web framework and its non-blocking asynchronous sockets. Plus, it comes with everything you need built-in, including an integrated database, SMTP, HTTP client/server, and even IoT protocols like MQTT and industrial protocols like OPC-UA and Modbus.
People
- Calvin Rose -- bakpakin.com (creator of Fennel lang, moonmint web framework, etc.,)
- Stefano Trettel --
moon*libs for graphics, etc.,
Compiling Lua source files
Let's say you have a lua program -- hello.lua.
print("Hello Lua!")
The source code can be compiled into a binary file using luac
$ luac -o hello.luac hello.lua
The file hello.luac can then be used in place of the source file. Using the binary file has some advantages like: faster loading, simple source hiding etc.,
To run a .luac file (this is my own convention, the Lua docs do not
seem to prefer any particular suffix for the compiled file), you still
need to call the lua interpreter,
$ lua hello.luac
Creating standalone executables for lua
A Lua source file can be converted into a executable using different
methods. srlua appears to be the popular one.
Download srlua from
here and build it using
make. Copy glue and srlua files into a convenient location, say
~/bin.
You can now create standalone executable from the Lua source file
--hello.lua thus:
$ ~/bin/glue ~/bin/srlua hello.lua hello
$ chmod +x hello
$ ./hello
Hello Lua!
Installing new software packages
Luarocks is the deployment and package management system for Lua. Think CPAN for Perl and PyPI for Python.
I have installed Lua in my $HOME directory. That is, lua interpreter
resides in $HOME/bin, include files in $HOME/include etc.,
So, to install Luarocks:
$ export PREFIX=$HOME
$ ./configure --prefix=$PREFIX --sysconfdir=$PREFIX/luarocks --force-config
Installing new lua packages is as simple as:
$ cd
luarocks install luasocket
where luasocket is a new package that
is fetched from the luarocks mirrors and installed.
To make this package available to the Lua interpreter export LUA_PATH
thusly:
export LUA_PATH="/opt/local/share/lua/5.1//?.lua;/opt/local/lib/luarocks/?.lua;;"
Another LUA_PATH that makes more sense:
?;?.lua;/usr/local/lua/?/?.lua
Also, to explicitly add paths to a script:
# cat t_paths.lua
package.path = package.path.. ";/opt/local/share/lua/5.1/?.lua"
package.cpath = package.cpath.. ";/opt/local/lib/lua/5.1/?.so"
local s = require "socket"
print(s._VERSION)
Incidentally, on the day I was learning aobut luarocks, luaforge.net,
the main lua modules repository was down. Friendly folks on the #lua
IRC channel told me to add mirrors to the luarocks configuration.
$ vim ~/luarocks/config.lua
I replaced the luaforge.net line with
http://www.luarocks.org/repositories/rocks/",
Misc. Notes
Setting up LUA_PATH and LUA_CPATH is always more complicated than it
needs to be. Remember not to have any spaces after the path seperator
;.
LuaDist appears promising to set up virtualenv
like sandboxed environments (and more..) for lua.
Lua application packaging
luastatic README tells us that it can package lua applications into executables for windows, macos & linux. A few applications that use luastatic to do their packaging are given. It will be nice to find build setups which can compile to all the three OSes using github CI pipeline.
--
See also: Luarocks.
Shell programming
- learnbyexample/Command-line-text-processing: From finding text to search and replace, from sorting to beautifying text and more -- the
pastecommand was really interesting!
- explainshell.com - match command-line arguments to their help text
- Shellcheck finds bugs in your shell scripts. Available as an online tool and a installable CLI tool. Written in Haskell.
- modernish/modernish: cross-platform POSIX shell feature detection and language extension library
- Oilshell -- Why create a new Unix Shell. See "A glimpse of Oil" -- (statically parsed, lossless syntax tree, stricter runtime behaviour.. etc.,)
- Software development using Bash -- illustrates the use of
shfmt(code formatting),shellcheck(linting/static analysis),bats(unit testing). - Ask HN: Share a shell script you like | Hacker News
Janet
Janet Programming Language is a Clojure like Lisp scripting language also suitable for embedding.
Why
Why Janet?; Apr 2023. Book "Janet for Mortals" by Ian Henry.
Learn
Notes
- Project definitions go into a
project.janetfile. - Third party dependencies are defined like this:
{:dependencies [{:repo "https://github.com/joy-framework/moondown" :tag "0.1.0"}]}
The structure of a project.janet file is: (See more here)
(declare-project
:name "mylib" # required
:description "a library that does things" # some example metadata.
# Optional urls to git repositories that contain required artifacts.
:dependencies ["https://github.com/janet-lang.json.git"])
- See littleserver on how to build an executable from Janet source.
Cool projects in Janet
Bauble studio -- making art online with lisp(janet) and math.
Mendoza -- static website generator with a markdown language inspired by Scribble (of racket).
Tester -- testing framework. Readme file has an example of how to use fswatch to run the tests when files change.
Joy Framework -- a web framework for Janet.
jpm install joy.- has an ORM?
esv a web application built using Janet, (and circlet library).
Janet Shell
janetsh "A powerful new shell that uses
the janet programming language for both the implementation and
repl.". This is pretty cool when you want a regular shell that can do
mundane things like ls -lart, but also use janet as a REPL and
scripting language when you want to more advaned things without
resolving to bash scripting. See this introductory
article by
the creator -- Andrew Chambers.
In this article, -- JSON in Janet
Shell you can see how
to use the ~/.janetsh.rc file to load additional modules (in this
case ability to process JSON) to extend the capability of janetsh.
# Tell janet it can load janet and native modules from ~/janet-modules
(array/insert module/paths 0
[(string (os/getenv "HOME") "/janet-modules/:all:.janet") :source]
[(string (os/getenv "HOME") "/janet-modules/:all:.:native:") :native])
# copy combined dynamic library to janet-modules dir
cp build/json.so ~/janetsh-modules
# use it
$ (import json)
$ (var astronaut-in-space
(json/decode ($$ curl http://api.open-notify.org/astros.json)))
# note: $$ appears to be the function call to invoke programs
# Print each one and the space craft they are in.
$ (each astronaut (astronauts-in-space "people")
(print
"Name: " (astronaut "name")
", Craft: " (astronaut "craft")))
...
Name: Oleg Kononenko, Craft: ISS
Name: David Saint-Jacques, Craft: ISS
Name: Anne McClain, Craft: ISS
This is a very nice capability (being able to extend the shell programming language).
Fennel programming language
Fennel is another clojure-like language that compiles down to lua created by Phil HagelBerg "technomancy".
Anywhere you can run Lua code, you can run Fennel code.
Phil Hagelberg/Technomancy has three.blog.posts about using Fennel to write a new game EXO_encounter that is hosted on itch.io (which itself is written by Lua-u* leafo).
Here is an introductory post on Fennel by Technomancy.
Software written using Fennel
*What's the demonym for a Lua programmer? (like Pythonista for Python programmers) -- Lua'r, Lua-oo?
C Programming Langauge
Why C?
"The Endurance of an Unmanageable Language" - Some Were Meant for C; via ATS As a Systems Programming Language.
Learning
- youtube lectures on C programming by Prof Jerry Cain, structured around the book Computer Systems: A programmer's Perspective by Bryant & O'Hallaron.
- Charles Cabergs - YouTube
Tooling
Why not C?
C Is Not a Low-level Language - ACM Queue
Books
- Learn C Programming With 9 Excellent Open Source Books - OSS Blog
- Learn C programming | Lulu's blog; 14 chapters with examples and quizzes.
- comp.lang.c Frequently Asked Questions
- C Craft notes by Ben Lynn on C vs many other languages. "C is the desert island language"
- Object Oriented C, 1993 by Axel-Tobias Schreiner
People and blogs
- https://c9x.me/ by Quentin Carbonneaux. qbe compiler backend etc.,
- The Jim Roskind C/C++ Grammar
Important
- cdecl; C gibberish ↔ English
- ~sircmpwn/cstyle -- style guidelines on the lines of "SHOULD" and "SHOULD NOT"s.
C libraries
- Better String library
- Valgrind
- zeromq
- lock-free data structure library
- uthash -- simple data structures
- Compilers targetting C
- TrustInSoft/tis-interpreter: An interpreter for finding subtle bugs in programs written in standard C
Memory Management
- Untangling Lifetimes: The Arena Allocator; making performant dynamic manual memory management in C feel almost like garbage collection by Ryan Fleury.
- Malloc tutorial by Dan Luu
C programming practices
- C Programming Substance Guidelines from the Stronglink (a searchable, syncable, content-addressable notetaking system) project
- Lecture notes on Practical Programming in C.
- A rant on C (not by me)
- a critique of "how not to c"; Jan 2016.
- how to c; HN
Another interesting approach to learning C if you already know Python is to re-implement the C compiler described in this article. If you're looking for a way to learn 10 things while also learning C then this 500 line Python complier is A++.
Cool stuff
- How I wrote a self-hosting C compiler in 40 days
- How to read C declarations.. say
int *(*func())();-- C Right-Left Rule (Rick Ord's CSE 30 - UC San Diego) -- "func is function returning pointer to function returning pointer to int". - Memory Allocation at samwho.dev -- intuitive visual guide on how memory allocation works step by step.
- Writing a C compiler in 500 lines of Python
- Writing a simple 16 bit VM in less than 125 lines of C | andreinc
Programming Language Theory
- Subtleties of the ANSI/ISO C standard by Robbert Krebbers, Freek Wiedijk of Radboud University Nijmegen.
we argue that the C standard does not allow Turing complete implementations, and that its evaluation semantics does not preserve typing. Finally, we claim that no strictly conforming programs exist. That is, there is no C program for which the standard can guarantee that it will not crash.
Discussions
- Comments on The cost of forsaking C | Hacker News
Safe C
Xr0 is a new verifier for the C programming language that eliminates many classes of undefined behaviour, such as use-after-frees (of which double frees are a special case), dangling and null pointer dereferences, memory leaks and the use of uninitialised memory. Most importantly, we believe Xr0 is on a clear trajectory towards enabling programming in C with no undefined behaviour whatever.
Python Programming Language
My Python Stuff
Meta
Advanced Python
dabeaz-course/python-mastery: Advanced Python Mastery (course by David Beazley)
Books
Fundamentals of Python programming (PDF) -- "... introduction to computer programming textbooks are available in PDF form for free download. University and high school students and self learners around the world have found them helpful. See the terms of use in the preface of each book."
Intermediate Python -- "Fluent python" by Luciano Ramalho.
Learning sources
"This repository contains the text for the Tiny Python 3.6 Notebook. it is a notebook containing curated examples for Python 3 as well as the new features found in Python 3.6."
Internals
Developer Experience (DevEx)
Make Python DevEx -- this is very close to how I choose to do Python development. good read. I don't have such an extensive Makefile setup.
Debugging
- Martin Heinz - "Ultimate Guide to Python Debugging" 2020-06-02. Talks a lot about logging, but there is some interesting bits about using
__repr__and__missing__dunder methods.
Profiling
Scalene: a high-performance, high-precision CPU and memory profiler for Python has interleaved cross-language profiling.
Pyflame: A Ptracing Profiler For Python — Pyflame 1.4.0 documentation
Web
- emmett-framework/granian: A Rust HTTP server for Python applications
- Robyn - An async Python Framework written in Rust.
Multiprocessing
Async
Sublime Text
- Flake8Lint is infuriating but important plugin for sublime text. Flake8 Rules
Alternate Python implementations
To Install Zippy:
hg clone https://bitbucket.org/ssllab/zippy
cd zippy
TBD
Libraries
- Deciphering Glyph :: Python Packaging Is Good Now; August 2016.
- Cookiecutter -- A command-line utility that creates projects from cookie cutters (project templates). See Example using cookie cutter for pandoc presentations.
- Python modules you should know
- 20 Python Libraries You Aren’t Using (But Should) [PDF] by Caleb Hattingh on O'Reilly. (broken link; sep 2024)
- Peep. A "pip install" that is cryptographically guaranteed repeatable
- imutils -- A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.
- The Python Graph Gallery – Visualizing data – with Python
- Getting the Most out of Sqlite3 with Python; See dataset and apsw.
- mahmoud/awesome-python-applications: 💿 Free software that works great, which also happens to be open-source Python.
Data science libraries
- agate 1.6.0 — agate 1.6.0 documentation
- dataset: databases for lazy people
- Python Itertools: For a faster and memory efficient code – Kanoki
Conferences
Python3
- The key differences between Python 2.7.x and Python 3.x with examples
- "the not-so-simple intricacies of Python2->Python3" - oilshell comments on Python 3 and Firefox 57 (an observation)
Pypy
Package management
Python packages with pyproject.toml and nothing else | Simon Willison’s TILs; Jul 2023. Discovered it via My User Experience Porting Off setup.py
Python Project Tooling explained — chobeat; Apr 2019. lobste.rs
- Poetry
- Pipsi
pyenv(polyglot alternate is mise; is a replacement forpyenv,rbenv,asdf,nvm, etc.,)- not mentioned above, but see also
hatchandpdm
Use
twine, andwheel.Follow the packaging tutorial
Use TestPyPi
Short summary of commands:
python setup.py sdist
python setup.py bdist_wheel
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- uv: An Extremely Fast Python Package Manager - YouTube, talk by Charlie Marsh of Astral.sh
Project Managers
Do not use requirements.txt - quanttype -- instead choose Poetry, Hatch or pdm.
Poetry
I have been using poetry for a while.
Poetry uses the
pyproject.tomlstandard, but it does not follow the standard specifying how metadata should be represented in a pyproject.toml file (PEP 621), instead using a custom[tool.poetry]table. This is partly because Poetry came out before PEP 621. -- from pdm's documentation
Hatch
- Standardized build system with reproducible builds by default
- Robust environment management with support for custom scripts
- Easy publishing to PyPI or other indexes
- Version management
- Configurable project generation with sane defaults
- Responsive CLI, ~2-3x faster than equivalent tools
pdm
Unlike Poetry and Hatch, PDM is not limited to a specific build backend; users have the freedom to choose any build backend they prefer.
Links
- Solving the Water Jug Problem from Die Hard 3 with TLA+ and Hypothesis
- Writing beautiful intelligent python -- talk by Raymond Hettinger in Pycon 2015.
- profiling - Python profiler. HN; Aug 2015
- vprof - Visual Profiler; flame charts, memory usage etc.,
- Pyparallel -- "An experimental, proof-of-concept fork of Python 3 designed to optimally exploit multiple CPU cores, fast SSDs, NUMA architectures and 10Gb+ Ethernet networks. Removes the limitation of the Global Interpreter Lock (GIL) without needing to remove it at all."
- Replacing Python: Candidates.
A survey of various languages while keeping these considerations in
mind: speed, binary compatibility, safety, diagnostics, ease of
writing, shared libs, static typing, bounds of privilege, mutability,
C interoperability and asynchronous code. OCaml appears to be the
winner. This is written by the author of
0install. - Setting up Emacs for python development including Pymacs, pyflakes, pep8, python-mode.el, python.el etc.,. Pymacs has detailed documentation (31pp) on their website.
- Python Tips -- Intermediate Python
- Nov 2015; Python for High performance scintific computing (disussion)
- Python: Generators, Coroutines, Native Coroutines and async/await | Abu Ashraf Masnun -Parallelizing a Python Function for the Extremely Lazy - tdhopper.com
- The Little Book of Python Anti-Patterns — Python Anti-Patterns documentation
2019
Via My Python Development Environment, 2020 Edition | Jacob Kaplan-Moss:
Futhark
Futhark is a small programming language designed to be compiled to efficient parallel code. It is a statically typed, data-parallel, and purely functional array language in the ML family, and comes with a heavily optimising ahead-of-time compiler that presently generates GPU code via CUDA and OpenCL, although the language itself is hardware-agnostic and can also run on multicore CPUs. As a simple example, this function computes the average of an array of 64-bit floating-point numbers:
let average (xs: []f64) = reduce (+) 0.0 xs / r64 (length xs)
Futhark is not designed for graphics programming, but instead uses the compute power of the GPU to accelerate data-parallel array computations.
Code in Futhark
2019
Datalog
Introduction to datalog -- Data Integration The Relational Logic Approach by Michael Genesereth
"I See What You Mean" by Peter Alvaro - YouTube -- "From model + proof theory and datalog to dedalus and Bloom: a pledge for logic programming. by palvaro".
Datalog is an inspiration for Open Policy Agent's Rego language. Rego extends Datalog to support structured document models such as JSON.
LogicBlox – Datalog REPL Tutorial | Hacker News -- has a bunch of datalog related links to explore in leisure.
An introduction to Datalog at michelin.io
xtdb-tutorial at nextjournal
Ballerina programming language
"Ballerina" Could Become the Programming Language of Integration - By dhanushka
Ballerina is a static typed language.
Another special type of variable is that “anydata” data type. This type is a union of the ()|boolean|int|float|decimal|string|(anydata|error)[]|map<anydata|error>|xml|table data types. anydata variables can be used in places where you expect pure values.
Since Ballerina specifically designed to construct apps operating on networks, it natively supports JSON and XML.
json user = {
fname: "Peter",
lname: "Stallone",
"age": age,
address: {
line: "20 Palm Grove",
city: "Colombo 03",
country: "Sri Lanka"
}
};
io:println(user.address.country);
xml x1 = xml `<book>The Lost World</book>`;
io:println(x1);
News
Articles
James Clark's blog:
Scala programming language
See Also: Scala for Datascience, ScalaJS, coursier, select-scala
July, 2015 -- Scala book reviews Feb, 2018 -- Recursion and Trampolines in Scala
Random Notes
scala-cli—power repl -S 2.13 -A —ammonite-ver 2.5.11
Notes from Programming in Scala
Chapter 7 - built-in control structures.
- has very few control structures
if while for try matchand function calls.- scala accumulates control structs in libraries.
- use
valinstead ofvarwherever possible. makes it easy to refactor. "equational reasoning". - no
=sign while defining a function => returns aUnitvalue() whileanddo-whileare NOT expressions. they returnUnit.- prefer NOT to use while.
- for
- "generator" syntax --
file <- files. works on all collections. fileis aval.Ranges--1 to 4(yields 1,2,3,4)1 until 4-- exlcude the upper bound (yields 1,2,3)- generators can also include filters --
for (f <- files if f.getName.endsWith('.py')) - nested iteration.
- mid-stream variable bindings
- new collection:
def pyFiles =
for {
file <- files
if file.getName.endsWith('.py')
} yield file
- IMP: don't put
yieldinside the curlies.
Exceptions:
try {
} catch {
case ex: FileNotFoundException => //handle
case ex: IOException => //handle
}
- like other control structures,
try-catch-finallyalso results in a value. (this is unlike Java) //imp
Match:
val fruit =
someArg match {
case "foo" => "bar"
case "banana" => "pepper"
case _ => "what?"
}
Chapter 8- Functions and Closures
First class functions
(x: Int) => x+1
named function:
var increase = (x: Int) => x + 1
- target typing:
someNumbersList.filter((x) => x > 0). the type is inferred from the the list of integers. - alternatively:
someNumbersList.filter(x => x > 0)
Placeholder syntax:
someNumbersList.filter( _ > 0)
val f = (_: Int) + (_: Int)
Chapter 12 -- Traits
Traits are like java interfaces with concrete methods + declare fields and maintain state.
Traits can do everything classes can do, except --
- trait cannot have any clas parameters (ie., those passed to primary constructors).
supercalls are not statically bound.
Unlike Java, adding a concrete method to scala trait is an one-time effort.
Chapter 15 -- Case classes and pattern matching
Notes from "Scala in Action"
Chapter 2 -- Getting started
// working with arrays and Lists
@ val nList = 1 :: 2 :: 3 :: 4 :: Nil
nList: List[Int] = List(1, 2, 3, 4)
@ nList.fil
filter filterNot
@ nList.filter( _ > 2)
res17: List[Int] = List(3, 4)
@ // for comprehensions
@ oldList
res19: List[Int] = List(1, 2)
@ newList
res20: List[Int] = List(1, 2, 3)
@ for { a <- oldList; b <- newList } println (a+b)
2
3
4
3
4
5
@ // above is imperative form
@ // The functional form for comprehension is:
@ // also called the sequence composition
@ for { a <- oldList; b <- newList } yield a+b
res22: List[Int] = List(2, 3, 4, 3, 4, 5)
@ // Pattern Matching
@ val x = 3
x: Int = 3
@ def ordinal(number: Int): Unit = number match {
case 0 => println("One")
case 1 => println("Two")
case 2 => println("Three")
case 3 => println("Four")
case _ => println("what is this?")
}
defined function ordinal
@ ordinal(x)
Four
@ // Pattern Matching Types
@ dBef printType(obj: AnyRef) = obj match {
case s: String => println("This is a string")
case i: java.util.Date => println("This is a Date")
case l: List[_] => println("An array eh?")
case _ => println("dunno who ye are")
}
defined function printType
@ printType(List(1,1,2))
An array eh?
// Guards
@ def numCatcher(num: Int): Unit = num match {
case x if x < 10 => println("Number less than 10")
case y if (y%2 == 0) => println("Is an even number")
}
defined function numCatcher
@ numCatcher(5)
Number less than 10
@ numCatcher(12)
Is an even number
Miscellaneous notes
sbt plays an important role in the day to day programming of scala. I believe 'sbt' stood for "scala build tool" at one time, but is no longer.
To start working on a scala program, you can start with a simple text editor, however using something like IntelliJ IDEA is probably far more productive.
Creating a "project structure" can be automated. Essentially this
boilBs down to creating the build.sbt file, project directory and
optional plugins.sbt file inside it, a scala file inside the proper
src/main/scala/com/example/projectname/ directory etc., There is
little reason to do all this manually, except when you are trying to
understand the reason behind such a recommended directory layout.
giter8 ie., the g8 is a tool that
can create a project structure based on pre-defined
templates. Think
of this as paster tool for Python.
When you have g8 installed, creating a new project (say, a basic
scala project using
this template ),
all you have to do is:
$ g8 fayimora/basic-scala-project.g8
A basic scala project
name [Basic Project]: basic-scala
organization [com.example]: com.btbytes
version [0.0.1]:
Template applied in ./basic-scala
$ cd basic-scala
$ ls
build-sbt src
$ sbt run will download the dependencies defined in the build.sbt
file,B compile source and run the program.
sbt can also create the files necessary to make this an "IntelliJ IDEA
project". For this, we add a dependency to the plugins.sbt file:
#project/plugins.sbt -- add this line
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.6.0")
Running sbt gen-idea will generate the IDEA project files (.idea,
some .iml).
Launch up IDEA and "open project" and open the root directory of the project. You are now set to work on the code.
Packaging the binary to a .jar:
$ sbt packageBin
Will produce target/scala-2.10/basic-scala_2.10-0.0.1.jar (where
basic-scala is the name of the project).
Why not Scala
Concepts
Covariance, Contravariance and Invariance
Reading:
In general, covariant type parameter can be used as immutable field type, method return type and also as method argument type if the method argument type has a lower bound. Because of those restrictions, covariance is most commonly used in producers (types that return something) and immutable types.
Adhoc polymorphism
In this article we discussed the motivation for introducing ad hoc polymorphism and implementing it using the Type Class Pattern in Scala. It allows us to build abstractions which are completely decoupled from the underlying data types on which they operate. Hence we can implement polymorphic functions which operate on types we have no control over, such as types defined in the standard library or some other third party library, without sacrificing the static type safety.
Concurrency (Akka etc.,)
StBreams
- Folding Stream with Scala(2011).
Libraries
- scalaz-stream and related ..
Process[Task, A] - Doobie -- principled database access for scala
- Monix via Travis Brown on twitter for "exceptionally good documentation"
- Easy Parsing with Parser Combinators HN
- ConsBcript is a distribution mechanism for Scala apps using Github and Maven repositories as the infrastructure. You can use it to install and update apps similar to APT or Home Brew.
- Knobs Documentation - Home
Tools
- lihaoyi/Ammonite: Scala Scripting. Ammonite enables shell-like scripting in the Scala programming language.
- Conscript -- is a tool for installing and updating Scala software programs.
- giter8 -- is a command line tool to generate files and directories from templates published on github or any other git repository.
SBT
sbt the easy way -- with example configurations.
sbt baby steps [Feb 2018]. SBT, scopes, proxy and so on
Ensime -- Enhanced Scala
Interaction Mode for Emacs.
Talks
- Compositionality talk by Runorama.
Articles
- 16 months of FP (with scala examples).
- Scala’s Types of Types
- Generalized type constraints in Scala
- Scala Saturday: Functions for the Object-Oriented – Medium -- a beginner overview of some scala features (eg: how apply works).
- Why? by Paul Snively.
- Transitioning to Scala – RedElastic (notes on "Scala levels" as espoused by Odersky.)
- Warts of the Scala Programming Language
- When the Scala compiler doesn't help
Blogs
- Bcomposes | (Scala, Java, Python, R)
- Just another scala quant
- Vladimir Pavkin – Scala developer at Evolution Gaming
- alexn.org creator of Monix. see Asynchronous Programming and Scala
- Julien Richard-Foy -- play, category-theory examples, dependency injection etc.,
- Timothy Perrett
- Blog Archive | Madusudanan -- scala posts.
Libraries
- kantan.csv has good documentation/tutorials.
- Quill Quoted Domain Specific Language (QDSL) to express queries in Scala and execute them in a target language. The library’s core is designed to support multiple target languages, currently featuring specializations for Structured Query Language (SQL) and Cassandra Query Language (CQL).
REPL
Ammonite REPL is much more featureful than the default REPL and comes with a lot of ergonomic improvements and configurability that may be familiar to people coming from IDEs or other REPLs such as IPython or Zsh.
Links
- Cheatsheet - Idiomatic Scala: Your Options Do Not Match - Originate Developer Blog
- Scala Starter Kit
- Essential Scala
- Code examples for "Programming in Scala" book by Odersky
- Scala Exercises | The easy way to learn Scala
- λ Tony's blog λ - scala.Option Cheat Sheet
- Scala jargon – Bonnie Eisenman
Scalajs
- From first principles: Why I bet on Scala.js
- vmunier/play-with-scalajs-example: Example application showing how you can integrate Play with Scala.js.
Scala Native
- Hands On Scala Native
- Stephen M. Blackburn and Kathryn S. McKinley. 2008. Immix: a mark-region garbage collector with space efficiency, fast collection, and mutator performance. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI '08). ACM, New York, NY, USA, 22-32. [PDF].
- Fast startup and low latency - pick two [PDF] by Denys Shabalin and Lukas Kellenberger.
- Scala 0.3.0 announcement
Scala CLI
With scala-cli, it is quite easy to package a scala program into a standalone program:
scala-cli --power package --native-image Echo.scala -o echo -- --no-fallback
where Echo.scala is:
object Echo {
def main(args: Array[String]): Unit =
println(args.mkString(" "))
}
$ ls -alrt echo
-rwxr-xr-x@ 1 pradeep staff 14120984 Aug 23 17:15 echo
$ du -sh echo
13M echo
Books
- Overview of Apache Spark · Mastering Apache Spark 2 (Spark 2.2+) by jace klaskowski
- Introduction · Mastering Apache Kafka (0.11.0.1+) by jace klaskowski
- Introduction · Spark Structured Streaming (Apache Spark 2.2+) by jace klaskowski
Tutorials
- Learn Scala in Y Minutes
- The Neophyte's Guide to Scala - Daniel Westheide
- bhoward/IndyScala Notebooks for the Scala Primer presentation to the Indy Scala meetup, September 2016.
- Mark Lewis - YouTube tutorials on Scala and programming. Dr. Lewis's Homepage
- From Python to Scala: A Tutorial - Cristian Cardellino
Indyscala notes
Feb 6, 2017 -- Resource management in Scala
Presenter -- Ross A. Baker
- tut - Underscore
- atomic boolean in
- codensity == FManaged
- presentation code
May 1, 2017
- Brad Fritz -- Introduction to Scala Type Classes
- Ross A. Baker -- []
Mercury Programming Language
Mercury combines (predicate) logic programming and one of the more rigorous type systems to give a programming language that is declarative, efficient and consistent.
- Logical Types, LLC (Douglas Auclair) uses the Mercury programming language to develop and deliver rule-based system to clients.
-- Good explanation of Mercury syntax by Markus Triska, a prolog programmer; Apr 2019.
- Mercury Crash Course, now also has package index.
Racket Programming Language
- Beautiful Racket how to make your own programming languages with Racket—and why by Matthew Butterick
- Learning Racket #1: Introduction
- Racket Workflow
- Setting up emacs for Racket (and PL course on Coursera).
- Search Manuals
Libraries
- Video Language -- "Video is a language for making movies. It combines the power of a traditional video editor with the capabilities of a full programming language."
Articles
- Racket: The Lisp for the modern day - by Diego Crespo
- Extramaze LLC: Using Racket, PostgreSQL, AWS (but no ads or JS)
- Posts tagged 'racket' by Alex Harsányi.
Code
- Pointers in Racket by @samth.
Exciting
- willghatch/racket-rash: The Reckless Racket Shell This is the most I have been excited to learn Racket.
Videos
My notes
- Racket cannot pin version dependencies yet. Does common-lisp have the same issue? Is it a Lispism?
2018
Logic Programming
To Read:
- Sterling and Shapiro (Sterling and Shapiro 1986) is often recommended as the introductory text to Logic Programming.
- Nominal Logical Programming (Cheney and Urban 2008) -- is an extension of first-order logic which provides a simple foundation for formalizing and reasoning about abstract syntax modulo consistent renaming of bound names (that is, alpha-equivalence). "powerful tool for informal reasoning about theoretical computer science. For me it made theoretical computer science tangible, and I hope these series of posts can do the same for the reader." -- swannodette
- miniKanren -- is an embedded Domain Specific Language for logic programming. See also: Will Byrd's Thesis -- Relational Programming in miniKanren: Techniques, applications and implementations (Byrd 2010).
- For real world applications of logic programming see -- Concepts, Techniques, and Models of Computer Programming by Roy, Haridi and Seif (Van Roy and Haridi 2004).
Software
- logic-db is a js lib to combine logic programming and database
Misc
- Datalog 2.0 workshop --for Datalog pioneers, implementors, and current practitioners.
References
- Sterling, Shapiro (1986). The Art of Prolog: Advanced Programming Techniques.
- Cheney, Urban (2008). Nominal Logic Programming.
- Byrd (2010). Relational Programming in Minikanren: Techniques, Applications, and Implementations.
- Van Roy, Haridi (2004). Concepts, Techniques, and Models of Computer Programming.
Julia programming language
Learning
Blog Posts
- A Lisper's first impression of Julia | HN
- From Common Lisp to Julia, and a response - Why not: from Common Lisp to Julia
Comparisons
2020-06-03 A Look at Chapel, D, and Julia Using Kernel Matrix Calculations – The D Blog; Julia comes out ahead in performance. Even handed comparison on Dlang's website.
Books/Tutorials
IDE/tools
Juno -- programming environment for Julia based on Light Table.
Important information
- Julia C++ FFI announcement.
J programming language
J programming language
Pete Corey - J's Low-level Obfuscation Leads to Higher Levels of Clarity [Mar 2018]
mlochbaum/ILanguage: An interpreter for a J-inspired language. The examples directory has some literate code examples of I in action ILanguage/fibonacci.md. paper. via
An implementation of J (pdf) - "Roger Hui's presentation to the British APL Association on 12 February 1993".
Essays/Incunabulum - J Wiki The "one-page" interpreter.
Code
- tikkanz; Example -- adventofcode, rosetta_code
Blogs
People
ATS Lang
What is ATS?
- ATS is created by Hongwei Xi
- Why ATS? from a thread titled "What is the goal of ATS".
- ATS/LF for Coq users -- presentation by Kiwamu Okabe [Sep 2015].
Learning
- The Joy of ATS 1: Installing ATS -- "the first in a series of ats tutorials on how to install ats on *nix operating systems."
- The Joy of ATS 2: A Simple Game -- "writing your first lines of code in ats."
- Many blog posts by Chris Double (bluishcoder.co.nz/@doublec)
- and Vanessa McHale's ATS blog posts
Programs written in ATS
- vmchale/polyglot: Tool to count lines of source code.
- galletti94/magnificATS: Collection of ATS goodness
- ats-lang/ATS-CodeBook : This repository contains coding examples of all sorts written in ATS and possibly other programming languages. These examples are primarily meant as recipes for people interested in learning ATS as well as using it to construct software for use in the real world.
Talks
- Effective Programming - Introduction to functional programming by Lance Galletti
Blog posts
Vala Programming Language
STATUS: No longer Maintained.
Vala is a C# | Java like langauge that compiles down to C+glibc. Used heavily for developing gnome desktop applications. Before I discovered D (and to certain extent nim), I had hoped that Vala would be a nice compiled langauge to use. However, the community of Vala appears to not care beyond desktop applications.
- Instructions to install Vala from source
ML programming language
- An exhaustive set of links related to ML
- Of interest: Unix system programming in Standard ML by Anthony Shipman.
- C&C - A Crash Course on ML Modules; HN
Implmenting an ML style langauge:
- MinCaml: A Simple and Efficient Compiler for a Minimal Functional Language Eijiro Sumii, 2005.
- The Zinc experiment: An economical implementation of the ML language Xavier Leroy, 1990.
- A few papers on Caml
Factor Programming language
Factor is a stack based language, and is a forth
About
- Documentation -- also accessible via Factor UI.
- Slava Pestov -- blog of Slava Pestov, the creator of Factor Language. Slava is also a developer with Apple (as of 2015), working on the Swift programming language.
- Planet Factor -- Factor related blogs aggregator.