wwall
2017-9-20 10:38:02

hello. im’m write simple code for convert string into list of tokens. My question - is more simple way for converting, than my code

(define (lex-list s) (let ((buf (open-input-string s))) (let loop ((results ’())) (let ((next-token (lexer buf))) (if (eq? ’EOF (token-name (position-token-token next-token))) (reverse results) (loop (cons next-token results)))))))


samth
2017-9-20 13:39:19

@wwall I might write it like this:


samth
2017-9-20 13:39:23
(define (lex-list s)
  (define buf (open-input-string s))
  (for/list ([next-token (in-producer (λ () (lexer buf)))]
             #:break (eq? 'EOF (token-name (position-token-token next-token))))
    next-token))

samth
2017-9-20 15:26:55

Someone on Reddit reported an issue that seems to be .zo files not being used: https://www.reddit.com/r/Racket/comments/713v6h/horrible_performance/


samth
2017-9-20 15:27:22

@mflatt I think we’ve seen issues like this before, but I can’t find the discussion in my email archives


mtelesha
2017-9-20 21:14:07

I am making a image generator program but my image function was with 2htdp is there something I can do use (require) for the function?


samth
2017-9-20 21:14:31

(require 2htdp/image)


mtelesha
2017-9-20 21:17:27

What I want is to make the function available to the rest of the program.


notjack
2017-9-20 21:19:50

@mtelesha I’m unsure what you mean, could you provide more details?


mtelesha
2017-9-20 21:20:49

I mean (provide) with my function that is (require 2htdp/image) the rest of my program is #lang racket


samth
2017-9-20 21:22:34

@mtelesha you can use 2htdp/image in #lang racket


notjack
2017-9-20 21:26:07

@mtelesha This should work:

#lang racket
(require 2htdp/image)

(define (my-image-func arg ...) ...)

(provide my-image-func)

mtelesha
2017-9-20 21:28:06

provide = provide: this function is not defined


mtelesha
2017-9-20 21:28:19

1 sec


mtelesha
2017-9-20 21:28:34

I didn’t think you could mix #lang racket with 2htdp


notjack
2017-9-20 21:31:37

2htdp/image is a normal library that any module​ can require and #lang 2htdp will automatically require it for you (I think)


mtelesha
2017-9-20 21:32:43

LOL I lost a few hours trying to redo my function with pict 2htdp scale/xy


notjack
2017-9-20 21:33:35

Glad to help :)