Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#Brachylog , 23 bytes

Brachylog , 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler.

###Explanation

Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }

#Brachylog , 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler.

###Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }

Brachylog , 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler.

Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }
deleted 4 characters in body
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165

#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler yet.

###Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }

#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler yet.

###Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }

#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler.

###Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }
added 517 characters in body
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165

#Brachylog#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings asin a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler yet.

###Explanation

pending...

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }

#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings as a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler yet.

###Explanation

pending...

#Brachylog, 23 bytes

:1foh.,{,.[A:B]hs?'~sB}

Works on the old Java transpiler. Expects the two strings in a list as input, unifies the output with the substring. If no substring is found, returns false.

Unfortunately I have not yet coded the subset built-in in the new Prolog transpiler yet.

###Explanation

:1f Find all bindings which satisfy predicate 1 with that binding as input and
 with the Input of the main predicate as output.
 oh., Order that list of bindings, and unify the output with the first one.
{
 ,.[A:B] Unify the output with the list [A,B]
 hs? Unify the input with a subset of A
 '~sB Check that no subset of B can be unified with the input
 }
Source Link
Fatalize
  • 39.6k
  • 5
  • 73
  • 165
Loading

AltStyle によって変換されたページ (->オリジナル) /