Tips for golfing in Jellyfish

4

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.

Leaky Nun

Posted 2016-08-05T03:16:56.117

Reputation: 45 011

10I 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. – Martin Ender – 2016-08-05T05:45:27.553

3

I suspect tips threads like this are a sneaky way to advertise the language. We have a place for that.

– xnor – 2016-08-05T09:28:45.950

3Golfing tips may partly serve as advertising, but they are a different thing – Luis Mendo – 2016-08-05T11:36:57.560

Answers

1

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.

Leaky Nun

Posted 2016-08-05T03:16:56.117

Reputation: 45 011

0

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.

Leaky Nun

Posted 2016-08-05T03:16:56.117

Reputation: 45 011