guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: srfi-1 take and drop seriously broken


From: Jan Synáček
Subject: Re: srfi-1 take and drop seriously broken
Date: Sun, 20 Nov 2016 11:39:20 +0100

On Sat, Nov 19, 2016 at 10:18 PM, Jan Nieuwenhuizen <address@hidden> wrote:
> Jan Synáček writes:
>
>> scheme@(guile-user)> ,use (srfi srfi-1)
>> scheme@(guile-user)> (take (list 1 2 3) 4)
>> ERROR: In procedure list-head:
>> ERROR: In procedure list-head: Wrong type argument in position 1
>> (expecting pair): ()
>
> That's expected.
>
>> scheme@(guile-user) [1]> (drop (list 1 2 3) 4)
>> ERROR: In procedure list-tail:
>> ERROR: In procedure list-tail: Wrong type argument in position 1
>> (expecting pair): ()
>
> That too.
>
>> Please, tell me that this is just a mistake...
>
> It's just a mistake!
>
>> This can't be true. I still can't believe it. This is from
>> 2.0.11. Please, tell me that the implementation is fixed in 2.2.
>
> You'd have to give me more clues about what it is that puzzles you
> and why.
>
>> Yours truly puzzled,
>
> Do you possibbly mean something like
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (use-modules (srfi srfi-1))
> scheme@(guile-user)> (take '(list 1 2 3) 4)
> $1 = (list 1 2 3)
> scheme@(guile-user)> (drop '(list 1 2 3) 4)
> $2 = ()
> --8<---------------cut here---------------end--------------->8---

Yes, this is exactly how it should work, thank you. For some reason, I
thought that was clear, but apparently wasn't. What's the point of
using take/drop when you have to know the length of the list?

Cheers,
-- 
Jan Synáček



reply via email to

[Prev in Thread] Current Thread [Next in Thread]