3 ms·
Your example isn't a very functional code style though so I don't know that I'd consider it to be idiomatic. Generally code written in a functional style ends u
by fc417fc802 2y ago
Your example isn't a very functional code style though so I don't know that I'd consider it to be idiomatic. Generally code written in a functional style ends up indented many layers deep. Below is a quick (and quite tame) example from one of the introductory guides for Racket. My code often ends up much deeper. Consider what it would look like if one of the cond branches contained a nested cond.
(define (start request)
(define a-blog
(cond [(can-parse-post? (request-bindings request))
(cons (parse-post (request-bindings request))
BLOG)]
[else
BLOG]))
(render-blog-page a-blog request))
https://docs.racket-lang.org/continue/index.html https://docs.racket-lang.org/continue/index.html
- MarceColl 2y agoCommon Lisp, which is what I use, is not really a functional oriented language. I'd say the above is okay in CL.
- fc417fc802 2y agoI must have missed that memo. Sure it's remarkably flexible and simultaneously accommodates other approaches, but most of the code I see in the wild leans fairly heavily into a functional style. I posted a CL link in an adjacent comment. Here's an example that mixes in a decent amount of procedural code that I'd consider idiomatic. https://github.com/ghollisjr/cl-ana/blob/master/hdf-table/hdf-table.lisp https://github.com/ghollisjr/cl-ana/blob/master/hdf-table/hd...