Hacker Newsnew | past | comments | ask | show | jobs | submit | soegaard's commentslogin

There is a reason for that.

Consider appending two strings in Scheme:

    (string-append s1 s2)
Appending two strings in Scheme:

    (vector-append v1 v2)
Since the type is present in the function name, it would be redundant to include it in the variable name.


This is literally my point. A python example would be like, calling readline to store someone's name into a name variable then printing a string that said "Hello name". Scheme examples are some abstract list manipulations.


    > `(1 ,@2)
    '(1 . 2)
This is a pair. The notations is called "dotted pair".


Looks like fweimer is correct for scheme. I admit to being very surprised. Here is the verbiage from various rXrs:

r3rs, r4rs & r5rs (section 4.2.6):

https://standards.scheme.org/official/r3rs.pdf

https://standards.scheme.org/official/r4rs.pdf

https://conservatory.scheme.org/schemers/Documents/Standards...

"If a comma appears followed immediately by an at- sign (@), then the following expression must evaluate to a list;"

r6rs (section 11.17):

https://standards.scheme.org/official/r6rs.pdf

"If an (unquote-splicing 〈expression〉 . . . ) form appears inside a〈qq template〉, then the〈expression〉s must evaluate to lists;"

r7rs (4.2.8):

https://standards.scheme.org/official/r7rs.pdf

"If a comma appears followed without intervening whitespace by a commercial at-sign (@), then it is an error if the following expression does not evaluate to a list;"


You need to use the Racket documentation.


But 2 isn't a list, and the argument to unqoute-splicing must be a list:

> If an (unquote-splicing <expression> ...) form appears inside a <qq template>, then the <expression>s must evaluate to lists; the opening and closing parentheses of the lists are then “stripped away” and the elements of the lists are inserted in place of the unquote-splicing form.



That has been in Racket for a long time.


I tried:

  #lang racket/base
  (let ((a '#0=(0 . #0#)))
    (display (car a)))
...over at

https://onecompiler.com/racket

...and it didn't compile, complaining:

  read-syntax: `#...=` forms not  enabled for `read-syntax` mode
...maybe there is a switch needed to enable it?


I am not 100% sure what's going on, but you can use `read` mode this way:

    #lang racket
    (let ((a (read (open-input-string "#0=(0 . #0#)"))))
      (display (car a)))
I think the problem is that `read` / `write` support shared data constructed using `shared`. But programs (read by `read-syntax` are not allow to have cycles.


Yeah, there's a toggle for it in read-syntax mode.

https://docs.racket-lang.org/reference/Reading.html#%28def._...


How do you get that to work?

  #lang racket
  (read-syntax-accept-graph #t)
  (let ((a '#0=(0 . #0#)))
    (display (car a)))
...which of course doesn't work, because `(read-syntax-accept-graph)` is a run-time thing, and the circular-list structure is a `read`-time thing.

I couldn't figure it out with this either:

https://stackoverflow.com/questions/51942188/read-syntax-for...

...just to make sure I wasn't going crazy, this:

  (let ((a '#0=(0 . #0#)))
    (display (car a)))
...does work as expected with this online scheme interpreter:

https://www.jdoodle.com/execute-scheme-online


It's ugly and probably fragile and prone to break, but I found a way. Added it as an answer on that Stack Overflow question: https://stackoverflow.com/a/79997503/9952196


It might take a custom #lang. I'll play around with it when I have some free time...

That read-syntax doesn't just accept everything accepted by plain read is one of my biggest annoyances with Racket.



The evolution of the logo:

https://users.cs.northwestern.edu/~robby/logos/

The skull didn't last long.


> Easy is an understatement. Macros and dynamic programming (often done using runtime reflection in other languages) are so trivially easy in Lisps that one can stumble into it without realizing they're even doing it.

Well, getting the interaction between modules and syntax transformations (macros) right is not an easy task.

"Composable and Compilable Macros: You Want it When?" Matthew Flatt http://dl.acm.org/authorize?24908


Btw - if people are interested in Racket related blogs / articles etc.

https://racket-stories.com/


Yeah - the number syntax is pretty cool.

    #i is the prefix for inexact
    #e is the prefix for exact
So `#e0.1` is exact 0.1 which means it will be read as an exact fraction 1/10 and `#i0.1` will be read as a floating point number.

The `i` in `8i` is the imaginary unit. The `1@1` is the polar notation for complex numbers.

The `10#` is a compatibility remain (the Scheme authors wanted a way to see how many signifant digits were known. In `10#` there 2. So `#` stands for "some digit". In most implementations this is read as 0. More details at [1]

An `#` followed by a list datum is read as a vector. Thus `#()` is an empty vector and `()` is an empty list.

[1] https://stackoverflow.com/a/10936403/23567

Complicated? Well, to support both inexact (floating point) and exact numbers (bignums and fractions) it makes sense to have `#i` and `#e` to explicitl choose. The default is (more or less): numbers with . are inexact the others are exact.


> DrRacket seems to have doing the thing where they implement of a bunch of GUI stuff from scratch ...

The GUIs actually use the underlying native GUIs thanks to the dynamic FFI. The goal is to have a cross platform GUI. Your program runs on macOS, Linux and Windows without any problems.

But if there is some gui feature, that is only available on one platform, you won't find it in the builtin gui libraries. However, you can always add platform specific functionality yourself.


I can't attest to the implementation. I can only attest to the jank.


The email is obfuscated.

https://pkgs.racket-lang.org/

And has been for a long while.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: