mark.warren
2018-10-10 09:11:59

Could anyone tell me how to open a tab in chrome from Racket? I can’t seem to find anything but I know it’s possible because the DrRacket help does it.



mark.warren
2018-10-10 09:14:40

@soegaard2 Thanks, couldn’t see the wood for the trees


cawright.99
2018-10-10 21:33:34

talk about beginner! (for/list ((i '(1 2 3))) (* i 2)) returns '(2 4 6)

but

(for ((i '((1 2 3) (4 5 6))))
  (for/list ((j i))
    (* j 2)))

returns nothing

I am not sure why … thanks for the help!


cawright.99
2018-10-10 21:36:07

AHHH!!! Because the enclosing (for ...) ignores the result of evaluating the body …. doh!!


cawright.99
2018-10-10 21:36:34

but (for/list ((i '((1 2 3) (4 5 6)))) (for/list ((j i)) (* j 2)))


cawright.99
2018-10-10 21:36:55

returns '((2 4 6) (8 10 12)) - excellent!


khepin
2018-10-10 22:17:37

:wave: How can I check if a keyword argument was given during the function call or if I’m just seeing the default value?


khepin
2018-10-10 22:18:26

I remember seeing something like (define (fn #:kw [kw default arg-was-given])) but it looks like I’m mistaken on this


khepin
2018-10-10 22:18:32

or this was another scheme and not racket


khepin
2018-10-10 22:18:34

?


samth
2018-10-10 22:20:46

@khepin make the default value be something that the caller can’t provide


samth
2018-10-10 22:21:06

@khepin however, I find that APIs defined that way are usually problematic


khepin
2018-10-10 23:41:19
(define invalid (λ () 'invalid))
(define (valid? value)
  (not (eq? value invalid)))

(define (fn [a invalid])
  (when (valid? a) ...))

:point_up:what I did in the end