From 01ef5ffab82e3cfaf64dba23a970e99f67b84fdb Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 31 Mar 2021 18:27:25 +0530 Subject: add day 15, 16 of devlog --- posts/SDL2_devlog.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'posts') diff --git a/posts/SDL2_devlog.md b/posts/SDL2_devlog.md index 4605b91..72aedef 100644 --- a/posts/SDL2_devlog.md +++ b/posts/SDL2_devlog.md @@ -5,6 +5,43 @@ on the editor. The days are listed in reverse chronological order, begin from the bottom, if this is your first time on this page. +### Day 16 + +The embedded lisp is coming along nicely, users can load +a custom `rc.lisp`, which is evaluated on startup. To +disable to grid on start, for example: + +```scheme +;;; rc.lisp +(toggle-grid) +``` + +Some aliases to switch between brushes: + +```scheme +;;; rc.lisp +(define (brush kind) + (cond + ((eq? kind 'f) (brush-fill)) + ((eq? kind 'c) (brush-circle)) + ((eq? kind 'l) (brush-line)) + ((eq? kind 'l+) (brush-line-extend)) + (else (brush-circle)))) +``` + +### Day 15 + +I began writing a standard library for the lisp, in lisp. It +includes basic list operations: `car`, `cdr`, `null?`, +`list`, higher order functions: `map`, `filter`, `fold`: + +```lisp +(define (member? item ls) + (fold #f + (lambda (acc x) (or acc (eq? item x))) + ls)) +``` + ### Day 14 I attempted a [small art -- cgit v1.2.3