Support prelude.lisp
Using this module to support utility functions that I have not classified further than being miscellaneous.
This commit is contained in:
		
							parent
							
								
									b6fa3941b3
								
							
						
					
					
						commit
						95d03facb3
					
				
					 3 changed files with 22 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -1,15 +0,0 @@
 | 
			
		|||
(in-package #:cl-user)
 | 
			
		||||
(defpackage #:utils
 | 
			
		||||
  (:documentation "Some utility functions and macros to wet my beak.")
 | 
			
		||||
  (:use #:cl)
 | 
			
		||||
  (:shadow #:type))
 | 
			
		||||
(in-package #:utils)
 | 
			
		||||
 | 
			
		||||
(defmacro type (name in out)
 | 
			
		||||
  `(declaim (ftype (function ,in ,out) ,name)))
 | 
			
		||||
 | 
			
		||||
(defmacro comment (&rest _forms) nil)
 | 
			
		||||
 | 
			
		||||
(type add (int int) int)
 | 
			
		||||
(defun add (a b)
 | 
			
		||||
  (+ a b))
 | 
			
		||||
							
								
								
									
										14
									
								
								lisp/prelude.lisp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								lisp/prelude.lisp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
(in-package #:cl-user)
 | 
			
		||||
(defpackage #:prelude
 | 
			
		||||
  (:documentation "Supporting miscellaneous utility functions and macros.")
 | 
			
		||||
  (:use #:cl)
 | 
			
		||||
  (:shadow #:type)
 | 
			
		||||
  (:export #:type #:comment))
 | 
			
		||||
(in-package #:prelude)
 | 
			
		||||
 | 
			
		||||
;; TODO: Add documentation to these macros.
 | 
			
		||||
 | 
			
		||||
(defmacro type (name in out)
 | 
			
		||||
  `(declaim (ftype (function ,in ,out) ,name)))
 | 
			
		||||
 | 
			
		||||
(defmacro comment (&rest _forms) nil)
 | 
			
		||||
							
								
								
									
										8
									
								
								lisp/prelude.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								lisp/prelude.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
{ depot ? import <depot> {}, ... }:
 | 
			
		||||
 | 
			
		||||
depot.nix.buildLisp.library {
 | 
			
		||||
  name = "prelude";
 | 
			
		||||
  srcs = [
 | 
			
		||||
    ./prelude.lisp
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue