But, Kazimir, your solution is precisely what I was seeking. After creating the various macros, the syntax is as simple as can be, and, by expanding as an explicit
Thank you very much.
-- Sam
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
(all? integer? 1 2 3 "string")
(apply and (map integer? (list 1 2 3 "string")))
(integer? 1 2 3 "string")
(map list (sort (flat (dup (sequence 1 5) 4))) (explode (dup "abcd" 5)))
(map list
(sort (flat (dup (sequence 1 5) 4))) ;numbers
(explode (dup "abcd" 5)) ;letters
)
Can you explain why we need letex in this case? Why lambda can't take side from function definition?Quote
; make-square
; 2011-03-05
; example
; (set 's1 (make-square 2))
; (s1 'area) ;result = 4
; (s1 'perimeter) ;result = 8
; (s1 'xxx) ;result = "unknown message" error
(define (make-square side)
(letex (s side)
(lambda (msg)
(cond
((= msg 'area) (mul s s))
((= msg 'perimeter) (mul 4 s))
(true (throw-error "unknown message")) ))))
(define (magoo list-of-strings)
(magoo-aux (sort list-of-strings) '()))
(define (magoo-aux list-of-strings list-of-lists)
(if (empty? list-of-strings)
list-of-lists
;else
(local (newlist)
(push (pop list-of-strings) newlist)
(while (and
(not (empty? list-of-strings))
(= ((list-of-strings 0) 0) ((newlist 0) 0))
(push (pop list-of-strings) newlist -1))
)
(magoo-aux list-of-strings (push newlist list-of-lists -1))
)
)
)
("API" "About" "All" "Apps" "Art" "Built" "C" "Cilk" "Development" "Docs" "Documented"
"Downloads" "Expandable" "Find" "Forum" "FriendFeed" "Friendly" "GNU" "GPL" "GS"
"General" "Gui" "Home" "IDE" "It" "LISP" "LISPs" "Libs" "License" "Links" "Linux"
"Lisp" "Mac" "Maintenance" "May" "Modules" "Most" "Movie" "Netscape" "News" "Nuevatec"
"OS" "October" "Parallel" "Public" "Read" "Release" "Search" "See" "Server" "Share"
"Slideshow" "Stable" "Tips" "Tricks" "Twitter" "UA" "UBUNTU" "Unix" "Watch" "Win"
"X" "a" "about" "all" "already" "amp" "and" "are" "area" "arial" "b" "background"
"big" "bold" "border" "built" "but" "button" "buttons" "by" "ccc" "changes" "code"
"color" "complete" "computing" "copy" "copyright" "courier" "custom" "dashed" "ddd"
"decoration" "differs" "displating" "distributed" "divs" "doing" "easier" "edit"
"eee" "eef" "entry" "ever" "example" "family" "fast" "features" "files" "follow"
"font" "for" "friendly" "from" "functions" "general" "has" "helvetica" "hover" "how"
"hr" "if" "img" "in" "installers" "is" "language" "layout" "learn" "left" "libraries"
"like" "line" "links" "list" "magic" "margin" "mdash" "mediumred" "modern" "modes"
"modules" "more" "most" "mybox" "need" "new" "newLISP" "none" "normal" "not" "of"
"on" "operating" "or" "other" "out" "overwritten" "p" "padding" "passwords" "powered"
"processing" "purpose" "px" "quick" "referencrs" "reserved" "right" "rights" "runs"
"sans" "save" "scripting" "search" "separator" "serif" "server" "shared" "site"
"size" "small" "smallred" "solid" "spec" "st" "style" "styles" "support" "systems"
"table" "tables" "tag" "tags" "td" "text" "textarea" "th" "the" "these" "thinkHome"
"to" "top" "tr" "traditional" "transparent" "uacct" "urchinTracker" "use" "used"
"using" "v" "verdana" "version" "weight" "when" "width" "wiki" "will" "with" "work"
"written" "you")
(parse (read-file {C:MyDirectorysites-sm.txt}) "n")
returns
("1tgoogle.com" "2tfacebook.com" "3tyahoo.com" "4tyoutube.com" "5tlive.com"
"6twikipedia.org" "7tblogger.com" "8tbaidu.com" "9tmsn.com" "10tyahoo.co.jp")
(define (url-decode str)
(replace "+" str " ") ; optional
(replace "%([0-9A-F][0-9A-F])" s (char (int $1 0 16)) 1))
(define (url-decode str)
(replace "+" str " ") ; optional
(replace "%([0-9A-F][0-9A-F])" str (char (int $1 0 16)) 1))