←back to thread

222 points futurisold | 1 comments | | HN request time: 0.219s | source
Show context
sram1337 ◴[] No.44400463[source]
This is the voodoo that excites me.

Examples I found interesting:

Semantic map lambdas

  S = Symbol(['apple', 'banana', 'cherry', 'cat', 'dog'])
  print(S.map('convert all fruits to vegetables'))
  # => ['carrot', 'broccoli', 'spinach', 'cat', 'dog']

comparison parameterized by context

  # Contextual greeting comparison
  greeting = Symbol('Hello, good morning!')
  similar_greeting = 'Hi there, good day!'

  # Compare with specific greeting context
  result = greeting.equals(similar_greeting, context='greeting context')
  print(result) # => True

  # Compare with different contexts for nuanced evaluation
  formal_greeting = Symbol('Good morning, sir.')
  casual_greeting = 'Hey, what\'s up?'

  # Context-aware politeness comparison
  politeness_comparison = formal_greeting.equals(casual_greeting, context='politeness level')
  print(politeness_comparison) # => False
bitwise ops

  # Semantic logical conjunction - combining facts and rules
  horn_rule = Symbol('The horn only sounds on Sundays.', semantic=True)
  observation = Symbol('I hear the horn.')
  conclusion = horn_rule & observation # => Logical inference
`interpret()` seems powerful.

OP, what inspired you to make this? Where are you applying it? What has been your favorite use case so far?

replies(3): >>44400592 #>>44401514 #>>44401936 #
haileys ◴[] No.44401514[source]
Why is carrot the vegetablefication of apple?
replies(3): >>44401518 #>>44401567 #>>44401606 #
herval ◴[] No.44401518[source]
Also if you run it twice, is it gonna be a carrot again?
replies(3): >>44401564 #>>44403465 #>>44405055 #
1. ◴[] No.44401564[source]