Skip to content

Commit

Permalink
Continue to remove old permutations code
Browse files Browse the repository at this point in the history
  • Loading branch information
decal committed Jan 21, 2019
1 parent 5cc4ee9 commit 48c4007
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ OBJ := ${SRC:.scm=.go}

.SILENT: OBJ

#export GUILE_AUTO_COMPILE=1
export GUILE_AUTO_COMPILE=1
#export GUILE_LOAD_PATH="${CURDIR}"

all: ${SRC} compile
Expand Down Expand Up @@ -74,7 +74,7 @@ install: envrc
@echo
@echo 'This can be accomplished with:'
@echo
@echo 'cat ~/.envrc >> ~/.bashrc'
@echo 'cat ~/.envrc >> ~/.profile'
@echo
@echo 'You can execute those export statements to update your current shell process environment via:'
@echo
Expand Down
4 changes: 2 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* check files for useless use of `use-modules`

* use `guile-coroutines` for `lazy-flatten`

* support date string formatting
Expand Down Expand Up @@ -37,8 +39,6 @@

* implement derangements as set operation in addition to `power-set`, `n-choose-r`, etc.

* accept a command-line flag for each expansion type (and create useful groups of these)

* string insertion features
1. prefixes
- prepend period for "hidden" paths
Expand Down
19 changes: 19 additions & 0 deletions assets/github-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions assets/macos-linux.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions pathgro/base/path-combos.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#:use-module (ice-9 common-list))

(use-modules (pathgro base combine-paths) (pathgro base path-strings))
(use-modules (pathgro util stdio) (pathgro util clean-list))
(use-modules (pathgro util permute-list) (pathgro util clean-list))

(define (combos m lst)
(cond ((zero? m) '(()))
Expand All @@ -13,7 +13,7 @@

(define (path-combos cdepth cfiles dirns)
(letrec*
((aset (drop-length cdepth (combos cdepth dirns)))
((aset (drop-length cdepth (permute-list (combos cdepth dirns))))
(amap (map join-path aset))
(apls (clean amap)))
(append apls (combine-paths-helper apls cfiles))))
4 changes: 2 additions & 2 deletions pathgro/base/path-powerset.scm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(define-module (pathgro base path-powerset)
#:export (path-powerset))

(use-modules (pathgro base path-combos))
(use-modules (pathgro base path-combos) (pathgro util permute-list))

(define (path-powerset acount pdepth cfiles dirns)
(if (> acount pdepth)
'()
(append (path-combos acount cfiles dirns) (path-powerset (+ 1 acount) pdepth cfiles dirns))))
(append (permute-list (path-combos acount cfiles dirns)) (path-powerset (+ 1 acount) pdepth cfiles dirns))))
2 changes: 1 addition & 1 deletion pathgro/help.scm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
(display " ")
(display (colorize-string "-e, --extname" 'BLACK 'ON-GREEN 'BOLD 'UNDERLINE))
(display " ")
(display (colorize-string "output file extensions with no basenames and no directory names" 'MAGENTA))
(display (colorize-string "output file extensions without base and directory names" 'MAGENTA))
(newline)
(display " ")
(display (colorize-string "-n, --noslash" 'BLACK 'ON-GREEN 'BOLD 'UNDERLINE))
Expand Down
8 changes: 4 additions & 4 deletions pathgro/util/clean-list.scm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
(delete-duplicates!
(flatten l)))

(define (empty-string-list? alist)
(if (null? alist)
alist
(and (= 1 (length alist)) (eq? (car alist) ""))))
;(define (empty-string-list? alist)
; (if (null? alist)
; alist
; (and (= 1 (length alist)) (eq? (car alist) ""))))
3 changes: 2 additions & 1 deletion pathgro/version.scm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#:export (display-version))

(use-modules (pathgro util ansi-color))
;(use-modules (pathgro util stdio))

(define (display-version)
(newline)
Expand Down Expand Up @@ -38,10 +37,12 @@
(display (colorize-string "com" 'WHITE 'ON-RED 'BOLD 'REVERSE 'UNDERLINE))
(display (colorize-string "]" 'YELLOW 'BOLD))
(newline)
(newline)
(display (colorize-string "This program comes with ABSOLUTELY NO WARRANTY. It is free software and you are welcome to redistribute it" 'RED))
(newline)
(display (colorize-string "under certain conditions. See the COPYING.txt file in the root directory of the source repository for details." 'RED))
(newline)
(newline)
(display (colorize-string "https://github.com/decal/pathgro" 'BOLD 'REVERSE 'UNDERLINE))
(newline)
(newline)
Expand Down
8 changes: 8 additions & 0 deletions scripts/single-symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
#
# Find procedure identifiers that only occur once so they can be removed from the source tree
#

for aproc in $(find pathgro -type f -name '*.scm' -exec egrep -Hrna '[(][[:space:]]*define[[:space:]]+' {} \; | awk -F\) '{print$1}' | cut -d ' ' -f2 | tr -d '[(]' | sort -u);do declare -i instanceCount=$(egrep -Hrna -- "$aproc" pathgro | wc -l);[ $instanceCount -eq 1 ] && echo "$aproc" && egrep -Hrna -- "$aproc" pathgro;done

exit 0

0 comments on commit 48c4007

Please sign in to comment.