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

added 19 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, (削除) 12 11 (削除ここまで) 8 bytes

-3 thanks to @KevinCruijssen (take the wordsearch as a mulitline list of characters).

=Ḣ\ƝŻḋẇ€

A dyadic Link that accepts the list of words on the left and the wordsearch (a multiline list of characters) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€ - Link: words W;W wordsearch(list linesof lists of characters); wordsearch P (list of characters)
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearchP?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F

Jelly, (削除) 12 11 (削除ここまで) 8 bytes

-3 thanks to @KevinCruijssen (take the wordsearch as a mulitline list of characters).

=Ḣ\ƝŻḋẇ€

A dyadic Link that accepts the list of words on the left and the wordsearch (a multiline list of characters) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F

Jelly, (削除) 12 11 (削除ここまで) 8 bytes

-3 thanks to @KevinCruijssen (take the wordsearch as a mulitline list of characters).

=Ḣ\ƝŻḋẇ€

A dyadic Link that accepts the list of words on the left and the wordsearch (a multiline list of characters) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€ - Link: words W (list of lists of characters); wordsearch P (list of characters)
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 € - for each Word in W:
 ẇ - is Word a sublist of P?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F
deleted 133 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, (削除) 12 11 (削除ここまで) 118 bytes

-3 thanks to @KevinCruijssen (take the wordsearch as a mulitline list of characters).

=Ḣ\ƝŻḋẇ€K}\=Ḣ\ƝŻḋẇ€

A dyadic Link that accepts the list of words on the left and the wordsearch (a multiline list of linescharacters) on the right and yields a non-negative integer.

Try it online! Try it online!

How?

=Ḣ\ƝŻḋẇ€K}\=Ḣ\ƝŻḋẇ€ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 \ - last two links as a dyad - f(W, P):
 } - treat a monad as a dyad using the right argument, P:
 K - join P with space characters
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F

Jelly, (削除) 12 (削除ここまで) 11 bytes

=Ḣ\ƝŻḋẇ€K}\

A dyadic Link that accepts the list of words on the left and the wordsearch (a list of lines) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€K}\ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 \ - last two links as a dyad - f(W, P):
 } - treat a monad as a dyad using the right argument, P:
 K - join P with space characters
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F

Jelly, (削除) 12 11 (削除ここまで) 8 bytes

-3 thanks to @KevinCruijssen (take the wordsearch as a mulitline list of characters).

=Ḣ\ƝŻḋẇ€

A dyadic Link that accepts the list of words on the left and the wordsearch (a multiline list of characters) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 ḋ - E dot-product F
deleted 31 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293

Jelly, 12 (削除) 12 (削除ここまで) 11 bytes

=Ḣ\ƝŻaẇ€K=Ḣ\ƝŻḋẇ€K}\S\

A dyadic Link that accepts the list of words on the left and the wordsearch (a list of lines) on the right and yields a non-negative integer.

Try it online! Try it online!

How?

=Ḣ\ƝŻaẇ€K=Ḣ\ƝŻḋẇ€K}\S\ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 \ - last two links as a dyad - f(W, P):
 } - treat a monad as a dyad using the right argument, P:
 K - join P with space characters
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 a  - E logical AND F (vectorises)
  S dot-product sumF

Jelly, 12 bytes

=Ḣ\ƝŻaẇ€K}\S

A dyadic Link that accepts the list of words on the left and the wordsearch (a list of lines) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻaẇ€K}\S - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 \ - last two links as a dyad - f(W, P):
 } - treat a monad as a dyad using the right argument, P:
 K - join P with space characters
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
 a - E logical AND F (vectorises)
  S - sum

Jelly, (削除) 12 (削除ここまで) 11 bytes

=Ḣ\ƝŻḋẇ€K}\

A dyadic Link that accepts the list of words on the left and the wordsearch (a list of lines) on the right and yields a non-negative integer.

Try it online!

How?

=Ḣ\ƝŻḋẇ€K}\ - Link: words W; wordsearch lines P
 Ɲ - for neighbouring words in W:
 \ - last two links as a dyad - f(left, right):
= - left equals right (vectorises)
 Ḣ - head
 Ż - prepend a zero
 -> E = a list of 1s and 0s identifying whether the previous
 word stated with the same letter.
 \ - last two links as a dyad - f(W, P):
 } - treat a monad as a dyad using the right argument, P:
 K - join P with space characters
 € - for each Word in W:
 ẇ - is Word a sublist of the space-joined wordsearch?
 -> F = a list of 1s and 0s identifying whether the current
 word is in the wordsearch
  - E dot-product F
added 945 characters in body
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading
Source Link
Jonathan Allan
  • 115.4k
  • 8
  • 68
  • 293
Loading

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