theau.poulat
2020-9-22 07:29:14

@theau.poulat has joined the channel


laurent.orseau
2020-9-22 08:58:51

That’s a very good point, thanks for the hints @dyllongagnier


yanyingwang1
2020-9-22 09:25:15

hi, everyone. I’m trying to figure out the usage of pretty-print-size-hook.

From the <https://docs.racket-lang.org/reference/pretty-print.html?q=pretty-print-size-hook#%28def._%28%28lib._racket%2Fpretty..rkt%29._pretty-print-size-hook%29%29|racket doc>, it says, if the hook returns #f, then printing is handled internally by the pretty-printer. Otherwise, the value should be an integer specifying the length of the printed value in characters.

While as my trying, it works for the #f part, but it prints nothing if I make the hook returns integer. -&gt; (pretty-print-size-hook (lambda (a b c) #f)) -&gt; (pretty-print (hash 1 2 (hash 1 2 3 (hash 4 5) 6 8) 4 9 10)) '#hash((1 . 2) (9 . 10) (#hash((1 . 2) (3 . #hash((4 . 5))) (6 . 8)) . 4)) -&gt; (pretty-print-size-hook (lambda (a b c) 2)) -&gt; (pretty-print (hash 1 2 (hash 1 2 3 (hash 4 5) 6 8) 4 9 10)) -&gt;


ryanc
2020-9-22 12:19:06

You also need to override pretty-print-print-hook to do the actual printing.


greg
2020-9-22 12:23:21

@yanyingwang1 I was just about to type what @ryanc did. The default value of pretty-print-print-hook is #&lt;procedure:void&gt;. The intent is that you’d set both the size-hook and print-hook parameters.


scibor.on.github
2020-9-22 15:00:17

@scibor.on.github has joined the channel


yanyingwang1
2020-9-22 15:04:47

@greg @ryanc thanks for the answer. I’ll try that.


soegaard2
2020-9-22 17:00:32

Heard about a http://linked.in\|linked.in group on Racket. Decided to check it out.

Turns out I already joined (10+ years ago).

/feeling old


caente
2020-9-22 17:07:41

pocmatos
2020-9-22 20:01:22

Unsure what that Racket Money group. The real deal has over 60 members.



spdegabrielle
2020-9-22 20:19:07

Someone on the Racket-money list set it up on LinkedIn not realising there was already a racket on LinkedIn


leif
2020-9-22 22:01:20

@soegaard2 Any idea how much effort it would take to get javascript classes in Urlang?


leif
2020-9-23 03:52:56

@soegaard2 Oh, looks like it is in there, just not documented. :slightly_smiling_face:


leif
2020-9-23 03:53:28

(Documented in the readme that is)


leif
2020-9-23 03:53:33

Based on:

1367: ; <class> ::= (class <class-heritage> ((<property-name> x …) <body>)) …) 1368: ; <class-heritage> ::= x | (x x)


leif
2020-9-23 03:53:37

(in main.rkt)


soegaard2
2020-9-23 04:30:32

@leif If they work - great. I couldn’t find any examples, where I used class so it is not unthinkable, that class hasn’t been fully tested. I’t possible that I was interrupted while introducing class - I can’t remember.

Also the first lines in main.rkt are: ;;; TODO Fix scope of class names =&gt; make class declaration module-top-level only ? ;;; TODO 0. put this and super into scope in a class declaration ;;; TODO 1. Is the uncommented (not (keyword? ..))) correct in PropertyName ;;; TODO 2. Write more documentation. So potentially there could be a scope problem, but I need to try it.

Most JavaScript constructs takes only a reasonable amount of effort to put into Urlang - and since the goal is to avoid writing JavaScript - any constructs you find missing, I am willing to at least look at :slightly_smiling_face:


leif
2020-9-23 04:36:06

Basically I want to see if I can use ReactJS with Urlang. :slightly_smiling_face:


jcoo092
2020-9-23 04:37:11

> the goal is to avoid writing JavaScript A noble goal attempted by so very many over the years :D


leif
2020-9-23 04:38:01

And while simple reactjs components use functions, it looks like the more advanced ones use class.


soegaard2
2020-9-23 04:41:49

Ooh! Rings a bell. I think I introduced class to work with React. Then I discovered the new approach “React Hooks” and ditched the class approach. Of course, class might be needed in order to interface with React libraries written in the older style.

I’ll attempt to write a React example tonight - I haven’t got any documentation - sorry. Using React Hooks has worked fine for me using Urlang. Instead of the jsx-syntax I wrote a small macro urx with the same purpose.


soegaard2
2020-9-23 04:44:24

This is the video where React Hooks were introduced: https://www.youtube.com/watch?v=V-QO-KO90iQ


soegaard2
2020-9-23 04:46:07

But this video is probably better: https://www.youtube.com/watch?v=dpw9EHDh2bM&amp;feature=emb_title It’s linked from the documentation on React Hooks, so you might have seen it already.


soegaard2
2020-9-23 04:47:24

(I got fooled by the almost identical thumbnails)


leif
2020-9-23 04:47:33

@soegaard2 Oh cool.


leif
2020-9-23 04:47:46

Anyway, ya, I would love to see any react+urlang examples you’ve got.