I want to get two strings as arguments, and check if the first string is the beginning of the second string. I cannot get that since I don't know how to get strings as arguments to my function.
(define starts-with( lambda (prefix str)
(define str2 (string->list (str)))
(define prefix2 (string->list (prefix)))
( cond ( (= (string-length(prefix2) 0) display "#t")
( (= car(prefix2) car(str2)) (starts-with (cdr(prefix2)cdr(str2) ) ) )
( display "#f")))))
Error: application: not a procedure; expected a procedure that can be
applied to arguments
given: "ab" arguments...: [none]
Can anyone explain me what is my mistake, and in general how scheme works with lists or strings.. ? I want to have:
(starts-with "baz" "bazinga!") ;; "#t"