Search Results

Search found 9366 results on 375 pages for 'common lisp'.

Page 4/375 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Common Lisp condition system for transfer of control

    - by Ken
    I'll admit right up front that the following is a pretty terrible description of what I want to do. Apologies in advance. Please ask questions to help me explain. :-) I've written ETLs in other languages that consist of individual operations that look something like: // in class CountOperation IEnumerable<Row> Execute(IEnumerable<Row> rows) { var count = 0; foreach (var row in rows) { row["record number"] = count++; yield return row; } } Then you string a number of these operations together, and call The Dispatcher, which is responsible for calling Operations and pushing data between them. I'm trying to do something similar in Common Lisp, and I want to use the same basic structure, i.e., each operation is defined like a normal function that inputs a list and outputs a list, but lazily. I can define-condition a condition (have-value) to use for yield-like behavior, and I can run it in a single loop, and it works great. I'm defining the operations the same way, looping through the inputs: (defun count-records (rows) (loop for count from 0 for row in rows do (signal 'have-value :value `(:count ,count @,row)))) The trouble is if I want to string together several operations, and run them. My first attempt at writing a dispatcher for these looks something like: (let ((next-op ...)) ;; pick an op from the set of all ops (loop (handler-bind ((have-value (...))) ;; records output from operation (setq next-op ...) ;; pick a new next-op (call next-op))) But restarts have only dynamic extent: each operation will have the same restart names. The restart isn't a Lisp object I can store, to store the state of a function: it's something you call by name (symbol) inside the handler block, not a continuation you can store for later use. Is it possible to do something like I want here? Or am I better off just making each operation function explicitly look at its input queue, and explicitly place values on the output queue?

    Read the article

  • How can I spot subtle Lisp syntax mistakes?

    - by Marius Andersen
    I'm a newbie playing around with Lisp (actually, Emacs Lisp). It's a lot of fun, except when I seem to run into the same syntax mistakes again and again. For instance, here's something I've encountered several times. I have some cond form, like (cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred) (t xyzzy))) and the default clause, which returns xyzzy, is never carried out, because it's actually nested inside the previous clause: (cond ((foo bar) (qux quux)) ((or corge (grault warg)) (fred)) (t xyzzy)) It's difficult for me to see such errors when the difference in indentation is only one space. Does this get easier with time? I also have problems when there's a large distance between the (mal-)indented line and the line it should be indented against. let forms with a lot of complex bindings, for example, or an unless form with a long conditional: (defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred)))) xyzzy) It turns out xyzzy was never inside the unless form at all: (defun test () (unless (foo bar (qux quux) (or corge (grault warg) (fred))) xyzzy)) I auto-indent habitually and use parenthesis highlighting to avoid counting parentheses. For the most part it works like a breeze, but occasionally, I discover my syntax mistakes only by debugging. What can I do?

    Read the article

  • Oracle Sun Solaris 11.1 Completes EAL4+ Common Criteria Evaluation

    - by Joshua Brickman-Oracle
    Oracle is pleased to announce that the Oracle Solaris 11.1 operating system has achieved a Common Criteria certification at Evaluation Assurance Level (EAL) 4 augmented by Flaw Remediation under the Canadian Communications Security Establishment’s (CSEC) Canadian Common Criteria  Scheme (CCCS).  EAL4 is the highest level achievable for commercial software, and is the highest level mutually recognized by 26 countries under the current Common Criteria Recognition Arrangement (CCRA).  Oracle Solaris 11.1 is conformant to the BSI Operating System Protection Profile v2.0 with the following four extended packages. (1) Advanced Management, (2) Extended Identification and Authentication, (3) Labeled Security, and (4) Virtualization. Common Criteria is an international framework (ISO/IEC 15408) which defines a common approach for evaluating security features and capabilities of Information Technology security products. A certified product is one that a recognized Certification Body asserts as having been evaluated by a qualified, accredited, and independent evaluation laboratory competent in the field of IT security evaluation to the requirements of the Common Criteria and Common Methodology for Information Technology Security Evaluation. Oracle Solaris is the industry’s most widely deployed UNIXtm operating system, delivers mission critical cloud infrastructure with built-in virtualization, simplified software lifecycle management, cloud scale data management, and advanced protection for public, private, and hybrid cloud environments. It provides a suite of technologies and applications that create an operating system with optimal performance. Oracle Solaris 11.1 includes key technologies such as Trusted Extensions, the Oracle Solaris Cryptographic Framework, Zones, the ZFS File System, Image Packaging System (IPS), and multiple boot environments. The Oracle Solaris 11.1 Certification Report and Security Target can be viewed on the Communications Security Establishment Canada (CSEC) site and on the Common Criteria Portal. For more information on Oracle’s participation in the Common Criteria program, please visit the main Common Criteria information page here: (http://www.oracle.com/technetwork/topics/security/oracle-common-criteria-095703.html) For a complete list of Oracle products with Common Criteria certifications and FIPS 140-2 validations, please see the Security Evaluations website here: (http://www.oracle.com/technetwork/topics/security/security-evaluations-099357.html).

    Read the article

  • dates and times in emacs lisp

    - by Stephen
    Hi, I understand emacs lisp is great for handling dates and times, but does it have a function to convert strings to internal representation of integers using formats like %Y, %m, %d, %H, %M, %S, and so on? And also, in the emacs reference manual, it says that times are lists of two or three integers, but is there a more formal specification or description? ~ Thanks ~

    Read the article

  • Lisp, OCaml or what for Runge Kutta?

    - by Eelvex
    Which language would you propose for solving a system with: first order differential equations complex variables N-dimensions using 4th order Runge Kutta or the like. Speed matters a lot but would sacrifice for: Elegant (clean and short) code Flexibility + scalability I'm mostly between a Lisp and OCaml but any other suggestion is welcomed. Thanks!

    Read the article

  • Lisp data security/validation

    - by Wayne Werner
    This is really just a conceptual question for me at this point. In Lisp, programs are data and data are programs. The REPL does exactly that - reads and then evaluates. So how does one go about getting input from the user in a secure way? Obviously it's possible - I mean viaweb - now Yahoo!Stores is pretty secure, so how is it done?

    Read the article

  • Really minimum lisp

    - by Mgccl
    What is the minimum set of primitives required such that a language is Turing complete and a lisp variant? Seems like car, cdr and some flow control and something for REPL is enough. It be nice if there is such list. Assume there are only 3 types of data, integers, symbols and lists.(like in picolisp)

    Read the article

  • Hidden features of Emacs Lisp?

    - by anon
    What are some features of Emacs Lisp that you use to solve real problems? One feature per answer Give an example and short description of the feature, not just a link to documentation Label the feature using bold title as the first line See also: Hidden features of Python Hidden features of Ruby Hidden features of Perl Hidden features of Java

    Read the article

  • lisp, differences in assignment functions

    - by johnc
    I'm pretty new to lisp, so apologies for what may be a simple question, Whilst I understand the difference between DEFVAR and DEFPARAMETER (defvar only sets undefined variables), and the LET is for local scope only, what is the is the use of SETF as opposed to the other, previously mentioned assignment functions?

    Read the article

  • a question on common lisp

    - by kostas
    Hello people, I'm getting crazy with a small problem here, I keep getting an error and I cant seem to figure out why, the code is supposed to change the range of a list, so if we give it a list with values (1 2 3 4) and we want to change the range in 11 to fourteen the result would be (11 12 13 14) the problem is that the last function called scale-list will give back an error saying: Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil) anybody has a clue why? I use aquamacs as an editor thanks in advance ;;finds minimum in a list (defun minimum(list) (car (sort list #'<))) ;;finds maximum in a list (defun maximum(list) (car (sort list #'>))) ;;calculates the range of a list (defun range(list) (- (maximum list) (minimum list))) ;;this codes scales a value from a list (defun scale-value(list low high n) (+ (/ (* (- (nth (- n 1) list) (minimum list)) (- high low)) (range list)) low)) ;and this code is supposed to scale the whole list (defun scale-list(list low high n) (unless (= n 0) (cons (scale-value list low high n) (scale-list list low high (- n 1))))) (scale-list '(0.1 0.3 0.5 0.9) 20 30 4)

    Read the article

  • Overriding a function in Emacs Lisp

    - by scrapdog
    I would like to temporarily override the kill-new function. I have a way I want to reimplement kill-new that works in only in certain contexts, but I don't want to reimplement a special version of kill-region on top of that. (kill-new is called from kill-region) Since Emacs Lisp uses dynamic scoping, this should be possible, right? (On the other hand, it seems that this would be an unsafe thing to support, and it might make me a bit nervous knowing that it is possible...) I have experimented with using let and fset, but so far have found no way to get it to work as expected. So, hopefully someone can fill in the blank in the following pseudocode: (defun my-kill-new (string &optional replace yank-handler) (message "in my-kill-new!")) (defun foo () (some-form-that-binds-a-function (kill-new my-kill-new) (kill-region (point) (mark)))) What should some-form-that-binds-a-function be? Or am I barking up the wrong tree?

    Read the article

  • Clojure: Equivalent to Common Lisp READ function?

    - by jkndrkn
    Hi there. When I want to read in an S-expression stored in a file into a running Common Lisp program, I do the following: (defun load-file (filename) "Loads data corresponding to a s-expression in file with name FILENAME." (with-open-file (stream filename) (read stream))) If, for example, I have a file named foo.txt that contains the S-expression (1 2 3), the above function will return that S-expression if called as follows: (load-file "foo.txt"). I've been searching and searching and have not found an equally elegant solution in Clojure. Any ideas? Thanks!

    Read the article

  • In Lisp, Avoid "Cannot open load file" when using require

    - by Jesse
    I am working on a custom .emacs file that I will be able to use on several different computers. I would like to be able to load a mode if it exists on the system. If it does not exist I would like Emacs to stop showing the error: File error: Cannot open load file, X. For example: (require 'darkroom-mode) Results in: File error: Cannot open load file, darkroom-mode I am using file-exists-p to test if certain other files exist but for this test I would assume I need to search my load-path. I am new to Lisp so this is stumping me.

    Read the article

  • Help writing emacs lisp for emacs etags search

    - by user535707
    I'm looking for some help developing what I think should be an easy program. I want something similar to Emacs tags-search command, but I want to collect all search results into a buffer. (I want to see all results of M-,) I'm thinking this python style pseudo code should work, but I have no idea how to do this in emacs lisp? Any help would be greatly appreciated. def myTagsGrep(searchValue): for aFile in the tag list: result = grep aFile seachValue if len(result) > 0: print aFile # to the buffer print result # to the buffer I would like to be able to browse through the buffer with the same features tags-apropos does. Note that a similar question has been asked before: Is there a way to get emacs tag-search command to output all results to a buffer?

    Read the article

  • Clojure for a lisp illiterate

    - by dbyrne
    I am a lifelong object-oriented programmer. My job is primarily java development, but I have experience in a number of languages. Ruby gave me my first real taste of functional programming. I loved the features Ruby borrowed from the functional paradigm such as closures and continuations. Eventually, I graduated to Scala. This has been a great way to gradually learn to approach non-trivial problems in a functional manner. Now I am interested in Clojure. I know all the sexy features that make it enticing (software transactional memory, macros, etc.), but I just can't get used to "thinking in lisp". I've seen Rich Hickey's screencasts aimed at java programmers, but they are geared towards explaining language features and not approaching real world problems. I am looking for any advice or resources which have made this transition easier for others.

    Read the article

  • Could anyone tell me something about Scheme Common-Lisp and FASL File.

    - by Joe
    Does anyone could tell something about these file? As I know: 1. Common-Lisp and Scheme are both some lisp programming langue. 2. common-Lisp source file *.lisp can be compiled into binary file *.fasl which can be load faster than the source file. Q:Can the Scheme source code *.scm be compiled into some binary file that will be load faster than the source code? Thanks in advance joe

    Read the article

  • Slime: frame-source-location not implemented / is my sldb Backtrace output normal?

    - by Joel
    I'm debugging my Lisp code in Slime. When the debugger generates the Backtrace it's my understanting that I can hit 'v' on a frame to take me to the source. When I do this on the first (0 index) frame (or indeed any frame) I get frame-source-location not implemented Is this expected, am I missing anything? Edit1: In addition every single frame has "No Locals", is this to be expected too? Edit2: In fact, the whole backtrace output is pretty unintelligible. I'm new to Lisp, so I wasn't initially sure if this was expected or not - but I'm attaching a screenshot, hopefully someone can confirm for me if this looks 'normal':

    Read the article

  • Cadr of a list involving assoc function

    - by user3619045
    I have looked around on the net and cant find an answer to my query. I would really appreciate if someone could provide a good answer without down rating this post. In Lisp car, cdr are used on data mode like '(whatever here) which makes sense to me. Now, in the book Land of Lisp the author is explaining how to build a text engine and suddenly he uses the following description to make a function. (defun describe-location (location nodes) (cadr (assoc location nodes))) Can I ask why is he doing a cadr on a list and how come it provides a response and not an error? shouldn't it be a data mode i.e with a quote in front of the opening bracket '(whatever here)? and also why is he using assoc as in (assoc location nodes) and not (assoc 'garden *nodes*) Isn't the second correct way to use assoc ? I may be missing the big picture and as such would really appreciate someone explaining these key points please. Many thanks!

    Read the article

  • Help me write my LISP :) LISP environments, Ruby Hashes...

    - by MikeC8
    I'm implementing a rudimentary version of LISP in Ruby just in order to familiarize myself with some concepts. I'm basing my implementation off of Peter Norvig's Lispy (http://norvig.com/lispy.html). There's something I'm missing here though, and I'd appreciate some help... He subclasses Python's dict as follows: class Env(dict): "An environment: a dict of {'var':val} pairs, with an outer Env." def __init__(self, parms=(), args=(), outer=None): self.update(zip(parms,args)) self.outer = outer def find(self, var): "Find the innermost Env where var appears." return self if var in self else self.outer.find(var) He then goes on to explain why he does this rather than just using a dict. However, for some reason, his explanation keeps passing in through my eyes and out through the back of my head. Why not use a dict, and then inside the eval function, when a new "sub-environment" needs to be created, just take the existing dict and update the key/value pairs that need to be updated, and pass that new dict into the next eval? Won't the Python interpreter keep track of the previous "outer" envs? And won't the nature of the recursion ensure that the values are pulled out from "inner" to "outer"? I'm using Ruby, and I tried to implement things this way. Something's not working though, and it might be because of this, or perhaps not. Here's my eval function, env being a regular Hash: def eval(x, env = $global_env) ........ elsif x[0] == "lambda" then ->(*args) { eval(x[2], env.merge(Hash[*x[1].zip(args).flatten(1)])) } ........ end The line that matters of course is the "lambda" one. If there is a difference, what's importantly different between what I'm doing here and what Norvig did with his Env class? If there's no difference, then perhaps someone can enlighten me as to why Norvig uses the Env class. Thanks :)

    Read the article

  • Cocoa equivalent of the Carbon method getPtrSize

    - by Michael Minerva
    I need to translate the a carbon method into cocoa into and I am having trouble finding any documentation about what the carbon method getPtrSize really does. From the code I am translating it seems that it returns the byte representation of an image but that doesn't really match up with the name. Could someone give me a good explanation of this method or link me to some documentation that describes it. The code I am translating is in a common lisp implementation called MCL that has a bridge to carbon (I am translating into CCL which is a common lisp implementation with a Cocoa bridge). Here is the MCL code (#_before a method call means that it is a carbon method): (defmethod COPY-CONTENT-INTO ((Source inflatable-icon) (Destination inflatable-icon)) ;; check for size compatibility to avoid disaster (unless (and (= (rows Source) (rows Destination)) (= (columns Source) (columns Destination)) (= (#_getPtrSize (image Source)) (#_getPtrSize (image Destination)))) (error "cannot copy content of source into destination inflatable icon: incompatible sizes")) ;; given that they are the same size only copy content (setf (is-upright Destination) (is-upright Source)) (setf (height Destination) (height Source)) (setf (dz Destination) (dz Source)) (setf (surfaces Destination) (surfaces Source)) (setf (distance Destination) (distance Source)) ;; arrays (noise-map Source) ;; accessor makes array if needed (noise-map Destination) ;; ;; accessor makes array if needed (dotimes (Row (rows Source)) (dotimes (Column (columns Source)) (setf (aref (noise-map Destination) Row Column) (aref (noise-map Source) Row Column)) (setf (aref (altitudes Destination) Row Column) (aref (altitudes Source) Row Column)))) (setf (connectors Destination) (mapcar #'copy-instance (connectors Source))) (setf (visible-alpha-threshold Destination) (visible-alpha-threshold Source)) ;; copy Image: slow byte copy (dotimes (I (#_getPtrSize (image Source))) (%put-byte (image Destination) (%get-byte (image Source) i) i)) ;; flat texture optimization: do not copy texture-id -> destination should get its own texture id from OpenGL (setf (is-flat Destination) (is-flat Source)) ;; do not compile flat textures: the display list overhead slows things down by about 2x (setf (auto-compile Destination) (not (is-flat Source))) ;; to make change visible we have to reset the compiled flag (setf (is-compiled Destination) nil))

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >