<define> <fib>n</fib>
<if><leq>n 2</leq>
1
<plus><fib><minus>n 1</minus></fib>
<fib><minus>n 2</minus></fib></plus>
</if>
</define>
questions comments concerns
I feel like it needs tags around the literals and symbols, too. <leq><var>n</var><lit>2</lit></leq>
:wink:
ALL CAPS WOULD BE MORE READABLE
and don’t use /
for end tags, that’s so 2000. Use words in backward, like bif
.
DEFINE FIB n
IF LEQ n 2 QEL
THEN 1
ELSE PLUS FIB MINUS n 2 SUNIM BIF
FIB MINUS n 2 SUNIM BIF SULP
FI
ENIFED
rhombus take notes
Nice! But I was thinking you’d keep the <> anyway :thinking_face:
[DEFINE [FIB <VAR TYPE=fixnum?>n</VAR>]
[IF [LEQ <REF>n</REF> <LIT TYPE=fixnum?>2</LIT> QEL]
1
[PLUS [FIB [MINUS <REF>n</REF> <LIT TYPE=fixnum?>1</LIT> SUNIM] BIF]
[FIB [MINUS <REF>n</REF> <LIT TYPE=fixnum?>2</LIT> SUNIM] BIF] SULP]
FI]
ENIFED]
Also macros should be prefixed with __
for clarity, and keywords that can be omitted (due to redundancy) should be marked as such with a **#
prefix and a #**
suffix
And numbers should be roman numerals for simplicity, obviously!
Next time on random langs: a generator for this fibonacci program in your (least) favorite syntaxes
there’s also @joel’s #lang tabloid, based on Tabloid: https://github.com/otherjoel/tabloid
DISCOVER HOW TO fibonacci WITH a, b, n
RUMOR HAS IT
WHAT IF n SMALLER THAN 1
SHOCKING DEVELOPMENT b
LIES! RUMOR HAS IT
YOU WON'T WANT TO MISS b
SHOCKING DEVELOPMENT
fibonacci OF b, a PLUS b, n MINUS 1
END OF STORY
END OF STORY
EXPERTS CLAIM limit TO BE 10
YOU WON'T WANT TO MISS 'First 10 Fibonacci numbers'
EXPERTS CLAIM nothing TO BE fibonacci OF 0, 1, limit
PLEASE LIKE AND SUBSCRIBE