alexknauth
2019-5-30 14:32:39

Reader behavior vs run-time behavior.

For reader behavior it would be valid, represented with an “ordered dictionary” at read-time and compile-time.

For run-time behavior, it would be an error, since 'a and 'a evaluate to the same value at run-time.


ryanc
2019-5-30 15:23:00

@steveh2009 yes, the tests run for me on Linux with zeromq versions 4.0.8 and 3.2.5.


steveh2009
2019-5-30 15:40:40

Is there any reference application project written in Racket, compiled to self-contained executable where someone used either Racket or any other "#lang defined language to be used as a scripting language within the app? What I was thinking of doing was to create an extensive real-time stock/futures charting program in Racket where I could have scripting with a variety of "#lang"’s available to the end-user. Thanks for the pointer.


mflatt
2019-5-30 15:53:11

You’ll want to supply the ++lang flag to raco exe. That’s an indirect answer, but the flag exists because others have done what you describe (and without ++lang it’s tricky to convert raco exe to preserve the right modules).


jeapostrophe
2019-5-30 18:37:34

Can you tell all your friends about RacketCon? Post on the tweets and Facebooks? http://con.racket-lang.org :poop::poop::poop::poop::poop::poop::poop::poop::poop::poop::poop::spaghetti:


dan153
2019-5-30 19:44:27

> Hackathon (multiple tracks) is this known in advance or is it a whatever happens style thing


samth
2019-5-30 19:47:31

@dan153 the tracks are listed there


dan153
2019-5-30 19:48:04

oh i thought those were concurrent events rather than the tracks. thanks


blerner
2019-5-30 21:18:24

Managed to figure it out:


blerner
2019-5-30 21:18:27
(define current-subdirectory (make-parameter #f))
(define (install-files-mixin %)
  (class %
    (inherit-field dest-dir)
    (inherit-field helper-file-prefix)
    (inherit/super path->root-relative
                   root-relative->path
                   resolve-part
                   derive-filename
                   install-file)
    ;; COPIED FROM render-multi-mixin, because I can't access
    ;; the current-directory parameter from there
    (define/override (get-dest-directory [create? #f])
      (or (and (current-subdirectory)
               (let ([d (build-path (or (super get-dest-directory)
                                        (current-directory))
                                    (current-subdirectory))])
                 (when (and create? (not (directory-exists? d)))
                   (make-directory* d))
                 d))
          (super get-dest-directory create?)))

    (define/override (start-resolve ds fns ri)
      (for ([d (in-list ds)]
            [fn (in-list fns)])
        ;; NOTE: Because multi-mixin sets suffix to "", fn is already a bare name
        (parameterize ([current-subdirectory fn])
          (resolve-part d ri))))

    (define/public (install-file-to src-file dest-prefix)
      (define cur-dest-dir (get-dest-directory #t))
      (define cur-helper-file-prefix (get-field helper-file-prefix this))
      (set-field! helper-file-prefix this dest-prefix)
      (define wanted-path (build-path (get-dest-directory #t) dest-prefix))
      (when (not (directory-exists? wanted-path))
        (make-directory* wanted-path))
      (define result (install-file (path->string src-file) #:private-name? #t))
      (set-field! helper-file-prefix this cur-helper-file-prefix)
      (path->string (build-path dest-prefix result))
      )
    (super-new)
    ))

justin.hu
2019-5-30 22:54:17

I don’t think that this works if you use ISL+Lambda by selecting it from the DrRacket “chose language” menu - I believe there macro somehow doesn’t make it into the teaching language. I’m getting the error draw-arrow: this function is not defined.


alexknauth
2019-5-30 23:19:40

Hm, I just tried that now, and it works for me with setting the language in DrRacket (not “determine from source”) with this file: (require "controlling-drracket-arrows-2.rkt") (draw-arrow) ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ; <<OVER HERE!>> Although with selecting the language in DrRacket instead of the #lang line, I have to click the “Check Syntax” button for it to show the arrows


notjack
2019-5-31 01:29:45

I made a module that provides string functions that only accept and return immutable strings https://docs.racket-lang.org/rebellion/Immutable_Strings.html


sorawee
2019-5-31 03:41:12

How do I know what kind of values can be used across namespaces?


notjack
2019-5-31 04:38:13

@sorawee magic, usually. I recommend avoiding relying on phase crossings. What’s your use case?


sorawee
2019-5-31 04:50:00

I’m running a Racket program several times with different mutations (via current-compile). I got this to work, but was measuring how good a mutation is solely by running time of the mutated program. Now, I want more information, so I need to communicate between the parent namespace and the child namespace as well.


notjack
2019-5-31 04:53:11

As soon as multiple program instantiations are involved you can’t share values between them without sacrificing generativity somewhere, so I recommend doing that communication by explicitly serializing and deserializing values at namespace boundaries.


notjack
2019-5-31 04:55:27

Alternatively you might be able to get away with using namespace-attach-module somewhere


alexknauth
2019-5-31 04:58:35

Hm. Your macro for doing that looks nice. I think it looks nicer than my macro for doing that, I like how you use the positional-argument and string-function-header syntax classes to pack the create-a-function-with-this-parameter and call-a-function-with-this-argument ideas together

Your macro: https://github.com/jackfirth/rebellion/blob/fb2f73d9dc31a4668f4bbead475450dd9d55f407/private/immutable-string.rkt#L94-L121 My macro: https://github.com/AlexKnauth/racket-immutable/blob/master/racket-immutable/immutable.rkt#L106-L142

Syntax-parse and syntax-classes are awesome. I think the reason I tried to avoid them was that when I wrote my macro I was trying to get it into a state where it could be merged into racket. But for an external library using syntax-classes to do that makes the code so much cleaner.


notjack
2019-5-31 05:00:37

Oh, thank you!


notjack
2019-5-31 05:01:48

I actually ended up duplicating that macro in the immutable-bytes and immutable-vector modules I made too


alexknauth
2019-5-31 05:08:09

If you want to add keyword arguments, you can change the argument syntax class so that instead of the id attribute, it has an argument-use attribute which determines how it looks in a function-call. For positional arguments it will be id, but for keyword arguments it needs to have #:kw id. Because of this I would make it an ellipsis-depth 1 attribute, like #:with [argument-use ...] #'[id] for positional arguments and #:with [argument-use ...] #'[kw id] for keyword arguments.


alexknauth
2019-5-31 05:09:16

Then in the function-header syntax class in place of #:with function-call-expression #'(id arg.id ...), you would have #:with function-call-expression #'(id arg.argument-use ... ...)


notjack
2019-5-31 05:15:46

I don’t want to add keyword argument support. At least, not in those modules. The tiny number of functions with keyword arguments isn’t worth it to add support in each module, and I don’t want to factor out the macros because I’ll be depending on these modules from a lot of other code. Code that I’d like to use in a public module providing better versions of these macros.


notjack
2019-5-31 05:16:19

That is a good way to implement keyword support though