[racket] Custom syntax colorer in DrRacket's REPL?

2011-11-07 Thread Dmitry Pavlov
Hello, I am developing a custom non-sexp language in Racket. Here is how I provide my own syntax colorer for it in module mylang/lang/reader.rkt: #:info (lambda (key defval default) (case key [(color-lexer) (dynamic-require 'mylang/tool/syntax-color

[racket] Can not set breakpoints on macro calls that do not expand into a single command

2011-11-14 Thread Dmitry Pavlov
Hello, I am having trouble debugging Racket code that contains macros. Here is the simplest example: #lang racket (define-syntax-rule (my-print x) (printf "~a\n" x)) (define-syntax-rule (my-print1 x) (begin (printf "~a\n" x))) (my-print 10) (my-print1 20) (my-print 30) (my-print1 40

Re: [racket] Can not set breakpoints on macro calls that do not expand into a single command

2011-11-18 Thread Dmitry Pavlov
(let) solves the problem with source location of the macro and also preserves the source location info of the inner S-expressions of the macro. I still use Racket 5.1.3. Best regards, Dmitry On 11/14/2011 12:24 PM, Dmitry Pavlov wrote: > > Hello, > > I am having trouble debugging

[racket] exception instead of EOF?

2011-12-26 Thread Dmitry Pavlov
Hello, I would like to make read-byte and friends to throw an exception in case end of file is reached. That is, when I call read-byte, I know that the byte must be there, otherwise the input data is corrupt. I would prefer not to check the result of every read-byte call. What is the simplest way

Re: [racket] exception instead of EOF?

2011-12-27 Thread Dmitry Pavlov
ose?)) (define p (open-input-bytes #"apple")) (define p2 (input-port->error-eof-input-port p)) (read-bytes 5 p2) ; ok (read-byte p2) ; fail At Mon, 26 Dec 2011 08:06:47 -0800, John Clements wrote: On Dec 26, 2011, at 2:46 AM, Dmitry Pavlov wrote: Hello, I would like to ma

[racket] Formatted output of floating-point numbers?

2012-01-12 Thread Dmitry Pavlov
Hello all, I have been looking for a way to do in Racket something you can easily do in C: printf("%10.5lf\n", 12.345678); so it properly cuts the fractional part to 5 digits and adds padding to get 10 characters in total, producing " 12.34568" as a result. Best regards, Dmitry _

Re: [racket] Formatted output of floating-point numbers?

2012-01-12 Thread Dmitry Pavlov
Hello Grant, > http://synthcode.com/scheme/fmt > > There is a Planet package for it right on the page. Thanks, it seems to be just what I need. After reading the docs, I think that (fmt #f (pad 10 (fix 5 12.345678))) will do the job for me. However, I can not load the package: > (require (plane

Re: [racket] Formatted output of floating-point numbers?

2012-01-13 Thread Dmitry Pavlov
Jos, Ryan, Thanks for your suggestions. They both work -- for planet-fmt the code is ((fmt "F10.5") 12.345678). I think I will take srfi/48, as it does not require connecting to PLaneT. Best regards, Dmitry Racket Users list: http://lists.racket-lang.org/users

[racket] why shift/reduce conflict?

2012-01-16 Thread Dmitry Pavlov
Hello all, I am having trouble with yacc parser giving shift/reduce conflict, while I do not see where the conflict can be. I have simplified the grammar to the following one: #lang racket (require parser-tools/yacc parser-tools/lex) (define-empty-tokens my-tokens (EOF A B C)) (defi

Re: [racket] why shift/reduce conflict?

2012-01-17 Thread Dmitry Pavlov
parser. I should have educated myself on the subject earlier: http://www.cs.man.ac.uk/~pjj/cs212/ho/node7.html So to make that conflict gone, I had to convert my grammar to something like (x ((C A B) 'cab)) ((C A A B) 'caab))) Best regards, Dmitry On Mon, Jan 16, 2012 at 2:49

Re: [racket] Look-ahead in parser-tools?

2012-01-17 Thread Dmitry Pavlov
Hello Simon, Some observations that maybe will help: 1. Since the problem is obviously in the lexer, you would probably prefer testing the lexer instead of parser: (define (test-lexer str) (let ((p (open-input-string str))) (port-count-lines! p) (let loop () (let ((tok (position

[racket] Anything happened with the bug report server?

2012-02-17 Thread Dmitry Pavlov
Hello, I recently tried to submit a bug report about srfi/48. The system tells me every time that it will send me an e-mail soon, and I have not received any. I tried to search my bug on the site, and found nothing, so I think it rejected my report for some reason. I tried yesterday and today, fr

[racket] Debug button unavailable when is should not be

2012-03-01 Thread Dmitry Pavlov
Hello, I once implemented a DSL called "slon" in Racket. My programs start with "#lang slon", and I open them in DrRacket, edit, run, and debug them. To make Racket aware of the DSL, I can either put a symbolic link to my code into the standard collects directory: ln -s /home/dpavlov/work/slon

Re: [racket] Debug button unavailable when is should not be

2012-03-02 Thread Dmitry Pavlov
et the collection path and then > started up a DrRacket inside that DrRacket, you'd see the buttons as > you expect. > > But in any case, I think raco link is probably the best approach. > > Robby > > On Thu, Mar 1, 2012 at 2:22 AM, Dmitry Pavlov wrote: >> Hello, &g

[racket] keyword initialization of structs?

2012-03-05 Thread Dmitry Pavlov
Hello, I was wondering if Racket's struct instances can be initialized with keywords, like in the following example written in CL: * (defstruct foo bar baz) FOO * (make-foo :bar 1 :baz 2) #S(FOO :BAR 1 :BAZ 2) Best regards, Dmitry Racket Users list: http://lists.racke

Re: [racket] keyword initialization of structs?

2012-03-06 Thread Dmitry Pavlov
03392.html (See Matthias' response) I recall this example quite well, as it was very helpful when I was learning Racket macros. On 2012-03-05, at 8:16 AM, Dmitry Pavlov wrote: Hello, I was wondering if Racket's struct instances can be initialized with keywords, like in the followin

Re: [racket] What math do you want to do in Racket?

2012-07-04 Thread Dmitry Pavlov
Neil, I kept in mind to initiate a topic about it, but since you asked first (thanks!), I will say it now: *** I want 80 bit IEEE floating point numbers in Racket. *** Double precision (64 bit) is not always enough for scientific calculations. Extended precision is demanded. Is it possible to

[racket] Unload an FFI library

2012-08-09 Thread Dmitry Pavlov
Hello, The topic of unloading a library loaded with ffi-lib was raised in 2010: http://lists.racket-lang.org/users/archive/2010-August/041023.html The answer was that Racket can not unload a library. Has there been any update since then? Best regards, Dmitry Racket Users

Re: [racket] Unload an FFI library

2012-08-09 Thread Dmitry Pavlov
>> http://lists.racket-lang.org/users/archive/2010-August/041023.html >> >> The answer was that Racket can not unload a library. >> Has there been any update since then? > > No, there's still no support for unloading. It would be nice to have at least REloading, at least "for debugging purposes on

[racket] Trouble with C->Racket callbacks passing pointers to arrays

2012-08-20 Thread Dmitry Pavlov
Hello, I am stuck with a Racket<->C linkage problem which manifests itself at random occasions. I was able to come up with this short example (ffi-test.rkt) with which the problem can be analyzed: #lang racket (require ffi/unsafe ffi/unsafe/define ffi/unsafe/cvector ffi/vector) (define libmy

Re: [racket] Trouble with C->Racket callbacks passing pointers to arrays

2012-08-20 Thread Dmitry Pavlov
Matthew, (define _handler (_fun _int _pointer -> _int)) The `_pointer' C type means a reference to memory that is not managed by the GC. Change the `_pointer' above to `_gcpointer', since the handler receives a pointer that is managed by the GC. That makes perfect sense! Thank you very much

Re: [racket] Trouble with C->Racket callbacks passing pointers to arrays

2012-08-21 Thread Dmitry Pavlov
The problem in this case is that the C code receives a pointer `x' to a GC-managed object, and the object at that memory moves during the callback to filler(), so that memcpy(x, ) copies to the wrong place. Ahhh, I should have figured that. Thanks! Assuming that your C code will remain o

[racket] Strange difference between (define (for-syntax)) and (define-for-syntax)

2012-08-29 Thread Dmitry Pavlov
Hello, I just came across a strange error: #lang racket ;(require (for-syntax (only-in ffi/unsafe ctype-sizeof _pointer))) (require-for-syntax (only-in ffi/unsafe ctype-sizeof _pointer)) (define-for-syntax (os-bitness) (let ((ptrsize (ctype-sizeof _pointer))) (case ptrsize ((4) 32)

Re: [racket] Strange difference between (define (for-syntax)) and (define-for-syntax)

2012-08-29 Thread Dmitry Pavlov
Danny, Is require-for-syntax even a form in #lang racket? I thought it doesn't exist outside the mzscheme legacy language, at least according to http://docs.racket-lang.org/mzscheme/Old_Syntactic_Forms.html#(form._((lib._mzscheme/main..rkt)._require-for-syntax)) I agree with you. It is strang

[racket] raco exe: unknown module

2015-02-27 Thread Dmitry Pavlov
Hello, Using the latest Racket snapshot, I am getting a cryptic error message in raco exe. test.slon is a program written in a custom #lang. $ racket -v Welcome to Racket v6.1.1.8. $ raco make test.slon $ racket test.slon OK $ raco exe test.slon require: unknown module module name: #"/opt/rack

Re: [racket] raco exe: unknown module

2015-03-02 Thread Dmitry Pavlov
rted with a recent change in TR to avoid loading contracts when typed code isn't used in untyped contracts, refining that implementation exposed a problem with `raco exe`, etc. Thanks for the report! At Fri, 27 Feb 2015 15:39:14 +0300, Dmitry Pavlov wrote: Hello, Using the latest Racket snapsh

Re: [racket] raco exe: unknown module

2015-03-03 Thread Dmitry Pavlov
On 03/03/2015 01:59 AM, Alexander D. Knauth wrote: Could submodules be causing it? try.rkt: #lang typed/racket/base (provide x) (define x : Integer 1) (module* test racket/base (require (submod "..")) x) Gives this error: . . Racket v6.1.1.8/collects/racket/private/reqprov.rkt:79:13: syn

[racket-users] (require plot) categorically requires X11

2015-04-11 Thread Dmitry Pavlov
Hello, I try to require the plotting library (let alone use it) in a non-X Linux session: $ ssh localhost $ racket Welcome to Racket v6.1.1.8. > (require plot) Gtk initialization failed for display ":0" context...: /opt/racket/share/pkgs/gui-lib/mred/private/wx/gtk/queue.rkt: [running body

Re: [racket-users] (require plot) categorically requires X11

2015-04-11 Thread Dmitry Pavlov
Leif, You can always use the plot/no-gui collection: http://docs.racket-lang.org/plot/plotting.html?q=plot%2Fno-gui#%28mod-path._plot%2Fno-gui%29 This should work without the need for X11. Thank you, that is exactly what I need. Best regards, Dmitry -- You received this message because y

[racket-users] Why not ship pre-built Racket libraries in the distribution?

2015-09-15 Thread Dmitry Pavlov
Hello, I just started to experiment with making my Racket library embeddable to C programs [1]. The first thing I needed to do was to download the Racket source code and compile the libracket3m.a. I wonder why the maintainers do not put this file into the distribution? It seems that as soon as

Re: [racket-users] Why not ship pre-built Racket libraries in the distribution?

2015-09-15 Thread Dmitry Pavlov
se `execve()` works better for our purposes. At Tue, 15 Sep 2015 14:29:51 +0300, Dmitry Pavlov wrote: Hello, I just started to experiment with making my Racket library embeddable to C programs [1]. The first thing I needed to do was to download the Racket source code and compile the libracket3m.a. I

[racket-users] embedded Racket + runtime paths = ?

2015-09-16 Thread Dmitry Pavlov
Hello, I just created a C program that uses my Racket library via Racket's embedding mechanism, and it works fantastic. Now I am wondering---how to ship my C program's executable if the underlying Racket library has runtime paths in it? The executable seems to have been set up for absolute paths

Re: [racket-users] embedded Racket + runtime paths = ?

2015-09-16 Thread Dmitry Pavlov
y At Wed, 16 Sep 2015 14:26:41 +0300, Dmitry Pavlov wrote: Hello, I just created a C program that uses my Racket library via Racket's embedding mechanism, and it works fantastic. Now I am wondering---how to ship my C program's executable if the underlying Racket library has runtime pa

Re: [racket-users] embedded Racket + runtime paths = ?

2015-09-16 Thread Dmitry Pavlov
Also, if it matters, I usually make my Windows builds on Linux with MinGW (i686-w64-mingw32-gcc, x86_64-w64-mingw32). But I can use Visual Studio too, I guess, if that will make things easier for raco distribute or whatever. Best regards, Dmitry On 09/16/2015 03:52 PM, Dmitry Pavlov wrote

Re: [racket-users] embedded Racket + runtime paths = ?

2015-09-20 Thread Dmitry Pavlov
Matthew, I've added a `--runtime ` argument to `raco ctool --cmods`, which gathers runtime files into and makes the embedded modules refer to them in (which is expected to be relative to the executable, but see also the `--runtime-access` option). The embedding executable must call scheme_se

Re: [racket-users] Why not ship pre-built Racket libraries in the distribution?

2015-09-20 Thread Dmitry Pavlov
, Dmitry On 09/15/2015 11:01 PM, Dmitry Pavlov wrote: Matthew, Sure I meant the full distribution. Thanks, I hope that the consensus will be reached :) Best regards, Dmitry On 09/15/2015 08:06 PM, Matthew Flatt wrote: We left out "libracket3m.a" just to make the distribution smaller

[racket-users] crash in nightly build

2015-09-20 Thread Dmitry Pavlov
Hello, I was just able to discover that my program crashes on the nightly build 6.2.900.17, on Linux. The program has a heavy portion of math, double and extended unsafe ops, and accesses multiple low-level libraries. It has crashed after 4 hours of running, while doing just the same that it had

Re: [racket-users] embedded Racket + runtime paths = ?

2015-09-20 Thread Dmitry Pavlov
Matthew, On 09/21/2015 12:38 AM, Matthew Flatt wrote: At Sun, 20 Sep 2015 23:53:42 +0300, Dmitry Pavlov wrote: On Windows, though, I ran into a problem when linking my app with pre-built libracket3m_9yy8mp.lib : error LNK2001: unresolved external symbol __imp_scheme_get_mz_setjmp That is the

Re: [racket-users] embedded Racket + runtime paths = ?

2015-09-20 Thread Dmitry Pavlov
I just tried the 32-bit Utah snapshot and 32-bit C app -- build OK, but the app crashed right on scheme_main_setup with zero pointer access. It did not even enter my "run" function. My initial guess is that it's related to thread-local storage and missing instructions in "Inside". I'll look i

Re: [racket-users] crash in nightly build

2015-10-05 Thread Dmitry Pavlov
gs in places.) If you can get any sort of crash report with a stack trace, that information is often enough for me to either track down the problem or at least say something about what parts of the example may be relevant. Thanks, Matthew At Mon, 21 Sep 2015 00:08:43 +0300, Dmitry Pavlov wrote: Hell

Re: [racket-users] crash in nightly build

2015-10-11 Thread Dmitry Pavlov
, Dmitry Pavlov wrote: I am going to get you a stack trace. Am I correct that in order to get the stack trace, I have to rebuild Racket with -G and run it in gdb? Racket builds with `-g` by default, but `make install` uses `strip`. You could configure with `--enable-strip`, or just run "

Re: [racket-users] crash in nightly build

2015-10-15 Thread Dmitry Pavlov
Matthew, It seems that I have lost my grip on the crash. It has not happened for almost a week---neither with the version that I build myself, nor with the nightly build where I definitely saw it. I did not update Racket during this time. I did not do anything else. I have no idea why it is gone

Re: [racket-users] crash in nightly build

2015-10-30 Thread Dmitry Pavlov
gets JIT-compiled. At Thu, 15 Oct 2015 11:56:21 +0300, Dmitry Pavlov wrote: Matthew, It seems that I have lost my grip on the crash. It has not happened for almost a week---neither with the version that I build myself, nor with the nightly build where I definitely saw it. I did not update R

[racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-10-31 Thread Dmitry Pavlov
Hello, I vaguely remember that extflonum support was supposed to be turned off by default in 32-bit Linux releases. OK. But current 32-bit Windows nightly builds do not provide it either. I did not notice when they stopped to provide it. Moreover: I just built Racket from github source on 32-bit

Re: [racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-10-31 Thread Dmitry Pavlov
Moreover: I just built Racket from github source on 32-bit Linux with --enable-extflonum switch to ./configure, and the build version somehow misses the extflonums: Actually, not from the github source, but from the snapshot "source + built packages". I guess it should not matter, though. Reg

Re: [racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-11-03 Thread Dmitry Pavlov
Matthew, But current 32-bit Windows nightly builds do not provide it either. I did not notice when they stopped to provide it. When I try the 32-bit Windows builds, they seem to have extflonums enabled. Oh, sorry. It has turned out that I was jumping to conclusion on this one. Actually, ex

Re: [racket-users] embedded Racket + runtime paths = ?

2015-11-05 Thread Dmitry Pavlov
h string there anymore, so I do not know what to do. Regards, Dmitry On 09/21/2015 08:13 AM, Dmitry Pavlov wrote: I just tried the 32-bit Utah snapshot and 32-bit C app -- build OK, but the app crashed right on scheme_main_setup with zero pointer access. It did not even enter my "r

Re: [racket-users] crash in nightly build

2015-11-11 Thread Dmitry Pavlov
Matthew, More than a week has passed since I updated my installation of Racket. Good news: no crashes since the update. Most probably the bug that you fixed was causing the crash. Best regards, Dmitry On 10/31/2015 06:23 AM, Dmitry Pavlov wrote: Matthew, Before upgrading to the version

Re: [racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-11-12 Thread Dmitry Pavlov
Matthew, unsafe-extfllong_double_mult: unsupported on this platform FWIW, my actual program is a C program that uses a Racket library obtained with raco ctool. I can provide you more details and a reproducible example if the above is not enough to hunt down the cause. I think the problem is

Re: [racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-11-12 Thread Dmitry Pavlov
The more interesting thing is that the 'longdouble.dll' is not put into the runtime directory by 64-bit Racket, too. Still, the 64-bit program works without any additional effort. Oops, sorry, I just checked again, the 64-bit Racket fails too. I think you'll need to call scheme_set_dll_path(

Re: [racket-users] embedded Racket + runtime paths = ?

2015-11-15 Thread Dmitry Pavlov
Matthew, On 11/13/2015 06:33 PM, Matthew Flatt wrote: I've pushed a change that may solve this problem. The change was to the way that `--runtime` determines a shared path prefix among runtime files, so that it can copy them to a new place but keep relative paths intact. On Windows, the paths b

Re: [racket-users] embedded Racket + runtime paths = ?

2015-11-15 Thread Dmitry Pavlov
Matthew, [...] So, if the immediate repair doesn't solve the problem for you, a follow-up change might. [...] Is it e3d78e4, or it is to be done yet? Yes, it's e3d78e4. I hate to tell you this, but the error still remains in the latest nightly build, Windows i386: >racket Welcome to Rac

Re: [racket-users] embedded Racket + runtime paths = ?

2015-11-17 Thread Dmitry Pavlov
Matthew On 11/17/2015 03:50 PM, Matthew Flatt wrote: I found another place where case-normalization of paths was not handled correctly. Your example now works for me with a snapshot build. Can you try the latest? Yes the latest build works! Thank you very much. The case can be finally closed,

Re: [racket-users] What has happened to extflonum support in 32-bit nightly builds?

2015-11-17 Thread Dmitry Pavlov
Matthew, On 11/13/2015 06:25 PM, Matthew Flatt wrote: At Thu, 12 Nov 2015 19:11:28 +0300, Dmitry Pavlov wrote: The more interesting thing is that the 'longdouble.dll' is not put into the runtime directory by 64-bit Racket, too. Still, the 64-bit program works without any additio

[racket-users] lib-search-dirs in config.rktd discards Racket's own libs on Windows

2015-11-25 Thread Dmitry Pavlov
Hello, I edit etc/config.rktd on every installation of Racket to add a path to my own libraries: (lib-search-dirs . ("C:/my/libs")) Older versions of Racket were OK with that setting. Current version obeys that setting too strongly, forgetting where its own libraries are. For example, DrRacket

Re: [racket-users] pasteboard% applications

2015-12-05 Thread Dmitry Pavlov
Does anyone have an application using pasteboard%? I want to try one, and I’d love to see an example. A (bit underdone) spreadsheed editor using pasteboard% : https://github.com/kugelblitz/spreadsheet-editor Available in Racket via raco pkg install spreadsheet-editor Regards, Dmitry -

[racket-users] How to cite Racket in a journal paper?

2015-12-20 Thread Dmitry Pavlov
Hello, I am writing a paper for a scientific journal. The results that I am presenting there were obtained mostly in Racket. What is the best way to give credit to Racket in references? Is there a specific paper I can reference, or just link the website? If specifics matter: I am heavily usi

Re: [racket-users] How to cite Racket in a journal paper?

2015-12-20 Thread Dmitry Pavlov
exclusively use URLs ad bib entries :-) — Matthias On Dec 20, 2015, at 7:05 AM, Jay McCarthy wrote: Hi Dmitry, This page describes what you should do: http://racket-lang.org/tr/ > http://racket-lang.org/tr1/ On Sun, Dec 20, 2015 at 5:52 AM, Dmitry Pavlov wrote: Hello, I am writin

Re: [racket-users] can't (require table-panel) today

2017-10-13 Thread Dmitry Pavlov
#lang racket/gui (require table-panel) leads to: standard-module-name-resolver: collection not found Have you tried raco pkg install table-panel? Best regards, Dmitry -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from th

Re: [racket-users] Re: New wiki page ‘friends of Racket’

2017-10-31 Thread Dmitry Pavlov
John Carmack uses Racket as script language in Oculus platform. Not anymore: https://twitter.com/ID_AA_Carmack/status/739289907038801921 Regards, Dmitry -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and sto

Re: [racket-users] New wiki page ‘friends of Racket’

2017-10-31 Thread Dmitry Pavlov
I have added some Racket-related information about the Institute of Applied Astronomy I work in. Stephen or Racket-devs: feel free to edit it if needed. Regards, Dmitry On 28.10.2017 12:56, Stephen De Gabrielle wrote: I created a new wiki page https://github.com/racket/racket/wiki/Friend

Re: [racket-users] Using ffi/unsafe/alloc

2018-01-24 Thread Dmitry Pavlov
Konrad, I would create a wrapper like this: (define-fooapi make-foo (_fun (foo : (_ptr o _foo)     -> (r : _int)     -> (if r (begin (register-finalizer-and-custodian-shutdown foo destroy-foo) foo)     (error "can not make foo"))) Regards, Dmitry On 01/2

Re: [racket-users] raco distribute help

2018-02-05 Thread Dmitry Pavlov
Deren, In addition to what Matthew has said, I guess you need to have a 'main' module in your language, and provide it to raco exe, too. It can be a dummy module or not. The requirement of such a module is unclear to me, but it exists. Here is my working script to pack a standalone interpreter

[racket-users] (dynamic-require) performance problem

2018-02-12 Thread Dmitry Pavlov
Hello, I have a performance problem with loading a Racket program dynamically. I measure the time taken to execute a program in two different ways: 1. raco make ; time racket 2. raco make my-runner.rkt; raco make ; time racket my-runner.rkt In the first case, execution takes ~1 second, in

Re: [racket-users] (dynamic-require) performance problem

2018-02-12 Thread Dmitry Pavlov
Matthew, I'm not clear on why you're using `require-input-port` here instead of `dyanmic-require` with 's path. Originally, I needed it to prepend "#lang " to the source because I did not have it in the file. That requirement is not so strict now and I will be able to lift it if it is critica

Re: [racket-users] (dynamic-require) performance problem

2018-02-12 Thread Dmitry Pavlov
Does the port `p` contain the source text for , or does it contain the bytecode from the ".zo" file created by `raco make ? In this dedicated test, just the source text of and nothing else. I think this is the main cause of the performance difference, but just to make sure, does raco

Re: [racket-users] (dynamic-require) performance problem

2018-02-12 Thread Dmitry Pavlov
Matthew, I can imagine a problem where the "language implementation" is in the reader, in which case it wouldn't get run when loading from bytecode, but that doesn't explain why `racket ` works --- unless the initialization is also triggered by a `main` or `configure-runtime` submodule, which wo

[racket-users] "Immobile" lambdas for FFI

2018-03-14 Thread Dmitry Pavlov
Hello, I am doing a Racket interface for a C library and the garbage collector is my trouble again. I am asking for advice from Racket FFI masters (actually, from anybody who knows how to keep persistent callbacks from a C side to Racket). Earlier I was doing this: (define _callback (_fun _int

Re: [racket-users] "Immobile" lambdas for FFI

2018-03-15 Thread Dmitry Pavlov
Matthew, On 03/15/2018 04:22 AM, Matthew Flatt wrote: At Wed, 14 Mar 2018 21:56:05 +0300, Dmitry Pavlov wrote: I suspect that "my-callback" or something linked to it are moved in memory by the garbage collector, and the pointer kept by the C library is no longer valid. In the fir

Re: [racket-users] "Immobile" lambdas for FFI

2018-03-15 Thread Dmitry Pavlov
Matthew, I agree with John on this one. In case you decide to release the files, you may want to correct the comment in callback.rkt: it has (define b #f) and (define b null) where I believe you mean (define b (box #f)) and (define b (box null)), respectively. Also, among listed options for #:ke

Re: [racket-users] Windows Foreign Libraries

2018-03-23 Thread Dmitry Pavlov
On 03/23/2018 03:58 PM, silverfire...@gmail.com wrote: Really silly question but I was using the rsvg package with racket/gui on Linux and everything was working fine.   I moved the code over to windows to try it out (after installing the rsvg package there) and it's complaining that librsvg

[racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
Hello, I would like to write two seemingly simple macros and I found no way to do it. (my-let ((x 2)) (begin (begin (begin (access x) (access y) I would like the (access) macro to know at compile (expansion) time that x is up there in (my-let) macro and y is not.

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
ax ([x (communicate #'e  (length (flatten (syntax->datum #'e] ...)    body)])) (my-let ([x '(a b ((c d) 4) (5 9))])   (access x)) ;=> '((a b ((c d) 4) (5 9)) has-tree-nodes 8) (the answer is 8 and not 7 because it's counting the 'quote in the syntax) On M

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
You can "pass" information from one macro to another by binding information to an identifier defined to be a syntax parameter that both macros have in scope. You would need to functionally update its value for each rebinding. Its value would be retrievable with syntax-local-value. Like this

Re: [racket-users] How to access lexical context from macro?

2018-04-16 Thread Dmitry Pavlov
Oh, syntax-parameter-value has helped. #lang racket (require (for-syntax syntax/parse syntax/transformer) racket/stxparam) (define-syntax-parameter my-info '()) (define-syntax (access stx)   (syntax-parse stx     ((_) (printf "my-info = ~v\n" (syntax-parameter-value #'my-info))  

[racket-users] Is it possible to pass syntax information from bottom up?

2018-04-18 Thread Dmitry Pavlov
Hello, I am looking for an advice on how to write a macro that is aware of the information extracted from syntax objects from another macro that is called "inside" the first one. For instance, let it be the (this) macro that detects if its argument is an integer or float, and let it be the (p

Re: [racket-users] Is it possible to pass syntax information from bottom up?

2018-04-18 Thread Dmitry Pavlov
f information: the expanded syntax and the additional property. You can try to encode this with #'(begin expanded-code property) or just use a syntax-property, whatever fits best. When the local-expand returns, take apart the macro and re-do the same thing. Details in the implem

Re: [racket-users] plan for the upcoming v7.0 release

2018-05-27 Thread Dmitry Pavlov
On 05/27/2018 03:10 PM, Matthew Flatt wrote: Hi Dmitry, At Sun, 27 May 2018 14:21:27 +0300, Dmitry Pavlov wrote: We do not expect Racket users to see a big difference between Racket v6.12 and Racket v7.0. I once saw in some text file that extflonums will not make it to Racket on Chez. Will

[racket-users] plot library: legend outside plot?

2018-11-08 Thread Dmitry Pavlov
Hello, Is it possible to render a plot with the legend outside the plotting area, like gnuplot does with "set key outside" option? I see only (plot-legend-anchor) parameter for placement of the legend in different places inside the plot area. Best regards, Dmitry -- You received this mes

Re: [racket-users] Re: plot library: legend outside plot?

2018-11-11 Thread Dmitry Pavlov
ub.com/racket/plot/blob/8dcfd7745e2595b8d517fd8cd7c59510efab84a9/plot-lib/plot/private/common/plot-device.rkt#L587 <https://github.com/racket/plot/blob/8dcfd7745e2595b8d517fd8cd7c59510efab84a9/plot-lib/plot/private/common/plot-device.rkt#L587> Alex. On Thursday, November 8, 2018

[racket-users] net/url: Can not download a file over HTTPS

2019-01-24 Thread Dmitry Pavlov
Hello, My workflow broke because of some mess going on with SSL certificates or something. I do not understand what is going on and how to fix it. Could please anybody give an idea? Here is a link: https://datacenter.iers.org/data/latestVersion/9_FINALS.ALL_IAU2000_V2013_019.txt It opens in bro

Re: [racket-users] net/url: Can not download a file over HTTPS

2019-01-24 Thread Dmitry Pavlov
Neil, Thank you so much, I did not know that I can play with the header so easily in get-pure-port. It turned out that the server expects "Accept:" field in the request (but does not care much about its value). So the following code works #lang racket (require net/url) (let* ((url "https://

Re: [racket-users] net/url: Can not download a file over HTTPS

2019-01-24 Thread Dmitry Pavlov
An additional reason to do it with Racket's HTTP libraries is so that one bot someday going crazy doesn't make a devops/sysadmin see that it's Racket, and think unhappy thoughts about Racket. :) Agreed. Best regards, Dmitry -- You received this message because you are subscribed to the G

[racket-users] CAM-2019 conference (St. Petersburg, July 22-24)

2019-03-25 Thread Dmitry Pavlov
Bernard University Lyon, France - Dmitry Pavlov, IAA of Russian Academy of Sciences, Russia - Michael Weigend, University of Münster, Germany - Tatiana Mylläri, St.George’s University, Grenada, West Indies ### Registration and abstract submission Abstract submission is done via EasyChair: https

[racket-users] Program aborts except when there are no previously compiled .zo files

2019-04-12 Thread Dmitry Pavlov
Hello, My program demonstrates an unexpected behavior depending on how I run it. $ $ racket program.rkt $ raco make program.rkt $ racket program.rkt read: bad syntax `#fx' in: compiled/subprogram.mylang.zo context...: "/path/to/myprogram.rkt": [running body] temp37_0 for-loop

Re: [racket-users] Program aborts except when there are no previously compiled .zo files

2019-04-15 Thread Dmitry Pavlov
It would be good if you can share a link to the code. It is difficult to guess where is the problem is with this information. Is there an online public repository with the code? Unfortunately, no. But you are right. I will try and provide an excerpt on which the crash reproduces. Best regar

[racket-users] Bytecode problem with fxvector inside a macro

2019-05-08 Thread Dmitry Pavlov
Hello, I would like to report something that I see as inconsistent behavior of the bytecode compiler. The following short program (an artificial minimal reproducible example) works at first, but fails after raco make. My OS is Linux. $ cat one.rkt #lang racket (require (for-syntax syntax/pars

Re: [racket-users] Bytecode problem with fxvector inside a macro

2019-05-08 Thread Dmitry Pavlov
Matthew, The intended error here is "cannot marshal value that is embedded in compiled code" at `raco make` time, because fxvectors are not supported as literals. I'll fix the bytecode writer to check for this case. OK, thank you. What would you recommend, though, to users who want fxvectors

Re: [racket-users] Bytecode problem with fxvector inside a macro

2019-05-08 Thread Dmitry Pavlov
On 5/9/19 12:04 AM, Dmitry Pavlov wrote: Matthew, The intended error here is "cannot marshal value that is embedded in compiled code" at `raco make` time, because fxvectors are not supported as literals. I'll fix the bytecode writer to check for this case. OK, thank you.

Re: [racket-users] anyone using single-flonums?

2019-05-29 Thread Dmitry Pavlov
My guess is that no one uses them currently, because it's rare that you'd want to trade speed for *im*precision. Single-flonums in Racket are significantly slower than regular flonums, because they're not treated as a common case. The only use I can think of, and the one that inspired the origi

[racket-users] Compiler options for a DSL

2019-05-30 Thread Dmitry Pavlov
Hello, Racket is a perfect tool for creating new languages and compilers for them, everybody knows that. There is one thing, though, generally available in compilers and not instantly available in Racket DSL tools (or I just missed it). How to specify options to the compiler? Consider a source

Re: [racket-users] Why struct type doesn't include field names?

2019-06-14 Thread Dmitry Pavlov
Hello, While we are at it: is it theoretically possible in Racket or Typed Racket (or will be possible in Racket 2 or Typed Racket 2) to access struct fields without repeating the name of the struct type again? Like in C typedef struct {   double x;   double y; } VeryLongStructureName; VeryL

Re: [racket-users] Why struct type doesn't include field names?

2019-06-15 Thread Dmitry Pavlov
But yes, this is directly related to the discussion above because with the field name information, you can write your own accessor. Yes it will be a way to go in Racket 2. But for now, https://docs.racket-lang.org/struct-define/index.html might be a good workaround for your problem. T

[racket-users] DSL to C code generation with symbolic computations en route

2016-04-18 Thread Dmitry Pavlov
Dear Racketeers, I, as a programmer in the area of numerics, just evolved to the state where the following task seem reasonable to work on: - I need to take (or invent) some DSL for numerical computations. All I need is: variables and functions, vectors, loops, arithmetics on numbers and vector

Re: [racket-users] DSL to C code generation with symbolic computations en route

2016-04-19 Thread Dmitry Pavlov
All, Thank you very much for the provided references. Robby, John, Jerzy: thanks for the pointer to Jeff Siskind. His works on automatic differentiation are very interesting. I should look at his Stalingrad software. I did not think about automatic vs symbolic differentiation before; now I am co

Re: [racket-users] DSL to C code generation with symbolic computations en route

2016-04-29 Thread Dmitry Pavlov
RAI seems to be the closest to what I need to do. It has a DSL with arrays and matrices, it generates C code, and it even has automatic differentiation, according to the docs. It is designed for DSP, but probably can be extended to non-DSP programming. I should look at it closer. For the rec

Re: [racket-users] Re: Running racket on a #lang-less module-less file?

2016-05-07 Thread Dmitry Pavlov
Jack, There exists a language that wasn't initially designed with racket in mind, but could easily be a racket #lang. To interop with code already written in this language, I wanted an easy way to run files that don't have the #lang line. I had a very similar case when I had to create a comman

[racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Dmitry Pavlov
Hello, I would like to report two GUI issues; I do not know is they are related or not. I ran against those issues while working on spreadsheet-editor. The task is to clip a row of buttons (column buttons in my spreadsheet). Below I reproduce the issue using a simpler configuration than I use i

Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-18 Thread Dmitry Pavlov
Matthew, > One possible fix is to add the 'hscroll style to the horizontal panel. > That change moves the program into "defined behavior" territory, since > a scrolling panel allows its content to be wider than itself. I just tried that and I see that it shows a scrollbar under the panel that I

Re: [racket-users] GUI: clipping of controls fails on Linux but not on Windows

2016-05-19 Thread Dmitry Pavlov
recommend? Is there a catalog similar to Debian "unstable" repo that I can sync to? Best regards, Dmitry At Wed, 18 May 2016 23:37:02 +0300, Dmitry Pavlov wrote: Matthew, > One possible fix is to add the 'hscroll style to the horizontal panel. > That change move

  1   2   3   >