IRC channel logs
2023-08-10.log
back to list of logs
<apteryx>'any' is a more general 'find', is it? <RhodiumToad>any returns the result of the predicate, find returns the list element <RhodiumToad>(any even? '(1 2 3)) => #t, (find even? '(1 2 3)) => 2 <apteryx>(any (lambda (x) (and (even? x) x)) '(1 2 3)) => 2, (find even? '(1 2 3)) <RhodiumToad>finding a value of #f in a list that way can be hard :-) <RavenJoad>Does guile have a procedure for getting a file's extension? I found basename to get the file's base name, but I am unsure how to get the extension beyond getting the final element of a string-split on the period. <RhodiumToad>(and=> (and=> (string-index-right fn #\.) 1+) (cut string-drop fn <>)) <RhodiumToad>(and-let* ((pos (string-index-right fn #\.)) (dlen (1+ pos)) (ext (string-drop fn dlen))) ext) <RhodiumToad>(and-let* ((pos (string-index-right fn #\.))) (string-drop fn (1+ pos))) <apteryx>how do I delete a breakpoint at the REPL? <apteryx>OK, I think it was in some nested state and confused; exiting to the top level things look saner <apteryx>the debugger is hard to use (it's hard to see where we are/the context), but tracing is helpful <rlb>RhodiumToad: suppose you could also use basename and then drop that many chars from the original. <rlb>(if the basename algorithm is suitable for you) <RhodiumToad>basename only removes the extension if you specify it? and it removes dirs <apteryx>interesting, tracing gives me an error, while evaluating normallly is fine: In procedure primitive-call-ip: Wrong type argument in position 1 (expecting PRIMITIVE_P): #<procedure 7faca22aa760 (_ _ _ _)> <RavenJoad>RhodiumToad: Right, my bad. I w2ill take one of your three suggestions and throw it in a function that returns the file's extension. <RavenJoad>Is (apply execl `(...)) or (execl ...) more idiomatic? <RhodiumToad>where's the list coming from? if it's being formed purely to make the call, then use (execl ...) <RhodiumToad>apply is generally for when you have an existing list and want to pass it as separate args <RavenJoad>Right now it is (execl "/path/to/highlight" "highlight" "--force" ... file-to-highlight).