Deutsch English Français Italiano |
<vc4sp8$1m02t$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "B. Pym" <Nobody447095@here-nor-there.org> Newsgroups: comp.lang.lisp,comp.lang.scheme Subject: Re: Poll: StudlyChallenge Date: Sat, 14 Sep 2024 20:47:37 -0000 (UTC) Organization: A noiseless patient Spider Lines: 44 Message-ID: <vc4sp8$1m02t$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Injection-Date: Sat, 14 Sep 2024 22:47:38 +0200 (CEST) Injection-Info: dont-email.me; posting-host="f2477dd8f5f86e6d1f3e8deefdebd6cb"; logging-data="1769565"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vtemwCNJcs4eX4lR3oHcB" User-Agent: XanaNews/1.18.1.6 Cancel-Lock: sha1:fA+8UHcrPRhBowSt6b2GhQUVo+Q= Bytes: 1921 Kenny Tilton wrote: > (defun lisp-fn (n$ &aux ln) > (dotimes (n (length n$) (intern (coerce (nreverse ln) 'string))) > (let ((c (elt n$ n))) > (when (and (upper-case-p c) > (or (lower-case-p (elt n$ (1- n))) > (lower-case-p (elt n$ (1+ n))))) > (push #\- ln)) > (push (char-upcase c) ln)))) > > > (lisp-fn "sTuDlYcApS") > S-TU-DL-YC-AP-S Gauche Scheme (use srfi-13 :only (string-downcase string-trim)) (define (de-stud name) ;; Clojure-style threading or pipelining. (-> name ((swap regexp-replace-all) #/[A-Z]/ "-\\0") (string-trim #\-) string-downcase string->symbol)) (de-stud "XsTuDLYcApS") ===> xs-tu-d-l-yc-ap-s Given: (define-syntax -> (syntax-rules () [(_ x) x] [(_ x (y more ...) z ...) (-> (y x more ...) z ...)] [(_ x y z ...) (-> (y x) z ...)])) (define (swap func) (lambda (a b . args) (apply func b a args)))