popa.bogdanp
2019-12-8 08:03:35

@sorawee would (sequence-map list (in-producer gen)) do what you want?


popa.bogdanp
2019-12-8 08:05:00

#lang racket (require racket/generator) (define gen (generator () (yield 1 2) (yield 3 4) (yield 5 6 7))) (for ([lst (sequence-map list (in-producer gen))] [i (in-range 3)]) (displayln lst)) displays (1 2) (3 4) (5 6 7) (I had to add the (in-range 3) to get the loop to terminate)


sorawee
2019-12-8 08:09:03

That works indeed. Thanks!


notjack
2019-12-8 08:36:10

I 100% do not believe that prefix notation is inherently more modular and extensible than infix notation. I just don’t.


notjack
2019-12-8 08:37:29

I have heard many, many arguments claiming it is and found none convincing


tonyg
2019-12-8 10:26:46

I’m having trouble finding an answer via the Great Google — does Racket CS support C extension building? The ansi package has a C extension built via a make/setup-extension pre-install call, which appears to be doing nothing.


sorawee
2019-12-8 11:55:15

@mflatt in https://docs.racket-lang.org/guide/hash-reader.html#%28tech._readtable%29, the code reads:

(define (bad-ending ch src in) (let-values ([(line col pos) (port-next-location in)]) ((if (eof-object? ch) raise-read-error raise-read-eof-error) "expected a closing `$'" src line col pos (if (eof-object? ch) 0 1)))) Should raise-read-error and raise-read-eof-error be swapped?


samth
2019-12-8 12:29:35

Yes, my guess is that you have to do the same thing I did with one of my packages



mflatt
2019-12-8 13:23:53

Yes, that’s right.


mflatt
2019-12-8 13:29:58

@tonyg No, Racket CS does not support C extensions that can substitute directly for a Racket module. Building a plain old shared object and accessing its functionality through unsafe/ffi is the way to go.


tonyg
2019-12-8 13:39:31

Thanks @mflatt and @samth! The .so solution sounds right. ISTR some support for building .so in the standard libraries, but I can’t quite recall the incantation; I’ll go looking


tonyg
2019-12-8 13:40:35

compile-extension, perhaps. Will experiment


samth
2019-12-8 13:41:00

The package I linked to builds a .so


samth
2019-12-8 13:41:16

That’s what I thought you were talking about


tonyg
2019-12-8 13:41:41

Oh cool, yes, thanks, I’ll crib from that then


samth
2019-12-8 13:42:01

I think I originally cribbed it from you, but that might be wrong



tonyg
2019-12-8 13:43:53

I vaguely remember something like that, yeah :slightly_smiling_face: but I’d been using pre-install because the interface was more convenient


tonyg
2019-12-8 13:44:23

Oh haha


kamil.beker
2019-12-8 16:31:25

Anyone pretty familiar with so called HTDP design recipe?


samth
2019-12-8 16:56:20

@kamil.beker yes, many people here are very familiar with it


kamil.beker
2019-12-8 17:06:14

I have not read HTDP yet, however I would like to grasp a little bit of it, as many people refer to it there.


kamil.beker
2019-12-8 17:06:50

I suppose HTDP approach would help me in general problem solving area


samth
2019-12-8 17:07:21

Yes, that’s the idea. I recommend starting and asking here if you run into trouble.


kamil.beker
2019-12-8 17:08:14

Then moving my question to chat :wink:


kamil.beker
2019-12-8 17:08:36

Guys, how do you cope with projects that are hard and involve things that you do not know yet? Short background: Decided to try something harder for University project, and it revolves around Evolutionary Alghortihms and Text Summarization, so it’s mainly reading research papers and trying to understand it, but damn its hard! I Wonder is there some sort of “Alghorithm” for learning & developing things that are mentally exhausting :smile:


kamil.beker
2019-12-8 17:14:17

I know it may does not have a lot in common with Racket, but… maybe? :slightly_smiling_face:


samth
2019-12-8 17:15:26

@kamil.beker there’s not really an algorithm for this. You get better with practice, though.


kamil.beker
2019-12-8 17:16:18

Eat, Code, Sleep, Repeat? :smile:


kamil.beker
2019-12-8 17:16:34

I know we can make this alghorithm run faster with no sleep, but…..


samth
2019-12-8 17:16:56

No, that makes it run slower


kamil.beker
2019-12-8 17:21:30

Funny comment i spotted somewhere


kamil.beker
2019-12-8 17:21:36

I keep saying I hate programming, but the truth is, I hate how it makes me feel stupid.


psnively
2019-12-8 21:24:14

@kamil.beker: see George Pólya “How to Solve It” and Richard Hamming “You and Your Research,” IIRC.


psnively
2019-12-8 21:25:12

Both Polya and Hamming did much research on solidifying intuition and inductive reasoning generally.


deactivateduser60718
2019-12-8 23:00:47

I figured this would be a common question but I could not find the answer on the user list. I’m able to serve static files from path just fine as shown below, except that the index.html that appears to be packaged with the web-server collection appears instead of the index.html I know is located in the directory I’m serving. What am I doing wrong?

(define (serve-distribution path #:port [port 8080] #:open-browser? [open-browser? #f]) (define (start request) (response/xexpr '(html (body (p ""))))) (serve/servlet start #:launch-browser? open-browser? #:port 8080 #:servlet-path "/_server" #:server-root-path path #:extra-files-paths (list path) #:command-line? #t #:file-not-found-responder show-not-found))


deactivateduser60718
2019-12-9 00:01:10

@notjack Are the arguments conflating ambiguity with other qualities? (e.g. "1 + 9 * 8 means 73. I want it to mean 80 sometimes, without adding more detail. Therefore prefix > infix.")

@rokitna I’m unsure if ecosystems can be managed, and I’m unsure if modularity in software will protect people from the divides we’re talking about. Racket is certainly better equipped to deal with subjectivity and experimentation than most, but I think it’s better to develop skills that protect the value of your knowledge in the face of big changes (e.g. Rhombus forming a disjoint ecosystem). Those skills take systematic thought, but not necessarily engineering skills.


deactivateduser60718
2019-12-9 00:05:24

I know that extra-files-path is redundant with server-root-path , but I added the latter in an attempt to stop serving the page shown in the attached screenshot.


rokitna
2019-12-9 02:31:31

I’m not sure what you mean, @deactivateduser60718, by being “unsure if ecosystems can be managed.” You were describing Honu as a bridge between two worlds. This “manages” two worlds of thought by engineering a path people can use to transport concepts from one to the other, right?

So I’m going to respond in more general terms, maybe clearing up a few things I didn’t fully express.

For context, it seems like the two worlds you refer to (in my own words right now) are a world of s-expression-based languages where syntax-case and other advanced hygienic macro research has taken place and a world of languages which use EBNF-based syntax designs and generally make do with functional abstraction rather than macro systems.

In response, I was characterizing that a different way: I was saying prefix notation keeps one of those worlds cohesive, while the other world generally forks into multiple worlds when even the simplest new syntaxes are introduced. So the Honu bridge connects a connected world to a disconnected set of worlds. I think some people who are aware of this connectedness advantage feel like “Lisp with Algol Syntax” projects are burning more bridges than they’re building.

That characterization isn’t the whole story, because Honu isn’t like a lot of “Lisp with Algol Syntax” projects. @notjack was right that “The Honu paper is all about making non-s-expression syntax extensible and modular.” Honu can serve as the missing macro system that makes some fragmentary EBNF-based worlds more connected amongst themselves. Honu can build a lot more than one bridge.

I think macro systems are a big part in the Lisp world’s connectedness… but I think prefix syntax serves its own role on top of that. One way to extend a language ecosystem is to invent a new language that’s mostly compatible with it, maybe with new features built in or some unnecessary features taken out. I tend to believe prefix notation is an easy convention to remember, making it easier to invent mostly-compatible language specs without specifically copying details from the existing ones, thus keeping a cohesive ecosystem even when the community is extremely partitioned. This advantage of prefix remains relevant even if macro systems like Honu are brought to infix languages.

Jack and I have talked about this “inventing mostly-compatible languages” angle before, and he’s persuaded me toward an interesting possibility: Infix notation, in a world with a sufficient set of parsing libraries easily at hand and a sufficiently memorable body of common knowledge to help people recreate those libraries, could have the same extensibility advantage I just described for prefix.

My goal here wasn’t to convince anyone that there were advantages to prefix syntax. My goal was to chime in so there was at least one voice in this community which didn’t shame people for trying to express why they thought so.

I know I’ve been rambling or lecturing. I hoped to express a simple vote of dissent, like an upvote proportional to the facepalm downvote. Instead, once I saw responses that I felt doubled down on the condescension with “fetishization,” “didn’t seem to understand,” etc., I wanted to more clearly state why I was afraid for the health of the community. (And I chose to give some arguments on behalf of the HN commenters’ positions because I thought if I made those positions look even a little bit more plausible, that would unlock some empathy.)

I should be honest that I was afraid for myself too. A lot of what I do with my time has to do with finding prefix syntaxes that are even simpler to specify than Lisp or Scheme syntax. I’m afraid that my work on this topic might have no audience, especially if it has no audience in a community that’s as keen on extensible languages as this one is.


samdphillips
2019-12-9 05:30:23

I feel that we may actually agree on much of this and perhaps fetishization is too strong a term.