Re: [racket] didn't know HN used Racket

2014-11-07 Thread Patrick Useldinger
On 07/11/2014 19:51, Geoffrey S. Knauth wrote: I visited HackerNews [1]. Unfortunately it was down, but you can following @HNStatus on Twitter. In that feed, I saw: IIRC it's written in ARC, which is implemented in Racket. See http://en.wikipedia.org/wiki/Arc_(programming_language) _

[racket] integer-sqrt

2014-09-12 Thread Patrick Useldinger
Hi all, according to the documentation, the above procedure accepts a *number* and returns an integer. But (at least in Racket 6.1) there's an error message stating that the parameter needs to be an *integer*: --- > (integer-sqrt 151.29) integer-sqrt:

Re: [racket] About genericity...

2014-04-04 Thread Patrick Useldinger
On 05/04/2014 00:08, Patrick Useldinger wrote: I copied Common Lisp's model, but it's a good idea to add Racket-style contracts. It should be a matter of simply adding a matcher for this. I've pushed a quick fix. Your code becomes: (def-multi P contract-match-parms) (add-

Re: [racket] About genericity...

2014-04-04 Thread Patrick Useldinger
On 04/04/2014 23:48, Alexander D. Knauth wrote: (def-multi +) (add-multi + '() (lambda () 0)) (add-multi + (listof number?) (lambda args (apply + args))) (add-multi + (listof vector?) (lambda args (apply v+ args))) (check-equal? (+ 1 2 3) 6) (check-equal? (+ (vector 1 2 3) (vec

Re: [racket] About genericity...

2014-04-04 Thread Patrick Useldinger
On 02/04/2014 20:48, Patrick Useldinger wrote: I can share it if you're interested, it's roughly 40 lines of code. Here's the link: https://github.com/uselpa/def-multi Racket Users list: http://lists.racket-lang.org/users

Re: [racket] About genericity...

2014-04-02 Thread Patrick Useldinger
On 02/04/2014 20:53, Alejandro Zamora Fonseca wrote: (defmethod dup ((a string)) (concatenate 'string a a)) (defmethod dup ((a integer)) (list a a)) 1) From the standard Racket "swindle/tiny-clos" library, you can use the CLOS-like functions that you may already know from Common

Re: [racket] Tail recursive module cons

2014-03-29 Thread Patrick Useldinger
On 29/03/2014 03:54, Yuhao Dong wrote: Using accumulator+reverse won't really improve the runtime at all. Every other benchmark has (unfortunately) shown the opposite. I think that tail recursion doesn't help at all, and introduces conceptual overhead. Racket doesn't use the stack, and conver

[racket] Tail recursive module cons

2014-03-16 Thread Patrick Useldinger
Greetings everybody, Let's assume we want a procedure that doubles every even? number of a list. The recursive way would be something like: (require rackunit) (define parms '(1 2 3 4 5)) (define result '(4 8)) (define (f-recursive lst) (if (null? lst) null (let ((c (car lst)))

[racket] Swindle

2014-01-23 Thread Patrick Useldinger
Hello I was looking for a CLOS(-like) implementation in Scheme and found that there is one which is already included in Racket. Before investing some time into studying this, I have 2 questions: 1) Given that the Swindle docs lack some polish in comparison with the rest of the modules, are t

[racket] struct with default value per field

2013-06-22 Thread Patrick Useldinger
Hi I can't find a way to have a per-field default value in a struct, such as in Common Lisp: ? (defstruct person (name "James" :type string) (age 1 :type number)) PERSON ? (defparameter p (make-person)) P ? p #S(PERSON :NAME "James" :AGE 1) ? (defparameter p (make-person :name "Paul")) P ? p #

[racket] today's Racket icon

2013-02-14 Thread Patrick Useldinger
Nice idea ;-) Racket Users list: http://lists.racket-lang.org/users

Re: [racket] R7RS and Racket in the (far) future

2013-02-10 Thread Patrick Useldinger
On 10/02/2013 18:34, Matthias Felleisen wrote: more). While Racket obviously inherits many traits from Scheme and while we are obviously grateful to the Scheme branch of the family for its inspiration, Racket is NOT Scheme and we will continue to develop the language as we see fit. I'm happy t

Re: [racket] Racket v5.3.1

2012-11-08 Thread Patrick Useldinger
On 07/11/2012 23:16, Eli Barzilay wrote: Racket version 5.3.1 is now available from http://racket-lang.org/ Thanks for this nice release. I noticed a 20% speed increase on one of my programs, and I absolutely *love* the line indicator triangle in DrRacket! -pu Rack

Re: [racket] translate from Racket to Common Lisp

2012-11-05 Thread Patrick Useldinger
On 05/11/2012 19:14, Asumu Takikawa wrote: A follow-up blog post detailing what's improved performance-wise would be great. Indeed, speed is an important point for many people choosing a PL implementation. And it's becoming even more important with ubiquitous virtualisation and energy conside

Re: [racket] generator performance (again)

2012-10-08 Thread Patrick Useldinger
FWIW, 1) the timings with the 32 bit version of Racket 5.3 (the other timings were from the 64 bit version) fibo-clos : cpu time: 12529 real time: 12720 gc time: 850 fibo-gen1 : cpu time: 21003 real time: 22319 gc time: 1808 fibo-gen2 : cpu time: 20527 real time: 20929 gc time: 1795 fibo-delay

Re: [racket] generator performance (again)

2012-10-07 Thread Patrick Useldinger
On 08/10/2012 01:23, Danny Yoo wrote: Hmmm! Looking at it now... Wait: your definition of fibo-gen2 is not exactly equivalent to the others in terms of work when verbose is off. Good spot! It's consistent now. Generators and delay/force are roughly the same speed (although the latter explod

[racket] generator performance (again)

2012-10-07 Thread Patrick Useldinger
Hi, following up on my earlier thread (sep 16th) on the same subject, I tried to compare some solutions generating fibonacci series in a lazy way: via a closure, via generators and using delay/force. The results are correct for all methods: fibo-clos : 0 1 1 2 3 5 8 13 21 34 55 89 144 233 37

Re: [racket] generator performance

2012-09-18 Thread Patrick Useldinger
On 18/09/2012 00:24, Matthias Felleisen wrote: On Sep 16, 2012, at 2:36 PM, Patrick Useldinger wrote: Which makes me wonder if continuations are really usable in Racket (in terms of performance)? That is a good question, and the answer is 'yes, in the right situation'. I think

Re: [racket] generator performance

2012-09-16 Thread Patrick Useldinger
On 16/09/2012 15:34, Neil Van Dyke wrote: 1. Use statistical profiler to see who is actually eating the time: http://doc.racket-lang.org/profile/index.html Increasing the sampling resolution can help. This is what I get - only quoting the highest self pct: Profiling results -

[racket] generator performance

2012-09-16 Thread Patrick Useldinger
Hello I have a Python program doing some intensive computing and would like to port it to Racket for performance reasons. I use a generator in Python which has a very low overhead. While writing some test programs, I seem to have an substantial overhead on using generators in Racket: Callb