4
\$\begingroup\$

Jellyfish is a two-dimensional esoteric programming language inspired by J and written in Python 3. It was inspired by a challenge on PPCG. The name was suggested in PPCG chat as a combination of Jelly, a golfing language inspired by J, and Fish, a two-dimensional esoteric language.

What general tips do you have for golfing in Jellyfish? I'm looking for ideas which can be applied to problems and which are also at least somewhat specific to Jellyfish.

\$\endgroup\$
  • 10
    \$\begingroup\$ I don't think we need a tips question for every single language on the planet. Especially if the language is far from finished and has only two users and the question generates tips like "remove unnecessary whitespace" for lack of better ideas, I doubt that this creates content that is actually useful to the community at this point. \$\endgroup\$ – Martin Ender Aug 5 '16 at 5:45
  • 3
    \$\begingroup\$ I suspect tips threads like this are a sneaky way to advertise the language. We have a place for that. \$\endgroup\$ – xnor Aug 5 '16 at 9:28
  • 3
    \$\begingroup\$ Golfing tips may partly serve as advertising, but they are a different thing \$\endgroup\$ – Luis Mendo Aug 5 '16 at 11:36
1
\$\begingroup\$

Use functions before consumed by operators

When calculating the Catalan number, I used this trick in my Jellyfish answer:

p
%C+
 &
>+i

The > function is taking + as argument, while the & takes the same + as functional argument.

As a result, the + that the > gets is unary, while the & makes + binary to be used by C.

\$\endgroup\$
0
\$\begingroup\$

Remove unnecessary whitespaces

In my Jellyfish answer to this question, I golfed my program from 41 bytes down to 29 bytes just by finding alternative methods of placing the functions and operators so as to minimize the number of spaces used.

41-byte version:

p
n         +
+  `1
   /+&*
`/*   r&;>i
1

29-byte version:

p
n     +
+`/
`1*
/
+
&*r&;>i

Use the fact that literals cannot take argument to pack things together. For example, in my 29-byte version, I have a 1 above a * which does not affect the performance of *.

The major goal when I was golfing from 41 bytes to 29 bytes is to minimize the whitespaces used on the second line, meaning to minimize the horizontal span of the remaining lines.

Also, in the 41-byte version, I had two occurrences of 1, and in my 29-byte version I combined them.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.