DennisMitchell / jellylanguage

Jelly is a recreational programming language inspired by J.
MIT License
859 stars 47 forks source link

Add program examples for simple things (ie. factorial, Pythagorean theorem) [Suggestion] #60

Open fionafibration opened 6 years ago

fionafibration commented 6 years ago

I have found Jelly to be a very cool language but I am extremely confused about how to actually write it. With it being a tacit language, it is radically different from most other languages I've seen and because of this it can be very difficult to initially get into. Some examples with explanations would be extremely useful. Such examples that are usually quite helpful are factorials (recursion and looped versions), Pythagorean theorem (Examples of just doing equations), GCD (quite common and also useful in cryptographic cops & robber challenges), and compute digits of Pi (using Euler's problem).

I think such examples would be very useful and would probably help many more people move towards Jelly as their main golfing language. Thanks!

Kroppeb commented 5 years ago

Factorial: (monadic) RP (no recursion though) Pythagoras: (monadic, input as a array) ²S½ Pythagoras: (dyadic, not a lot of experience so this is probably not the shortest) ²+ɓ²µ½ GCD (dyadic) : g (not recursive either)