Hacker News new | ask | show | jobs
by mcaruso 3374 days ago
I've made the analogy of function calls before, it's a pretty cool way to think about it. But I think your example is slightly off. The verb is the head of the phrase, and would thus be the function (or command) itself:

    miru --topic=Taro --object=Noriko # Taro sees Noriko
This uses "miru", the plain non-past form of "to see". Conjugating the verb is a little trickier to translate, but I think it would be analogous to higher-order functions, functions that modify the verb to create a new verb. Using a Python-like syntax:

    formal(past(miru))(topic="Taro", object="Noriko")
    # Taro wa Noriko wo mimashita
I'm trying to think of a way to include relative clauses in this analogy, but it's a little harder. A relative clause is of the form "[verb-phrase] [noun]", e.g. "doresu wo kiru Noriko" (Noriko who wears a dress). Maybe we could use positional arguments for this:

    formal(past(miru))(topic="Taro", object=kiru(object="doresu", "Noriko"))
    # Taro wa doresu wo kiru Noriko wo mimashita ??
EDIT: or maybe currying would be a nice way to solve this. So each verb would be a function that takes arguments, and returns a new function that takes a noun to apply that verb to:

    formal(past(miru))(topic="Taro", object=kiru(object="doresu")("Noriko"))
    # Taro wa doresu wo kiru Noriko wo mimashita
1 comments

Could this situation be described by nesting sentences?

  "Taro saw (Noriko wears a dress)."
To extend your example:

  formal(past(miru))(topic="Taro", object="Noriko")
  "Taro saw Noriko."

  formal(present(kiru))(topic="Noriko", object="doresu") 
  "Noriko wears a dress."
Nested:

  formal(past(miru))(topic="Taro", object=(formal(present(kiru))(topic="Noriko", object="doresu")) )

  "Taro saw (Noriko wears a dress)."
  "Taro saw Noriko wear a dress."

  "Taro wa (doresu wo kiru Noriko wa(?)) wo mimashita"
  "Taro wa doresu wo kiru Noriko wo mimashita"
Does that make sense?

*Please help correct any errors, as I have never formally studied the Japanese language.

It wouldn't type-check, since `object` is expected to be a noun and not a verb. :)
It's a difficulty inherent in describing one unfamiliar language with another unfamiliar language. :)

This could work in Powershell. The function would have to be written to expect nested recursive calls, to remove the omitted particle.

  Construct-Sentence -verb miru -Formal -Past -Topic Taro -Object (
  Construct-Sentence -verb kiru -Formal -Present -Topic Noriko -Object doresu
  )

  "Taro saw (Noriko wears a dress)."
  "Taro saw Noriko wear a dress."

  "Taro wa (doresu wo kiru Noriko wa(?)) wo mimashita"
  "Taro wa doresu wo kiru Noriko wo mimashita"