Skip to content

Commit

Permalink
extsym and stdstr features
Browse files Browse the repository at this point in the history
  • Loading branch information
inconvergent committed Jun 11, 2024
1 parent 6a4fa2d commit 7a994b8
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
22 changes: 22 additions & 0 deletions docs/lqn.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@
; t if l is empty; or d
; Source file: /data/x/lqn/src/basic-utils.lisp
```
```
; LQN:EXTSYM?
; [symbol]
;
; EXTSYM? names a compiled function:
; Lambda-list: (&OPTIONAL (PKG LQN) DEFAULT &AUX
; (PKG (FIND-PACKAGE PKG)))
; Derived type: (FUNCTION (&OPTIONAL T T) (VALUES T &OPTIONAL))
; Documentation:
; list external symbols of package
; Source file: /data/x/lqn/src/init.lisp
```
```
; LQN:FILE?
; [symbol]
Expand Down Expand Up @@ -1018,6 +1030,16 @@
; s if sym, not kw; or d
; Source file: /data/x/lqn/src/basic-utils.lisp
```
```
; LQN:STDSTR
; [symbol]
;
; STDSTR names a macro:
; Lambda-list: (BODY)
; Documentation:
; trap stdout as string.
; Source file: /data/x/lqn/src/io.lisp
```
```
; LQN:STR!
; [symbol]
Expand Down
4 changes: 2 additions & 2 deletions lqn.asd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(asdf:defsystem #:lqn
:description "Lisp Query Notation"
:version "2.1.0"
:version "2.1.1"
:author "anders hoff / @inconvergent / inconvergent@gmail.com"
:in-order-to ((asdf:test-op (asdf:test-op #:lqn/tests)))
:licence "MIT" :pathname "src/" :serial nil
Expand All @@ -19,7 +19,7 @@

(asdf:defsystem #:lqn/tests
:depends-on (#:lqn #:prove #:uiop #:asdf)
:version "2.1.0"
:version "2.1.1"
:perform (asdf:test-op (o s) (uiop:symbol-call ':lqn-tests '#:run-tests))
:pathname "test/" :serial t
:components ((:file "run")))
4 changes: 4 additions & 0 deletions src/init.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
(abbrev mvc multiple-value-call) (abbrev mvl multiple-value-list)
(abbrev vpe vector-push-extend) (defmacro vex (v o) `(vpe ,o ,v))

(defun extsym? (&optional (pkg "LQN") default &aux (pkg (find-package pkg)))
"list external symbols of package"
(if pkg (loop for s being the external-symbols of pkg collect s) default))

(defmacro λ (&rest rest) `(lambda ,@rest))
(defun internal-path-string (&optional (path "") (pkg :lqn)) (declare (string path))
(namestring (asdf:system-relative-pathname pkg path)))
Expand Down
2 changes: 2 additions & 0 deletions src/io.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ as alists. see ldnload."
(format *standard-output* "~&~a~&" ,s*))))))
(defmacro fmt (s &rest rest) "format to string."
(if rest `(format nil ,s ,@rest) `(format nil "~a" ,s)))
(defmacro stdstr (body) "trap stdout as string."
`(with-output-to-string (*standard-output*) ,body))

(defun nstr (n &optional (c #\Space)) "str of length n, filled with c"
(make-string n :initial-element c))
Expand Down
4 changes: 2 additions & 2 deletions src/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
(:nicknames #:cl-lqn)
(:export #:d? #:v?
#:qry #:qrydb #:qryd #:jsnqryf #:qryl #:proc-qry
#:jsnloads #:jsnloadf #:jsnout #:ldnout #:ldnload #:fmt #:out #:jsnstr #:@* #:@get #:??
#:jsnloads #:jsnloadf #:jsnout #:ldnout #:ldnload #:fmt #:out #:stdstr #:jsnstr #:@* #:@get #:??
#:read? #:some? #:none? #:all? #:empty? #:size? #:is?
#:path? #:subdir #:subfiles #:ls #:dir? #:file? #:cwd #:now #:cmd
#:some? #:all? #:none? #:cd #:keys?
#:new* #:new$ #:cat$ #:cat* #:head #:tail #:apply* #:range #:linspace #:psh* #:pop*
#:flatn* #:compct #:flatall* #:flatn$ #:uniq
#:noop #:kv? #:kw? #:ssym? #:msym? #:trim #:sym! #:kw!
#:noop #:kv? #:kw? #:ssym? #:msym? #:trim #:sym! #:kw! #:extsym?
#:num!? #:num? #:flt! #:flt!? #:flt? #:int! #:int!? #:int?
#:lst? #:lst! #:lst!? #:seq? #:seq!? #:str! #:str? #:str!? #:vec! #:vec? #:vec!?
#:ind* #:sel #:seq
Expand Down

0 comments on commit 7a994b8

Please sign in to comment.