
Poor Intel: First AMD and now Apple. It is going to be an interesting race. I hope ARM chips will bring more cores (at comparable prices).

FWIW I see that in http://www.netlib.org/blas/cblas.h they use void *
to pass an array of complex floating points. Not sure if this is a general C thing - or due to an older Fortran convention.

good morning, how are you. I have problems with this exercise. I want separate this list in parts most littles. -> ((list 1 2 3 4 5 6 7 8 9 10)2) ->(list 1 2)(list 3 4)(list 5 6)(list 7 8)(list 9 10).
I’m make this code: (define (count list)
(cond
[(empty? list) 0]
[else (+ 1 (count (rest list)))]
)
)
(define (list-divide list element)
(cond
[(empty? list) "U can't divide the list"]
[(= element count) (cons (first list)(first(rest list)))]
[else "no se puede dividir"]
)
)
(list-divide (length (list 1 2 3 4 5 6 7 8 9 10)) 2)
I don’t know how I do, to separate the list, in lists with two elements. thanks.

Is showing me this error: <: contract violation
expected: real?
given: #<procedure:count>
argument position: 2nd
other arguments...:
2

This is a problem: [(= element count)
. Here count
is a function which needs to be called (count list)
.

Oh thanks. Now, Is showing me this error: rest: contract violation
expected: (and/c list? (not/c empty?))
given: 10
:worried:

Which expression?

Actually it must be: (list-divide (length (list 1 2 3 4 5 6 7 8 9 10)) 2)
Since list-divide
expects a list, you can take the length first.

(define (count list)
(cond
[(empty? list) 0]
[else (+ 1 (count (rest list)))]
)
)
(define (list-divide list element)
(cond
[(empty? list) "U can't divide the list"]
[(= element (count list)) (cons (first list)(first(rest list)))]
[else "no se puede dividir"]
)
)
(list-divide (length (list 1 2 3 4 5 6 7 8 9 10)) 2)

Remove the call to length
in (list-divide (length (list 1 2 3 4 5 6 7 8 9 10)) 2)
.

done, but the list is not divided. It is assumed that according to the number you put, the list is divided with that number of elementsSomething like some kind of loop?

So ‘element’ is the number of elements in each of the lists?

yes, that should do element :sweat_smile:

Consider making a simpler, helper functions first: (define (take lst k) ...)
Given a list lst
it returns the first k
elements.
Then write (define (skip lst k) ...)
which given a list list
removes the first k
elements.
Then use take
and skip
to write list-divide
.

Consider the following: (define _flomat (_cpointer 'flomat))
(define p (cast (malloc 1 _double 'atomic) _pointer _flomat))
(ptr-ref p _double)
The result is 2.1751677484121e–314 However I was expecting to see 0.0 since malloc
zeros out the returned memory.
And to make sure 0.0 is represented as zero-bytes I tried this: (real->floating-point-bytes 0.0 8)
which gave: #"\0\0\0\0\0\0\0\0"
.

This is in Racket BC 7.5. Just tested in Racket CS 7.7 and here it works.

In BC 7.7 it still gives 2.182457299669e–314

Welcome to DrRacket, version 7.7 [3m]. Language: racket [custom]; memory limit: 256 MB. 4.743030200076e–322

just for reference on my machine

definitely not zeroed out :slightly_smiling_face:

I don’t think you can rely on malloc
producing all–0 memory

The docs says this:

But you are right, it must malloc
returning non-zeros.

It looks like the documentation is incorrect, and Racket CS zeros memory because I followed the documentation. I think probably the documentation and Racket CS should change.

Makes sense the user can decide to zero or not.

Welcome to DrRacket, version 4.743030200076e–322 [3m]

why this function (remq ’(2) (list’ (1) ’(2)’ (3))) return ’((1) (2) (3)). Shouldn’t I return ’((1) (3))?

Doesn’t remq
use eq?
for comparison? You want remove
, which uses equal?
for the comparison.

I want to know its logic, is that this example appears in the documentation and is different from the others and I want to know why. Here: <file:///C:/Program%20Files/Racket/doc/reference/pairs.html?q=list-tail#%28def._%28%28lib._racket%2Fprivate%2Flist..rkt%29._remq%29%29>

@dcmicoltacespedes I think @massung’s explanation is pretty clear. Is there anything that you are still confused?

Do you know how eq?
works, and how it is different from equal?
?

(eq? '(a) '(a)) ;=> #f
(eqv? '(a) '(a)) ;=> #f
(equal? '(a) '(a)) ;=> #t

I want to list and “def” some identifiers in Scribble. The result of defform*
looks okay. However it only defs the first identifier. Is there an alternative that gives a similar compact output (ideally without the parentheses around the identifiers?

A deftogether
around a bunch of defidform
s (or defthing
s), maybe?

Deftogether looks right.

tip: use [[
with deftogether
to get nice formatting and indentation from DrRacket
@deftogether[[
@defthing[foo thing?]
@defthing[bar thing?]
@defthing[baz thing?]]]{
...}