jsn
2018-8-15 13:34:32

(eq? (expt 2 3) (expt 2 3)) => #t (eq? (expt 2 100) (expt 2 100)) => #f why?


shu--hung
2018-8-15 14:01:00

eq? tests physical equality


shu--hung
2018-8-15 14:01:30

use = to test numerical equality


lexi.lambda
2018-8-15 15:46:17

Is there an equal-hash-code/recur similar to equal?/recur?


pocmatos
2018-8-15 16:04:24

@jsn short answer: (expt 2 3) is a fixnum, no objects are allocated. (expt 2 100) is not a fixnum.


pocmatos
2018-8-15 16:04:43

@jsn Test with fixnum?


mflatt
2018-8-15 16:38:34

Added.

Instead of adding 4 functions, I could have added just 1 that’s something like syntax-binding-set-extend to make a single binding and then have datum->syntax accept a list of bindings as its first argument. I decided to go through an intermediate syntax-binding-set data structure, instead, because it seems more adpatible to different internal representations, and I decided to keep it separate from datum->syntax.


ben
2018-8-15 17:20:05

I would try to make a timeline renderer using the rectangles renderer


jsn
2018-8-15 17:59:11

Thanks for the explanation about object allocation and fixnums


shu--hung
2018-8-15 18:35:46

Is it possible to turn off string normalization in xrepl?


shu--hung
2018-8-15 18:37:21

Everytime I wanted to paste a lambda function it became hex digits (like (λ (x) x) became (\U+FFCE\U+FFBB (x) x))


philip.mcgrath
2018-8-15 18:46:34

@pocmatos You may want to look at web-server/lang/serial-lambda, which gives you serial-lambda, a version of lambda that works with serialize and deserailize.


leif
2018-8-15 18:49:25

Wootz, thanks. :smile:


soegaard2
2018-8-15 18:54:44

@jsn Check eq? eqv? and equal? in the docs.


ben
2018-8-15 19:30:06

Leif and I just tried to use include/reader in a scribble file using Scribble’s read-syntax-inside reader: https://gist.github.com/bennn/9901db528a7ac3fd8247c1fad55ab2d6


ben
2018-8-15 19:30:19

the include seems to run forever, but along the way it throws a contract error from cadar


ben
2018-8-15 19:30:31

is this a bug?


leif
2018-8-15 19:37:01

To be clear, cadar isn’t the bug, but whoever passed the argument to cadar:

racket verbim.rkt
verbim.rkt:9:11: include/reader: read error (cdadr: contract violation
  expected: (cons/c any/c (cons/c pair? any/c))
  given: '((0 . 0) #f))
  in: (include/reader "text.rkt" scb:read-syntax-inside)
  location...:
   verbim.rkt:9:11

mflatt
2018-8-15 20:15:17

@shu—hung You are probably using a build of libedit that doesn’t support Unicode. Try installing the readline library and the readline-gpl package.


leif
2018-8-15 20:21:20

@mflatt and @jbclements About a week ago I sent you both a message wondering why Racket’s rsound and portaudio packages weren’t working in a VM.


leif
2018-8-15 20:21:34

Namely, I was getting an ffi error, stating it couldn’t find the portaudio dll.


leif
2018-8-15 20:21:43

(I didn’t have this problem on physical machines oddly enough.)


shu--hung
2018-8-15 20:21:47

@mflatt thank!! let me try that


leif
2018-8-15 20:22:16

Anyway, while I still am not sure what the problem was, I put together a machine set up with the problem:



leif
2018-8-15 20:24:18

I would be interested in finding out why I would get that problem anyway. :slightly_smiling_face:


michael.ballantyne
2018-8-15 20:51:42

Could anyone explain the motivation for local-expand and related APIs accepting a list of definition contexts, rather than just one? I can see why one would want to create a definition context extending an existing one with syntax-local-make-definition-context, but given that I don’t see the need to pass a list of them to local-expand. Do these two somehow differ in behavior?


lexi.lambda
2018-8-15 20:53:57

@michael.ballantyne They do. Providing a definition context to local-expand adds brings all the bindings of the immediate contexts and their transitive parents into scope, but it only adds the scopes of the immediate contexts.


michael.ballantyne
2018-8-15 20:55:44

Hmm. When might I want to have a context as a parent, but not add its scope?


lexi.lambda
2018-8-15 20:57:54

I believe that’s generally the behavior you want… I think it’s rare that you actually want to add the scope of parent binding forms. Imagine you have nested definitions contexts that ostensibly represent a binding structure like (let (....) (let (....) e)). When the outer let expands, it should add its scope to its body, but when the inner let expands, the scope of the outer let should already be on the body, so it shouldn’t add any additional scopes.


lexi.lambda
2018-8-15 20:58:39

I don’t think it’s likely to matter very much in practice, but it could matter if you use first-class definitions contexts in strange ways.


lexi.lambda
2018-8-15 20:59:28

(I found this behavior confusing, and I didn’t understand it until recently, so I made an effort to improve the documentation for v7. It could definitely be improved further, though.)


michael.ballantyne
2018-8-15 20:59:44

I thought I was meant to think about definition context scopes as “inside-edge” scopes that should end up on all syntax that ends up within a scope (such as within the nested let), not just on syntax that originated in the scope.


michael.ballantyne
2018-8-15 21:00:41

Whereas I’d use outside-edge” scopes from make-syntax-introducer to create the scopes for the two let forms that might distinguish identifiers that originated within them vs were introduced into them by a macro.


lexi.lambda
2018-8-15 21:02:05

Yes, I think your understanding is correct, but the inside edge scope is still only added by the outer let. After the body is expanded, the scope is added, but the inner let has no reason to do anything with the outer let’s inside-edge scope.


michael.ballantyne
2018-8-15 21:05:17

Have you used multiple immediate contexts for something before?


michael.ballantyne
2018-8-15 21:05:27

That one hasn’t come up for me yet.


lexi.lambda
2018-8-15 21:05:31

I believe I have, but I don’t remember what it was…


lexi.lambda
2018-8-15 21:06:17

In any case, I’m not sure how clear the “right” behavior is, since the difference only really comes up in complex uses of local-expand and first-class definition contexts, which are (1) rare and (2) probably already built with the current model in mind.


lexi.lambda
2018-8-15 21:06:52

So I’m lost as to what this would mean in the usual, intuitive interpretation of hygiene.


michael.ballantyne
2018-8-15 21:06:58

Yeah… right now I’m trying to figure out how to get use-site scopes to work properly when making a custom expander with only local-apply-transformer.


lexi.lambda
2018-8-15 21:08:01

This is only tangentially relevant, but the docs for local-apply-transformer have been wrong since I wrote them, and I am not sure how to rephrase them. :disappointed:


michael.ballantyne
2018-8-15 21:08:11

Oh? What’s been wrong?


lexi.lambda
2018-8-15 21:09:15

The documentation claims that “The result is similar to expanding (m stx) with local-expand, where m is bound to transformer,” except that isn’t right, since transformer is applied to stx directly, not wrapped in any additional syntax.


michael.ballantyne
2018-8-15 21:10:31

Oh! Right.


lexi.lambda
2018-8-15 21:10:49

I can’t figure out how to draw a clear analogy to local-expand without bringing in the awkward dance involving quote, which is too close to the implementation, so maybe the line should just be cut.


lexi.lambda
2018-8-15 21:13:38

I sort of like the analogy, though, since I think thinking about local-apply-transformer as “local-expand-once but the transformer is explicitly supplied” is probably more useful to most people than “(transformer stx) but with proper handling of macro-introduction scopes”. In any case, having both explanations is convenient.


dthien
2018-8-15 21:25:59

@dthien has joined the channel


dthien
2018-8-15 21:31:59

Hello, I’m trying to make a new racket package, but I can’t figure out how to make it do non-racket things when it installs. Specifically, I want to compile a C library from a github repo which creates a shared object and then install the shared object. The racket file is just the ffi bindings.


dthien
2018-8-15 21:32:11

Any guidance is appreciated :smiley:


soegaard2
2018-8-15 21:32:42

The simplest would be to include the binary.


lexi.lambda
2018-8-15 21:34:00

+1 to shipping the binary. If you must build from source, however, you can take a look at what the bcrypt package does, which builds bcrypt from source on installation. https://github.com/samth/bcrypt.rkt


dthien
2018-8-15 21:34:31

Ok, thanks for the info!


soegaard2
2018-8-15 21:35:09

It’s possible to ship binaries for more than one platform.


dthien
2018-8-15 21:36:19

I saw there was the copy-foreign-libs option for the info.rkt file, is there another option in there for shipping different binaries for different platforms?


lexi.lambda
2018-8-15 21:37:19

you can use install-platform to control which platform that collection should be used for


dthien
2018-8-15 21:37:44

Awesome, thanks for the help!


lexi.lambda
2018-8-15 21:38:37

For example, if you have a package foo, you could have two subdirectories foo/native/x86_64-macosx/ and foo/native/x86_64-linux-natipkg/, each with their own info.rkt file that includes both copy-foreign-libs and install-platform.


lexi.lambda
2018-8-15 21:39:23

(The directory names aren’t meaningful; they can be anything. What matters is what’s in install-platform.)


dthien
2018-8-15 21:39:50

Cool ty!


soegaard2
2018-8-15 21:40:39

@lexi.lambda Do you know of an example. I am looking at portaudio, but I don’t think copy-foreign-libs is used. https://github.com/jbclements/portaudio


lexi.lambda
2018-8-15 21:41:14

I have an example in one of my own projects, but it’s a private repo, and I don’t want to make it public right now… and unfortunately I don’t know of any other examples.