Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Clojure

Name: Anonymous 2011-05-18 11:32

0]=> clj
Clojure 1.2.0
user=> (defn f [x] (first x))
#'user/f
user=> (f '(1))
1
user=> (binding [first rest] (f '(1)))
()
user=> "WHAT THE FUCK. Will it work with procedures in a different namespace?"
"WHAT THE FUCK. Will it work with procedures in a different namespace?"
user=> (remove even? [1 2 3 4 5 6 7 8])
(1 3 5 7)
user=> (defn g [& rest] "BROKEN")
#'user/g
user=> (binding [filter g] (remove even? [1 2 3 4 5 6 7 8]))
"BROKEN"
user=> "Clojure, the best language of them all. All the power of unhygienic macros, and the usability of Emacs Lisp."
"Clojure, the best language of them all. All the power of unhygienic macros, and the usability of Emacs Lisp."
user=>


Let us compare Clojure with some other Lisp implementations:

Racket
0]=> racket
Welcome to Racket v5.1.1.5.
#;> (define (f x) (car x))
#;> (f '(1))
1
#;> (let ((car cdr)) (f '(1)))
1
#;>

Chicken
0]=> csi

CHICKEN
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.6.0
linux-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2010-11-09 on archlinux (Linux)

#;1> (define (f x) (car x))
#;2> (f '(1))
1
#;3> (let ((car cdr)) (f '(1)))
1
#;4>

SBCL
0]=> sbcl
This is SBCL 1.0.48, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>;.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
* (defun f (x) (car x))

F
* (f '(1))

1
* (flet ((car (x) (cdr x))) (f '(1)))
; in: FLET ((CAR (X) (CDR X)))
;     (FLET ((CAR (X)
;              (CDR X)))
;       (F '(1)))
;
; caught WARNING:
;   Compile-time package lock violation:
;     Lock on package COMMON-LISP violated when binding CAR as a local function
;     while in package COMMON-LISP-USER.
;   See also:
;     The SBCL Manual, Node "Package Locks"
;     The ANSI Standard, Section 11.1.2.1.2
;
; caught ERROR:
;   Lock on package COMMON-LISP violated when binding CAR as a local function while
;   in package COMMON-LISP-USER.
;   See also:
;     The SBCL Manual, Node "Package Locks"
;     The ANSI Standard, Section 11.1.2.1.2
;
; compilation unit finished
;   caught 1 ERROR condition
;   caught 1 WARNING condition

debugger invoked on a SB-INT:COMPILED-PROGRAM-ERROR in thread #<THREAD
                                                                "initial thread" RUNNING
                                                                {AAA0679}>:
  Execution of a form compiled with errors.
Form:
  (FLET ((CAR (X)
         (CDR X)))
  (F '(1)))
Compile-time error:
  Lock on package COMMON-LISP violated when binding CAR as a local function while
in package COMMON-LISP-USER.
See also:
  The SBCL Manual, Node "Package Locks"
  The ANSI Standard, Section 11.1.2.1.2

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((EVAL (FLET ((CAR (X) (CDR X))))))
0]

Emacs Lisp
*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (require 'cl) ; flet
cl
ELISP> (defun f (x) (car x))
f
ELISP> (f '(1))
1
ELISP> (flet ((car (x) (cdr x))) (f '(1)))
nil
ELISP>


Thus, Clojure is utterly broken. Rich Hickey is actually proud of dynamically bound functions.

Name: Anonymous 2011-05-18 11:47

Common Lisp: defmacro
---------------
Scheme/Racket: syntax-e syntax->datum syntax->list syntax-property #' (void) quote-syntax datum->syntax syntax-parameter-value syntax-rule raise-syntax-error internal-definition-context? syntax-parameterize make-set!-transformer syntax-local-value/immediate syntax-local-transforming-module-provides? syntax-local-module-defined-identifiers syntax-local-module-required-identifiers make-require-transformer (require (lib "stxparam.ss" "mzlib")) syntax? (require mzlib/defmacro) syntax-local-lift-expression (require racket/stxparam-exptime) make-rename-transformer syntax-local-require-certifier make-parameter-rename-transformer syntax-local-value define-syntax-parameter make-provide-transformer syntax-local-provide-certifier syntax-source local-expand/capture-lifts local-transformer-expand/capture-lifts syntax-local-lift-values-expression syntax-local-lift-module-end-declaration syntax-local-lift-require syntax-local-lift-provide syntax-local-name syntax-local-context syntax-local-phase-level syntax-local-module-exports syntax-local-get-shadower syntax-local-certifier syntax-transforming? syntax-local-introduce make-syntax-introducer make-syntax-delta-introducer syntax-local-make-delta-introducer syntax-case define-syntax syntax-rules with-syntax syntax-position syntax-line syntax-column ...

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List