343519265
2020-11-19 08:59:41

switch to continuation marks?


sorawee
2020-11-19 09:12:44

Tried that. It’s… 2x slower. I don’t know what went wrong.


sorawee
2020-11-19 09:13:26

parameterize already uses continuation marks though.


sorawee
2020-11-19 09:15:55


sorawee
2020-11-19 09:16:30

In my application which uses parameters heavily, it’s 2x slower.


laurent.orseau
2020-11-19 10:06:54

@wanpeebaw It’s much better than mere occurrences since it cooperates with check-syntax to distinguish between the different lexical scopes:


wanpeebaw
2020-11-19 10:27:07

@laurent.orseau Well, AFAIK, many IDEl’s highlight occurrence feature are also semantics aware. For example Android Studio (IntelliJ), VSCode…


laurent.orseau
2020-11-19 10:27:54

Really, are they? I’m surprised, but that’s cool.


wanpeebaw
2020-11-19 10:30:40

IIRC, it starts from Eclipse JDT. Which equipped with an incremental compiler.


laurent.orseau
2020-11-19 10:33:36

I’ve been using Racket for too long :smile:


kellysmith12.21
2020-11-19 11:03:04

Are syntax-properties appropriate for tasks like tracking static type information?


343519265
2020-11-19 12:00:13

Probably it walk through a large proportion of mark stacks if you have many different keys, while with parameter it just find the closest parameterization.


capfredf
2020-11-19 13:58:31

yes


soegaard2
2020-11-19 14:03:39

@sorawee We (Neil and I) had the same problem when we implemented with-modulus in math/number-theory. The first version used parameters and was somewhat slow. The solution was to use a cache. See https://github.com/racket/math/blob/master/math-lib/math/private/number-theory/modular-arithmetic-base.rkt


mflatt
2020-11-19 14:26:04

@sorawee Your replacement for parameterize seems faster to me, but maybe my tests aren’t using parameters in the same way as your application. Here’s what I tired: https://gist.github.com/mflatt/9e307484d3288f7784096dfddd70e12a


samth
2020-11-19 14:50:43

Roughly, the original idea was to teach using functional programming. Doing that made them realize that they needed multiple separate languages for teaching, thus an IDE that supported that. That led to research on supporting multiple languages, and ultimately to the language-oriented approach now in Racket.


samth
2020-11-19 14:52:19

You can check out turnstile, which does this: https://bitbucket.org/stchang/macrotypes/src/master/


cris2000.espinoza677
2020-11-19 16:39:22

when using define-runtime-path if i raco exe my program, the relative paths are according to the original source file and not the new executable, how do i fix it? eg: (define-runtime-path DB-FILE "mydb.db") (define WCONN (sqlite3-connect #:database DB-FILE #:mode 'create))


samth
2020-11-19 16:44:32

I think you might want raco distribute


samth
2020-11-19 16:46:27

In general define-runtime-path is specifying a path that should be interpreted relative to the source file, so that it’s the same path regardless of where you execute the racket file or executable.


cris2000.espinoza677
2020-11-19 16:51:01

oh ok that works, now it puts the file in some nested directory… but it at least goes along with my exe, thank you!


samth
2020-11-19 16:55:36

Right, if what you want is to be able to move things and have files come along, then you want raco distribute


samth
2020-11-19 16:56:15

If you want a relative path, then it depends what you want that path to be relative to.


cris2000.espinoza677
2020-11-19 17:01:57

let’s say i want a config file to auto generate when opening my exe, i had already heard of (find-system-path 'run-file) that sometimes returns the racket exe of the drracket executable which is not what i want, now fair enough i just have to make a procedure that handles those edge cases. but i wanted to know if there was a more straightforward way of doin this.


samth
2020-11-19 17:02:42

what do you want it to produce if you just run the file with racket foo.rkt?


cris2000.espinoza677
2020-11-19 17:08:58

well… if my source code is composed of many files, and i made a tool that i could carry around and only affect the directory is in… i could just pack them into an executable and voila.

also i run into an issue in Windows where i dont seem to be able to open more than one script with gracket unless i raco exe it.


cris2000.espinoza677
2020-11-19 17:10:08

i can with racket but it shows the console screen, and that is annoying


samth
2020-11-19 17:10:40

What do you mean by more than one script?


samth
2020-11-19 17:11:04

Also, I don’t understand what your suggestion is for my question


cris2000.espinoza677
2020-11-19 17:16:19

okok yeah i dont seem to have answered your question, basically what i’ve been using define-runtime-path until now is for having references to file that will be created with dumped information, a db file in the case of a database, maybe a json config file.

I wanted a straightforward solution for when I either execute my program with racket/drracket/gracket to get these paths and when i pack my program with raco exe aaah… I don’t think i understand the question though.


By more than one script i mean physically cannot have more than one instance of gracket running, this is circumvented by using raco exe , but if i have a script with let’s say #lang racket/gui (send (new frame% [label ""]) show #t) and then i name it A.rkt and have copy of it A-copy.rkt i try to run both with gracket <namefile> and only the first one will appear and the other silently do nothing


samth
2020-11-19 17:18:26

Right, the question is if you had a function that magically gave you the answer you wanted, what would it produce if you hadn’t used raco exe


samth
2020-11-19 17:18:50

That really sounds like a bug


samth
2020-11-19 17:19:27

It’s possible that Windows is weird relative to other platforms but I don’t think so in this case


cris2000.espinoza677
2020-11-19 17:21:30

uhh not really i dont think so? i mean my problem originated that the examples for define-runtime-path [https://docs.racket-lang.org/reference/Filesystem.html?q=define-runtime-path#%28form._%28%28lib._racket%2Fruntime-path..rkt%29._define-runtime-path%29%29\|link] make it seems as you can have always a relative path to a file, and that it cooperated with raco exe . im backtracking a little here.

did i confuse you with that thing i said about gracket? because im confused now too. :(


samth
2020-11-19 17:25:02

define-runtime-path does cooperate with raco exe, and it does work with relative paths, so I’m not sure what you’re saying.


samth
2020-11-19 17:25:42

My point is that if you want a relative path, then you have to decide “relative to what” and it’s not obvious what the right answer is.


cris2000.espinoza677
2020-11-19 17:32:59

let’s say i have

;; main.rkt #lang racket (require "other.rkt") (dump) ;; other.rkt #lang racket (require racket/runtime-path) (provide dump) (define-runtime-path data.txt "data.txt") (define (dump) (call-with-output-file data.txt (lambda (out) (writeln "hello there" out)) #:exists 'replace #:mode 'text)) raco exe main.rkt

i move main.exe to folder bin i run it, and the data.txt file will be created in the parent directory of bin


cris2000.espinoza677
2020-11-19 17:33:33

and i dont want that…


samth
2020-11-19 17:34:15

what do you want the function to do if you do racket main.rkt? Or cd ..; racket code/main.rkt?


cris2000.espinoza677
2020-11-19 17:38:26

i want it to write data.txt in the same folder as main.exe which as you mentioned raco distribute kinda does that, except that it is not in the same folder main.exe but a nested directory that i have no control over it. based on my example above i get this

\|- main.rkt \|- other.rkt \|- data.txt \| \|- bin \|--- main.exe after executing main.exe

i want \|- main.rkt \|- other.rkt \| \|- bin \|--- main.exe \|--- data.txt


samth
2020-11-19 17:39:03

Right but what do you want to happen when you don’t create an executable?


cris2000.espinoza677
2020-11-19 17:39:56

where i to run racket main.rkt i want the first file tree


samth
2020-11-19 17:40:48

what about when you run racket foo/main.rkt?


cris2000.espinoza677
2020-11-19 17:41:47

ah also the same as the first file tree, yeah… i cant use (current-directory) well not in a straightforward way, but i think about what if i change the cwd in a batch file or the like… idk


samth
2020-11-19 17:44:25

So you want something that’s in the same location as what the (define-runtime-path ...) specified if you run it without raco exe, but you want it to be relative when you move the executable file?


cris2000.espinoza677
2020-11-19 17:44:42

yeah exactly!


samth
2020-11-19 17:50:43

Note that such behavior definitely won’t work if you’re reading the file


cris2000.espinoza677
2020-11-19 17:57:47

if im reading data.txt?


laurent.orseau
2020-11-19 17:58:16

Just checking, can you do this with these editors: https://www.youtube.com/watch?v=XinMxDLZ7Zw&t=4s


samth
2020-11-19 18:01:14

Right


samth
2020-11-19 18:28:38

Because data.txt is in some specific place, not a place that moves with the executable


phanthero
2020-11-19 19:18:28

Is there a rationale for naming this lvp? lvp ::= pat ooo greedily match pat instances \| pat match pat I keep thinking “list value pair”, but it’s actually “pattern, or lots of patterns”



sorawee
2020-11-19 19:21:13

v is probably “variable” as in “variable in length”


sorawee
2020-11-19 19:21:42

p is definitely “pattern”


cris2000.espinoza677
2020-11-19 19:23:01

yeah how can i achieve that? how can i detect if i am running from an executable made with raco exe?


samth
2020-11-19 19:23:39

Why do you want different behavior?


cris2000.espinoza677
2020-11-19 19:25:56

because i want them to act as different entities.

when running with racket is probably because im developing it,

if im running it “compiled”, it’s probably because i have multiple copies of the file and want it to keep configurations, data, etc separated…


phanthero
2020-11-19 20:12:12

Yea, I think it might actually be “length variable pattern”


phanthero
2020-11-19 20:12:20

list doesn’t make too much sense here either, maybe


samth
2020-11-19 20:18:16

The bad news is that define-runtime-path, and raco exe/distribute, and overall racket as a whole, are designed to preserve behavior through different compilation modes


cris2000.espinoza677
2020-11-19 20:18:59

huh i see…


cris2000.espinoza677
2020-11-19 20:52:48

ok so after some searching, (find-system-path 'run-file) almost always gets the file it was executed, unless it was tampered with such as inside DrRacket… so for my purposes it will work, well enough i think. https://github.com/racket/distributed-places/blob/3f4a1f43430216871e8cc7a6ecbd2a03530a9bfb/distributed-places-lib/racket/place/distributed.rkt#L126\|distributed.rkt#L126 this gave me some clues. thank you for your guidance


ryanc
2020-11-19 23:28:46

My guess is “list-valued pattern”.


wanpeebaw
2020-11-20 01:37:22

Yes, it’s call Extract Method. It’s a code refactoring feature. https://www.jetbrains.com/help/idea/extract-method.html

There are also other kinds of refactoring actions like Extract constant, Extract field, Extract Parameter, Extract/Introduce variable, Rename, Inline… https://www.jetbrains.com/help/idea/refactoring-source-code.html


racket192
2020-11-20 02:38:41

My M1 based Macbook Pro 13 comes 11/24. DrRacket will be one of the first things I’ll install. I’ll let you know. It may be that it just runs fine under Rosetta x86 emulation. It’s going to be a while before the package managers (brew, nix, macports, etc.) work at all.



wanpeebaw
2020-11-20 07:01:07

wanpeebaw
2020-11-20 07:05:03