2021-11-01 11:53:44 Hello, how do I add history and movement to retro repl on linux? I just get weird characters, arrows not working

2021-11-01 12:01:01 nuno: you can use retro with rlwrap

2021-11-01 12:02:25 <eli_oat > I second the use of rlwrap

2021-11-01 12:02:38 I just installed that, what do i do now?

2021-11-01 12:02:44 <eli_oat > rlwrap retro

2021-11-01 12:02:55 <eli_oat > that'll launch you into the retro repl, but within rlwrap

2021-11-01 12:03:12 <eli_oat > type something, then hit up arrow, it'll let you tick through history

2021-11-01 12:03:25 It works now! Thanks!

2021-11-01 12:03:36 <eli_oat > https://github.com/hanslub42/rlwrap

2021-11-01 12:03:40 <eli_oat > glad that works!

2021-11-01 12:03:54 <eli_oat > I use rlwrap with both forth interpreters and scheme repls

2021-11-01 12:09:22 I'm also not able to compile, i get objcopy: "retro-compiler": sem tal ficheiro

2021-11-01 12:09:22 objcopy: "retro-compiler": sem tal ficheiro

2021-11-01 12:09:37 both objcopy and retro-compiler are on $PATH

2021-11-01 12:09:56 'sem tal ficheiro' is portuguese, means file not found

2021-11-01 12:10:31 i used retro-compiler a.retro hello

2021-11-01 12:10:45 <eli_oat > sorry, I'm not sure on that one. Are you sure that retro-compiler is installed? It isn't installed by default, I don't think, unless you use a special flag during building with make

2021-11-01 12:12:21 i get 'retro-compiler

2021-11-01 12:12:22 Missing arguments' so I think it's working

2021-11-01 12:13:38 Also, it runs slow like the block editor example or retro-describe, I'm still learning how it works but would compilation improve that launch speed?

2021-11-01 12:14:49 <eli_oat > I think theoretically yes, it'd be faster, but, in my experience retro, it is never wicked fast

2021-11-01 12:52:42 Is is possible to eval a file right after starting the repl?

2021-11-01 13:01:48 <eli_oat > I think yes, I don't know the way right off the top of my head, though

2021-11-01 13:02:01 <eli_oat > you can also launch a file by retro name-of-file.retro

2021-11-01 13:03:41 <eli_oat > I think maybe I've seen rick_carlino1 do it in the past

2021-11-01 13:05:50 <eli_oat > I think maybe file:read may be it?

2021-11-01 13:06:21 ok, I'll wait, someone will know. 'retro file.retro' doesnt stay on the repl, i tried with -i but the words defined on the file aren't available

2021-11-01 13:07:29 <eli_oat > what are you trying to do?

2021-11-01 13:08:16 It seems file:read only returns next character

2021-11-01 13:08:47 I want my words to be available on the repl.

2021-11-01 13:11:18 <rick_carlino1> nuno: Yes this is possible. Let me find the entry in the glossary

2021-11-01 13:11:47 <rick_carlino1> Here's what you want, assuming I understand your question correctly: http://forthworks.com:9999/339

2021-11-01 13:13:55 That's it! but it seems it's not working: 'hello.forth include < this?

2021-11-01 13:14:23 <rick_carlino1> If you are trying to build something similar to a main() fn in C or a TURNKEY vector in other Forth systems you may want to look at retro-compiler http://forthworks.com/retro/book.html

2021-11-01 13:14:45 <rick_carlino1> nuno: Is hello.forth written in Unu style? This was a big hangup for me when I got started.

2021-11-01 13:15:11 <rick_carlino1> You need to make sure that the code is wrapped in a fence: ~~~ on both sides. Is the code fenced?

2021-11-01 13:15:24 <rick_carlino1> Without a Fence, unu will assume the file is just documentation with no code.

2021-11-01 13:15:25 no

2021-11-01 13:15:52 OK, now it works!

2021-11-01 13:15:58 <rick_carlino1> Great!

2021-11-01 13:16:13 Thanks

2021-11-01 13:16:35 <rick_carlino1> It took me a while to get used to the fences, but I really do think it is a strong point of the platform, since readability matters more in Forth than other languages.

2021-11-01 13:16:43 <rick_carlino1> No problem! :-D

2021-11-01 13:17:24 retro -i -f file.retro < Now this works too, so it reads the file and stays with the repl open

2021-11-01 13:17:46 <eli_oat > ~(^-^)~

2021-11-01 13:18:11 <rick_carlino1> Great! I hope you build something cool to share with us :-P

2021-11-01 13:18:42 Still have a lot to learn :)

2021-11-01 13:18:56 <rick_carlino1> Is this your first experience with Forth?

2021-11-01 13:19:02 yes

2021-11-01 13:20:21 <rick_carlino1> I think it's the best first Forth to learn, personally. Good luck!

2021-11-01 13:20:47 retro-compiler hello.forth hello

2021-11-01 13:20:48 objcopy: "retro-compiler": sem tal ficheiro

2021-11-01 13:20:58 it's the example from the book

2021-11-01 13:23:38 <rick_carlino1> You might be missing an assembler on your system. It will build an ELF binary. I forget which tool it uses to do this. It's also worth noting it only works on Unix-y systems. crc would know better though. I have not used it in a while.

2021-11-01 13:24:01 <eli_oat > I think it is even linux only at this point

2021-11-01 13:24:12 <eli_oat > I haven't gotten it to work anywhere but debian, I don't think

2021-11-01 13:25:21 ok

2021-11-01 13:25:29 <rick_carlino1> Intersting. I'm not sure, but afaik crc does not use Linux, only BSD

2021-11-01 13:26:36 Can you confirm whether compiling makes the programs faster to run? some of the examples are a bit slow to open

2021-11-01 13:27:02 <rick_carlino1> Not sure.

2021-11-01 13:27:54 retro-compiler requires a system using ELF and needs objcopy to be installed

2021-11-01 13:28:34 <rick_carlino1> crc: Idea, though it might have legacy support implications: it seems that a lot of newcomers (including me when I was in the early learning stages) will be unaware that Retro is a literate-style environment. It might be worth adding a compiler warning when attempting to compile empty files (no Unu fences)

2021-11-01 13:28:48 For instance block-editor.retro took like 7s 1st time and now over 3s for a simple program

2021-11-01 13:29:15 I'm on linux and objcopy is installed

2021-11-01 13:29:34 Linux pc 4.19.0-17-amd64 #1 SMP Debian 4.19.194-3 (2021-07-18) x86_64 GNU/Linux

2021-11-01 13:30:22 in terms of runtime performance, there is no difference. It can reduce startup time as it compiles the code into an embedded image

2021-11-01 13:30:37 I haven't tested on that configuration

2021-11-01 13:30:53 ACTION mostly uses openbsd & freebsd

2021-11-01 13:31:17 ok

2021-11-01 13:31:23 i might try on openbsd

2021-11-01 13:32:21 rick_carlino1: I'll look into doing that

2021-11-01 13:32:56 <eli_oat > crc does anything like a linter exist for retro?

2021-11-01 13:33:13 <eli_oat > less something that formats code and more something that makes optimization suggestions?

2021-11-01 13:33:41 eli_oat: no :(

2021-11-01 13:33:47 <eli_oat > no worries

2021-11-01 13:33:48 real 0m3,208s |

2021-11-01 13:33:49 user 0m2,508s |

2021-11-01 13:34:22 <eli_oat > crc my initial idea was something that would suggest places to drop straight into assembly, but I'm not sure of the benefit, tbh

2021-11-01 13:46:11 nuno: won't be instant; the reading in of blocks and initializations still take considerable time

2021-11-01 13:47:51 ok, i'll test, just want to make sure I can actually use the language for small programs, the startup time is important.

2021-11-01 13:47:53 eli_oat: I can see how that would be helpful; inlining assembly can be a big improvement to runtime performance

2021-11-01 18:25:05 I tried to compile the book example on openbsd and got segmentation fault

2021-11-01 18:26:48 anyone know why?

Proxy Information
Original URL
gemini://retroforth.org/irclogs/2021-11-01
Status Code
Success (20)
Meta
application/octet-stream
Capsule Response Time
533.231915 milliseconds
Gemini-to-HTML Time
1.323475 milliseconds

This content has been proxied by September (ba2dc).