notjack
2018-7-16 07:40:17

@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.


dmitry
2018-7-16 08:38:17

@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
2018-7-16 13:16:44

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



samth
2018-7-16 14:00:48

@githree sigh


samth
2018-7-16 14:00:57

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


leif
2018-7-16 18:05:10

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


leif
2018-7-16 18:05:15

Anyway, this PR fixes that: https://github.com/racket/racket/pull/2172


leif
2018-7-16 18:05:22

I’ll merge it if that’s okay.


mark.shead
2018-7-16 18:39:49

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.)


soegaard2
2018-7-16 18:41:31

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


soegaard2
2018-7-16 18:42:20

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


soegaard2
2018-7-16 18:42:54

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


soegaard2
2018-7-16 18:43:16

Personally I prefer an explicit (lambda () …)


greg
2018-7-16 19:12:23

@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)


soegaard2
2018-7-16 19:14:38

I like explicit.


greg
2018-7-16 19:17:49
;; 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")

greg
2018-7-16 19:21:11

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


abmclin
2018-7-16 19:31:51

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


abmclin
2018-7-16 19:33:27

I do use internal defines 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


mark.shead
2018-7-16 19:34:36

Thank you!


notjack
2018-7-16 20:14:34

I am a big fan of using defines instead of lets


githree
2018-7-16 21:17:39

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


zenspider
2018-7-16 21:19:26

I don’t even have such a thing afaict


githree
2018-7-16 21:19:42

:grin:


githree
2018-7-16 21:19:56

lucky you


soegaard2
2018-7-16 21:20:48

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



githree
2018-7-16 21:21:24

search for ASCII


soegaard2
2018-7-16 21:21:58

yup worked here


githree
2018-7-16 21:22:07

linux?


soegaard2
2018-7-16 21:22:10

mac


githree
2018-7-16 21:22:13

ok


soegaard2
2018-7-16 21:23:05

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


githree
2018-7-16 21:24:45

c:s:pageup


githree
2018-7-16 21:25:32

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


soegaard2
2018-7-16 21:26:26

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


soegaard2
2018-7-16 21:26:39

does it move the tab left ?


soegaard2
2018-7-16 21:26:51

or does it just switch tab?


githree
2018-7-16 21:27:49

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


githree
2018-7-16 21:28:01

it doesn’t wait for key release


githree
2018-7-16 21:30:28

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


githree
2018-7-16 21:33:17

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


soegaard2
2018-7-16 21:34:40

time to make custom keybindings


githree
2018-7-16 21:36:15

it seems like the only option for now


githree
2018-7-16 21:37:06

but still - would you classify it as a bug?


githree
2018-7-16 21:38:06

after all DrRacket on win seems to be missing some functionality


soegaard2
2018-7-16 21:39:36

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



githree
2018-7-16 21:42:00

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


githree
2018-7-16 21:42:38

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


zenspider
2018-7-16 21:44:26

@soegaard2 pageup should be fn-up-arrow


soegaard2
2018-7-16 21:45:54

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


leif
2018-7-16 22:41:25

j.chris.turner
2018-7-16 23:44:05

@j.chris.turner has joined the channel