Nov. 14th, 2013

juan_gandhi: (VP)
Говорят, что я в один из дней октября, в обед, какую-то машину в Сан Франциско стукнул и уехал.
Мило; за каким бы хреном меня понесло в обед в город. Я на работе работаю.

Ну посмотрим.
juan_gandhi: (VP)
  override def dropPrefix = new PropsFromMap({
    val mapWhereKeysAreSplitIntoPrefixAndTheRest = map map(kv => (kv._1.split("\\.", 2), kv._2))
    val mapWithDroppedPrefix = mapWhereKeysAreSplitIntoPrefixAndTheRest map (kv => (kv._1 drop 1 mkString, kv._2))
    val mapWithNonemptyKeys  = mapWithDroppedPrefix filter (kv => !kv._1.isEmpty)
    mapWithNonemptyKeys
  })
juan_gandhi: (VP)
      val sut = props("a.b.c.d" -> "<<ABCD>>", 
                      "x"       -> "<<X>>", 
                      "a.d.x.y" -> "<<ADXY>>")
      sut.findAllHaving("c").value must_== Good("<<ABCD>>")
      sut.findAllHaving("a").value.isBad must beTrue
      sut.findAllHaving("ab").value.isBad must beTrue
      sut.findAllHaving("y.d").value must_== Good("<<ADXY>>")


What happens here.
First, I create a property tree with three keys (that's like ldap, kind of)
Then I try to find a subtree of all those keys that contain "c" as a subkey.
And I get it's unique value (will fail if the value is not unique.
Like in the second example, I find a subtree of those having "a" in the keys; and it is not a singleton, so it's bad.
In the third example the resulting subtree is empty, so retrieving a unique value fails again.
In the third example the key is compound, and actually not even sequential.
Maybe I should rename the method. Or maybe not.

What do you think?

See, what I do now, is grab the body of html, transform it into a tree of knowledge, and then extract knowledge. There's a lot of garbage there; eliminating it is cumbersome, but I can just ignore it, the way you ignore it when you look at a web page.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

June 2025

S M T W T F S
1 2345 6 7
8 9 10 11 121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 16th, 2025 11:16 am
Powered by Dreamwidth Studios