
@theau.poulat has joined the channel

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

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. -> (pretty-print-size-hook (lambda (a b c) #f))
-> (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))
-> (pretty-print-size-hook (lambda (a b c) 2))
-> (pretty-print (hash 1 2 (hash 1 2 3 (hash 4 5) 6 8) 4 9 10))
->

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

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

@scibor.on.github has joined the channel

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

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


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


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

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

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

(Documented in the readme that is)

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

(in main.rkt)

@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 => 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:

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

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

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

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.

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

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

(I got fooled by the almost identical thumbnails)

@soegaard2 Oh cool.

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