05AB1E icon indicating copy to clipboard operation
05AB1E copied to clipboard

How to get multiplication table in 05AB1E (Nested For Loops problem)

Open MortezaRahmaniJRP opened this issue 4 years ago • 6 comments

Hi, everyone! In fact, it is better to say "how to use for loop with different counter name?" 10G10GNN*ðJ}¶J}

MortezaRahmaniJRP avatar Jun 30 '20 06:06 MortezaRahmaniJRP

When using nested for-loops (such as F, G, etc.), the index variable N gets overwritten by the inner for-loop.

If you would like to explicitly save the index number of the outer for-loop, you would have to use an assignment command, such as U (which assigns a number to X). Your code would then probably be something like this:

10GNU10GNX*ðJ}¶J}

You can try this online here. However, in osabie, it is preferred to use lists + vectorization over for-loops. In fact, this 5-byte code gets the same job done:

9Lδ*»

Does this answer your problem?

Adriandmen avatar Jun 30 '20 13:06 Adriandmen

Thank you very much Dear Adriandmen

MortezaRahmaniJRP avatar Jun 30 '20 18:06 MortezaRahmaniJRP

9Lδ*» it is Not working! I run it by a file argument and so execute but it doesn't work, but works in tio

MortezaRahmaniJRP avatar Jun 30 '20 19:06 MortezaRahmaniJRP

@MortezaRahmaniJRP Hmm, have you checked if the file encoding is in UTF-8? The osabie script assumes that the file is encoded in UTF-8 or in 05AB1E-encoding when using the -c flag.

Also, inputs are not supplied as command line arguments, but rather as one big input file which is used to redirect the input. If this input file is not given, it tries to read the input from the command line instead.

Adriandmen avatar Jul 02 '20 08:07 Adriandmen

Yeah, it's checked, it is a simple UTF_8 file created by NotePad, but not working!

MortezaRahmaniJRP avatar Jul 03 '20 16:07 MortezaRahmaniJRP

@Adriandmen hi, about the code 9Lδ*», I recheck it more and more, finally I find that the problem is in UTF-8 char code 'δ',I am a windows guy and use notepad as a plain text editor, what do you suppose to do? by the way I have a problem in using -c flag as a command line argument , I have received the err message: ** (ArgumentError) argument error :erlang.binary_to_list({:error, :arguments}) (stdlib 3.11) binary.erl:51: :binary.bin_to_list/1 (osabie 1.0.1) lib/reading/reader.ex:73: Reading.Reader.read_file/2 (osabie 1.0.1) lib/osabie.ex:61: Osabie.CLI.main/1 (elixir 1.10.2) lib/kernel/cli.ex:124: anonymous fn/3 in Kernel.CLI.exec_fun/2 and the same goes for --osabie flag.

MortezaRahmaniJRP avatar Jul 16 '20 12:07 MortezaRahmaniJRP