Questions tagged [cdr]

cdr (/ˈkʌdər/ or /ˈkʊdər/) is primitive operation on cons cells (or "non-atomic S-expressions") introduced in the Lisp programming language.

cdr (/ˈkʌdər/ or /ˈkʊdər/) is primitive operation on cons cells (or "non-atomic S-expressions") introduced in the Lisp programming language. A cons cell is composed of two pointers; The cdr operation extracts the second pointer.

Thus, the expression (cdr (cons x y)) evaluates to y.

For Compact Disc Recordable, use instead.

Source: Wikipedia

103 questions
3
votes
2 answers

Why is caddr[(A B C)] = C?

Ideally in LISP: caddr[(A B C)] = car[cdr[cdr[(A B C)]]] = car[cdr[(B C)]] = car[C] = Undefined. But the book says answer is C. Can anyone please explain? Thanks a lot.
nrb
  • 31
  • 3
2
votes
1 answer

How do lisps that prefer first and rest to car and cdr approach combinations like cdaddr?

One of the great schisms in the Lisp community is if we should have car and cdr or first and rest. One of the benefits of the traditional car and cdr is that we can combine them to produce pronoucible functions like cdaddr. How do Lisps that do not…
J. Mini
  • 1,868
  • 1
  • 9
  • 38
2
votes
4 answers

Asterisk 13.4 cdr engine is creating 2 records per call

This is really starting to get annoying. I´m using Asterisk 1.4 since 2007 to operate a flawless PBX, and it creates a SINGLE CDR per call, like any other version of asterisk would. Yesterday I figured an upgrade would be ok and got Asterisk…
Pedro Guillem
  • 43
  • 1
  • 4
2
votes
0 answers

ingesting CDRs into hadoop

I've just started working on a hadoop use case of analyzing CDRs in near-real time. CDRs are encoded in ASN1.1. A remote server is feeded regularly by CDRs. I'm wondering about how to ingest CDRs from this server into my cluster, and decode them to…
Mehdi Erk
  • 31
  • 3
2
votes
3 answers

Functions to print and replace elements in a list

I am trying to implement two functions : subterm and replace. subterm takes two lists as arguments and prints the element in the first list that is reached after exhausting the second list. For example, calling (subterm '(1 2 (3 4 5) (6 (7 (8) 9…
2
votes
3 answers

Emacs Lisp shared structure and shared links

Consider the cons x1: (setq x1 '(a . (b c))) => (a b c) or in list notation: (setq x1 '(a b c)) => (a b c) and the cons x2, built on x1: (setq x2 (cons 'A (cdr x1))) => (A b c) cons help (in Emacs) says that the function creates a new cons, gives…
antonio
  • 10,629
  • 13
  • 68
  • 136
2
votes
2 answers

Common Lisp quote behavior with car and cdr

Beginner with Lisp. I'm working through "Common Lisp: A gentle introduction" and I ran into this behavior that I don't understand. This is in clisp: [57]> (cdar '((fee fi) '(fo fum))) (FI) [58]> (cdar '('(fee fi) '(fo fum))) ((FEE FI)) The first…
Max
  • 41
  • 5
2
votes
3 answers

How to set Asterisk call log CDR database fields from AMI ORIGINATE

I'm using the Asterisk Management Interface (AMI) in PHP to originate outbound calls. Below is a snippet of the code I'm using: // snippet // $num is the number to dial e.g. 0207 121 3456 // $ext is the extension use to make the call e.g. 101 //…
justlooking
  • 21
  • 1
  • 4
2
votes
3 answers

Proper lists and recursive tail in Python

In various Lisps a proper list is either nil (a null value) or a cons cell, where the first (head, first, car) value points to a value and the second (tail, rest, cdr) points to another proper list. Various other functional programming languages…
Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
1
vote
1 answer

LISP cdr function

If I do (setq x '(NOT (NOT (NOT (NOT A)))) ) (cdr x) is (NOT (NOT (NOT A)))) but (cdr (cdr x)) is NIL What's going on here?
CyberShot
  • 2,265
  • 6
  • 28
  • 36
1
vote
1 answer

How can I read xml metadata from a Corel file with PHP?

I don't understand how I can read tags, from a metadata.xml of a cdr files. Thanks for any help.
1
vote
1 answer

CorelDraw's CDR to Fireworks?

I have the layout of a website in CorelDraw X4 and I need to move it to Fireworks CS5 (for many reasons). The thing is that, apparently, the only method I was able to find on the Internet doesn't work very well. What I do is to export the file from…
Diego
  • 296
  • 2
  • 16
1
vote
0 answers

CDR ASN1 decode failed (python - asn1tools)

I would like some help with an issue please (any idea is worth trying, I'm out of ideas already). Context: I have a schema (.asn) and a .dat file (binary) and I'm trying to decode the .dat. For now I'm using asn1tools. Some of the fields work but…
Sango
  • 31
  • 5
1
vote
1 answer

How can I enable CDR logging via the cdr_adaptive_odbc.so module in Asterisk 1.8.5?

I am running an Asterisk 1.8.5 with CEL and CDR via ODBC (connected to MySQL). The CEL works fine (see below) but the CDR is not working via adaptive ODBC. (Standard ODBC and direct MySQL writing is working for CDR btw.) The asterisk can find the…
Konrad Kleine
  • 4,275
  • 3
  • 27
  • 35
1
vote
1 answer

Is there a lisp cdr equivalence for c++ std::list

Some people have their custom list class with car(eg. head) cdr(eg. tail). I'm wondering if std::list can be used to support these operations. car is trivial. But I don't know how cdr can be emulated.
zjk
  • 2,043
  • 3
  • 28
  • 45