
@dmitry The term “DSL” is not commonly used with a precise technical definition, and lots of other language communities tend to use “DSL” to mean “a library with an API designed so that you can write code using it without really thinking of it as normal <<whatever langauge the library is for>> code”. In that sense, a DSL isn’t really any different than just using funny-looking names for things.
But in Racket, “DSL” usually means “a #lang
, a complex macro, or a group of related macros”, and macros let you change the rules of the language you’re using them in. That’s very different from just providing funnily-named functions. Pattern matching systems, class and object systems, and even entire static type systems can be built with Racket DSLs.

@notjack thanks a lot! I still haven’t touched Racket, or any of the Lisps. So I guess I’ll really understand it once I use it

@samth set the channel topic: Racket — http://racket-lang.org — http://pasterack.org - Slack invite link: http://racket-slack.herokuapp.com - Archives: http://racket.slackarchive.io/

@samth http://racket.slackarchive.io\|racket.slackarchive.io redirects to http://github.com\|github.com

@githree sigh

@samth set the channel topic: Racket — http://racket-lang.org — http://pasterack.org - Slack invite link: http://racket-slack.herokuapp.com

@mflatt Herp derp…looks like we forgot to actually make sure the relative serialized paths were actually readable…oops.


I’ll merge it if that’s okay.

I’m trying to understand the racket code here: https://rosettacode.org/wiki/Chat_server#Racket
Specifically I’m trying to understand the double parenthesis in (define ((client i o)) ...)
on line 7. I assumed that the double parenthesis mean than (client i o) returns a function and when we execute that function it returns an identifier that we want to define. However, Dr Racket doesn’t point to a definition for client somewhere else.
My best guess now is that the double parenthesis may have something to do with threads since single parenthesis result in a chat server that can only be connected to by a single client. If anyone can explain or point me toward the correct documentation, I’d appreciate it. (I evidently don’t know the right terminology to use a search engine to look for an answer.)

(define ((foo)) 42) is the same as (define (foo) (lambda () 42))

(define (foo x y) body) one can think of (foo x y) as an example of an use of foo.

Similar in (define ((client i o)) ...)
the ((client i o)) shows how to call it.

Personally I prefer an explicit (lambda () …)

@soegaard2 I think I’ve also seen you do this style, which I like: (define (make-handler suffix)
(define (handler str)
(string-append str suffix))
handler)

I like explicit.

;; What I think some people call the "curried" style.
(define ((make-handler suffix) str)
(string-append str suffix))
;; I think I see this the most frequently.
;; It slightly bothers me that it mixes styles.
(define (make-handler suffix)
(λ (str)
(string-append str suffix)))
;; What I call Indiana University extreme style. :)
;; Very verbose, but demystisfied, no shorthand.
(define make-handler
(λ (suffix)
(λ (str)
(string-append str suffix))))
;; What I think of as Soegaard style only because I first saw it in
;; his code. This has the virtue of being consistent. All intermediate
;; values have names.
(define (make-handler suffix)
(define (handler str)
(string-append str suffix))
handler)
;; Example usage: Any of the above should print "lifted".
(define past-tense (make-handler "ed"))
(past-tense "lift")

Yes, in this silly example you could also do: (define past-tense (curryr string-append "ed"))
. ¯_(ツ)_/¯

Am I the only one who finds it a little annoying to see define
s inside another define
?

I do use internal define
s if I need to be consistent with the codebase I’m working in but I find myself attracted towards both the Indiana and the common case styles

Thank you!

I am a big fan of using defines instead of lets

has anyone tried to adjust ASCII rectangle on Windows in DrRacket? In docs it says C-x r a
but I can’t make it work

I don’t even have such a thing afaict

:grin:

lucky you

How do we make an ascii rectangle in the first place?


search for ASCII

yup worked here

linux?

mac

ok

do you on the other hand have move-current-tab-left bound to anything?

c:s:pageup

the problem is that C-x only wants to cut text and C-s opens save dialog

my problem is that the laptop doesn’t have a pageup

does it move the tab left ?

or does it just switch tab?

no win doesn’t like sequences and simply opens save dialog when c-s is pressed

it doesn’t wait for key release

I wonder if it shouldn’t be considered as a DrRacket bug on Win

I was trying to work with 2d syntax but without table support editing these tables is pretty nightmarish

time to make custom keybindings

it seems like the only option for now

but still - would you classify it as a bug?

after all DrRacket on win seems to be missing some functionality

I think it would be a good thing to report it.

btw - it is probably related - some time ago I tried https://docs.racket-lang.org/drracket/Keyboard_Shortcuts.html?q=Sending%20Program%20Fragments%20to%20the%20REPL#%28part._.Sending_.Program_.Fragments_to_the_.R.E.P.L%29

and noticed that this custom keybinding simply blocked C-c as copy (you couldn’t copy any text from DrRacket)

I wonder if it is only Win problem or this code has similar effect on other OSes?

@soegaard2 pageup should be fn-up-arrow

@zenspider Yes, fn-up will do an pageup, but it doesn’t count in c:s:pagegup


@j.chris.turner has joined the channel