regex - List to String in Racket -


i've got list defined this:

(define testlist '((dog <=> cat)                    (anne <=> dodd)) 

is there way turn: (car testlist) string can use regexp on search "<=>"?

let me start extremely relevant jamie zawinski quote:

some people, when confronted problem, think, “i know, i'll use regular expressions.” have two problems.

you really don't want use regular expressions here. 1 thing, regexp-based solution break when have identifiers <=> in middle of them.

for another, it's really easy solve problem without using regular expressions.

there whole bunch of "right answers" here, depending on you're trying do, let me start pointing out can use "member" function see whether list contains symbol '<=> :

#lang racket  (define testlist '((dog <=> cat)                    (anne <=> dodd)))  (cond [(member '<=> (car testlist)) "yep"]       [else "nope"]) 

i suspect you're trying parse these logical equivalences, in case you'll need define possible structures of statements, , go there, let's start not using regular expressions :).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -