[racket] List functions instead of string functions?
Strings and lists are both sequences, so you can write functions that
work on sequences. For example:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#lang racket
(define (peel seq)
(define n (sequence-length seq))
(define seq-without-head
(sequence-tail seq 1))
(define seq-without-ends
(for/list ([s seq-without-head]
[_ (- n 2)])
s))
seq-without-ends)
;; Examples:
(peel "hello world this is a test")
(peel '(hello world this is another test))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Can you give more details on what you're trying to do?