Thanks!
Yeah, since broot is a full featured file navigator and operator, you can get anywhere once it's launched. I have alt+up bound to go up a directory, but there are other ways to get around as well.
Broot supports fish out of the box, and you can use its default fish launcher function to change your folder (alt+enter quits broot then performs a cd) or insert a path (the broot command pp quits broot then prints the path, like fzf).
I never learned fish scripting, but if anyone here has they may try to port my Zsh functions, especially to get path completion for partially typed paths. If you're doing that and have questions about the broot config side of the equation, I'm happy to try to help.
For Arch, you may like a project called aconfmgr.
Haha it's all good, but it sounds like selling the house to avoid cleaning a table.
Honestly that sounds good to me, but not everyone configures their own preferred fonts, so it may not be a crowd pleaser. It's not too bad for me to just override the style on my side.
I had a look and it can be set by setting font-family inside the .hljs block within the theme (e.g. atom-one-dark.css).
I'm not really happy with the repetition I have, but here's my Factor solution:
Here it is on GitHub with comments and imports.
: part1 ( -- )
"vocab:aoc-2023/day01/input.txt" utf8 file-lines
[
[ [ digit? ] find nip ]
[ [ digit? ] find-last nip ] bi
2array string>number
] map-sum .
;
MEMO: digit-words ( -- name-char-assoc )
[ "123456789" [ dup char>name "-" split1 nip ,, ] each ] H{ } make
;
: first-digit-char ( str -- num-char/f i/f )
[ digit? ] find swap
;
: last-digit-char ( str -- num-char/f i/f )
[ digit? ] find-last swap
;
: first-digit-word ( str -- num-char/f )
[
digit-words keys [
2dup subseq-index
dup [
[ digit-words at ] dip
,,
] [ 2drop ] if
] each drop !
] H{ } make
[ f ] [
sort-keys first last
] if-assoc-empty
;
: last-digit-word ( str -- num-char/f )
reverse
[
digit-words keys [
reverse
2dup subseq-index
dup [
[ reverse digit-words at ] dip
,,
] [ 2drop ] if
] each drop !
] H{ } make
[ f ] [
sort-keys first last
] if-assoc-empty
;
: first-digit ( str -- num-char )
dup first-digit-char dup [
pick 2dup swap head nip
first-digit-word dup [
[ 2drop ] dip
] [ 2drop ] if
nip
] [
2drop first-digit-word
] if
;
: last-digit ( str -- num-char )
dup last-digit-char dup [
pick 2dup swap 1 + tail nip
last-digit-word dup [
[ 2drop ] dip
] [ 2drop ] if
nip
] [
2drop last-digit-word
] if
;
: part2 ( -- )
"vocab:aoc-2023/day01/input.txt" utf8 file-lines
[ [ first-digit ] [ last-digit ] bi 2array string>number ] map-sum .
;
Factor on github (with comments and imports):
: symbol-indices ( line -- seq )
[ ".0123456789" member? not ] find-all [ first ] map
;
: num-spans ( line -- seq )
>array [ over digit? [ nip ] [ 2drop f ] if ] map-index
{ f } split harvest
[ [ first ] [ last ] bi 2array ] map
;
: adjacent? ( num-span symbol-indices -- ? )
swap [ first 1 - ] [ last 1 + ] bi [a,b]
'[ _ interval-contains? ] any?
;
: part-numbers ( line nearby-symbol-indices -- seq )
[ dup num-spans ] dip
'[ _ adjacent? ] filter
swap '[ first2 1 + _ subseq string>number ] map
;
: part1 ( -- )
"vocab:aoc-2023/day03/input.txt" utf8 file-lines
[ [ symbol-indices ] map ] keep
[
pick swap [ 1 - ?nth-of ] [ nth-of ] [ 1 + ?nth-of ] 2tri
3append part-numbers sum
] map-index sum nip .
;
: star-indices ( line -- seq )
[ CHAR: * = ] find-all [ first ] map
;
: gears ( line prev-line next-line -- seq-of-pairs )
pick star-indices
[ 1array '[ _ part-numbers ] [ 3dup ] dip tri@ 3append ]
[ length 2 = ] map-filter [ 3drop ] dip
;
: part2 ( -- )
"vocab:aoc-2023/day03/input.txt" utf8 file-lines
dup [
pick swap [ 1 - ?nth-of ] [ 1 + ?nth-of ] 2bi
gears [ product ] map-sum
] map-index sum nip .
;
Leaving traffic safety to human police, discretion often means racist biases and outcomes.
It's honestly excellent. Very capable yet doesn't complicate things beyond "it's git" unless you want to check out a fancy feature.
It's already elsewhere in this thread but Niagara launcher is fantastic and worth a try.
Factor!