
@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

I will try merging the PR

Great.

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

@sorawee I’ll check again.

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

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

Done!

Great - now we only need to test it.

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

But where…

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

Looks correct to me!

Great. Wrote to pchaigno. Cross your fingers.

Meanwhile, I will look into https://github.com/textmate/scheme.tmbundle/issues/7

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

Either here or the beginners channel is appropriate.

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

but annother quick one though …

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)

where would i import the type Keymap
from ??

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.

Coolio, thanks anywho :)

@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")))

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

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.

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

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

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

(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")))

thanks @sorawee

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

Thanks a ton :)

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)

(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"

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

huh… yeah. they’re just missing

all of the ~#
specifiers that are documented


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

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

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.

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

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

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

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

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)))))