[racket-users] Get contract from function

2018-08-24 Thread Joao Pedro Abreu De Souza
Hi. I am contributing in a library that create functions to parse PEG(parsing expression grammar). To implement a feature, I need to know the return's type of a function. We are using racket, not typed-racket, so I think that I need to get the contract or something like that. I dont see in the

[racket-users] Get contract from function

2018-08-24 Thread Joao Pedro Abreu De Souza
to handle this special case too. The repository is racket-peg on GitHub, from user rain-1. There's a issue about empty string in the second place I think if this helps. Thank you for the attention. :) 2018-08-24 11:02 GMT-03:00 Alex Knauth : > > > On Aug 24, 2018, at 8:50 AM, Joao Pedro Abre

Re: [racket-users] confusion about call-with-current-continuation

2018-10-25 Thread Joao Pedro Abreu De Souza
Well, call/cc is like (in racket) delimited continuation, and have a implicit prompt around a s-exp, so, as begin is a macro, he don't create a prompt. The continuation captured is (+ 1 []) in your example. If you change the begin to a let, this works, because let expand to a application of a

Re: [racket-users] confusion about call-with-current-continuation

2018-10-25 Thread Joao Pedro Abreu De Souza
ation or special form ? > > > > 2. assume this procedure or special form exists to construct a prompt. > > > > (+ 1 (prompt (* 2 (call/cc (lambda (k) (set! x k) 2) > > > > After the (lambda (k) ...) evaluated, value of k is (* 2 []), then I call > > (

Re: [racket-users] confusion about call-with-current-continuation

2018-10-25 Thread Joao Pedro Abreu De Souza
> > "lambda" special form also have a sequence of expressions in it. > > They are essentially the same, except the lambda can be applied. > > What is prompt you mentioned? > > I have not heard of this concept before. > > Can you tell me something about th

Re: [racket-users] Functions in a terminal port

2019-01-02 Thread Joao Pedro Abreu De Souza
Well, I know that the game will run only on Gnu/Linux systems. A alternative that I see is using ffi to provide 1 function that returns this number but if exists some racket-only solution I think is better, right? Em qui, 3 de jan de 2019 às 03:53, Joao Pedro Abreu De Souza < jp_ab...@id.uff

[racket-users] Functions in a terminal port

2019-01-02 Thread Joao Pedro Abreu De Souza
Hi everyone. I am coding a console-based game in racket to teach shell to freshman on university. In some point, I need to print a message that can have a lot of lines. I want to do a less(the command in the shell)-like output, so the output will freeaze on the end of line, if the user type 'q'

Re: [racket-users] Functions in a terminal port

2019-01-02 Thread Joao Pedro Abreu De Souza
Thanks Ben. The problem is that this functions can give me the number of line that live my next read, but cannot tell me "Well, this port is a terminal and have 80 lines of height". With the height information I can control the display but without that, and using just port-count-lines! and

Re: [racket-users] Functions in a terminal port

2019-01-02 Thread Joao Pedro Abreu De Souza
a better way? Again, thanks a lot for the help until here. Em qui, 3 de jan de 2019 às 04:01, Joao Pedro Abreu De Souza < jp_ab...@id.uff.br> escreveu: > Well, I know that the game will run only on Gnu/Linux systems. A > alternative that I see is using ffi to provide 1 function

Re: [racket-users] Functions in a terminal port

2019-01-03 Thread Joao Pedro Abreu De Souza
, Joao Pedro Abreu De Souza < jp_ab...@id.uff.br> escreveu: > Thanks, Neil. I will test today later. :) > > Em qui, 3 de jan de 2019 04:35, Neil Van Dyke escreveu: > >> If you're on a Unix, like GNU/Linux or a BSD, you could use the >> `charterm` package: >> >&

Re: [racket-users] Functions in a terminal port

2019-01-03 Thread Joao Pedro Abreu De Souza
Thanks, Neil. I will test today later. :) Em qui, 3 de jan de 2019 04:35, Neil Van Dyke If you're on a Unix, like GNU/Linux or a BSD, you could use the > `charterm` package: > > #lang racket/base > (require charterm) > (with-charterm > (let-values (((w h) (charterm-screen-size))) >

[racket-users] test user-interact function dont work

2019-02-16 Thread Joao Pedro Abreu De Souza
Hi everyone. I have a test of a user-related function that I don't can see why don't work : #lang racket (require rackunit) (require "../../main.rkt") (check-equal? (with-output-to-string (lambda () (with-input-from-string

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Joao Pedro Abreu De Souza
mbda () > (with-input-from-string "input" >(lambda () > (refine-main))))) > "input") > > On Sun, Feb 17, 2019 at 12:35 AM Joao Pedro Abreu De Souza > wrote: > > > > Hi everyone. I have a test of a user-related function th

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Joao Pedro Abreu De Souza
WOW. I finish read the doc about #:final That is so beatiful thing. Thank you to you three Em dom, 17 de fev de 2019 às 22:18, Joao Pedro Abreu De Souza < jp_ab...@id.uff.br> escreveu: > Thanks for the feedback! > I will study this code and make more functional > > Em dom,

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Joao Pedro Abreu De Souza
Thanks a lot. Sorry about the simple error. Em dom, 17 de fev de 2019 22:06, Matthias Felleisen > > On Feb 17, 2019, at 6:44 PM, Joao Pedro Abreu De Souza > wrote: > > (check-equal? > (with-output-to-string >(lambda () > (with-input-from-string

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Joao Pedro Abreu De Souza
hat return a struct "execute" in the case of reading a "exit 0" just call (exit 0) Em dom, 17 de fev de 2019 às 16:07, Joao Pedro Abreu De Souza < jp_ab...@id.uff.br> escreveu: > Well, there's no imediate return, i need to type exit 0 to finally the > test works >

Re: [racket-users] test user-interact function dont work

2019-02-17 Thread Joao Pedro Abreu De Souza
each other or itself. You could likewise parameterize the > exit handler around your call to define-main for testing purposes. > > However, I think this is a good example of why side-effects (like exiting) > are less good for testing than returning values. > > -Philip > > > O