Phrases/AtomicRepresentation

From J Wiki
Jump to navigation Jump to search

Create Atomic Representations

NB. Atomic-representation utilities:

NB. y is string whose contents are a J phrase/sentence; result is the AR that represents the value of y’s content
ar=: {{5!:1<'y' [".'y=. ',y}}

NB. y is string name of verb; result is AR of verb
arverb =: <@,

NB. y is noun, result is AR of noun
arnoun =: [: < (<,'0') , <

NB. (adverb): m is adverb in AR form; y is AR
NB. Result is AR of y m
aradv=: <@{{m , <@,}}

NB. (adverb): m is conjunction in AR form; x is AR; y is AR
NB. Result is AR of x m y
arconj=: <@{{m ,&< ,}}

NB. y is a list of 3 ARs; result is AR of their fork
arfork=: [: < (<,'3') , < 

NB. x is AR; y is AR; result is AR for (x y)
arhook=: [: < (<,'2') , <