procgen  Diff

Differences From Artifact [98598e4655]:

To Artifact [fa196ac94e]:


1


2
3


4
5
6
7
8

9
10

11
12
13
14
15
16
17
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; ʞ / verb.scm


;	(depends lisp-macro.scm struct.scm)
;	a library by lexi hale


;
; macros, functions, and rules for conjugating verbs and 
; generating verb phrases. this library rules was written 
; specifically for english verbs and cannot be used as a
; "drop-in" library for other languages; however, the

; structured and functions used are sufficiently generic
; that it should be portable to other languages with

; minimal effort.

;;;; section i. generic functions & structures

; struct verb
;  fields contain conjugation functions for the specified
;  tense. ((v 'inf) object) will generate a verb phrase string
................................................................................
;   'ger: gerund (-ing form)
;   'pst: past (-ed form)
;   'ppl: past participle (often -ed or -en)
; * l10n note: the fields mentioned in the last line of the
;   (verb-form) macro must always match the fields listed in
(define verb (struct 'inf 'prs 'ger 'adj 'pst 'ppl))

; takes a list of individual strings and joins them with
; spaces. occurrences of "a" are automatically replace by
; "an" if the word following them appears to start with a
; vowel. this can be forcibly induced by preceeding that
; word with the symbol 'vowel in the list
; TODO: make it handle initialisms. yes, everything about
; this is horrible. yes, this *is* the wrong way to do it.
; yes, i *am* ashamed. why do you ask
(define (word-append . body)
  (define (vowel? c) (member c '("a" "e" "i" "o" "u")))
  (define (vowel-onset? w)
................................................................................

; create a compound form a verb that already exists
; - prefix: prefix to append (e.g. up, out, over, un)
; - vb: final, "stem" verb
(define (compound prefix vb) (lambda (form) (lambda (*o*)
	  (word-append (string-append prefix ((vb form) *o*))))))

; create a verb where another string interposes between the
; root verb and the object. this can be used to implement
; object incorporation or prepositional verbs such as "get
; off on" (not to be confused with phrasal verbs)
; a phrasal verb.
; - vb: the root (leftmost) verb
; - pps: the preposition complex immediately following the
;   verb.
(define (postpositive vb post) (lambda (form) (lambda (*o*)
	(if (or (equal? form 'ppl) (equal? form 'adj))
		(word-append
		  (string-append ((vb form) '()) "-" post)
		  *o*)
		(word-append ((vb form) '()) post *o*)))))

|
>
>
|
<
>
>
|
|
|
|
<
>
|
<
>







 







|


|







 







|
|
|
|
|

|
|







1
2
3
4

5
6
7
8
9
10

11
12

13
14
15
16
17
18
19
20
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
; [ʞ] verb.scm
;  ~ lexi hale <lexi@hale.su>
;  © affero general public license
;  > (load "lib/lisp-macro.scm")

;    (load "lib/struct.scm")
;    (load "lib/verb.scm")

; macros, functions, and rules  for conjugating verbs and
; generating verb phrases. this library rules was written
; specifically for english verbs and  cannot be used as a

; "drop-in"  library for  other  languages; however,  the
; structured and functions  used are sufficiently generic

; that  it should  be  portable to  other languages  with
; minimal effort.

;;;; section i. generic functions & structures

; struct verb
;  fields contain conjugation functions for the specified
;  tense. ((v 'inf) object) will generate a verb phrase string
................................................................................
;   'ger: gerund (-ing form)
;   'pst: past (-ed form)
;   'ppl: past participle (often -ed or -en)
; * l10n note: the fields mentioned in the last line of the
;   (verb-form) macro must always match the fields listed in
(define verb (struct 'inf 'prs 'ger 'adj 'pst 'ppl))

; takes a list of individual  strings and joins them with
; spaces. occurrences of "a" are automatically replace by
; "an" if the word following them appears to start with a
; vowel. this can be  forcibly induced by preceeding that
; word with the symbol 'vowel in the list
; TODO: make it handle initialisms. yes, everything about
; this is horrible. yes, this *is* the wrong way to do it.
; yes, i *am* ashamed. why do you ask
(define (word-append . body)
  (define (vowel? c) (member c '("a" "e" "i" "o" "u")))
  (define (vowel-onset? w)
................................................................................

; create a compound form a verb that already exists
; - prefix: prefix to append (e.g. up, out, over, un)
; - vb: final, "stem" verb
(define (compound prefix vb) (lambda (form) (lambda (*o*)
	  (word-append (string-append prefix ((vb form) *o*))))))

; create a  verb where another string  interposes between
; the  root verb  and the  object.  this can  be used  to
; implement object  incorporation or  prepositional verbs
; such as "get  off on" (not to be  confused with phrasal
; verbs) a phrasal verb.
; - vb: the root (leftmost) verb
; - pps: the preposition complex immediately following
;   the verb.
(define (postpositive vb post) (lambda (form) (lambda (*o*)
	(if (or (equal? form 'ppl) (equal? form 'adj))
		(word-append
		  (string-append ((vb form) '()) "-" post)
		  *o*)
		(word-append ((vb form) '()) post *o*)))))