fork download
  1. (defun vowel-p (char)
  2. (member char '(#\a #\e #\i #\o #\u) :test #'char=))
  3.  
  4. (defun split-word (word)
  5. (let ((chars (coerce word 'list))
  6. (syllables nil)
  7. (current nil))
  8. (dolist (ch chars)
  9. (push ch current)
  10. (when (vowel-p ch)
  11. (push (coerce (reverse current) 'string) syllables)
  12. (setf current nil)))
  13. (when current
  14. (if syllables
  15. (setf (car syllables)
  16. (concatenate 'string (car syllables)
  17. (coerce (reverse current) 'string)))
  18. (push (coerce (reverse current) 'string) syllables)))
  19. (reverse syllables)))
  20.  
  21. (defun split-string (str)
  22. (let ((words nil) (current nil))
  23. (dotimes (i (length str))
  24. (let ((ch (char str i)))
  25. (if (char= ch #\Space)
  26. (when current
  27. (push (coerce (reverse current) 'string) words)
  28. (setf current nil))
  29. (push ch current))))
  30. (when current
  31. (push (coerce (reverse current) 'string) words))
  32. (reverse words)))
  33.  
  34. (defun split-phrase (phrase)
  35. (mapcar #'split-word (split-string phrase)))
  36.  
  37. (print (split-phrase "война"))
  38.  
  39. (format t "~%Результат: ~a~%" (split-phrase "война"))
Success #stdin #stdout #stderr 0.01s 9720KB
stdin
Standard input is empty
stdout
(("война")) 
Результат: ((война))
stderr
Warning: reserving address range 0x80000c0000...0x1fffffffffff that contains memory mappings. clisp might crash later!
Memory dump:
  0x8000000000 - 0x80000bffff
  0x15173f400000 - 0x15173f6e4fff
  0x15173f815000 - 0x15173f839fff
  0x15173f83a000 - 0x15173f9acfff
  0x15173f9ad000 - 0x15173f9f5fff
  0x15173f9f6000 - 0x15173f9f8fff
  0x15173f9f9000 - 0x15173f9fbfff
  0x15173f9fc000 - 0x15173f9fffff
  0x15173fa00000 - 0x15173fa02fff
  0x15173fa03000 - 0x15173fc01fff
  0x15173fc02000 - 0x15173fc02fff
  0x15173fc03000 - 0x15173fc03fff
  0x15173fc80000 - 0x15173fc8ffff
  0x15173fc90000 - 0x15173fcc3fff
  0x15173fcc4000 - 0x15173fdfafff
  0x15173fdfb000 - 0x15173fdfbfff
  0x15173fdfc000 - 0x15173fdfefff
  0x15173fdff000 - 0x15173fdfffff
  0x15173fe00000 - 0x15173fe03fff
  0x15173fe04000 - 0x151740003fff
  0x151740004000 - 0x151740004fff
  0x151740005000 - 0x151740005fff
  0x151740022000 - 0x151740025fff
  0x151740026000 - 0x151740026fff
  0x151740027000 - 0x151740028fff
  0x151740029000 - 0x151740029fff
  0x15174002a000 - 0x15174002afff
  0x15174002b000 - 0x15174002bfff
  0x15174002c000 - 0x151740039fff
  0x15174003a000 - 0x151740047fff
  0x151740048000 - 0x151740054fff
  0x151740055000 - 0x151740058fff
  0x151740059000 - 0x151740059fff
  0x15174005a000 - 0x15174005afff
  0x15174005b000 - 0x151740060fff
  0x151740061000 - 0x151740062fff
  0x151740063000 - 0x151740063fff
  0x151740064000 - 0x151740064fff
  0x151740065000 - 0x151740065fff
  0x151740066000 - 0x151740093fff
  0x151740094000 - 0x1517400a2fff
  0x1517400a3000 - 0x151740148fff
  0x151740149000 - 0x1517401dffff
  0x1517401e0000 - 0x1517401e0fff
  0x1517401e1000 - 0x1517401e1fff
  0x1517401e2000 - 0x1517401f5fff
  0x1517401f6000 - 0x15174021dfff
  0x15174021e000 - 0x151740227fff
  0x151740228000 - 0x151740229fff
  0x15174022a000 - 0x15174022ffff
  0x151740230000 - 0x151740232fff
  0x151740235000 - 0x151740235fff
  0x151740236000 - 0x151740236fff
  0x151740237000 - 0x151740237fff
  0x151740238000 - 0x151740238fff
  0x151740239000 - 0x151740239fff
  0x15174023a000 - 0x151740240fff
  0x151740241000 - 0x151740243fff
  0x151740244000 - 0x151740244fff
  0x151740245000 - 0x151740265fff
  0x151740266000 - 0x15174026dfff
  0x15174026e000 - 0x15174026efff
  0x15174026f000 - 0x15174026ffff
  0x151740270000 - 0x151740270fff
  0x55c2d7ce6000 - 0x55c2d7dd6fff
  0x55c2d7dd7000 - 0x55c2d7ee0fff
  0x55c2d7ee1000 - 0x55c2d7f40fff
  0x55c2d7f42000 - 0x55c2d7f70fff
  0x55c2d7f71000 - 0x55c2d7fa1fff
  0x55c2d7fa2000 - 0x55c2d7fa5fff
  0x55c2d8d63000 - 0x55c2d8d83fff
  0x7ffc1b675000 - 0x7ffc1b695fff
  0x7ffc1b6a1000 - 0x7ffc1b6a4fff
  0x7ffc1b6a5000 - 0x7ffc1b6a6fff