Skip to content

Instantly share code, notes, and snippets.

View digikar99's full-sized avatar

Shubhamkar Ayare digikar99

View GitHub Profile
@digikar99
digikar99 / cl-numericals-survey.org
Last active April 4, 2023 01:42
A Survey of Simple Vector Addition Performance of the Numerical Computing Libraries available in Common Lisp

A Survey of Simple Vector Addition Performance of the Numerical Computing Libraries available in Common Lisp

Help with the following systems is required: CL-BLAPACK, MAXIMA, GSLL, XECTO

ImplementationQuicklispSpeed
ARRAY-OPERATIONSNativeMedium
AVMNative, CudaMedium
CLEMNativeSlow
@digikar99
digikar99 / learn-from-lisp.md
Last active January 18, 2023 03:12
This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’ published on Medium

Lisp may not be the best language for Data Science, but what can we still learn from it?

This article is in response to Emmet Boudreau’s article ‘Should We be Using Lisp for Data-Science’.

Below, unless otherwise stated, lisp refers to Common Lisp; in general, lisp refers to the lisp family of languages, just like the C-family of languages. There are functional lisps like Clojure and Scheme, and there are general purpose lisps such as Common Lisp and Racket.

The primary hurdle to using Lisp for Data Science, I believe, is the non-infix syntax common in mathematics.

But, is there anything to learn from its syntax?

@digikar99
digikar99 / lisp-resources-digikar-2020.md
Last active November 9, 2023 04:35
If programming is more than just a means of getting things done for you, then Common Lisp is for you!
@digikar99
digikar99 / deep-copy.lisp
Last active July 4, 2023 16:54
Common Lisp Deep Copy
;; Jump to line 99
;; This is incomplete; follow the TODOs and think more to complete
(defpackage :deep-copy
(:use
:adhoc-polymorphic-functions
:cl
:alexandria)
(:local-nicknames (:cm :sandalphon.compiler-macro)
(:mop :closer-mop))
@digikar99
digikar99 / lispy-numerical-computing-library-features.org
Last active December 12, 2023 01:37
A comparison and wish-list of features for a Common Lispy approach to a (better) Numpy

Features of a Common Lispy approach to (better) Numpy

Numpy is great, in fact it’s one of the things that pulls people to Python. But can it be better?

Common Lisp is great, in fact it’s one of the things that pulls people to Common Lisp. But can it be better? Indeed Python can’t be better than Common Lisp without it becoming another Lisp. The closest we have is Julia. And while it gets some things right, Julia lacks certain features that limit the goodness of a numerical computing library.

All combined, below I will highlight some of the features that I wish a numerical computing library or ecosystem had. I also want to request the readers for their own inputs about how things can be even better. The goal amidst this is solely to keep things numpy-like. I do not intend to - nor have the background to - make a DSL like April or Petalisp.

While I take some interest in performance and numerical computing, I have m

sb-simd: Multiplying a 4x4 matrix with a 4-length vector (AVX)

(require 'sb-simd)
(defpackage :simd-pack-user
  (:use :sb-simd-avx :cl))
(in-package :simd-pack-user)

I'm assuming you are referring to the following operation:

Why not: from Common Lisp to Julia

This article is a response to mfiano’s From Common Lisp to Julia which might also convey some developments happening in Common Lisp. I do not intend to suggest that someone coming from a Matlab, R, or Python background should pickup Common Lisp. Julia is a reasonably good language when compared to what it intends to replace. You should pickup Common Lisp only if you are interested in programming in general, not limited to scientific computing, and envision yourself writing code for the rest of your life. It will expand your mind to what is possible, and that goes beyond the macro system. Along the same lines though, you should also pickup C, Haskell, Forth, and perhaps a few other languages that have some noteworthy things to teach, and that I too have been to lazy to learn.

/I also do not intend to offend anyone. I’m okay with criticizing Common Lisp (I myself have done it below!), but I want t

@digikar99
digikar99 / parametric polymorphism == trivia + exct + polymorphic-functions.lisp
Last active December 20, 2022 23:32
Again, I don't understand if this is what true parametric polymorphism is about. But this seems interesting none-the-less.
(in-package :polymorphic-functions)
(defun parametric-type-run-time-lambda-body (type-car type-cdr type-parameter)
(with-gensyms (object)
(let ((type-pattern (traverse-tree `(,type-car ,@type-cdr)
(lambda (node)
(cond ((eq node type-parameter)
type-parameter)
((and (symbolp node)
(parametric-type-symbol-p node))
@digikar99
digikar99 / cltl2-define-modify-macro.lisp
Created April 4, 2023 16:29
Type Declaration Propagating DEFINE-MODIFY-MACRO for INCF and DECF that play nice with CLTL2
(defun macroexpand-until (predicate form &optional env)
"Calls MACROEXPAND-1 on FORM until it is (FUNCALL PREDICATE FORM) returns non-NIL"
(loop :until (funcall predicate form)
:for expansion := (macroexpand-1 form env)
:do (setq form expansion)
:finally (return form)))
(defun macroexpand-until-car (car form &optional env)
"Calls MACROEXPAND-1 on FORM until it is a list which
starts with the symbol specified by CAR"
@digikar99
digikar99 / ubuntu-2204.org
Last active August 9, 2023 21:05
Ubuntu 22.04 customization reference for myself

Ubuntu 22.04 Customization

It’s been almost 4 years since my last linux OS upgrade. Last time it was Ubuntu 18.04, this time it is Ubuntu 22.04. Unfortunately, I do a lot of customization which can take plenty of post-installation time. This is one such list made primarily for self-reference later; it’d probably still be incomplete since I’m relying on memory.

Contents