Talk:FerNANDo

From Esolang
Jump to: navigation, search

How about 16 variables on one line to output a unicode character? :P--Patashu 11:00, 16 June 2009 (UTC)

That's just the Basic Multilingual Plane. The full range of Unicode code points requires 21 variables.
Main> maxBound :: Char
'\1114111' :: Char
Also if you are going to mix 8-bit binary and 21-bit Unicode output, you better change the Haskell interpreter while I run away screaming, because that's going to need explicit encoding handling, and just the other day I saw a post about ghc changing its default handling of Unicode stuff... --Ørjan 13:43, 16 June 2009 (UTC)

For copying A to B, why couldn't you just do
A B B
A A A

? That places NOT B into A then places NOT A into A.--Patashu 23:16, 16 June 2009 (UTC)

You're right, I'm sorry.

BTW I have feeling the conditional loop isn't really working well in the language, it works almost, but I might add jumping forward functionality. (if there's one word in a sentence if it's 0 it jumps forward, if it's 1 backwards). Whtspc


I think my python program is bugged with jumping. Don't be surprised if it doesn't work Orange 20:25, 17 June 2009 (UTC)

I made some changes to your Python program, I hope it fixes the problems. --Stop h time 15:58, 23 June 2009 (UTC)

 # FerNANDo Interpreter
 # Runs fernando programs, used command line style.
 # Original by Orange
 # Slight modifications by Stop h time (Robin Wellner)
 
 # You're free to use this code as you wish
 
 def FerNANDo(program,debug=0):
     ''' Run a FerNANDo program '''
     p = program.split('\n') #Split the string into a
                             #Sequence of lines
     pc = 0      #program counter
     var = {}    #holds variables
     
     while pc<len(p):
         #Split the current line into the variable line
         line = p[pc].split()
         
         if debug: print '\t',len(line),line
         
         #See how many varibales on a line
         #If 1,3,or 8, execute a command
         count = len(line)
         if count==3: #NAND
             var[line[0]] = not (var.get(line[1], False) and var.get(line[2], False))
         elif count==1: #Jump
             if var.get(line[0], False):
                 cl = line[0]
                 found = None
                 for i, f in enumerate(p[:pc].reverse()):
                     if f==cl:
                         found = pc-1-i
                         break
                 if found is not None:#can't do if found:, because 0 is possible here
                     pc = found
         elif count==8: #Output
             ascii = 0
             for i, item in enumerate(line):
                 ascii += var.get(item, 0)*2**(9-i)
             sys.stdout.write(chr(ascii))
         pc += 1
     print'\nDone.'
 
 import sys
 
 try:
     f = open(sys.argv[1])
     FerNANDo(f.read())
 except IOError:
     print"Error: Can't open file"
 except IndexError:
     print"Error: Missing file to run"
     print"Usage:\n\tnand.py filetorun.nand"
I don't think this works, as far as I can tell the main problem (in both this and the original) is that the jump code doesn't make any attempt at finding the previous occurence of the same line, just the first one in the program. --Ørjan 03:27, 24 June 2009 (UTC)
You're right. I hope it works now. --Stop h time 19:14, 24 June 2009 (UTC)
If I understand python slices correctly, the reversed list indices would still start at 0, so I added a correction for that. Someone else can do the testing.  ;-) --Ørjan 21:21, 24 June 2009 (UTC)
Wow, I'm really sloppy. Thanks again for the correction. I think this version is right. --Stop h time 10:18, 25 June 2009 (UTC)
I changed it a little bit again, I worry too much about optimization... --Stop h time 13:42, 8 November 2009 (UTC)

Proposed input command

inp a b c d e f g h

If there is a byte in the buffer, inp is set to 1, and a-h are set to the byte's bits. Otherwise, inp is set to 0 and nothing else happens. What do you think? (by asiekierka) --(this comment by 78.88.180.66 at 16:01, 27 February 2010 UTC; please sign your comments with ~~~~)


How about a predefined input bit variable? For lack of a better choice, _ for example. Every time this variable is accessed, it reads a bit (most significant first) from stdin. For example:
A _ 1
would set A to Not _.
This would also allow for:
_ _ _ _ _ _ _ _
which would read one byte from stdin, and immediately echo it. --Primo 11:09, 15 January 2012 (UTC)
On second thought, I think your suggestion is better. A language that has byte-at-a-time output, should probably also have byte-at-a-time input. --Primo 4:10, 23 January 2012 (UTC)

Disable PRNG

One suggestion is have a command-line option which tells it to make the PRNG variable ? into a normal variable, where the command-line option also tells it to initial 0 or 1. You might use this to run older programs or to use with anarchy golf, in case you want some programming languages (possibly including FerNANDo) to disallow random number. --Zzo38 03:21, 23 January 2012 (UTC)

Added a --no-prng command line option to the Python implementation, which disables the ? variable, leaving it unset. --Primo 04:52, 23 January 2012 (UTC)

Hey guys! I'm not always around at the esolang community, so it took a while to see the specs of this language are enhanced. I, as the writer of this language, think it's cool people are actively busy with something you came up with. Nevertheless I don't like the enhancements being a part of the language now (I'm talking about PRNG-bit and input command). I never intended to make things like this. The poetic character of the language was the most important to me. Well, I don't want to be a pain in the ass, but I thought I'd just share my thoughts on this. Take care. Wouter

Hello Wouter,
I had wanted to contact you personally before updating the implementations, but found very little opportunity to do so; your user page is non-existant, and inqueries into new features were left unanswered for two years. And so, in collaboration with other users of FerNANDo, primarilly in #anagol, we extended the feature set to something that was suitable -- and necessary -- to solve most kinds of problems. If you would like, I could remove these again, and create a fork of the language which implements them instead. --Primo 07:45, 10 February 2012 (UTC)

Turing complete proof

Flip bit: foo foo

Goto:

bar (define label)

code

bar (goto label if bar is 1)

Due to the way the language works, any subsequent instances of bar will jump to the previous instance of bar. Poolala (talk) 19:54, 2 September 2013 (UTC)

FerNANDo also cannot be Turing complete due to bounded memory. (There are no more bits than variables in the program.) --Ørjan (talk) 00:37, 3 September 2013 (UTC)