Arc Forumnew | comments | leaders | submit | gus_massa's commentslogin
3 points by gus_massa 4536 days ago | link | parent | on: Rainbow/Jarc on Android

Symbols are garbage-collected in Racket: http://docs.racket-lang.org/reference/symbols.html

  Interned and unreadable symbols are only weakly held by
  the internal symbol table. This weakness can never 
  affect the result of an eq?, eqv?, or equal? test, but a 
  symbol may disappear when placed into a weak box (see 
  Weak Boxes) used as the key in a weak hash table (see 
  Hash Tables), or used as an ephemeron key (see Ephemerons).

-----

1 point by rocketnia 4536 days ago | link

Awesome!

Kinda. It irks me that a value that's still arguably reachable (via 'read) could be observably lost by a weak box, weak hash table, or ephemeron. But it seems feasible to create readable-counts-as-reachable versions of these data structures on top of the built-in ones, so the built-in ones expose strictly better lower-level control.

-----

1 point by gus_massa 5363 days ago | link | parent | on: Why does pr return it's first arg?

I think that pr should return the last value, because to be consistent with other operators for multiple expressions. For example:

  (do 1 2 3) => 3
  (pr 1 2 3) => 1
  ((fn() 1 2 3)) => 3

-----

2 points by gus_massa 5897 days ago | link | parent | on: Return value of pr and prn

I agree. I think that (pr 1) should return 1.

The problem is with (pr 1 2). Should it return 1 or 2?

-----

1 point by stefano 5897 days ago | link

It could return the list (1 2), but this would mean to cons up a new list every time we use 'pr just to throw it away. Multiple return values would solve the problem. Why not add them to the language?

-----

1 point by bOR_ 5897 days ago | link

at least in agent-based models, printing is not the thing that is happening so often that consing up a new list is prohibitive.

How much more expensive is cons compared to multiple return values? I remember there being a long discussion against mrvs.

-----

2 points by stefano 5896 days ago | link

> How much more expensive is cons compared to multiple return values?

It depends on the GC used and on the implementation. mrvs are usually pushed on the stack, so there is no GC overhead. When I develop applications with Lisp, I notice that most of the time reducing the amount of garbage speeds up the program noticeably. It's not only a problem of consing, it's also a problem of collecting the garbage. More garabage, more collection cycles.

-----

1 point by xrchz 5887 days ago | link

do pr or prn create a string? it might be less expensive to return that string if it is created

-----

1 point by gus_massa 5915 days ago | link | parent | on: Bug in "last" page of Hacker News

It is fixed now.

-----

1 point by gus_massa 6045 days ago | link | parent | on: edit install manpage

I think that new users will find useful some links in the bottom of the forum page: a link to the main, a link to install and a link to the tutorial.

-----