soegaard2
2019-2-26 08:46:51

@sorawee I have forked the repository to the sicp-lang team (it turned out a new Team required a Github account associated with a business(?)). https://github.com/sicp-lang/scheme.tmbundle/issues/1


sorawee
2019-2-26 08:48:47

I will try merging the PR


soegaard2
2019-2-26 08:49:44

Great.


sorawee
2019-2-26 08:58:45

@soegaard2 I don’t have a permission to push to the fork, apparently


soegaard2
2019-2-26 08:59:02

@sorawee I’ll check again.


soegaard2
2019-2-26 09:00:23

Ah! I teams are per repos - not per organisations.


soegaard2
2019-2-26 09:02:51

@sorawee I have made a “scheme-team” and given you admin access.


sorawee
2019-2-26 09:03:23

Done!


soegaard2
2019-2-26 09:03:55

Great - now we only need to test it.


soegaard2
2019-2-26 09:04:10

I remember there is a page, where one can try out a new grammar definition.


soegaard2
2019-2-26 09:04:13

But where…


sorawee
2019-2-26 09:05:11

A simpler thing to do might be to test it using TextMate directly (supposing that GitHub is compatible with TextMate)



sorawee
2019-2-26 09:10:06

Looks correct to me!


soegaard2
2019-2-26 09:12:46

Great. Wrote to pchaigno. Cross your fingers.


sorawee
2019-2-26 09:14:54

chris613
2019-2-26 11:36:18

morning all, got a dtalog question, would this be an ok place to ask for some advise / guideance ?


mark.warren
2019-2-26 11:38:22

Either here or the beginners channel is appropriate.


chris613
2019-2-26 11:39:16

actually with fresh eyes i might havejust solved it …. :slightly_smiling_face:


chris613
2019-2-26 11:39:22

but annother quick one though …


chris613
2019-2-26 11:39:54

i cant seem to reference “built in” type ?? #lang typed/racket (require typed/racket/gui) (define (exit-editor button event) (exit 0)) (define (setup-shortcuts [e : Keymap]) (define mapping (send e get-keymap)) (send mapping add-function "quit" exit-editor) (send mapping map-function "d:d" "quit")) (define (log-it-out button event) (display "hey\n")) (define f (new frame% [label "Simple Edit"] [width 1024] [height 768])) (define c (new editor-canvas% [parent f])) (define t (new text%)) (send c set-editor t) (new button% [parent f] [label "quit"] [callback exit-editor]) (new button% [parent f] [label "clear"] [callback (lambda (button event) (send t erase))]) (new button% [parent f] [label "log"] [callback log-it-out]) (setup-shortcuts t) (define mb (new menu-bar% [parent f])) (define the-edit-menu (new menu% [label "Edit"] [parent mb])) (define the-font-menu (new menu% [label "Font"] [parent mb])) (send t set-max-undo-history 100) (send f show #t)


chris613
2019-2-26 11:40:06

where would i import the type Keymap from ??


mark.warren
2019-2-26 11:45:12

That’s beyond me I’m afraid. The people you need are in a different time zone. They usually appear later. A few hours maybe.


chris613
2019-2-26 11:46:24

Coolio, thanks anywho :)


sorawee
2019-2-26 12:00:44

@chris613

(define (setup-shortcuts [e : (Instance Text%)])
  (define mapping (send e get-keymap))
  (when mapping
    (send mapping add-function "quit" exit-editor)
    (send mapping map-function "d:d" "quit")))

sorawee
2019-2-26 12:01:39

The thing that has method get-keymap is text%, not keymap%.


sorawee
2019-2-26 12:02:38

And mapping could be #f. Typed Racket catches this mistake and reports a type error. By guarding (send mapping ...) with (when mapping ...), the code now works.


chris613
2019-2-26 13:04:19

So the “type” is keymap% but actually that was wrong for my specific usage here?


chris613
2019-2-26 13:05:38

Ahhh sorry (Instance text% ) is the typedef :) got it


sorawee
2019-2-26 15:55:35

@chris613 right, it’s mapping that has type (U (Instance Keymap%) #f)


sorawee
2019-2-26 15:55:40
(define (setup-shortcuts [e : (Instance Text%)])
  (: mapping (U (Instance Keymap%) #f))
  (define mapping (send e get-keymap))
  (when mapping
    (send mapping add-function "quit" exit-editor)
    (send mapping map-function "d:d" "quit")))

chris613
2019-2-26 15:57:24

thanks @sorawee


chris613
2019-2-26 15:57:54

just posted another wierd one too #beginners if you feel like being a super human and helping me on that one too :wink:


chris613
2019-2-26 16:57:25

Thanks a ton :)


oldsin
2019-2-26 17:52:50

How to use scribble/srcdoc like JavaDoc? :thinking_face: Is it supposed to look like this? : (provide (proc-doc/names (any/c . -> . boolean?) (v) @{Test if something @racket[v] is fun.})) (define (fun? v) #f)


zenspider
2019-2-26 23:13:19
(require srfi/19)
(string->date "2019-02-26" "~Y-~m-~d")  ; (date* 0 0 0 26 2 2019 ...)
(string->date "2019-02-26" "~1")        ; TIME-ERROR type bad-date-format-string: "~1"

zenspider
2019-2-26 23:13:49

can anyone confirm that this is a bug before I dig further?


zenspider
2019-2-26 23:17:08

huh… yeah. they’re just missing


zenspider
2019-2-26 23:17:24

all of the ~# specifiers that are documented


zenspider
2019-2-26 23:41:57

jaz
2019-2-26 23:47:44

An alternative: > (require gregor) > (iso8601->date "2019-02-26") #<date 2019-02-26>


zenspider
2019-2-27 05:11:11

Yes… but. I think the built-in libraries should be as usable/useful as possible.


lexi.lambda
2019-2-27 05:16:07

The SRFIs aren’t really the same as the “built-in libraries”, though, they are implementations of standards. If the standard isn’t what you want, you can’t just do something differently from the standard.


notjack
2019-2-27 06:05:39

and those standards are scheme standards, not racket standards - there’s a reason the language changed its name from PLT scheme to racket


notjack
2019-2-27 06:06:07

So I wouldn’t consider them built-in libraries of racket


hoshom
2019-2-27 07:28:50

How do I make this typecheck? #lang typed/racket (define-type StringOrNum (U String Number)) (define stuff '(1 "asd" 2 "qwe")) (: foo (-> (Listof StringOrNum) Number)) (define (foo lst) (let-values ([(strs nums) (partition (λ([x : StringOrNum]) (string? x)) lst)]) (+ (length strs) (apply + nums))))

I can see from the documentation that what I need seems to be a “negative proposition”, but I’m not sure where/how


hoshom
2019-2-27 07:29:30

The problem is in (apply + nums) where the typechecker doesn’t know that nums is definitely a list of numbers.


hoshom
2019-2-27 07:46:07

At least in a minimal example, this does the trick: #lang typed/racket (define-type StringOrNum (U String Number)) (define stuff '(1 "asd" 2 "qwe")) (: foo (-> (Listof StringOrNum) Number)) (define (foo lst) (let-values ([(strs nums) ((inst my-partition String Number StringOrNum) (λ([x : StringOrNum]) (string? x)) lst)]) (+ (length strs) (apply + nums)))) (: my-partition (All (a b c) (-> (-> c Any : #:+ a #:- b) (Listof c) (Values (Listof a) (Listof b))))) (define (my-partition fun lst) (for/fold : (Values (Listof a) (Listof b)) ([tru : (Listof a) '()] [fal : (Listof b) '()]) ([x : c (in-list lst)]) (if (fun x) (values (cons x tru) fal) (values tru (cons x fal)))))